diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fffbe741..5b1f5a229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/biz/bokhorst/xprivacy/XGoogleAuthUtil.java b/src/biz/bokhorst/xprivacy/XGoogleAuthUtil.java index 9d6dc61ee..a3644b298 100644 --- a/src/biz/bokhorst/xprivacy/XGoogleAuthUtil.java +++ b/src/biz/bokhorst/xprivacy/XGoogleAuthUtil.java @@ -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 { @@ -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());