diff options
| author | 2009-06-01 10:21:05 -0700 | |
|---|---|---|
| committer | 2009-06-01 10:21:05 -0700 | |
| commit | fa30c0eed3386af37be0f0df7aeaa886a8e6095d (patch) | |
| tree | cea3e80a8b015d24340ac262b39735c65efa9641 | |
| parent | 162c9d0e90eaa71adc8c7d1456d1a9a95e638c47 (diff) | |
| parent | c7b14e92075b8a0250ccc8bb4aa21e61d620a708 (diff) | |
Merge change 2548 into donut
* changes:
Fix a bug in AppSecurityPermissions where it wouldn't display permissions used by an app if it uses a shared user id. Remove the else clause and always get the list of requested permissions first before adding the permissions obtained via the shared user id. Also change an if condition and comments for better readability
| -rwxr-xr-x | core/java/android/widget/AppSecurityPermissions.java | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/core/java/android/widget/AppSecurityPermissions.java b/core/java/android/widget/AppSecurityPermissions.java index 5fa00e7d443a..c4b5ef891558 100755 --- a/core/java/android/widget/AppSecurityPermissions.java +++ b/core/java/android/widget/AppSecurityPermissions.java @@ -124,25 +124,25 @@ public class AppSecurityPermissions implements View.OnClickListener { if(pkg == null) { return; } - // Extract shared user permissions if any + // Get requested permissions + if (pkg.requestedPermissions != null) { + ArrayList<String> strList = pkg.requestedPermissions; + int size = strList.size(); + if (size > 0) { + extractPerms(strList.toArray(new String[size]), permSet); + } + } + // Get permissions related to shared user if any if(pkg.mSharedUserId != null) { int sharedUid; try { sharedUid = mPm.getUidForSharedUser(pkg.mSharedUserId); + getAllUsedPermissions(sharedUid, permSet); } catch (NameNotFoundException e) { Log.w(TAG, "Could'nt retrieve shared user id for:"+pkg.packageName); - return; } - getAllUsedPermissions(sharedUid, permSet); - } else { - ArrayList<String> strList = pkg.requestedPermissions; - int size; - if((strList == null) || ((size = strList.size()) == 0)) { - return; - } - // Extract permissions defined in current package - extractPerms(strList.toArray(new String[size]), permSet); } + // Retrieve list of permissions for(PermissionInfo tmpInfo : permSet) { mPermsList.add(tmpInfo); } @@ -176,14 +176,9 @@ public class AppSecurityPermissions implements View.OnClickListener { Log.w(TAG, "Could'nt retrieve permissions for package:"+packageName); return; } - if(pkgInfo == null) { - return; - } - String strList[] = pkgInfo.requestedPermissions; - if(strList == null) { - return; + if ((pkgInfo != null) && (pkgInfo.requestedPermissions != null)) { + extractPerms(pkgInfo.requestedPermissions, permSet); } - extractPerms(strList, permSet); } private void extractPerms(String strList[], Set<PermissionInfo> permSet) { |