summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-08-16 10:48:27 -0700
committerDianne Hackborn <hackbod@google.com>2012-08-16 12:46:38 -0700
commitf02b60aa4f367516f40cf3d60fffae0c6fe3e1b8 (patch)
tree893430514916fc74f4fd008dbcb457c2dd317989
parentca34bcf6746454c561b0c07ca5c6e42bd4a73e9e (diff)
downloadframeworks_base-f02b60aa4f367516f40cf3d60fffae0c6fe3e1b8.zip
frameworks_base-f02b60aa4f367516f40cf3d60fffae0c6fe3e1b8.tar.gz
frameworks_base-f02b60aa4f367516f40cf3d60fffae0c6fe3e1b8.tar.bz2
Rename UserId to UserHandle.
This is the start of turning this into a formal public API. Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
-rw-r--r--core/java/android/accounts/AccountManagerService.java12
-rw-r--r--core/java/android/app/ActivityManager.java8
-rw-r--r--core/java/android/app/ActivityManagerNative.java2
-rw-r--r--core/java/android/app/ActivityThread.java6
-rw-r--r--core/java/android/app/ApplicationPackageManager.java40
-rw-r--r--core/java/android/app/ContextImpl.java4
-rw-r--r--core/java/android/app/LoadedApk.java10
-rw-r--r--core/java/android/app/PendingIntent.java4
-rw-r--r--core/java/android/app/SearchManager.java4
-rw-r--r--core/java/android/content/ContentProvider.java2
-rw-r--r--core/java/android/content/ContentService.java34
-rw-r--r--core/java/android/content/IntentSender.java4
-rw-r--r--core/java/android/content/SyncManager.java14
-rw-r--r--core/java/android/content/pm/PackageParser.java12
-rw-r--r--core/java/android/os/Binder.java4
-rw-r--r--core/java/android/os/Process.java4
-rw-r--r--core/java/android/os/UserHandle.java (renamed from core/java/android/os/UserId.java)5
-rw-r--r--core/java/android/provider/Settings.java4
-rw-r--r--core/java/android/server/search/SearchManagerService.java18
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java4
-rw-r--r--core/java/com/android/internal/statusbar/StatusBarNotification.java4
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java4
-rw-r--r--core/java/com/android/internal/widget/LockSettingsService.java10
-rwxr-xr-xcore/tests/coretests/src/android/content/pm/AppCacheTest.java6
-rw-r--r--core/tests/coretests/src/android/os/ProcessTest.java8
-rw-r--r--opengl/java/com/google/android/gles_jni/GLImpl.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/SearchPanelView.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java4
-rw-r--r--policy/src/com/android/internal/policy/impl/LockScreen.java10
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java8
-rw-r--r--services/java/com/android/server/AppWidgetServiceImpl.java12
-rw-r--r--services/java/com/android/server/BackupManagerService.java14
-rw-r--r--services/java/com/android/server/ClipboardService.java6
-rw-r--r--services/java/com/android/server/MountService.java4
-rwxr-xr-xservices/java/com/android/server/NotificationManagerService.java4
-rw-r--r--services/java/com/android/server/WallpaperManagerService.java18
-rw-r--r--services/java/com/android/server/am/ActiveServices.java16
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java94
-rw-r--r--services/java/com/android/server/am/ActivityRecord.java4
-rwxr-xr-xservices/java/com/android/server/am/ActivityStack.java8
-rw-r--r--services/java/com/android/server/am/BroadcastQueue.java10
-rw-r--r--services/java/com/android/server/am/PendingIntentRecord.java4
-rw-r--r--services/java/com/android/server/am/ProcessRecord.java6
-rw-r--r--services/java/com/android/server/am/ProviderMap.java6
-rw-r--r--services/java/com/android/server/am/ServiceRecord.java4
-rw-r--r--services/java/com/android/server/am/TaskRecord.java4
-rw-r--r--services/java/com/android/server/net/NetworkPolicyManagerService.java20
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java66
-rw-r--r--services/java/com/android/server/pm/Settings.java4
-rw-r--r--services/java/com/android/server/pm/UserManagerService.java4
-rw-r--r--services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java10
55 files changed, 298 insertions, 297 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 935d647..a4d28b0 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -50,7 +50,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
import android.util.Log;
@@ -354,7 +354,7 @@ public class AccountManagerService
}
private UserAccounts getUserAccountsForCaller() {
- return getUserAccounts(UserId.getCallingUserId());
+ return getUserAccounts(UserHandle.getCallingUserId());
}
protected UserAccounts getUserAccounts(int userId) {
@@ -1004,7 +1004,7 @@ public class AccountManagerService
if (callingUid != android.os.Process.SYSTEM_UID) {
throw new SecurityException("can only call from system");
}
- UserAccounts accounts = getUserAccounts(UserId.getUserId(callingUid));
+ UserAccounts accounts = getUserAccounts(UserHandle.getUserId(callingUid));
long identityToken = clearCallingIdentity();
try {
new Session(accounts, response, accountType, false,
@@ -1222,7 +1222,7 @@ public class AccountManagerService
private Integer getCredentialPermissionNotificationId(Account account, String authTokenType,
int uid) {
Integer id;
- UserAccounts accounts = getUserAccounts(UserId.getUserId(uid));
+ UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
synchronized (accounts.credentialsPermissionNotificationIds) {
final Pair<Pair<Account, String>, Integer> key =
new Pair<Pair<Account, String>, Integer>(
@@ -2269,7 +2269,7 @@ public class AccountManagerService
Log.e(TAG, "grantAppPermission: called with invalid arguments", new Exception());
return;
}
- UserAccounts accounts = getUserAccounts(UserId.getUserId(uid));
+ UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
synchronized (accounts.cacheLock) {
final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
db.beginTransaction();
@@ -2303,7 +2303,7 @@ public class AccountManagerService
Log.e(TAG, "revokeAppPermission: called with invalid arguments", new Exception());
return;
}
- UserAccounts accounts = getUserAccounts(UserId.getUserId(uid));
+ UserAccounts accounts = getUserAccounts(UserHandle.getUserId(uid));
synchronized (accounts.cacheLock) {
final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
db.beginTransaction();
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index c74f823..2c6d5d9 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -40,7 +40,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
-import android.os.UserId;
+import android.os.UserHandle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -529,7 +529,7 @@ public class ActivityManager {
throws SecurityException {
try {
return ActivityManagerNative.getDefault().getRecentTasks(maxNum,
- flags, UserId.myUserId());
+ flags, UserHandle.myUserId());
} catch (RemoteException e) {
// System dead, we will be dead too soon!
return null;
@@ -1843,12 +1843,12 @@ public class ActivityManager {
return PackageManager.PERMISSION_GRANTED;
}
// Isolated processes don't get any permissions.
- if (UserId.isIsolated(uid)) {
+ if (UserHandle.isIsolated(uid)) {
return PackageManager.PERMISSION_DENIED;
}
// If there is a uid that owns whatever is being accessed, it has
// blanket access to it regardless of the permissions it requires.
- if (owningUid >= 0 && UserId.isSameApp(uid, owningUid)) {
+ if (owningUid >= 0 && UserHandle.isSameApp(uid, owningUid)) {
return PackageManager.PERMISSION_GRANTED;
}
// If the target is not exported, then nobody else can get to it.
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 88e7344..3197a63 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -39,7 +39,7 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StrictMode;
-import android.os.UserId;
+import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import android.util.Singleton;
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 0789c60..7eb86f4 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -62,7 +62,7 @@ import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.Trace;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.AndroidRuntimeException;
import android.util.DisplayMetrics;
import android.util.EventLog;
@@ -1696,7 +1696,7 @@ public final class ActivityThread {
ApplicationInfo ai = null;
try {
ai = getPackageManager().getApplicationInfo(packageName,
- PackageManager.GET_SHARED_LIBRARY_FILES, UserId.myUserId());
+ PackageManager.GET_SHARED_LIBRARY_FILES, UserHandle.myUserId());
} catch (RemoteException e) {
// Ignore
}
@@ -1713,7 +1713,7 @@ public final class ActivityThread {
boolean includeCode = (flags&Context.CONTEXT_INCLUDE_CODE) != 0;
boolean securityViolation = includeCode && ai.uid != 0
&& ai.uid != Process.SYSTEM_UID && (mBoundApplication != null
- ? !UserId.isSameApp(ai.uid, mBoundApplication.appInfo.uid)
+ ? !UserHandle.isSameApp(ai.uid, mBoundApplication.appInfo.uid)
: true);
if ((flags&(Context.CONTEXT_INCLUDE_CODE
|Context.CONTEXT_IGNORE_SECURITY))
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 9b59e2c..115c867 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -50,7 +50,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Process;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Log;
import java.lang.ref.WeakReference;
@@ -69,7 +69,7 @@ final class ApplicationPackageManager extends PackageManager {
public PackageInfo getPackageInfo(String packageName, int flags)
throws NameNotFoundException {
try {
- PackageInfo pi = mPM.getPackageInfo(packageName, flags, UserId.myUserId());
+ PackageInfo pi = mPM.getPackageInfo(packageName, flags, UserHandle.myUserId());
if (pi != null) {
return pi;
}
@@ -199,7 +199,7 @@ final class ApplicationPackageManager extends PackageManager {
public ApplicationInfo getApplicationInfo(String packageName, int flags)
throws NameNotFoundException {
try {
- ApplicationInfo ai = mPM.getApplicationInfo(packageName, flags, UserId.myUserId());
+ ApplicationInfo ai = mPM.getApplicationInfo(packageName, flags, UserHandle.myUserId());
if (ai != null) {
return ai;
}
@@ -214,7 +214,7 @@ final class ApplicationPackageManager extends PackageManager {
public ActivityInfo getActivityInfo(ComponentName className, int flags)
throws NameNotFoundException {
try {
- ActivityInfo ai = mPM.getActivityInfo(className, flags, UserId.myUserId());
+ ActivityInfo ai = mPM.getActivityInfo(className, flags, UserHandle.myUserId());
if (ai != null) {
return ai;
}
@@ -229,7 +229,7 @@ final class ApplicationPackageManager extends PackageManager {
public ActivityInfo getReceiverInfo(ComponentName className, int flags)
throws NameNotFoundException {
try {
- ActivityInfo ai = mPM.getReceiverInfo(className, flags, UserId.myUserId());
+ ActivityInfo ai = mPM.getReceiverInfo(className, flags, UserHandle.myUserId());
if (ai != null) {
return ai;
}
@@ -244,7 +244,7 @@ final class ApplicationPackageManager extends PackageManager {
public ServiceInfo getServiceInfo(ComponentName className, int flags)
throws NameNotFoundException {
try {
- ServiceInfo si = mPM.getServiceInfo(className, flags, UserId.myUserId());
+ ServiceInfo si = mPM.getServiceInfo(className, flags, UserHandle.myUserId());
if (si != null) {
return si;
}
@@ -259,7 +259,7 @@ final class ApplicationPackageManager extends PackageManager {
public ProviderInfo getProviderInfo(ComponentName className, int flags)
throws NameNotFoundException {
try {
- ProviderInfo pi = mPM.getProviderInfo(className, flags, UserId.myUserId());
+ ProviderInfo pi = mPM.getProviderInfo(className, flags, UserHandle.myUserId());
if (pi != null) {
return pi;
}
@@ -424,7 +424,7 @@ final class ApplicationPackageManager extends PackageManager {
@SuppressWarnings("unchecked")
@Override
public List<ApplicationInfo> getInstalledApplications(int flags) {
- int userId = UserId.getUserId(Process.myUid());
+ int userId = UserHandle.getUserId(Process.myUid());
try {
final List<ApplicationInfo> applicationInfos = new ArrayList<ApplicationInfo>();
ApplicationInfo lastItem = null;
@@ -448,7 +448,7 @@ final class ApplicationPackageManager extends PackageManager {
return mPM.resolveIntent(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- flags, UserId.myUserId());
+ flags, UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -462,7 +462,7 @@ final class ApplicationPackageManager extends PackageManager {
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
flags,
- UserId.myUserId());
+ UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -494,7 +494,7 @@ final class ApplicationPackageManager extends PackageManager {
try {
return mPM.queryIntentActivityOptions(caller, specifics,
specificTypes, intent, intent.resolveTypeIfNeeded(resolver),
- flags, UserId.myUserId());
+ flags, UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -507,7 +507,7 @@ final class ApplicationPackageManager extends PackageManager {
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
flags,
- UserId.myUserId());
+ UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -520,7 +520,7 @@ final class ApplicationPackageManager extends PackageManager {
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
flags,
- UserId.myUserId());
+ UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -533,7 +533,7 @@ final class ApplicationPackageManager extends PackageManager {
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
flags,
- UserId.myUserId());
+ UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -543,7 +543,7 @@ final class ApplicationPackageManager extends PackageManager {
public ProviderInfo resolveContentProvider(String name,
int flags) {
try {
- return mPM.resolveContentProvider(name, flags, UserId.myUserId());
+ return mPM.resolveContentProvider(name, flags, UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -1033,7 +1033,7 @@ final class ApplicationPackageManager extends PackageManager {
public void clearApplicationUserData(String packageName,
IPackageDataObserver observer) {
try {
- mPM.clearApplicationUserData(packageName, observer, UserId.myUserId());
+ mPM.clearApplicationUserData(packageName, observer, UserHandle.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
@@ -1146,7 +1146,7 @@ final class ApplicationPackageManager extends PackageManager {
public void setComponentEnabledSetting(ComponentName componentName,
int newState, int flags) {
try {
- mPM.setComponentEnabledSetting(componentName, newState, flags, UserId.myUserId());
+ mPM.setComponentEnabledSetting(componentName, newState, flags, UserHandle.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
@@ -1155,7 +1155,7 @@ final class ApplicationPackageManager extends PackageManager {
@Override
public int getComponentEnabledSetting(ComponentName componentName) {
try {
- return mPM.getComponentEnabledSetting(componentName, UserId.myUserId());
+ return mPM.getComponentEnabledSetting(componentName, UserHandle.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
@@ -1166,7 +1166,7 @@ final class ApplicationPackageManager extends PackageManager {
public void setApplicationEnabledSetting(String packageName,
int newState, int flags) {
try {
- mPM.setApplicationEnabledSetting(packageName, newState, flags, UserId.myUserId());
+ mPM.setApplicationEnabledSetting(packageName, newState, flags, UserHandle.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
@@ -1175,7 +1175,7 @@ final class ApplicationPackageManager extends PackageManager {
@Override
public int getApplicationEnabledSetting(String packageName) {
try {
- return mPM.getApplicationEnabledSetting(packageName, UserId.myUserId());
+ return mPM.getApplicationEnabledSetting(packageName, UserHandle.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index fd4c304..ed4f0a7 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -87,7 +87,7 @@ import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.SystemVibrator;
import android.os.UserManager;
import android.os.storage.StorageManager;
@@ -1259,7 +1259,7 @@ class ContextImpl extends Context {
@Override
public boolean bindService(Intent service, ServiceConnection conn,
int flags) {
- return bindService(service, conn, flags, UserId.getUserId(Process.myUid()));
+ return bindService(service, conn, flags, UserHandle.getUserId(Process.myUid()));
}
/** @hide */
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index f4195d6..1e89bb2 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -37,7 +37,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.StrictMode;
import android.os.Trace;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.AndroidRuntimeException;
import android.util.Slog;
import android.view.CompatibilityInfoHolder;
@@ -120,8 +120,8 @@ public final class LoadedApk {
final int myUid = Process.myUid();
mResDir = aInfo.uid == myUid ? aInfo.sourceDir
: aInfo.publicSourceDir;
- if (!UserId.isSameUser(aInfo.uid, myUid) && !Process.isIsolated()) {
- aInfo.dataDir = PackageManager.getDataDirForUser(UserId.getUserId(myUid),
+ if (!UserHandle.isSameUser(aInfo.uid, myUid) && !Process.isIsolated()) {
+ aInfo.dataDir = PackageManager.getDataDirForUser(UserHandle.getUserId(myUid),
mPackageName);
}
mSharedLibraries = aInfo.sharedLibraryFiles;
@@ -195,7 +195,7 @@ public final class LoadedApk {
ApplicationInfo ai = null;
try {
ai = ActivityThread.getPackageManager().getApplicationInfo(packageName,
- PackageManager.GET_SHARED_LIBRARY_FILES, UserId.myUserId());
+ PackageManager.GET_SHARED_LIBRARY_FILES, UserHandle.myUserId());
} catch (RemoteException e) {
throw new AssertionError(e);
}
@@ -358,7 +358,7 @@ public final class LoadedApk {
IPackageManager pm = ActivityThread.getPackageManager();
android.content.pm.PackageInfo pi;
try {
- pi = pm.getPackageInfo(mPackageName, 0, UserId.myUserId());
+ pi = pm.getPackageInfo(mPackageName, 0, UserHandle.myUserId());
} catch (RemoteException e) {
throw new AssertionError(e);
}
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index c320ee3..f638f7e 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -27,7 +27,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.AndroidException;
/**
@@ -651,7 +651,7 @@ public final class PendingIntent implements Parcelable {
try {
int uid = ActivityManagerNative.getDefault()
.getUidForIntentSender(mTarget);
- return uid > 0 ? UserId.getUserId(uid) : -1;
+ return uid > 0 ? UserHandle.getUserId(uid) : -1;
} catch (RemoteException e) {
// Should never happen.
return -1;
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index b8c9937..43a163d 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -31,7 +31,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.UserId;
+import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;
@@ -847,7 +847,7 @@ public class SearchManager
* @hide
*/
public Intent getAssistIntent(Context context) {
- return getAssistIntent(context, UserId.myUserId());
+ return getAssistIntent(context, UserHandle.myUserId());
}
/**
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index b22179e..8a69c3a 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -35,7 +35,7 @@ import android.os.OperationCanceledException;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Log;
import java.io.File;
diff --git a/core/java/android/content/ContentService.java b/core/java/android/content/ContentService.java
index 1a07504..472fe94 100644
--- a/core/java/android/content/ContentService.java
+++ b/core/java/android/content/ContentService.java
@@ -26,7 +26,7 @@ import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Log;
import android.util.SparseIntArray;
import android.Manifest;
@@ -168,7 +168,7 @@ public final class ContentService extends IContentService.Stub {
+ ", syncToNetwork " + syncToNetwork);
}
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
// This makes it so that future permission checks will be in the context of this
// process rather than the caller's process. We will restore this before returning.
long identityToken = clearCallingIdentity();
@@ -236,7 +236,7 @@ public final class ContentService extends IContentService.Stub {
public void requestSync(Account account, String authority, Bundle extras) {
ContentResolver.validateSyncExtrasBundle(extras);
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
// This makes it so that future permission checks will be in the context of this
// process rather than the caller's process. We will restore this before returning.
@@ -259,7 +259,7 @@ public final class ContentService extends IContentService.Stub {
* @param authority filter the pending and active syncs to cancel using this authority
*/
public void cancelSync(Account account, String authority) {
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
// This makes it so that future permission checks will be in the context of this
// process rather than the caller's process. We will restore this before returning.
@@ -294,7 +294,7 @@ public final class ContentService extends IContentService.Stub {
public boolean getSyncAutomatically(Account account, String providerName) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,
"no permission to read the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -312,7 +312,7 @@ public final class ContentService extends IContentService.Stub {
public void setSyncAutomatically(Account account, String providerName, boolean sync) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,
"no permission to write the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -330,7 +330,7 @@ public final class ContentService extends IContentService.Stub {
long pollFrequency) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,
"no permission to write the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -344,7 +344,7 @@ public final class ContentService extends IContentService.Stub {
public void removePeriodicSync(Account account, String authority, Bundle extras) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,
"no permission to write the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -358,7 +358,7 @@ public final class ContentService extends IContentService.Stub {
public List<PeriodicSync> getPeriodicSyncs(Account account, String providerName) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,
"no permission to read the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -372,7 +372,7 @@ public final class ContentService extends IContentService.Stub {
public int getIsSyncable(Account account, String providerName) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,
"no permission to read the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -390,7 +390,7 @@ public final class ContentService extends IContentService.Stub {
public void setIsSyncable(Account account, String providerName, int syncable) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,
"no permission to write the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -407,7 +407,7 @@ public final class ContentService extends IContentService.Stub {
public boolean getMasterSyncAutomatically() {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,
"no permission to read the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -424,7 +424,7 @@ public final class ContentService extends IContentService.Stub {
public void setMasterSyncAutomatically(boolean flag) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,
"no permission to write the sync settings");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -440,7 +440,7 @@ public final class ContentService extends IContentService.Stub {
public boolean isSyncActive(Account account, String authority) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,
"no permission to read the sync stats");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -458,7 +458,7 @@ public final class ContentService extends IContentService.Stub {
public List<SyncInfo> getCurrentSyncs() {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,
"no permission to read the sync stats");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -471,7 +471,7 @@ public final class ContentService extends IContentService.Stub {
public SyncStatusInfo getSyncStatus(Account account, String authority) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,
"no permission to read the sync stats");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
@@ -489,7 +489,7 @@ public final class ContentService extends IContentService.Stub {
public boolean isSyncPending(Account account, String authority) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,
"no permission to read the sync stats");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long identityToken = clearCallingIdentity();
try {
diff --git a/core/java/android/content/IntentSender.java b/core/java/android/content/IntentSender.java
index 9618645..1801488 100644
--- a/core/java/android/content/IntentSender.java
+++ b/core/java/android/content/IntentSender.java
@@ -27,7 +27,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.AndroidException;
@@ -257,7 +257,7 @@ public class IntentSender implements Parcelable {
try {
int uid = ActivityManagerNative.getDefault()
.getUidForIntentSender(mTarget);
- return uid > 0 ? UserId.getUserId(uid) : -1;
+ return uid > 0 ? UserHandle.getUserId(uid) : -1;
} catch (RemoteException e) {
// Should never happen.
return -1;
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index e6303b9..3d3ff51 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -52,7 +52,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.UserManager;
import android.os.WorkSource;
import android.provider.Settings;
@@ -174,7 +174,7 @@ public class SyncManager implements OnAccountsUpdateListener {
Log.v(TAG, "Internal storage is low.");
}
mStorageIsLow = true;
- cancelActiveSync(null /* any account */, UserId.USER_ALL,
+ cancelActiveSync(null /* any account */, UserHandle.USER_ALL,
null /* any authority */);
} else if (Intent.ACTION_DEVICE_STORAGE_OK.equals(action)) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
@@ -195,7 +195,7 @@ public class SyncManager implements OnAccountsUpdateListener {
private BroadcastReceiver mBackgroundDataSettingChanged = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
if (getConnectivityManager().getBackgroundDataSetting()) {
- scheduleSync(null /* account */, UserId.USER_ALL, null /* authority */,
+ scheduleSync(null /* account */, UserHandle.USER_ALL, null /* authority */,
new Bundle(), 0 /* delay */,
false /* onlyThoseWithUnknownSyncableState */);
}
@@ -287,7 +287,7 @@ public class SyncManager implements OnAccountsUpdateListener {
// a chance to set their syncable state.
boolean onlyThoseWithUnkownSyncableState = justBootedUp;
- scheduleSync(null, UserId.USER_ALL, null, null, 0 /* no delay */,
+ scheduleSync(null, UserHandle.USER_ALL, null, null, 0 /* no delay */,
onlyThoseWithUnkownSyncableState);
}
}
@@ -371,7 +371,7 @@ public class SyncManager implements OnAccountsUpdateListener {
mSyncAdapters.setListener(new RegisteredServicesCacheListener<SyncAdapterType>() {
public void onServiceChanged(SyncAdapterType type, boolean removed) {
if (!removed) {
- scheduleSync(null, UserId.USER_ALL, type.authority, null, 0 /* no delay */,
+ scheduleSync(null, UserHandle.USER_ALL, type.authority, null, 0 /* no delay */,
false /* onlyThoseWithUnkownSyncableState */);
}
}
@@ -517,7 +517,7 @@ public class SyncManager implements OnAccountsUpdateListener {
}
AccountAndUser[] accounts;
- if (requestedAccount != null && userId != UserId.USER_ALL) {
+ if (requestedAccount != null && userId != UserHandle.USER_ALL) {
accounts = new AccountAndUser[] { new AccountAndUser(requestedAccount, userId) };
} else {
// if the accounts aren't configured yet then we can't support an account-less
@@ -2180,7 +2180,7 @@ public class SyncManager implements OnAccountsUpdateListener {
}
}
// check if the userid matches
- if (userId != UserId.USER_ALL
+ if (userId != UserHandle.USER_ALL
&& userId != activeSyncContext.mSyncOperation.userId) {
continue;
}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index d906401..ac75040 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -28,7 +28,7 @@ import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.PatternMatcher;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.DisplayMetrics;
@@ -249,7 +249,7 @@ public class PackageParser {
return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime,
grantedPermissions, false, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
- UserId.getCallingUserId());
+ UserHandle.getCallingUserId());
}
/**
@@ -263,7 +263,7 @@ public class PackageParser {
HashSet<String> grantedPermissions, boolean stopped, int enabledState) {
return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime,
- grantedPermissions, stopped, enabledState, UserId.getCallingUserId());
+ grantedPermissions, stopped, enabledState, UserHandle.getCallingUserId());
}
public static PackageInfo generatePackageInfo(PackageParser.Package p,
@@ -3478,7 +3478,7 @@ public class PackageParser {
public static ApplicationInfo generateApplicationInfo(Package p, int flags, boolean stopped,
int enabledState) {
- return generateApplicationInfo(p, flags, stopped, enabledState, UserId.getCallingUserId());
+ return generateApplicationInfo(p, flags, stopped, enabledState, UserHandle.getCallingUserId());
}
public static ApplicationInfo generateApplicationInfo(Package p, int flags,
@@ -3508,7 +3508,7 @@ public class PackageParser {
// Make shallow copy so we can store the metadata/libraries safely
ApplicationInfo ai = new ApplicationInfo(p.applicationInfo);
if (userId != 0) {
- ai.uid = UserId.getUid(userId, ai.uid);
+ ai.uid = UserHandle.getUid(userId, ai.uid);
ai.dataDir = PackageManager.getDataDirForUser(userId, ai.packageName);
}
if ((flags & PackageManager.GET_META_DATA) != 0) {
@@ -3616,7 +3616,7 @@ public class PackageParser {
int enabledState, int userId) {
if (s == null) return null;
if (!copyNeeded(flags, s.owner, enabledState, s.metaData)
- && userId == UserId.getUserId(s.info.applicationInfo.uid)) {
+ && userId == UserHandle.getUserId(s.info.applicationInfo.uid)) {
return s.info;
}
// Make shallow copies so we can store the metadata safely
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index 7b51119..5d40456 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -82,7 +82,7 @@ public class Binder implements IBinder {
* @hide
*/
public static final int getOrigCallingUid() {
- if (UserId.MU_ENABLED) {
+ if (UserHandle.MU_ENABLED) {
return getOrigCallingUidNative();
} else {
return getCallingUid();
@@ -97,7 +97,7 @@ public class Binder implements IBinder {
* @hide
*/
public static final int getOrigCallingUser() {
- return UserId.getUserId(getOrigCallingUid());
+ return UserHandle.getUserId(getOrigCallingUid());
}
/**
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 93860aa..5118f1a 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -654,7 +654,7 @@ public class Process {
* distinct apps running under it each with their own uid.
*/
public static final int myUserHandle() {
- return UserId.getUserId(myUid());
+ return UserHandle.getUserId(myUid());
}
/**
@@ -662,7 +662,7 @@ public class Process {
* @hide
*/
public static final boolean isIsolated() {
- int uid = UserId.getAppId(myUid());
+ int uid = UserHandle.getAppId(myUid());
return uid >= FIRST_ISOLATED_UID && uid <= LAST_ISOLATED_UID;
}
diff --git a/core/java/android/os/UserId.java b/core/java/android/os/UserHandle.java
index 18a3062..577a8c6 100644
--- a/core/java/android/os/UserId.java
+++ b/core/java/android/os/UserHandle.java
@@ -17,9 +17,10 @@
package android.os;
/**
+ * Representation of a user on the device.
* @hide
*/
-public final class UserId {
+public final class UserHandle {
/**
* Range of IDs allocated for a user.
*
@@ -70,7 +71,7 @@ public final class UserId {
public static boolean isApp(int uid) {
if (uid > 0) {
- uid = UserId.getAppId(uid);
+ uid = UserHandle.getAppId(uid);
return uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID;
} else {
return false;
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index e08ec1f..6dbba46 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -41,7 +41,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
-import android.os.UserId;
+import android.os.UserHandle;
import android.speech.tts.TextToSpeech;
import android.text.TextUtils;
import android.util.AndroidException;
@@ -2336,7 +2336,7 @@ public final class Settings {
if (sLockSettings != null && !sIsSystemProcess
&& MOVED_TO_LOCK_SETTINGS.contains(name)) {
try {
- return sLockSettings.getString(name, "0", UserId.getCallingUserId());
+ return sLockSettings.getString(name, "0", UserHandle.getCallingUserId());
} catch (RemoteException re) {
// Fall through
}
diff --git a/core/java/android/server/search/SearchManagerService.java b/core/java/android/server/search/SearchManagerService.java
index b4f5e12..df85b2f 100644
--- a/core/java/android/server/search/SearchManagerService.java
+++ b/core/java/android/server/search/SearchManagerService.java
@@ -37,7 +37,7 @@ import android.database.ContentObserver;
import android.os.Binder;
import android.os.Process;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.util.Log;
@@ -186,45 +186,45 @@ public class SearchManagerService extends ISearchManager.Stub {
Log.e(TAG, "getSearchableInfo(), activity == null");
return null;
}
- return getSearchables(UserId.getCallingUserId()).getSearchableInfo(launchActivity);
+ return getSearchables(UserHandle.getCallingUserId()).getSearchableInfo(launchActivity);
}
/**
* Returns a list of the searchable activities that can be included in global search.
*/
public List<SearchableInfo> getSearchablesInGlobalSearch() {
- return getSearchables(UserId.getCallingUserId()).getSearchablesInGlobalSearchList();
+ return getSearchables(UserHandle.getCallingUserId()).getSearchablesInGlobalSearchList();
}
public List<ResolveInfo> getGlobalSearchActivities() {
- return getSearchables(UserId.getCallingUserId()).getGlobalSearchActivities();
+ return getSearchables(UserHandle.getCallingUserId()).getGlobalSearchActivities();
}
/**
* Gets the name of the global search activity.
*/
public ComponentName getGlobalSearchActivity() {
- return getSearchables(UserId.getCallingUserId()).getGlobalSearchActivity();
+ return getSearchables(UserHandle.getCallingUserId()).getGlobalSearchActivity();
}
/**
* Gets the name of the web search activity.
*/
public ComponentName getWebSearchActivity() {
- return getSearchables(UserId.getCallingUserId()).getWebSearchActivity();
+ return getSearchables(UserHandle.getCallingUserId()).getWebSearchActivity();
}
@Override
public ComponentName getAssistIntent(int userHandle) {
try {
- if (userHandle != UserId.getCallingUserId()) {
+ if (userHandle != UserHandle.getCallingUserId()) {
// Requesting a different user, make sure that they have the permission
if (ActivityManager.checkComponentPermission(
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
Binder.getCallingUid(), -1, true)
== PackageManager.PERMISSION_GRANTED) {
// Translate to the current user id, if caller wasn't aware
- if (userHandle == UserId.USER_CURRENT) {
+ if (userHandle == UserHandle.USER_CURRENT) {
long identity = Binder.clearCallingIdentity();
userHandle = ActivityManagerNative.getDefault().getCurrentUser().id;
Binder.restoreCallingIdentity(identity);
@@ -232,7 +232,7 @@ public class SearchManagerService extends ISearchManager.Stub {
} else {
String msg = "Permission Denial: "
+ "Request to getAssistIntent for " + userHandle
- + " but is calling from user " + UserId.getCallingUserId()
+ + " but is calling from user " + UserHandle.getCallingUserId()
+ "; this requires "
+ android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
Slog.w(TAG, msg);
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 84fe8ce..e63c57f 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -37,7 +37,7 @@ import android.os.Bundle;
import android.os.PatternMatcher;
import android.os.Process;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -133,7 +133,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
mAdapter = new ResolveListAdapter(this, intent, initialIntents, rList,
mLaunchedFromUid);
int count = mAdapter.getCount();
- if (mLaunchedFromUid < 0 || UserId.isIsolated(mLaunchedFromUid)) {
+ if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) {
// Gulp!
finish();
return;
diff --git a/core/java/com/android/internal/statusbar/StatusBarNotification.java b/core/java/com/android/internal/statusbar/StatusBarNotification.java
index 540d134..cb87ac4 100644
--- a/core/java/com/android/internal/statusbar/StatusBarNotification.java
+++ b/core/java/com/android/internal/statusbar/StatusBarNotification.java
@@ -19,7 +19,7 @@ package com.android.internal.statusbar;
import android.app.Notification;
import android.os.Parcel;
import android.os.Parcelable;
-import android.os.UserId;
+import android.os.UserHandle;
import android.widget.RemoteViews;
@@ -136,7 +136,7 @@ public class StatusBarNotification implements Parcelable {
/** Returns a userHandle for the instance of the app that posted this notification. */
public int getUserId() {
- return UserId.getUserId(this.uid);
+ return UserHandle.getUserId(this.uid);
}
}
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index f77e8f3..4777c16 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -34,7 +34,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.storage.IMountService;
import android.provider.Settings;
import android.security.KeyStore;
@@ -246,7 +246,7 @@ public class LockPatternUtils {
if (callingUid == android.os.Process.SYSTEM_UID) {
return mCurrentUserId;
} else {
- return UserId.getUserId(callingUid);
+ return UserHandle.getUserId(callingUid);
}
}
diff --git a/core/java/com/android/internal/widget/LockSettingsService.java b/core/java/com/android/internal/widget/LockSettingsService.java
index 2fb81ac..350e006 100644
--- a/core/java/com/android/internal/widget/LockSettingsService.java
+++ b/core/java/com/android/internal/widget/LockSettingsService.java
@@ -25,7 +25,7 @@ import android.database.sqlite.SQLiteOpenHelper;
import android.os.Binder;
import android.os.RemoteException;
import android.os.SystemProperties;
-import android.os.UserId;
+import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.text.TextUtils;
@@ -97,7 +97,7 @@ public class LockSettingsService extends ILockSettings.Stub {
private static final void checkWritePermission(int userId) {
final int callingUid = Binder.getCallingUid();
- if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID) {
+ if (UserHandle.getAppId(callingUid) != android.os.Process.SYSTEM_UID) {
throw new SecurityException("uid=" + callingUid
+ " not authorized to write lock settings");
}
@@ -105,7 +105,7 @@ public class LockSettingsService extends ILockSettings.Stub {
private static final void checkPasswordReadPermission(int userId) {
final int callingUid = Binder.getCallingUid();
- if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID) {
+ if (UserHandle.getAppId(callingUid) != android.os.Process.SYSTEM_UID) {
throw new SecurityException("uid=" + callingUid
+ " not authorized to read lock password");
}
@@ -113,8 +113,8 @@ public class LockSettingsService extends ILockSettings.Stub {
private static final void checkReadPermission(int userId) {
final int callingUid = Binder.getCallingUid();
- if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID
- && UserId.getUserId(callingUid) != userId) {
+ if (UserHandle.getAppId(callingUid) != android.os.Process.SYSTEM_UID
+ && UserHandle.getUserId(callingUid) != userId) {
throw new SecurityException("uid=" + callingUid
+ " not authorized to read settings of user " + userId);
}
diff --git a/core/tests/coretests/src/android/content/pm/AppCacheTest.java b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
index 0c31e2d..8d53db9 100755
--- a/core/tests/coretests/src/android/content/pm/AppCacheTest.java
+++ b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
@@ -24,7 +24,7 @@ import android.content.IntentFilter;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StatFs;
-import android.os.UserId;
+import android.os.UserHandle;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
@@ -719,7 +719,7 @@ public class AppCacheTest extends AndroidTestCase {
File getDataDir() {
try {
ApplicationInfo appInfo = getPm().getApplicationInfo(mContext.getPackageName(), 0,
- UserId.myUserId());
+ UserHandle.myUserId());
return new File(appInfo.dataDir);
} catch (RemoteException e) {
throw new RuntimeException("Pacakge manager dead", e);
@@ -748,7 +748,7 @@ public class AppCacheTest extends AndroidTestCase {
@LargeTest
public void testClearApplicationUserDataNoObserver() throws Exception {
- getPm().clearApplicationUserData(mContext.getPackageName(), null, UserId.myUserId());
+ getPm().clearApplicationUserData(mContext.getPackageName(), null, UserHandle.myUserId());
//sleep for 1 minute
Thread.sleep(60*1000);
//confirm files dont exist
diff --git a/core/tests/coretests/src/android/os/ProcessTest.java b/core/tests/coretests/src/android/os/ProcessTest.java
index 598a8d2..1f5b7c8 100644
--- a/core/tests/coretests/src/android/os/ProcessTest.java
+++ b/core/tests/coretests/src/android/os/ProcessTest.java
@@ -18,7 +18,7 @@
package android.os;
import android.os.Process;
-import android.os.UserId;
+import android.os.UserHandle;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
@@ -32,10 +32,10 @@ public class ProcessTest extends TestCase {
assertEquals(android.os.Process.SYSTEM_UID, Process.getUidForName("system"));
assertEquals(Process.BLUETOOTH_UID, Process.getUidForName("bluetooth"));
assertEquals(Process.FIRST_APPLICATION_UID, Process.getUidForName("u0_a0"));
- assertEquals(UserId.getUid(1, Process.SYSTEM_UID), Process.getUidForName("u1_system"));
- assertEquals(UserId.getUid(2, Process.FIRST_ISOLATED_UID),
+ assertEquals(UserHandle.getUid(1, Process.SYSTEM_UID), Process.getUidForName("u1_system"));
+ assertEquals(UserHandle.getUid(2, Process.FIRST_ISOLATED_UID),
Process.getUidForName("u2_i0"));
- assertEquals(UserId.getUid(3, Process.FIRST_APPLICATION_UID + 100),
+ assertEquals(UserHandle.getUid(3, Process.FIRST_APPLICATION_UID + 100),
Process.getUidForName("u3_a100"));
}
diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java
index 07f9e91..6b23be9 100644
--- a/opengl/java/com/google/android/gles_jni/GLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/GLImpl.java
@@ -23,7 +23,7 @@ import android.app.AppGlobals;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.os.Build;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Log;
import java.nio.Buffer;
@@ -68,7 +68,7 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int version = 0;
IPackageManager pm = AppGlobals.getPackageManager();
try {
- ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0, UserId.myUserId());
+ ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0, UserHandle.myUserId());
if (applicationInfo != null) {
version = applicationInfo.targetSdkVersion;
}
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index b36e71a..a2f43fd 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -24,7 +24,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.AttributeSet;
@@ -75,14 +75,14 @@ public class SearchPanelView extends FrameLayout implements
mBar.animateCollapse(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
// Launch Assist
Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, UserId.USER_CURRENT);
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT);
if (intent == null) return;
try {
ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
R.anim.search_launch_enter, R.anim.search_launch_exit,
getHandler(), this);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mContext.startActivityAsUser(intent, opts.toBundle(), UserId.USER_CURRENT);
+ mContext.startActivityAsUser(intent, opts.toBundle(), UserHandle.USER_CURRENT);
} catch (ActivityNotFoundException e) {
Slog.w(TAG, "Activity not found for " + intent.getAction());
onAnimationStarted();
@@ -143,7 +143,7 @@ public class SearchPanelView extends FrameLayout implements
private void maybeSwapSearchIcon() {
Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, UserId.USER_CURRENT);
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT);
if (intent != null) {
ComponentName component = intent.getComponent();
if (component == null || !mGlowPadView.replaceTargetDrawablesIfPresent(component,
@@ -281,6 +281,6 @@ public class SearchPanelView extends FrameLayout implements
public boolean isAssistantAvailable() {
return ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, UserId.USER_CURRENT) != null;
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT) != null;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
index 3e03f85..4d8c168 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
@@ -30,7 +30,7 @@ import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Process;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Log;
import com.android.systemui.R;
@@ -245,7 +245,7 @@ public class RecentTasksLoader {
final List<ActivityManager.RecentTaskInfo> recentTasks =
am.getRecentTasksForUser(MAX_TASKS,
- ActivityManager.RECENT_IGNORE_UNAVAILABLE, UserId.USER_CURRENT);
+ ActivityManager.RECENT_IGNORE_UNAVAILABLE, UserHandle.USER_CURRENT);
int numTasks = recentTasks.size();
ActivityInfo homeInfo = new Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_HOME).resolveActivityInfo(pm, 0);
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index bb647c3..7d36152 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -36,7 +36,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.UserId;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
@@ -790,7 +790,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
| Intent.FLAG_ACTIVITY_TASK_ON_HOME
| Intent.FLAG_ACTIVITY_NEW_TASK);
if (DEBUG) Log.v(TAG, "Starting activity " + intent);
- context.startActivityAsUser(intent, opts.toBundle(), UserId.USER_CURRENT);
+ context.startActivityAsUser(intent, opts.toBundle(), UserHandle.USER_CURRENT);
}
if (usingDrawingCache) {
holder.thumbnailViewImage.setDrawingCacheEnabled(false);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index c9c7753..7598537 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -49,7 +49,7 @@ import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.UserId;
+import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 8884179..ad06c1b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -46,7 +46,7 @@ import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.provider.Settings;
import android.service.dreams.IDreamManager;
import android.util.DisplayMetrics;
@@ -1783,7 +1783,7 @@ public class PhoneStatusBar extends BaseStatusBar {
} catch (RemoteException e) {
}
v.getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), UserId.USER_CURRENT);
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), UserHandle.USER_CURRENT);
animateCollapse();
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
index da161a9..ffe69e2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
@@ -19,7 +19,7 @@ package com.android.systemui.statusbar.tablet;
import android.app.StatusBarManager;
import android.content.Context;
import android.content.Intent;
-import android.os.UserId;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Slog;
@@ -119,7 +119,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener {
// ----------------------------
private void onClickSettings() {
getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), UserId.USER_CURRENT);
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), UserHandle.USER_CURRENT);
getStatusBarManager().collapse();
}
}
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index 8645172..5f5c105 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -32,7 +32,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.Vibrator;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -277,7 +277,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
// Update the search icon with drawable from the search .apk
if (!mSearchDisabled) {
Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, UserId.USER_CURRENT);
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT);
if (intent != null) {
// XXX Hack. We need to substitute the icon here but haven't formalized
// the public API. The "_google" metadata will be going away, so
@@ -313,7 +313,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
case com.android.internal.R.drawable.ic_action_assist_generic:
Intent assistIntent =
((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, UserId.USER_CURRENT);
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT);
if (assistIntent != null) {
launchActivity(assistIntent);
} else {
@@ -354,7 +354,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
Log.w(TAG, "can't dismiss keyguard on launch");
}
try {
- mContext.startActivityAsUser(intent, UserId.USER_CURRENT);
+ mContext.startActivityAsUser(intent, UserHandle.USER_CURRENT);
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Activity not found for intent + " + intent.getAction());
}
@@ -532,7 +532,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
}
boolean searchActionAvailable =
((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, UserId.USER_CURRENT) != null;
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT) != null;
mCameraDisabled = disabledByAdmin || disabledBySimState || !cameraTargetPresent;
mSearchDisabled = disabledBySimState || !searchActionAvailable || !searchTargetPresent;
mUnlockWidgetMethods.updateResources();
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index c036e1b..b91eb00 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -54,7 +54,7 @@ import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UEventObserver;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.Settings;
@@ -2064,7 +2064,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (searchManager != null) {
searchManager.stopSearch();
}
- mContext.startActivityAsUser(intent, UserId.USER_CURRENT);
+ mContext.startActivityAsUser(intent, UserHandle.USER_CURRENT);
} catch (ActivityNotFoundException e) {
Slog.w(TAG, "No activity to handle assist long press action.", e);
}
@@ -2073,13 +2073,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private void launchAssistAction() {
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, UserId.USER_CURRENT);
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT);
if (intent != null) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_SINGLE_TOP
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
- mContext.startActivityAsUser(intent, UserId.USER_CURRENT);
+ mContext.startActivityAsUser(intent, UserHandle.USER_CURRENT);
} catch (ActivityNotFoundException e) {
Slog.w(TAG, "No activity to handle assist action.", e);
}
diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/AppWidgetServiceImpl.java
index 48f967c..5250dfc 100644
--- a/services/java/com/android/server/AppWidgetServiceImpl.java
+++ b/services/java/com/android/server/AppWidgetServiceImpl.java
@@ -43,7 +43,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.AtomicFile;
import android.util.AttributeSet;
import android.util.Log;
@@ -593,7 +593,7 @@ class AppWidgetServiceImpl {
private boolean callerHasBindAppWidgetPermission(String packageName) {
int callingUid = Binder.getCallingUid();
try {
- if (!UserId.isSameApp(callingUid, getUidForPackage(packageName))) {
+ if (!UserHandle.isSameApp(callingUid, getUidForPackage(packageName))) {
return false;
}
} catch (Exception e) {
@@ -665,7 +665,7 @@ class AppWidgetServiceImpl {
mBoundRemoteViewsServices.remove(key);
}
- int userId = UserId.getUserId(id.provider.uid);
+ int userId = UserHandle.getUserId(id.provider.uid);
// Bind to the RemoteViewsService (which will trigger a callback to the
// RemoteViewsAdapter.onServiceConnected())
final long token = Binder.clearCallingIdentity();
@@ -756,7 +756,7 @@ class AppWidgetServiceImpl {
}
};
- int userId = UserId.getUserId(id.provider.uid);
+ int userId = UserHandle.getUserId(id.provider.uid);
// Bind to the service and remove the static intent->factory mapping in the
// RemoteViewsService.
final long token = Binder.clearCallingIdentity();
@@ -1026,7 +1026,7 @@ class AppWidgetServiceImpl {
}
};
- int userId = UserId.getUserId(id.provider.uid);
+ int userId = UserHandle.getUserId(id.provider.uid);
// Bind to the service and call onDataSetChanged()
final long token = Binder.clearCallingIdentity();
try {
@@ -1375,7 +1375,7 @@ class AppWidgetServiceImpl {
throw new IllegalArgumentException("packageName and uid don't match packageName="
+ packageName);
}
- if (!UserId.isSameApp(callingUid, packageUid)) {
+ if (!UserHandle.isSameApp(callingUid, packageUid)) {
throw new IllegalArgumentException("packageName and uid don't match packageName="
+ packageName);
}
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 4542840..8be0ba8 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -65,7 +65,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.WorkSource;
import android.os.storage.IMountService;
import android.provider.Settings;
@@ -4846,8 +4846,8 @@ class BackupManagerService extends IBackupManager.Stub {
// ----- IBackupManager binder interface -----
public void dataChanged(final String packageName) {
- final int callingUserHandle = UserId.getCallingUserId();
- if (callingUserHandle != UserId.USER_OWNER) {
+ final int callingUserHandle = UserHandle.getCallingUserId();
+ if (callingUserHandle != UserHandle.USER_OWNER) {
// App is running under a non-owner user profile. For now, we do not back
// up data from secondary user profiles.
// TODO: backups for all user profiles.
@@ -4950,8 +4950,8 @@ class BackupManagerService extends IBackupManager.Stub {
boolean doAllApps, boolean includeSystem, String[] pkgList) {
mContext.enforceCallingPermission(android.Manifest.permission.BACKUP, "fullBackup");
- final int callingUserHandle = UserId.getCallingUserId();
- if (callingUserHandle != UserId.USER_OWNER) {
+ final int callingUserHandle = UserHandle.getCallingUserId();
+ if (callingUserHandle != UserHandle.USER_OWNER) {
throw new IllegalStateException("Backup supported only for the device owner");
}
@@ -5019,8 +5019,8 @@ class BackupManagerService extends IBackupManager.Stub {
public void fullRestore(ParcelFileDescriptor fd) {
mContext.enforceCallingPermission(android.Manifest.permission.BACKUP, "fullRestore");
- final int callingUserHandle = UserId.getCallingUserId();
- if (callingUserHandle != UserId.USER_OWNER) {
+ final int callingUserHandle = UserHandle.getCallingUserId();
+ if (callingUserHandle != UserHandle.USER_OWNER) {
throw new IllegalStateException("Restore supported only for the device owner");
}
diff --git a/services/java/com/android/server/ClipboardService.java b/services/java/com/android/server/ClipboardService.java
index 8a6a550..baf33a9 100644
--- a/services/java/com/android/server/ClipboardService.java
+++ b/services/java/com/android/server/ClipboardService.java
@@ -36,7 +36,7 @@ import android.os.Parcel;
import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
@@ -115,7 +115,7 @@ public class ClipboardService extends IClipboard.Stub {
}
private PerUserClipboard getClipboard() {
- return getClipboard(UserId.getCallingUserId());
+ return getClipboard(UserHandle.getCallingUserId());
}
private PerUserClipboard getClipboard(int userId) {
@@ -258,7 +258,7 @@ public class ClipboardService extends IClipboard.Stub {
PackageInfo pi;
try {
pi = mPm.getPackageInfo(pkg, 0);
- if (!UserId.isSameApp(pi.applicationInfo.uid, uid)) {
+ if (!UserHandle.isSameApp(pi.applicationInfo.uid, uid)) {
throw new SecurityException("Calling uid " + uid
+ " does not own package " + pkg);
}
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 04267a3..bb5d552 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -48,7 +48,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.storage.IMountService;
import android.os.storage.IMountServiceListener;
import android.os.storage.IMountShutdownObserver;
@@ -1713,7 +1713,7 @@ class MountService extends IMountService.Stub
return false;
}
- final int packageUid = mPms.getPackageUid(packageName, UserId.getUserId(callerUid));
+ final int packageUid = mPms.getPackageUid(packageName, UserHandle.getUserId(callerUid));
if (DEBUG_OBB) {
Slog.d(TAG, "packageName = " + packageName + ", packageUid = " +
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 798915b..a565d08 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -48,7 +48,7 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.Settings;
import android.service.dreams.IDreamManager;
@@ -1286,7 +1286,7 @@ public class NotificationManagerService extends INotificationManager.Stub
try {
ApplicationInfo ai = mContext.getPackageManager().getApplicationInfo(
pkg, 0);
- if (!UserId.isSameApp(ai.uid, uid)) {
+ if (!UserHandle.isSameApp(ai.uid, uid)) {
throw new SecurityException("Calling uid " + uid + " gave package"
+ pkg + " which is owned by uid " + ai.uid);
}
diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/WallpaperManagerService.java
index d97d335..c5243a2 100644
--- a/services/java/com/android/server/WallpaperManagerService.java
+++ b/services/java/com/android/server/WallpaperManagerService.java
@@ -47,7 +47,7 @@ import android.os.ParcelFileDescriptor;
import android.os.RemoteCallbackList;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.service.wallpaper.IWallpaperConnection;
import android.service.wallpaper.IWallpaperEngine;
import android.service.wallpaper.IWallpaperService;
@@ -483,7 +483,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
public void clearWallpaper() {
if (DEBUG) Slog.v(TAG, "clearWallpaper");
synchronized (mLock) {
- clearWallpaperLocked(false, UserId.getCallingUserId());
+ clearWallpaperLocked(false, UserHandle.getCallingUserId());
}
}
@@ -520,7 +520,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
public void setDimensionHints(int width, int height) throws RemoteException {
checkPermission(android.Manifest.permission.SET_WALLPAPER_HINTS);
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
WallpaperData wallpaper = mWallpaperMap.get(userId);
if (wallpaper == null) {
throw new IllegalStateException("Wallpaper not yet initialized for user " + userId);
@@ -551,14 +551,14 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
public int getWidthHint() throws RemoteException {
synchronized (mLock) {
- WallpaperData wallpaper = mWallpaperMap.get(UserId.getCallingUserId());
+ WallpaperData wallpaper = mWallpaperMap.get(UserHandle.getCallingUserId());
return wallpaper.width;
}
}
public int getHeightHint() throws RemoteException {
synchronized (mLock) {
- WallpaperData wallpaper = mWallpaperMap.get(UserId.getCallingUserId());
+ WallpaperData wallpaper = mWallpaperMap.get(UserHandle.getCallingUserId());
return wallpaper.height;
}
}
@@ -573,7 +573,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
if (callingUid == android.os.Process.SYSTEM_UID) {
wallpaperUserId = mCurrentUserId;
} else {
- wallpaperUserId = UserId.getUserId(callingUid);
+ wallpaperUserId = UserHandle.getUserId(callingUid);
}
WallpaperData wallpaper = mWallpaperMap.get(wallpaperUserId);
try {
@@ -596,7 +596,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
}
public WallpaperInfo getWallpaperInfo() {
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
synchronized (mLock) {
WallpaperData wallpaper = mWallpaperMap.get(userId);
if (wallpaper.connection != null) {
@@ -608,7 +608,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
public ParcelFileDescriptor setWallpaper(String name) {
if (DEBUG) Slog.v(TAG, "setWallpaper");
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
WallpaperData wallpaper = mWallpaperMap.get(userId);
if (wallpaper == null) {
throw new IllegalStateException("Wallpaper not yet initialized for user " + userId);
@@ -651,7 +651,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
public void setWallpaperComponent(ComponentName name) {
if (DEBUG) Slog.v(TAG, "setWallpaperComponent name=" + name);
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
WallpaperData wallpaper = mWallpaperMap.get(userId);
if (wallpaper == null) {
throw new IllegalStateException("Wallpaper not yet initialized for user " + userId);
diff --git a/services/java/com/android/server/am/ActiveServices.java b/services/java/com/android/server/am/ActiveServices.java
index 632c2f2..d8ccabb 100644
--- a/services/java/com/android/server/am/ActiveServices.java
+++ b/services/java/com/android/server/am/ActiveServices.java
@@ -51,7 +51,7 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
@@ -226,7 +226,7 @@ public class ActiveServices {
ServiceLookupResult res =
retrieveServiceLocked(service, resolvedType,
- callingPid, callingUid, UserId.getUserId(callingUid), true);
+ callingPid, callingUid, UserHandle.getUserId(callingUid), true);
if (res == null) {
return null;
}
@@ -279,7 +279,7 @@ public class ActiveServices {
// If this service is active, make sure it is stopped.
ServiceLookupResult r = retrieveServiceLocked(service, resolvedType,
Binder.getCallingPid(), Binder.getCallingUid(),
- callerApp == null ? UserId.getCallingUserId() : callerApp.userId,
+ callerApp == null ? UserHandle.getCallingUserId() : callerApp.userId,
false);
if (r != null) {
if (r.record != null) {
@@ -300,7 +300,7 @@ public class ActiveServices {
IBinder peekServiceLocked(Intent service, String resolvedType) {
ServiceLookupResult r = retrieveServiceLocked(service, resolvedType,
Binder.getCallingPid(), Binder.getCallingUid(),
- UserId.getCallingUserId(), false);
+ UserHandle.getCallingUserId(), false);
IBinder ret = null;
if (r != null) {
@@ -759,8 +759,8 @@ public class ActiveServices {
}
r = new ServiceRecord(mAm, ss, name, filter, sInfo, res);
res.setService(r);
- mServiceMap.putServiceByName(name, UserId.getUserId(r.appInfo.uid), r);
- mServiceMap.putServiceByIntent(filter, UserId.getUserId(r.appInfo.uid), r);
+ mServiceMap.putServiceByName(name, UserHandle.getUserId(r.appInfo.uid), r);
+ mServiceMap.putServiceByIntent(filter, UserHandle.getUserId(r.appInfo.uid), r);
// Make sure this component isn't in the pending list.
int N = mPendingServices.size();
@@ -1725,7 +1725,7 @@ public class ActiveServices {
ArrayList<ActivityManager.RunningServiceInfo> res
= new ArrayList<ActivityManager.RunningServiceInfo>();
- int userId = UserId.getUserId(Binder.getCallingUid());
+ int userId = UserHandle.getUserId(Binder.getCallingUid());
if (mServiceMap.getAllServices(userId).size() > 0) {
Iterator<ServiceRecord> it
= mServiceMap.getAllServices(userId).iterator();
@@ -1746,7 +1746,7 @@ public class ActiveServices {
}
public PendingIntent getRunningServiceControlPanelLocked(ComponentName name) {
- int userId = UserId.getUserId(Binder.getCallingUid());
+ int userId = UserHandle.getUserId(Binder.getCallingUid());
ServiceRecord r = mServiceMap.getServiceByName(name, userId);
if (r != null) {
for (ArrayList<ConnectionRecord> conn : r.connections.values()) {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 0c378c9..0eb9983 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -111,7 +111,7 @@ import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.text.format.Time;
@@ -1084,7 +1084,7 @@ public final class ActivityManagerService extends ActivityManagerNative
boolean restart = (msg.arg2 == 1);
String pkg = (String) msg.obj;
forceStopPackageLocked(pkg, uid, restart, false, true, false,
- UserId.getUserId(uid));
+ UserHandle.getUserId(uid));
}
} break;
case FINALIZE_PENDING_INTENT_MSG: {
@@ -1829,7 +1829,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (procs == null) return null;
final int N = procs.size();
for (int i = 0; i < N; i++) {
- if (UserId.isSameUser(procs.keyAt(i), uid)) return procs.valueAt(i);
+ if (UserHandle.isSameUser(procs.keyAt(i), uid)) return procs.valueAt(i);
}
}
ProcessRecord proc = mProcessNames.get(processName, uid);
@@ -2195,7 +2195,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
void enforceNotIsolatedCaller(String caller) {
- if (UserId.isIsolated(Binder.getCallingUid())) {
+ if (UserHandle.isIsolated(Binder.getCallingUid())) {
throw new SecurityException("Isolated process not allowed to call " + caller);
}
}
@@ -2324,7 +2324,7 @@ public final class ActivityManagerService extends ActivityManagerNative
String resultWho, int requestCode, int startFlags,
String profileFile, ParcelFileDescriptor profileFd, Bundle options) {
return startActivityAsUser(caller, intent, resolvedType, resultTo, resultWho, requestCode,
- startFlags, profileFile, profileFd, options, UserId.getCallingUserId());
+ startFlags, profileFile, profileFd, options, UserHandle.getCallingUserId());
}
public final int startActivityAsUser(IApplicationThread caller,
@@ -2332,20 +2332,20 @@ public final class ActivityManagerService extends ActivityManagerNative
String resultWho, int requestCode, int startFlags,
String profileFile, ParcelFileDescriptor profileFd, Bundle options, int userId) {
enforceNotIsolatedCaller("startActivity");
- if (userId != UserId.getCallingUserId()) {
+ if (userId != UserHandle.getCallingUserId()) {
// Requesting a different user, make sure that they have the permission
if (checkComponentPermission(
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
Binder.getCallingPid(), Binder.getCallingUid(), -1, true)
== PackageManager.PERMISSION_GRANTED) {
// Translate to the current user id, if caller wasn't aware
- if (userId == UserId.USER_CURRENT) {
+ if (userId == UserHandle.USER_CURRENT) {
userId = mCurrentUserId;
}
} else {
String msg = "Permission Denial: "
+ "Request to startActivity as user " + userId
- + " but is calling from user " + UserId.getCallingUserId()
+ + " but is calling from user " + UserHandle.getCallingUserId()
+ "; this requires "
+ android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
Slog.w(TAG, msg);
@@ -2457,7 +2457,7 @@ public final class ActivityManagerService extends ActivityManagerNative
AppGlobals.getPackageManager().queryIntentActivities(
intent, r.resolvedType,
PackageManager.MATCH_DEFAULT_ONLY | STOCK_PM_FLAGS,
- UserId.getCallingUserId());
+ UserHandle.getCallingUserId());
// Look for the original activity in the list...
final int N = resolves != null ? resolves.size() : 0;
@@ -2562,7 +2562,7 @@ public final class ActivityManagerService extends ActivityManagerNative
"startActivityInPackage only available to the system");
}
int ret = mMainStack.startActivities(null, uid, intents, resolvedTypes, resultTo,
- options, UserId.getUserId(uid));
+ options, UserHandle.getUserId(uid));
return ret;
}
@@ -3428,7 +3428,7 @@ public final class ActivityManagerService extends ActivityManagerNative
throw new SecurityException(msg);
}
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
long callingId = Binder.clearCallingIdentity();
try {
IPackageManager pm = AppGlobals.getPackageManager();
@@ -3502,7 +3502,7 @@ public final class ActivityManagerService extends ActivityManagerNative
Slog.w(TAG, msg);
throw new SecurityException(msg);
}
- final int userId = UserId.getCallingUserId();
+ final int userId = UserHandle.getCallingUserId();
long callingId = Binder.clearCallingIdentity();
try {
IPackageManager pm = AppGlobals.getPackageManager();
@@ -3638,7 +3638,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
private void forceStopPackageLocked(final String packageName, int uid) {
- forceStopPackageLocked(packageName, uid, false, false, true, false, UserId.getUserId(uid));
+ forceStopPackageLocked(packageName, uid, false, false, true, false, UserHandle.getUserId(uid));
Intent intent = new Intent(Intent.ACTION_PACKAGE_RESTARTED,
Uri.fromParts("package", packageName, null));
if (!mProcessesReady) {
@@ -3648,7 +3648,7 @@ public final class ActivityManagerService extends ActivityManagerNative
broadcastIntentLocked(null, null, intent,
null, null, 0, null, null, null,
false, false,
- MY_PID, Process.SYSTEM_UID, UserId.getUserId(uid));
+ MY_PID, Process.SYSTEM_UID, UserHandle.getUserId(uid));
}
private final boolean killPackageProcessesLocked(String packageName, int uid,
@@ -4369,8 +4369,8 @@ public final class ActivityManagerService extends ActivityManagerNative
try {
if (callingUid != 0 && callingUid != Process.SYSTEM_UID) {
int uid = AppGlobals.getPackageManager()
- .getPackageUid(packageName, UserId.getUserId(callingUid));
- if (!UserId.isSameApp(callingUid, uid)) {
+ .getPackageUid(packageName, UserHandle.getUserId(callingUid));
+ if (!UserHandle.isSameApp(callingUid, uid)) {
String msg = "Permission Denial: getIntentSender() from pid="
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
@@ -4466,8 +4466,8 @@ public final class ActivityManagerService extends ActivityManagerNative
PendingIntentRecord rec = (PendingIntentRecord)sender;
try {
int uid = AppGlobals.getPackageManager()
- .getPackageUid(rec.key.packageName, UserId.getCallingUserId());
- if (!UserId.isSameApp(uid, Binder.getCallingUid())) {
+ .getPackageUid(rec.key.packageName, UserHandle.getCallingUserId());
+ if (!UserHandle.isSameApp(uid, Binder.getCallingUid())) {
String msg = "Permission Denial: cancelIntentSender() from pid="
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
@@ -4686,7 +4686,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (permission == null) {
return PackageManager.PERMISSION_DENIED;
}
- return checkComponentPermission(permission, pid, UserId.getAppId(uid), -1, true);
+ return checkComponentPermission(permission, pid, UserHandle.getAppId(uid), -1, true);
}
/**
@@ -4696,7 +4696,7 @@ public final class ActivityManagerService extends ActivityManagerNative
int checkCallingPermission(String permission) {
return checkPermission(permission,
Binder.getCallingPid(),
- UserId.getAppId(Binder.getCallingUid()));
+ UserHandle.getAppId(Binder.getCallingUid()));
}
/**
@@ -4827,7 +4827,7 @@ public final class ActivityManagerService extends ActivityManagerNative
pid = tlsIdentity.pid;
}
- uid = UserId.getAppId(uid);
+ uid = UserHandle.getAppId(uid);
// Our own process gets to do everything.
if (pid == MY_PID) {
return PackageManager.PERMISSION_GRANTED;
@@ -4873,13 +4873,13 @@ public final class ActivityManagerService extends ActivityManagerNative
String name = uri.getAuthority();
ProviderInfo pi = null;
ContentProviderRecord cpr = mProviderMap.getProviderByName(name,
- UserId.getUserId(callingUid));
+ UserHandle.getUserId(callingUid));
if (cpr != null) {
pi = cpr.info;
} else {
try {
pi = pm.resolveContentProvider(name,
- PackageManager.GET_URI_PERMISSION_PATTERNS, UserId.getUserId(callingUid));
+ PackageManager.GET_URI_PERMISSION_PATTERNS, UserHandle.getUserId(callingUid));
} catch (RemoteException ex) {
}
}
@@ -4891,7 +4891,7 @@ public final class ActivityManagerService extends ActivityManagerNative
int targetUid = lastTargetUid;
if (targetUid < 0 && targetPkg != null) {
try {
- targetUid = pm.getPackageUid(targetPkg, UserId.getUserId(callingUid));
+ targetUid = pm.getPackageUid(targetPkg, UserHandle.getUserId(callingUid));
if (targetUid < 0) {
if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Can't grant URI permission no uid for: " + targetPkg);
@@ -5183,7 +5183,7 @@ public final class ActivityManagerService extends ActivityManagerNative
final String authority = uri.getAuthority();
ProviderInfo pi = null;
- int userId = UserId.getUserId(callingUid);
+ int userId = UserHandle.getUserId(callingUid);
ContentProviderRecord cpr = mProviderMap.getProviderByName(authority, userId);
if (cpr != null) {
pi = cpr.info;
@@ -5521,7 +5521,7 @@ public final class ActivityManagerService extends ActivityManagerNative
public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
int flags, int userId) {
final int callingUid = Binder.getCallingUid();
- if (userId != UserId.getCallingUserId()) {
+ if (userId != UserHandle.getCallingUserId()) {
// Check if the caller is holding permissions for cross-user requests.
if (checkComponentPermission(
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
@@ -5529,13 +5529,13 @@ public final class ActivityManagerService extends ActivityManagerNative
!= PackageManager.PERMISSION_GRANTED) {
String msg = "Permission Denial: "
+ "Request to get recent tasks for user " + userId
- + " but is calling from user " + UserId.getUserId(callingUid)
+ + " but is calling from user " + UserHandle.getUserId(callingUid)
+ "; this requires "
+ android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
Slog.w(TAG, msg);
throw new SecurityException(msg);
} else {
- if (userId == UserId.USER_CURRENT) {
+ if (userId == UserHandle.USER_CURRENT) {
userId = mCurrentUserId;
}
}
@@ -6006,7 +6006,7 @@ public final class ActivityManagerService extends ActivityManagerNative
(ProviderInfo)providers.get(i);
boolean singleton = isSingleton(cpi.processName, cpi.applicationInfo,
cpi.name, cpi.flags);
- if (singleton && UserId.getUserId(app.uid) != 0) {
+ if (singleton && UserHandle.getUserId(app.uid) != 0) {
// This is a singleton provider, but a user besides the
// default user is asking to initialize a process it runs
// in... well, no, it doesn't actually run in this process,
@@ -6177,7 +6177,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
// First check if this content provider has been published...
- int userId = UserId.getUserId(r != null ? r.uid : Binder.getCallingUid());
+ int userId = UserHandle.getUserId(r != null ? r.uid : Binder.getCallingUid());
cpr = mProviderMap.getProviderByName(name, userId);
boolean providerRunning = cpr != null;
if (providerRunning) {
@@ -6725,7 +6725,7 @@ public final class ActivityManagerService extends ActivityManagerNative
BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics();
int uid = info.uid;
if (isolated) {
- int userId = UserId.getUserId(uid);
+ int userId = UserHandle.getUserId(uid);
int stepsLeft = Process.LAST_ISOLATED_UID - Process.FIRST_ISOLATED_UID + 1;
uid = 0;
while (true) {
@@ -6733,7 +6733,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|| mNextIsolatedProcessUid > Process.LAST_ISOLATED_UID) {
mNextIsolatedProcessUid = Process.FIRST_ISOLATED_UID;
}
- uid = UserId.getUid(userId, mNextIsolatedProcessUid);
+ uid = UserHandle.getUid(userId, mNextIsolatedProcessUid);
mNextIsolatedProcessUid++;
if (mIsolatedProcesses.indexOfKey(uid) < 0) {
// No process for this uid, use it.
@@ -6771,7 +6771,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// This package really, really can not be stopped.
try {
AppGlobals.getPackageManager().setPackageStoppedState(
- info.packageName, false, UserId.getUserId(app.uid));
+ info.packageName, false, UserHandle.getUserId(app.uid));
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
@@ -8509,7 +8509,7 @@ public final class ActivityManagerService extends ActivityManagerNative
IPackageManager pm = AppGlobals.getPackageManager();
for (String pkg : extList) {
try {
- ApplicationInfo info = pm.getApplicationInfo(pkg, 0, UserId.getCallingUserId());
+ ApplicationInfo info = pm.getApplicationInfo(pkg, 0, UserHandle.getCallingUserId());
if ((info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) {
retList.add(info);
}
@@ -10258,10 +10258,10 @@ public final class ActivityManagerService extends ActivityManagerNative
cpr.launchingApp = null;
cpr.notifyAll();
}
- mProviderMap.removeProviderByClass(cpr.name, UserId.getUserId(cpr.uid));
+ mProviderMap.removeProviderByClass(cpr.name, UserHandle.getUserId(cpr.uid));
String names[] = cpr.info.authority.split(";");
for (int j = 0; j < names.length; j++) {
- mProviderMap.removeProviderByName(names[j], UserId.getUserId(cpr.uid));
+ mProviderMap.removeProviderByName(names[j], UserHandle.getUserId(cpr.uid));
}
}
@@ -10599,7 +10599,7 @@ public final class ActivityManagerService extends ActivityManagerNative
boolean isSingleton(String componentProcessName, ApplicationInfo aInfo,
String className, int flags) {
boolean result = false;
- if (UserId.getAppId(aInfo.uid) >= Process.FIRST_APPLICATION_UID) {
+ if (UserHandle.getAppId(aInfo.uid) >= Process.FIRST_APPLICATION_UID) {
if ((flags&ServiceInfo.FLAG_SINGLE_USER) != 0) {
if (ActivityManager.checkUidPermission(
android.Manifest.permission.INTERACT_ACROSS_USERS,
@@ -10704,7 +10704,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// Backup agent is now in use, its package can't be stopped.
try {
AppGlobals.getPackageManager().setPackageStoppedState(
- app.packageName, false, UserId.getUserId(app.uid));
+ app.packageName, false, UserHandle.getUserId(app.uid));
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
@@ -11046,7 +11046,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// If the caller is trying to send this broadcast to a different
// user, verify that is allowed.
- if (UserId.getUserId(callingUid) != userId) {
+ if (UserHandle.getUserId(callingUid) != userId) {
if (checkComponentPermission(
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
callingPid, callingUid, -1, true)
@@ -11060,7 +11060,7 @@ public final class ActivityManagerService extends ActivityManagerNative
String msg = "Permission Denial: " + intent.getAction()
+ " broadcast from " + callerPackage
+ " asks to send as user " + userId
- + " but is calling from user " + UserId.getUserId(callingUid)
+ + " but is calling from user " + UserHandle.getUserId(callingUid)
+ "; this requires "
+ android.Manifest.permission.INTERACT_ACROSS_USERS;
Slog.w(TAG, msg);
@@ -11553,7 +11553,7 @@ public final class ActivityManagerService extends ActivityManagerNative
throw new SecurityException(msg);
}
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
final long origId = Binder.clearCallingIdentity();
// Instrumentation can kill and relaunch even persistent processes
forceStopPackageLocked(ii.targetPackage, -1, true, false, true, true, userId);
@@ -11616,7 +11616,7 @@ public final class ActivityManagerService extends ActivityManagerNative
public void finishInstrumentation(IApplicationThread target,
int resultCode, Bundle results) {
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
// Refuse possible leaked file descriptors
if (results != null && results.hasFileDescriptors()) {
throw new IllegalArgumentException("File descriptors passed in Intent");
@@ -11929,7 +11929,7 @@ public final class ActivityManagerService extends ActivityManagerNative
} else {
try {
ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo(
- destIntent.getComponent(), 0, UserId.getCallingUserId());
+ destIntent.getComponent(), 0, UserHandle.getCallingUserId());
int res = mMainStack.startActivityLocked(srec.app.thread, destIntent,
null, aInfo, parent.appToken, null,
0, -1, parent.launchedFromUid, 0, null, true, null);
@@ -13509,7 +13509,7 @@ public final class ActivityManagerService extends ActivityManagerNative
for (Entry<String, SparseArray<ProcessRecord>> uidMap : map.entrySet()) {
SparseArray<ProcessRecord> uids = uidMap.getValue();
for (int i = 0; i < uids.size(); i++) {
- if (UserId.getUserId(uids.keyAt(i)) == extraUserId) {
+ if (UserHandle.getUserId(uids.keyAt(i)) == extraUserId) {
pkgAndUids.add(new Pair<String,Integer>(uidMap.getKey(), uids.keyAt(i)));
}
}
@@ -13535,14 +13535,14 @@ public final class ActivityManagerService extends ActivityManagerNative
}
private void checkValidCaller(int uid, int userId) {
- if (UserId.getUserId(uid) == userId || uid == Process.SYSTEM_UID || uid == 0) return;
+ if (UserHandle.getUserId(uid) == userId || uid == Process.SYSTEM_UID || uid == 0) return;
throw new SecurityException("Caller uid=" + uid
+ " is not privileged to communicate with user=" + userId);
}
private int applyUserId(int uid, int userId) {
- return UserId.getUid(userId, uid);
+ return UserHandle.getUid(userId, uid);
}
ApplicationInfo getAppInfoForUser(ApplicationInfo info, int userId) {
@@ -13556,7 +13556,7 @@ public final class ActivityManagerService extends ActivityManagerNative
ActivityInfo getActivityInfoForUser(ActivityInfo aInfo, int userId) {
if (aInfo == null
- || (userId < 1 && aInfo.applicationInfo.uid < UserId.PER_USER_RANGE)) {
+ || (userId < 1 && aInfo.applicationInfo.uid < UserHandle.PER_USER_RANGE)) {
return aInfo;
}
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index c40abb7..b0d480c 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -37,7 +37,7 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
@@ -321,7 +321,7 @@ final class ActivityRecord {
appToken = new Token(this);
info = aInfo;
launchedFromUid = _launchedFromUid;
- userId = UserId.getUserId(aInfo.applicationInfo.uid);
+ userId = UserHandle.getUserId(aInfo.applicationInfo.uid);
intent = _intent;
shortComponentName = _intent.getComponent().flattenToShortString();
resolvedType = _resolvedType;
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 196a259..1e0827f 100755
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -55,7 +55,7 @@ import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
@@ -501,7 +501,7 @@ final class ActivityStack {
TaskRecord cp = null;
- final int userId = UserId.getUserId(info.applicationInfo.uid);
+ final int userId = UserHandle.getUserId(info.applicationInfo.uid);
final int N = mHistory.size();
for (int i=(N-1); i>=0; i--) {
ActivityRecord r = mHistory.get(i);
@@ -545,7 +545,7 @@ final class ActivityStack {
if (info.targetActivity != null) {
cls = new ComponentName(info.packageName, info.targetActivity);
}
- final int userId = UserId.getUserId(info.applicationInfo.uid);
+ final int userId = UserHandle.getUserId(info.applicationInfo.uid);
final int N = mHistory.size();
for (int i=(N-1); i>=0; i--) {
@@ -2406,7 +2406,7 @@ final class ActivityStack {
}
if (err == ActivityManager.START_SUCCESS) {
- final int userId = aInfo != null ? UserId.getUserId(aInfo.applicationInfo.uid) : 0;
+ final int userId = aInfo != null ? UserHandle.getUserId(aInfo.applicationInfo.uid) : 0;
Slog.i(TAG, "START {" + intent.toShortString(true, true, true, false)
+ " u=" + userId + "} from pid " + (callerApp != null ? callerApp.pid : callingPid));
}
diff --git a/services/java/com/android/server/am/BroadcastQueue.java b/services/java/com/android/server/am/BroadcastQueue.java
index 76ddb96..7873dd8 100644
--- a/services/java/com/android/server/am/BroadcastQueue.java
+++ b/services/java/com/android/server/am/BroadcastQueue.java
@@ -36,7 +36,7 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.EventLog;
import android.util.Slog;
@@ -373,7 +373,7 @@ public class BroadcastQueue {
BroadcastFilter filter, boolean ordered) {
boolean skip = false;
if (r.onlySendToCaller) {
- if (!UserId.isSameApp(r.callingUid, filter.owningUid)) {
+ if (!UserHandle.isSameApp(r.callingUid, filter.owningUid)) {
Slog.w(TAG, "Permission Denial: broadcasting "
+ r.intent.toString()
+ " from " + r.callerPackage + " (pid="
@@ -668,7 +668,7 @@ public class BroadcastQueue {
boolean skip = false;
if (r.onlySendToCaller) {
- if (!UserId.isSameApp(r.callingUid, info.activityInfo.applicationInfo.uid)) {
+ if (!UserHandle.isSameApp(r.callingUid, info.activityInfo.applicationInfo.uid)) {
Slog.w(TAG, "Permission Denial: broadcasting "
+ r.intent.toString()
+ " from " + r.callerPackage + " (pid="
@@ -766,7 +766,7 @@ public class BroadcastQueue {
info.activityInfo = mService.getActivityInfoForUser(info.activityInfo, 0);
}
r.curReceiver = info.activityInfo;
- if (DEBUG_MU && r.callingUid > UserId.PER_USER_RANGE) {
+ if (DEBUG_MU && r.callingUid > UserHandle.PER_USER_RANGE) {
Slog.v(TAG_MU, "Updated broadcast record activity info for secondary user, "
+ info.activityInfo + ", callingUid = " + r.callingUid + ", uid = "
+ info.activityInfo.applicationInfo.uid);
@@ -775,7 +775,7 @@ public class BroadcastQueue {
// Broadcast is being executed, its package can't be stopped.
try {
AppGlobals.getPackageManager().setPackageStoppedState(
- r.curComponent.getPackageName(), false, UserId.getUserId(r.callingUid));
+ r.curComponent.getPackageName(), false, UserHandle.getUserId(r.callingUid));
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java
index ad15da1..d3b8510 100644
--- a/services/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/java/com/android/server/am/PendingIntentRecord.java
@@ -25,7 +25,7 @@ import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Slog;
import java.io.PrintWriter;
@@ -259,7 +259,7 @@ class PendingIntentRecord extends IIntentSender.Stub {
owner.broadcastIntentInPackage(key.packageName, uid,
finalIntent, resolvedType,
finishedReceiver, code, null, null,
- requiredPermission, (finishedReceiver != null), false, UserId
+ requiredPermission, (finishedReceiver != null), false, UserHandle
.getUserId(uid));
sendFinish = false;
} catch (RuntimeException e) {
diff --git a/services/java/com/android/server/am/ProcessRecord.java b/services/java/com/android/server/am/ProcessRecord.java
index 42b7708..d372422 100644
--- a/services/java/com/android/server/am/ProcessRecord.java
+++ b/services/java/com/android/server/am/ProcessRecord.java
@@ -30,7 +30,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.PrintWriterPrinter;
import android.util.TimeUtils;
@@ -313,7 +313,7 @@ class ProcessRecord {
info = _info;
isolated = _info.uid != _uid;
uid = _uid;
- userId = UserId.getUserId(_uid);
+ userId = UserHandle.getUserId(_uid);
processName = _processName;
pkgList.add(_info.packageName);
thread = _thread;
@@ -396,7 +396,7 @@ class ProcessRecord {
sb.append(info.uid%Process.FIRST_APPLICATION_UID);
if (uid != info.uid) {
sb.append('i');
- sb.append(UserId.getAppId(uid) - Process.FIRST_ISOLATED_UID);
+ sb.append(UserHandle.getAppId(uid) - Process.FIRST_ISOLATED_UID);
}
}
}
diff --git a/services/java/com/android/server/am/ProviderMap.java b/services/java/com/android/server/am/ProviderMap.java
index 405718f..ab2e428 100644
--- a/services/java/com/android/server/am/ProviderMap.java
+++ b/services/java/com/android/server/am/ProviderMap.java
@@ -20,7 +20,7 @@ import android.content.ComponentName;
import android.os.Binder;
import android.os.Process;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Slog;
import android.util.SparseArray;
@@ -98,7 +98,7 @@ public class ProviderMap {
if (record.singleton) {
mSingletonByName.put(name, record);
} else {
- final int userId = UserId.getUserId(record.appInfo.uid);
+ final int userId = UserHandle.getUserId(record.appInfo.uid);
getProvidersByName(userId).put(name, record);
}
}
@@ -111,7 +111,7 @@ public class ProviderMap {
if (record.singleton) {
mSingletonByClass.put(name, record);
} else {
- final int userId = UserId.getUserId(record.appInfo.uid);
+ final int userId = UserHandle.getUserId(record.appInfo.uid);
getProvidersByClass(userId).put(name, record);
}
}
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index 828eef7..41386e4 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -31,7 +31,7 @@ import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Slog;
import android.util.TimeUtils;
@@ -296,7 +296,7 @@ class ServiceRecord extends Binder {
this.restarter = restarter;
createTime = SystemClock.elapsedRealtime();
lastActivity = SystemClock.uptimeMillis();
- userId = UserId.getUserId(appInfo.uid);
+ userId = UserHandle.getUserId(appInfo.uid);
}
public AppBindRecord retrieveAppBindingLocked(Intent intent,
diff --git a/services/java/com/android/server/am/TaskRecord.java b/services/java/com/android/server/am/TaskRecord.java
index 3a767c2..1bae9ca 100644
--- a/services/java/com/android/server/am/TaskRecord.java
+++ b/services/java/com/android/server/am/TaskRecord.java
@@ -19,7 +19,7 @@ package com.android.server.am;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Slog;
import java.io.PrintWriter;
@@ -101,7 +101,7 @@ class TaskRecord extends ThumbnailHolder {
}
if (info.applicationInfo != null) {
- userId = UserId.getUserId(info.applicationInfo.uid);
+ userId = UserHandle.getUserId(info.applicationInfo.uid);
}
}
diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java
index 46c24b0..a7cba5a 100644
--- a/services/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -112,7 +112,7 @@ import android.os.Message;
import android.os.MessageQueue.IdleHandler;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.telephony.TelephonyManager;
@@ -426,7 +426,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
final String action = intent.getAction();
final int uid = intent.getIntExtra(EXTRA_UID, 0);
- final int appId = UserId.getAppId(uid);
+ final int appId = UserHandle.getAppId(uid);
synchronized (mRulesLock) {
if (ACTION_PACKAGE_ADDED.equals(action)) {
// NOTE: PACKAGE_ADDED is currently only sent once, and is
@@ -1188,8 +1188,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
final int uid = readIntAttribute(in, ATTR_UID);
final int policy = readIntAttribute(in, ATTR_POLICY);
- final int appId = UserId.getAppId(uid);
- if (UserId.isApp(appId)) {
+ final int appId = UserHandle.getAppId(uid);
+ if (UserHandle.isApp(appId)) {
setAppPolicyUnchecked(appId, policy, false);
} else {
Slog.w(TAG, "unable to apply policy to UID " + uid + "; ignoring");
@@ -1198,7 +1198,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
final int appId = readIntAttribute(in, ATTR_APP_ID);
final int policy = readIntAttribute(in, ATTR_POLICY);
- if (UserId.isApp(appId)) {
+ if (UserHandle.isApp(appId)) {
setAppPolicyUnchecked(appId, policy, false);
} else {
Slog.w(TAG, "unable to apply policy to appId " + appId + "; ignoring");
@@ -1304,7 +1304,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
public void setAppPolicy(int appId, int policy) {
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
- if (!UserId.isApp(appId)) {
+ if (!UserHandle.isApp(appId)) {
throw new IllegalArgumentException("cannot apply policy to appId " + appId);
}
@@ -1698,7 +1698,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
final PackageManager pm = mContext.getPackageManager();
final List<ApplicationInfo> apps = pm.getInstalledApplications(0);
for (ApplicationInfo app : apps) {
- final int appId = UserId.getAppId(app.uid);
+ final int appId = UserHandle.getAppId(app.uid);
updateRulesForAppLocked(appId);
}
@@ -1710,7 +1710,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
private void updateRulesForAppLocked(int appId) {
UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
for (UserInfo user : um.getUsers()) {
- final int uid = UserId.getUid(user.id, appId);
+ final int uid = UserHandle.getUid(user.id, appId);
updateRulesForUidLocked(uid);
}
}
@@ -1718,7 +1718,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
private static boolean isUidValidForRules(int uid) {
// allow rules on specific system services, and any apps
if (uid == android.os.Process.MEDIA_UID || uid == android.os.Process.DRM_UID
- || UserId.isApp(uid)) {
+ || UserHandle.isApp(uid)) {
return true;
}
@@ -1728,7 +1728,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
private void updateRulesForUidLocked(int uid) {
if (!isUidValidForRules(uid)) return;
- final int appId = UserId.getAppId(uid);
+ final int appId = UserHandle.getAppId(uid);
final int appPolicy = getAppPolicy(appId);
final boolean uidForeground = isUidForeground(uid);
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 4befb9e..9e94333 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -100,7 +100,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.os.UserId;
+import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings.Secure;
import android.security.SystemKeyStore;
@@ -691,15 +691,15 @@ public class PackageManagerService extends IPackageManager.Stub {
}
sendPackageBroadcast(Intent.ACTION_PACKAGE_ADDED,
res.pkg.applicationInfo.packageName,
- extras, null, null, UserId.USER_ALL);
+ extras, null, null, UserHandle.USER_ALL);
if (update) {
sendPackageBroadcast(Intent.ACTION_PACKAGE_REPLACED,
res.pkg.applicationInfo.packageName,
- extras, null, null, UserId.USER_ALL);
+ extras, null, null, UserHandle.USER_ALL);
sendPackageBroadcast(Intent.ACTION_MY_PACKAGE_REPLACED,
null, null,
res.pkg.applicationInfo.packageName, null,
- UserId.USER_ALL);
+ UserHandle.USER_ALL);
}
if (res.removedInfo.args != null) {
// Remove the replaced package's older resources safely now
@@ -1630,14 +1630,14 @@ public class PackageManagerService extends IPackageManager.Stub {
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
if(p != null) {
- return UserId.getUid(userId, p.applicationInfo.uid);
+ return UserHandle.getUid(userId, p.applicationInfo.uid);
}
PackageSetting ps = mSettings.mPackages.get(packageName);
if((ps == null) || (ps.pkg == null) || (ps.pkg.applicationInfo == null)) {
return -1;
}
p = ps.pkg;
- return p != null ? UserId.getUid(userId, p.applicationInfo.uid) : -1;
+ return p != null ? UserHandle.getUid(userId, p.applicationInfo.uid) : -1;
}
}
@@ -1961,7 +1961,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
private void checkValidCaller(int uid, int userId) {
- if (UserId.getUserId(uid) == userId || uid == Process.SYSTEM_UID || uid == 0)
+ if (UserHandle.getUserId(uid) == userId || uid == Process.SYSTEM_UID || uid == 0)
return;
throw new SecurityException("Caller uid=" + uid
@@ -1990,7 +1990,7 @@ public class PackageManagerService extends IPackageManager.Stub {
public int checkUidPermission(String permName, int uid) {
synchronized (mPackages) {
- Object obj = mSettings.getUserIdLPr(UserId.getAppId(uid));
+ Object obj = mSettings.getUserIdLPr(UserHandle.getAppId(uid));
if (obj != null) {
GrantedPermissions gp = (GrantedPermissions)obj;
if (gp.grantedPermissions.contains(permName)) {
@@ -2024,7 +2024,7 @@ public class PackageManagerService extends IPackageManager.Stub {
if (permName != null) {
BasePermission bp = findPermissionTreeLP(permName);
if (bp != null) {
- if (bp.uid == UserId.getAppId(Binder.getCallingUid())) {
+ if (bp.uid == UserHandle.getAppId(Binder.getCallingUid())) {
return bp;
}
throw new SecurityException("Calling uid "
@@ -2227,8 +2227,8 @@ public class PackageManagerService extends IPackageManager.Stub {
public int checkUidSignatures(int uid1, int uid2) {
// Map to base uids.
- uid1 = UserId.getAppId(uid1);
- uid2 = UserId.getAppId(uid2);
+ uid1 = UserHandle.getAppId(uid1);
+ uid2 = UserHandle.getAppId(uid2);
// reader
synchronized (mPackages) {
Signature[] s1;
@@ -2286,7 +2286,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
public String[] getPackagesForUid(int uid) {
- uid = UserId.getAppId(uid);
+ uid = UserHandle.getAppId(uid);
// reader
synchronized (mPackages) {
Object obj = mSettings.getUserIdLPr(uid);
@@ -2311,7 +2311,7 @@ public class PackageManagerService extends IPackageManager.Stub {
public String getNameForUid(int uid) {
// reader
synchronized (mPackages) {
- Object obj = mSettings.getUserIdLPr(UserId.getAppId(uid));
+ Object obj = mSettings.getUserIdLPr(UserHandle.getAppId(uid));
if (obj instanceof SharedUserSetting) {
final SharedUserSetting sus = (SharedUserSetting) obj;
return sus.name + ":" + sus.userId;
@@ -2791,7 +2791,7 @@ public class PackageManagerService extends IPackageManager.Stub {
final ParceledListSlice<PackageInfo> list = new ParceledListSlice<PackageInfo>();
final boolean listUninstalled = (flags & PackageManager.GET_UNINSTALLED_PACKAGES) != 0;
final String[] keys;
- int userId = UserId.getCallingUserId();
+ int userId = UserHandle.getCallingUserId();
// writer
synchronized (mPackages) {
@@ -2890,7 +2890,7 @@ public class PackageManagerService extends IPackageManager.Stub {
// reader
synchronized (mPackages) {
final Iterator<PackageParser.Package> i = mPackages.values().iterator();
- final int userId = UserId.getCallingUserId();
+ final int userId = UserHandle.getCallingUserId();
while (i.hasNext()) {
final PackageParser.Package p = i.next();
if (p.applicationInfo != null
@@ -2938,7 +2938,7 @@ public class PackageManagerService extends IPackageManager.Stub {
synchronized (mPackages) {
final Iterator<Map.Entry<String, PackageParser.Provider>> i = mProviders.entrySet()
.iterator();
- final int userId = UserId.getCallingUserId();
+ final int userId = UserHandle.getCallingUserId();
while (i.hasNext()) {
Map.Entry<String, PackageParser.Provider> entry = i.next();
PackageParser.Provider p = entry.getValue();
@@ -2965,14 +2965,14 @@ public class PackageManagerService extends IPackageManager.Stub {
synchronized (mPackages) {
final Iterator<PackageParser.Provider> i = mProvidersByComponent.values().iterator();
final int userId = processName != null ?
- UserId.getUserId(uid) : UserId.getCallingUserId();
+ UserHandle.getUserId(uid) : UserHandle.getCallingUserId();
while (i.hasNext()) {
final PackageParser.Provider p = i.next();
PackageSetting ps = mSettings.mPackages.get(p.owner.packageName);
if (p.info.authority != null
&& (processName == null
|| (p.info.processName.equals(processName)
- && UserId.isSameApp(p.info.applicationInfo.uid, uid)))
+ && UserHandle.isSameApp(p.info.applicationInfo.uid, uid)))
&& mSettings.isEnabledLPr(p.info, flags, userId)
&& (!mSafeMode
|| (p.info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0)) {
@@ -5148,7 +5148,7 @@ public class PackageManagerService extends IPackageManager.Stub {
IActivityManager am = ActivityManagerNative.getDefault();
if (am != null) {
try {
- int[] userIds = userId == UserId.USER_ALL
+ int[] userIds = userId == UserHandle.USER_ALL
? sUserManager.getUserIds()
: new int[] {userId};
for (int id : userIds) {
@@ -5163,7 +5163,7 @@ public class PackageManagerService extends IPackageManager.Stub {
// Modify the UID when posting to other users
int uid = intent.getIntExtra(Intent.EXTRA_UID, -1);
if (uid > 0 && id > 0) {
- uid = UserId.getUid(id, UserId.getAppId(uid));
+ uid = UserHandle.getUid(id, UserHandle.getAppId(uid));
intent.putExtra(Intent.EXTRA_UID, uid);
}
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
@@ -5312,13 +5312,13 @@ public class PackageManagerService extends IPackageManager.Stub {
extras.putInt(Intent.EXTRA_UID, removedUid);
extras.putBoolean(Intent.EXTRA_DATA_REMOVED, false);
sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED, removedPackage,
- extras, null, null, UserId.USER_ALL);
+ extras, null, null, UserHandle.USER_ALL);
}
if (addedPackage != null) {
Bundle extras = new Bundle(1);
extras.putInt(Intent.EXTRA_UID, addedUid);
sendPackageBroadcast(Intent.ACTION_PACKAGE_ADDED, addedPackage,
- extras, null, null, UserId.USER_ALL);
+ extras, null, null, UserHandle.USER_ALL);
}
}
@@ -7539,11 +7539,11 @@ public class PackageManagerService extends IPackageManager.Stub {
extras.putBoolean(Intent.EXTRA_REPLACING, true);
sendPackageBroadcast(Intent.ACTION_PACKAGE_ADDED, packageName,
- extras, null, null, UserId.USER_ALL);
+ extras, null, null, UserHandle.USER_ALL);
sendPackageBroadcast(Intent.ACTION_PACKAGE_REPLACED, packageName,
- extras, null, null, UserId.USER_ALL);
+ extras, null, null, UserHandle.USER_ALL);
sendPackageBroadcast(Intent.ACTION_MY_PACKAGE_REPLACED, null,
- null, packageName, null, UserId.USER_ALL);
+ null, packageName, null, UserHandle.USER_ALL);
}
}
// Force a gc here.
@@ -7576,15 +7576,15 @@ public class PackageManagerService extends IPackageManager.Stub {
}
if (removedPackage != null) {
sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED, removedPackage,
- extras, null, null, UserId.USER_ALL);
+ extras, null, null, UserHandle.USER_ALL);
if (fullRemove && !replacing) {
sendPackageBroadcast(Intent.ACTION_PACKAGE_FULLY_REMOVED, removedPackage,
- extras, null, null, UserId.USER_ALL);
+ extras, null, null, UserHandle.USER_ALL);
}
}
if (removedUid >= 0) {
sendPackageBroadcast(Intent.ACTION_UID_REMOVED, null, extras, null, null,
- UserId.getUserId(removedUid));
+ UserHandle.getUserId(removedUid));
}
}
}
@@ -7948,7 +7948,7 @@ public class PackageManagerService extends IPackageManager.Stub {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DELETE_CACHE_FILES, null);
// Queue up an async operation since the package deletion may take a little while.
- final int userId = UserId.getCallingUserId();
+ final int userId = UserHandle.getCallingUserId();
mHandler.post(new Runnable() {
public void run() {
mHandler.removeCallbacks(this);
@@ -8303,7 +8303,7 @@ public class PackageManagerService extends IPackageManager.Stub {
+ "/" + className);
}
// Allow root and verify that userId is not being specified by a different user
- if (!allowedByPermission && !UserId.isSameApp(uid, pkgSetting.appId)) {
+ if (!allowedByPermission && !UserHandle.isSameApp(uid, pkgSetting.appId)) {
throw new SecurityException(
"Permission Denial: attempt to change component state from pid="
+ Binder.getCallingPid()
@@ -8352,7 +8352,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
mSettings.writePackageRestrictionsLPr(userId);
- packageUid = UserId.getUid(userId, pkgSetting.appId);
+ packageUid = UserHandle.getUid(userId, pkgSetting.appId);
components = mPendingBroadcasts.get(packageName);
final boolean newPackage = components == null;
if (newPackage) {
@@ -8401,7 +8401,7 @@ public class PackageManagerService extends IPackageManager.Stub {
extras.putBoolean(Intent.EXTRA_DONT_KILL_APP, killFlag);
extras.putInt(Intent.EXTRA_UID, packageUid);
sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED, packageName, extras, null, null,
- UserId.getUserId(packageUid));
+ UserHandle.getUserId(packageUid));
}
public void setPackageStoppedState(String packageName, boolean stopped, int userId) {
@@ -9027,7 +9027,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
String action = mediaStatus ? Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
: Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE;
- sendPackageBroadcast(action, null, extras, null, finishedReceiver, UserId.USER_ALL);
+ sendPackageBroadcast(action, null, extras, null, finishedReceiver, UserHandle.USER_ALL);
}
}
diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java
index add91d3..cfc0f5c 100644
--- a/services/java/com/android/server/pm/Settings.java
+++ b/services/java/com/android/server/pm/Settings.java
@@ -49,7 +49,7 @@ import android.os.Environment;
import android.os.FileUtils;
import android.os.Process;
import android.os.RemoteException;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
@@ -2353,7 +2353,7 @@ final class Settings {
boolean setPackageStoppedStateLPw(String packageName, boolean stopped,
boolean allowedByPermission, int uid, int userId) {
- int appId = UserId.getAppId(uid);
+ int appId = UserHandle.getAppId(uid);
final PackageSetting pkgSetting = mPackages.get(packageName);
if (pkgSetting == null) {
throw new IllegalArgumentException("Unknown package: " + packageName);
diff --git a/services/java/com/android/server/pm/UserManagerService.java b/services/java/com/android/server/pm/UserManagerService.java
index b55dd24..725d67d 100644
--- a/services/java/com/android/server/pm/UserManagerService.java
+++ b/services/java/com/android/server/pm/UserManagerService.java
@@ -34,7 +34,7 @@ import android.os.IUserManager;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.SystemClock;
-import android.os.UserId;
+import android.os.UserHandle;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
@@ -539,7 +539,7 @@ public class UserManagerService extends IUserManager.Stub {
// Don't do it for the primary user, it will become recursive.
if (userId == 0)
continue;
- mInstaller.createUserData(packageName, UserId.getUid(userId, uid),
+ mInstaller.createUserData(packageName, UserHandle.getUid(userId, uid),
userId);
}
}
diff --git a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
index f6f9aa0..3373fd4 100644
--- a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
@@ -71,7 +71,7 @@ import android.os.Binder;
import android.os.INetworkManagementService;
import android.os.IPowerManager;
import android.os.MessageQueue.IdleHandler;
-import android.os.UserId;
+import android.os.UserHandle;
import android.test.AndroidTestCase;
import android.test.mock.MockPackageManager;
import android.test.suitebuilder.annotation.LargeTest;
@@ -138,10 +138,10 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase {
private static final int APP_ID_A = android.os.Process.FIRST_APPLICATION_UID + 800;
private static final int APP_ID_B = android.os.Process.FIRST_APPLICATION_UID + 801;
- private static final int UID_A = UserId.getUid(USER_ID, APP_ID_A);
- private static final int UID_B = UserId.getUid(USER_ID, APP_ID_B);
- private static final int UID_A_GUEST = UserId.getUid(USER_ID_GUEST, APP_ID_A);
- private static final int UID_B_GUEST = UserId.getUid(USER_ID_GUEST, APP_ID_B);
+ private static final int UID_A = UserHandle.getUid(USER_ID, APP_ID_A);
+ private static final int UID_B = UserHandle.getUid(USER_ID, APP_ID_B);
+ private static final int UID_A_GUEST = UserHandle.getUid(USER_ID_GUEST, APP_ID_A);
+ private static final int UID_B_GUEST = UserHandle.getUid(USER_ID_GUEST, APP_ID_B);
private static final int PID_1 = 400;
private static final int PID_2 = 401;