Merge "Changes to support side-loading of apps from other users." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
390392ff3e
@@ -1254,7 +1254,9 @@ public class Intent implements Parcelable, Cloneable {
|
||||
* Activity Action: Launch application installer.
|
||||
* <p>
|
||||
* Input: The data must be a content: or file: URI at which the application
|
||||
* can be retrieved. You can optionally supply
|
||||
* can be retrieved. As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1},
|
||||
* you can also use "package:<package-name>" to install an application for the
|
||||
* current user that is already installed for another user. You can optionally supply
|
||||
* {@link #EXTRA_INSTALLER_PACKAGE_NAME}, {@link #EXTRA_NOT_UNKNOWN_SOURCE},
|
||||
* {@link #EXTRA_ALLOW_REPLACE}, and {@link #EXTRA_RETURN_RESULT}.
|
||||
* <p>
|
||||
|
||||
@@ -24,8 +24,6 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.PackageParser;
|
||||
import android.content.pm.PackageUserState;
|
||||
import android.content.pm.PermissionGroupInfo;
|
||||
import android.content.pm.PermissionInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -272,7 +270,7 @@ public class AppSecurityPermissions {
|
||||
setPermissions(mPermsList);
|
||||
}
|
||||
|
||||
public AppSecurityPermissions(Context context, PackageParser.Package pkg) {
|
||||
public AppSecurityPermissions(Context context, PackageInfo info) {
|
||||
mContext = context;
|
||||
mPm = mContext.getPackageManager();
|
||||
loadResources();
|
||||
@@ -280,14 +278,11 @@ public class AppSecurityPermissions {
|
||||
mPermGroupComparator = new PermissionGroupInfoComparator();
|
||||
mPermsList = new ArrayList<MyPermissionInfo>();
|
||||
Set<MyPermissionInfo> permSet = new HashSet<MyPermissionInfo>();
|
||||
if(pkg == null) {
|
||||
if(info == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert to a PackageInfo
|
||||
PackageInfo info = PackageParser.generatePackageInfo(pkg, null,
|
||||
PackageManager.GET_PERMISSIONS, 0, 0, null,
|
||||
new PackageUserState());
|
||||
PackageInfo installedPkgInfo = null;
|
||||
// Get requested permissions
|
||||
if (info.requestedPermissions != null) {
|
||||
@@ -299,13 +294,13 @@ public class AppSecurityPermissions {
|
||||
extractPerms(info, permSet, installedPkgInfo);
|
||||
}
|
||||
// Get permissions related to shared user if any
|
||||
if (pkg.mSharedUserId != null) {
|
||||
if (info.sharedUserId != null) {
|
||||
int sharedUid;
|
||||
try {
|
||||
sharedUid = mPm.getUidForSharedUser(pkg.mSharedUserId);
|
||||
sharedUid = mPm.getUidForSharedUser(info.sharedUserId);
|
||||
getAllUsedPermissions(sharedUid, permSet);
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.w(TAG, "Could'nt retrieve shared user id for:"+pkg.packageName);
|
||||
Log.w(TAG, "Could'nt retrieve shared user id for:"+info.packageName);
|
||||
}
|
||||
}
|
||||
// Retrieve list of permissions
|
||||
|
||||
Reference in New Issue
Block a user