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

Commit

Permalink
Fixed accessing Google services
Browse files Browse the repository at this point in the history
Closes #1206
Closes #1209
  • Loading branch information
M66B committed Jan 31, 2014
1 parent c07dbef commit 66de1d9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Test and beta releases will have experimental functions enabled by default.

**Next release**

* Fixed accessing Google services ([issue](https://github.com/M66B/XPrivacy/issues/1206)) ([issue](https://github.com/M66B/XPrivacy/issues/1209))
* Compatibility with LBE Security Master ([issue](https://github.com/M66B/XPrivacy/issues/1167))
* Display message for *media* restrictions
* Added *deny once* (this will be cached for 15 seconds)
Expand Down
44 changes: 35 additions & 9 deletions src/biz/bokhorst/xprivacy/XAccountManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ protected void before(MethodHookParam param) throws Throwable {
}
param.args[0] = xlistener;
}

} else if (mMethod == Methods.removeOnAccountsUpdatedListener) {
if (param.args.length > 0 && param.args[0] != null)
if (isRestricted(param)) {
Expand All @@ -121,17 +122,29 @@ protected void before(MethodHookParam param) throws Throwable {
}
}
}

} else if (mMethod == Methods.getAccountsByTypeAndFeatures) {
if (param.args.length > 2 && param.args[2] != null) {
AccountManagerCallback<Account[]> callback = (AccountManagerCallback<Account[]>) param.args[2];
param.args[2] = new XAccountManagerCallbackAccount(callback, Binder.getCallingUid());
}
} else if (mMethod == Methods.getAuthToken) {
for (int i = 0; i < param.args.length; i++)
if (param.args[i] instanceof AccountManagerCallback<?>) {
AccountManagerCallback<Bundle> callback = (AccountManagerCallback<Bundle>) param.args[i];
param.args[i] = new XAccountManagerCallbackBundle(callback, Binder.getCallingUid());
if (param.args.length > 2 && param.args[2] != null)
if (isRestricted(param)) {
AccountManagerCallback<Account[]> callback = (AccountManagerCallback<Account[]>) param.args[2];
param.args[2] = new XAccountManagerCallbackAccount(callback, Binder.getCallingUid());
}

} else if (mMethod == Methods.getAuthToken || mMethod == Methods.getAuthTokenByFeatures) {
for (int i = 0; i < param.args.length; i++)
if (param.args[i] instanceof AccountManagerCallback<?>)
if (isRestricted(param)) {
AccountManagerCallback<Bundle> callback = (AccountManagerCallback<Bundle>) param.args[i];
param.args[i] = new XAccountManagerCallbackBundle(callback, Binder.getCallingUid());
}

} else if (mMethod == Methods.hasFeatures) {
for (int i = 0; i < param.args.length; i++)
if (param.args[i] instanceof AccountManagerCallback<?>)
if (isRestricted(param)) {
AccountManagerCallback<Boolean> callback = (AccountManagerCallback<Boolean>) param.args[i];
param.args[i] = new XAccountManagerCallbackBoolean(callback);
}
}
}

Expand Down Expand Up @@ -367,4 +380,17 @@ public void run(AccountManagerFuture<Bundle> future) {
mCallback.run(new XAccountManager.XFutureBundle(future, mUid));
}
}

private class XAccountManagerCallbackBoolean implements AccountManagerCallback<Boolean> {
private AccountManagerCallback<Boolean> mCallback;

public XAccountManagerCallbackBoolean(AccountManagerCallback<Boolean> callback) {
mCallback = callback;
}

@Override
public void run(AccountManagerFuture<Boolean> future) {
mCallback.run(new XAccountManager.XFutureBoolean());
}
}
}

0 comments on commit 66de1d9

Please sign in to comment.