Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Added restriction for getExtraInfo
Browse files Browse the repository at this point in the history
Closes #1175
  • Loading branch information
M66B committed Jan 27, 2014
1 parent 9e8218f commit e0c0308
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Test and beta releases will have experimental functions enabled by default.
**Next release**

* Fixed empty settings values ([issue](https://github.com/M66B/XPrivacy/issues/1164))
* Added restriction for *NetworkInfo.getExtraInfo* ([issue](https://github.com/M66B/XPrivacy/issues/1175))
* Updated German translation

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ For easy usage, data is restricted by category:
<a name="internet"></a>
* Internet
* revoke access to the internet
* return fake extra info
* return fake disconnected state
* return fake supplicant disconnected state
<a name="IPC"></a>
Expand Down
11 changes: 7 additions & 4 deletions src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ public static List<Hook> get() {
listHook.add(new Hook("internet", "getActiveNetworkInfo", true, false, null, 10, null, null));
listHook.add(new Hook("internet", "getAllNetworkInfo", false, false, null, 10, null, null));
listHook.add(new Hook("internet", "getNetworkInfo", true, false, null, 10, null, null));
listHook.add(new Hook("internet", "getDetailedState", false, false, null, 10, null, null));
listHook.add(new Hook("internet", "getState", false, false, null, 10, null, null));
listHook.add(new Hook("internet", "isConnected", false, false, null, 10, null, null));
listHook.add(new Hook("internet", "isConnectedOrConnecting", false, false, null, 10, null, null));

listHook.add(new Hook("internet", "getDetailedState", false, false, null, 1, null, null));
listHook.add(new Hook("internet", "getExtraInfo", false, false, null, 1, null, null));
listHook.add(new Hook("internet", "getState", false, false, null, 1, null, null));
listHook.add(new Hook("internet", "isConnected", false, false, null, 1, null, null));
listHook.add(new Hook("internet", "isConnectedOrConnecting", false, false, null, 1, null, null));

listHook.add(new Hook("internet", "getConnectionInfo", false, false, null, 10, null, null));
listHook.add(new Hook("ipc", "android.accounts.IAccountManager", false, false, "", 1, "1.99.1", null));
listHook.add(new Hook("ipc", "android.app.IActivityManager", false, false, "", 1, "1.99.1", null));
Expand Down
4 changes: 4 additions & 0 deletions src/biz/bokhorst/xprivacy/PrivacyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,10 @@ public static Object getDefacedProp(int uid, String name) {
if (name.equals("DeviceDescriptor"))
return cDeface;

// getExtraInfo
if (name.equals("ExtraInfo"))
return cDeface;

// Fallback
Util.log(null, Log.WARN, "Fallback value name=" + name);
return cDeface;
Expand Down
6 changes: 5 additions & 1 deletion src/biz/bokhorst/xprivacy/XNetworkInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;

import android.net.NetworkInfo;
import android.os.Binder;
import android.util.Log;

import de.robv.android.xposed.XC_MethodHook.MethodHookParam;
Expand All @@ -28,7 +29,7 @@ public String getClassName() {
// http://developer.android.com/reference/android/net/NetworkInfo.html

private enum Methods {
getDetailedState, getState, isConnected, isConnectedOrConnecting
getDetailedState, getExtraInfo, getState, isConnected, isConnectedOrConnecting
};

public static List<XHook> getInstances() {
Expand All @@ -48,6 +49,9 @@ protected void after(MethodHookParam param) throws Throwable {
if (mMethod == Methods.getDetailedState) {
if (param.getResult() != null && isRestricted(param))
param.setResult(NetworkInfo.DetailedState.DISCONNECTED);
} else if (mMethod == Methods.getExtraInfo) {
if (param.getResult() != null && isRestricted(param))
param.setResult(PrivacyManager.getDefacedProp(Binder.getCallingUid(), "ExtraInfo"));
} else if (mMethod == Methods.getState) {
if (param.getResult() != null && isRestricted(param))
param.setResult(NetworkInfo.State.DISCONNECTED);
Expand Down

1 comment on commit e0c0308

@M66B
Copy link
Owner

@M66B M66B commented on e0c0308 Jan 27, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Category Internet, function getExtraInfo is what you are looking for in the next release.

Please sign in to comment.