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

Commit

Permalink
Fixed restrictions getToken/WithNotification
Browse files Browse the repository at this point in the history
Fixes #2169
  • Loading branch information
M66B committed Apr 17, 2015
1 parent 4dbaf5c commit c16c9b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Changelog
**Next release**

* Fixed all problems reported through the debug info
* Fixed restrictions *getToken* and *getTokenWithNotification* ([issue](/../../issues/2169))
* Updated Norwegian translation

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
11 changes: 9 additions & 2 deletions src/biz/bokhorst/xprivacy/XGoogleAuthUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.List;

import android.accounts.Account;
import android.util.Log;

public class XGoogleAuthUtil extends XHook {
Expand Down Expand Up @@ -49,9 +50,15 @@ protected void before(XParam param) throws Throwable {
@Override
protected void after(XParam param) throws Throwable {
if (mMethod == Methods.getToken || mMethod == Methods.getTokenWithNotification) {
if (param.args.length > 1)
if (param.getResult() != null && isRestrictedExtra(param, (String) param.args[1]))
if (param.args.length > 1) {
String accountName = null;
if (param.args[1] instanceof String)
accountName = (String) param.args[1];
else if (param.args[1] instanceof Account)
accountName = ((Account) param.args[1]).type;
if (param.getResult() != null && isRestrictedExtra(param, accountName))
param.setThrowable(new IOException("XPrivacy"));
}

} else
Util.log(this, Log.WARN, "Unknown method=" + param.method.getName());
Expand Down

0 comments on commit c16c9b2

Please sign in to comment.