From c6d1c345f41cf817bf2c07c97b97107d94296064 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Thu, 26 Feb 2015 14:44:43 -0800 Subject: Runtime permissions: per user permission tracking. Before all permissions were granted at install time at once, so the user was persented with an all or nothing choice. In the new runtime permissions model all dangarous permissions (nomal are always granted and signature one are granted if signatures match) are not granted at install time and the app can request them as necessary at runtime. Before, all granted permission to an app were identical for all users as granting is performed at install time. However, the new runtime model allows the same app running under two different users to have different runtime permission grants. This change refactors the permissions book keeping in the package manager to enable per user permission tracking. The change also adds the app facing APIs for requesting runtime permissions. Change-Id: Icbf2fc2ced15c42ca206c335996206bd1a4a4be5 --- core/java/android/app/ActivityManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/java/android/app/ActivityManager.java') diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 29b024ac..d143f8b 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -2493,7 +2493,8 @@ public class ActivityManager { public static int checkComponentPermission(String permission, int uid, int owningUid, boolean exported) { // Root, system server get to do everything. - if (uid == 0 || uid == Process.SYSTEM_UID) { + final int appId = UserHandle.getAppId(uid); + if (appId == Process.ROOT_UID || appId == Process.SYSTEM_UID) { return PackageManager.PERMISSION_GRANTED; } // Isolated processes don't get any permissions. -- cgit v1.1