@Override @SuppressWarnings("unchecked") protected void after(XParam param) throws Throwable { if (mMethod != Methods.addOnAccountsUpdatedListener && mMethod != Methods.removeOnAccountsUpdatedListener) { int uid = Binder.getCallingUid(); if (mMethod == Methods.blockingGetAuthToken) { if (param.args.length > 0 && param.args[0] != null) { Account account = (Account) param.args[0]; if (param.getResult() != null && isRestrictedExtra(param, account == null ? null : account.name)) if (!isAccountAllowed(account, uid)) param.setResult(null); } } else if (mMethod == Methods.getAccounts) { if (param.getResult() != null && isRestricted(param)) { Account[] accounts = (Account[]) param.getResult(); param.setResult(filterAccounts(accounts, uid)); } } else if (mMethod == Methods.getAccountsByType || mMethod == Methods.getAccountsByTypeForPackage) { if (param.args.length > 0) if (param.getResult() != null && isRestrictedExtra(param, (String) param.args[0])) { Account[] accounts = (Account[]) param.getResult(); param.setResult(filterAccounts(accounts, uid)); } } else if (mMethod == Methods.getAccountsByTypeAndFeatures) { if (param.args.length > 0) if (param.getResult() != null && isRestrictedExtra(param, (String) param.args[0])) { AccountManagerFuture<Account[]> future = (AccountManagerFuture<Account[]>) param.getResult(); param.setResult(new XFutureAccount(future, uid)); } } else if (mMethod == Methods.getAuthenticatorTypes) { if (param.getResult() != null && isRestricted(param)) param.setResult(new AuthenticatorDescription[0]); } else if (mMethod == Methods.getAuthToken) { if (param.args.length > 0) { Account account = (Account) param.args[0]; if (param.getResult() != null && isRestrictedExtra(param, account == null ? null : account.name)) { AccountManagerFuture<Bundle> future = (AccountManagerFuture<Bundle>) param.getResult(); param.setResult(new XFutureBundle(future, uid)); } } } else if (mMethod == Methods.getAuthTokenByFeatures) { if (param.getResult() != null && isRestrictedExtra(param, (String) param.args[0])) { AccountManagerFuture<Bundle> future = (AccountManagerFuture<Bundle>) param.getResult(); param.setResult(new XFutureBundle(future, uid)); } } else if (mMethod == Methods.hasFeatures) { if (param.args.length > 0 && param.args[0] != null) { Account account = (Account) param.args[0]; if (param.getResult() != null && isRestrictedExtra(param, account == null ? null : account.name)) if (!isAccountAllowed(account, uid)) param.setResult(new XFutureBoolean()); } } else Util.log(this, Log.WARN, "Unknown method=" + param.method.getName()); } LogIntentSender.sendLog(param, getClassName(), getRestrictionName(), getMethodName()); }