This repository has been archived by the owner on Sep 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added restrictions Cast.getDeviceId/getIpAddress
Fixes #2108
- Loading branch information
Showing
6 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package biz.bokhorst.xprivacy; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import android.os.Binder; | ||
import biz.bokhorst.xprivacy.XHook; | ||
|
||
public class XCastDevice extends XHook { | ||
private Methods mMethod; | ||
|
||
private XCastDevice(Methods method, String restrictionName) { | ||
super(restrictionName, method.name(), "Cast." + method.name()); | ||
mMethod = method; | ||
} | ||
|
||
public String getClassName() { | ||
return "com.google.android.gms.cast.CastDevice"; | ||
} | ||
|
||
// public static getDeviceId() | ||
// public Inet4Address getIpAddress() | ||
// http://developer.android.com/reference/com/google/android/gms/cast/CastDevice.html | ||
|
||
private enum Methods { | ||
getDeviceId, getIpAddress | ||
}; | ||
|
||
public static List<XHook> getInstances() { | ||
List<XHook> listHook = new ArrayList<XHook>(); | ||
listHook.add(new XCastDevice(Methods.getDeviceId, PrivacyManager.cIdentification)); | ||
listHook.add(new XCastDevice(Methods.getIpAddress, PrivacyManager.cIdentification)); | ||
return listHook; | ||
} | ||
|
||
@Override | ||
protected void before(XParam param) throws Throwable { | ||
// Do nothing | ||
} | ||
|
||
@Override | ||
protected void after(XParam param) throws Throwable { | ||
// Do nothing | ||
switch (mMethod) { | ||
case getDeviceId: | ||
if (param.getResult() != null && isRestricted(param)) | ||
param.setResult(PrivacyManager.getDefacedProp(Binder.getCallingUid(), "CastID")); | ||
break; | ||
|
||
case getIpAddress: | ||
if (param.getResult() != null && isRestricted(param)) | ||
param.setResult(PrivacyManager.getDefacedProp(Binder.getCallingUid(), "InetAddress")); | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters