From 3b458ad9ee5f2d6b7cf28a13bc29123cdf540763 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Thu, 18 Apr 2013 18:40:07 -0700 Subject: Improve API and documentation API for querying accounts visible to a specific package. Improve API and docs for device owner. Bug: 8657158 Change-Id: I01b8701534f64b383391508a49ae93ed21f22ae0 --- .../android/server/accounts/AccountManagerService.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'services/java/com/android/server/accounts') diff --git a/services/java/com/android/server/accounts/AccountManagerService.java b/services/java/com/android/server/accounts/AccountManagerService.java index fd7cd78..241b224 100644 --- a/services/java/com/android/server/accounts/AccountManagerService.java +++ b/services/java/com/android/server/accounts/AccountManagerService.java @@ -30,6 +30,7 @@ import android.accounts.IAccountManager; import android.accounts.IAccountManagerResponse; import android.app.ActivityManager; import android.app.ActivityManagerNative; +import android.app.AppGlobals; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -1874,6 +1875,20 @@ public class AccountManagerService return getAccountsAsUser(null, UserHandle.getCallingUserId(), packageName, uid); } + @Override + public Account[] getAccountsByTypeForPackage(String type, String packageName) { + checkBinderPermission(android.Manifest.permission.INTERACT_ACROSS_USERS); + int packageUid = -1; + try { + packageUid = AppGlobals.getPackageManager().getPackageUid( + packageName, UserHandle.getCallingUserId()); + } catch (RemoteException re) { + Slog.e(TAG, "Couldn't determine the packageUid for " + packageName + re); + return new Account[0]; + } + return getAccountsAsUser(type, UserHandle.getCallingUserId(), packageName, packageUid); + } + public void getAccountsByFeatures(IAccountManagerResponse response, String type, String[] features) { if (Log.isLoggable(TAG, Log.VERBOSE)) { -- cgit v1.1