am 390392ff: Merge "Changes to support side-loading of apps from other users." into jb-mr1-dev
* commit '390392ff3ef0114544eab3db4093c1c7aba825da': Changes to support side-loading of apps from other users.
This commit is contained in:
@@ -1254,7 +1254,9 @@ public class Intent implements Parcelable, Cloneable {
|
|||||||
* Activity Action: Launch application installer.
|
* Activity Action: Launch application installer.
|
||||||
* <p>
|
* <p>
|
||||||
* Input: The data must be a content: or file: URI at which the application
|
* 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_INSTALLER_PACKAGE_NAME}, {@link #EXTRA_NOT_UNKNOWN_SOURCE},
|
||||||
* {@link #EXTRA_ALLOW_REPLACE}, and {@link #EXTRA_RETURN_RESULT}.
|
* {@link #EXTRA_ALLOW_REPLACE}, and {@link #EXTRA_RETURN_RESULT}.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import android.content.pm.ApplicationInfo;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
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.PermissionGroupInfo;
|
||||||
import android.content.pm.PermissionInfo;
|
import android.content.pm.PermissionInfo;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@@ -272,7 +270,7 @@ public class AppSecurityPermissions {
|
|||||||
setPermissions(mPermsList);
|
setPermissions(mPermsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppSecurityPermissions(Context context, PackageParser.Package pkg) {
|
public AppSecurityPermissions(Context context, PackageInfo info) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mPm = mContext.getPackageManager();
|
mPm = mContext.getPackageManager();
|
||||||
loadResources();
|
loadResources();
|
||||||
@@ -280,14 +278,11 @@ public class AppSecurityPermissions {
|
|||||||
mPermGroupComparator = new PermissionGroupInfoComparator();
|
mPermGroupComparator = new PermissionGroupInfoComparator();
|
||||||
mPermsList = new ArrayList<MyPermissionInfo>();
|
mPermsList = new ArrayList<MyPermissionInfo>();
|
||||||
Set<MyPermissionInfo> permSet = new HashSet<MyPermissionInfo>();
|
Set<MyPermissionInfo> permSet = new HashSet<MyPermissionInfo>();
|
||||||
if(pkg == null) {
|
if(info == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to a PackageInfo
|
// Convert to a PackageInfo
|
||||||
PackageInfo info = PackageParser.generatePackageInfo(pkg, null,
|
|
||||||
PackageManager.GET_PERMISSIONS, 0, 0, null,
|
|
||||||
new PackageUserState());
|
|
||||||
PackageInfo installedPkgInfo = null;
|
PackageInfo installedPkgInfo = null;
|
||||||
// Get requested permissions
|
// Get requested permissions
|
||||||
if (info.requestedPermissions != null) {
|
if (info.requestedPermissions != null) {
|
||||||
@@ -299,13 +294,13 @@ public class AppSecurityPermissions {
|
|||||||
extractPerms(info, permSet, installedPkgInfo);
|
extractPerms(info, permSet, installedPkgInfo);
|
||||||
}
|
}
|
||||||
// Get permissions related to shared user if any
|
// Get permissions related to shared user if any
|
||||||
if (pkg.mSharedUserId != null) {
|
if (info.sharedUserId != null) {
|
||||||
int sharedUid;
|
int sharedUid;
|
||||||
try {
|
try {
|
||||||
sharedUid = mPm.getUidForSharedUser(pkg.mSharedUserId);
|
sharedUid = mPm.getUidForSharedUser(info.sharedUserId);
|
||||||
getAllUsedPermissions(sharedUid, permSet);
|
getAllUsedPermissions(sharedUid, permSet);
|
||||||
} catch (NameNotFoundException e) {
|
} 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
|
// Retrieve list of permissions
|
||||||
|
|||||||
Reference in New Issue
Block a user