Skip to content

Commit 390392f

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Changes to support side-loading of apps from other users." into jb-mr1-dev
2 parents f8d618c + eba784f commit 390392f

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

core/java/android/content/Intent.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,9 @@ public static Intent createChooser(Intent target, CharSequence title) {
12541254
* Activity Action: Launch application installer.
12551255
* <p>
12561256
* Input: The data must be a content: or file: URI at which the application
1257-
* can be retrieved. You can optionally supply
1257+
* can be retrieved. As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1},
1258+
* you can also use "package:<package-name>" to install an application for the
1259+
* current user that is already installed for another user. You can optionally supply
12581260
* {@link #EXTRA_INSTALLER_PACKAGE_NAME}, {@link #EXTRA_NOT_UNKNOWN_SOURCE},
12591261
* {@link #EXTRA_ALLOW_REPLACE}, and {@link #EXTRA_RETURN_RESULT}.
12601262
* <p>

core/java/android/widget/AppSecurityPermissions.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import android.content.pm.PackageInfo;
2525
import android.content.pm.PackageManager;
2626
import android.content.pm.PackageManager.NameNotFoundException;
27-
import android.content.pm.PackageParser;
28-
import android.content.pm.PackageUserState;
2927
import android.content.pm.PermissionGroupInfo;
3028
import android.content.pm.PermissionInfo;
3129
import android.graphics.drawable.Drawable;
@@ -272,22 +270,19 @@ public AppSecurityPermissions(Context context, String packageName) {
272270
setPermissions(mPermsList);
273271
}
274272

275-
public AppSecurityPermissions(Context context, PackageParser.Package pkg) {
273+
public AppSecurityPermissions(Context context, PackageInfo info) {
276274
mContext = context;
277275
mPm = mContext.getPackageManager();
278276
loadResources();
279277
mPermComparator = new PermissionInfoComparator();
280278
mPermGroupComparator = new PermissionGroupInfoComparator();
281279
mPermsList = new ArrayList<MyPermissionInfo>();
282280
Set<MyPermissionInfo> permSet = new HashSet<MyPermissionInfo>();
283-
if(pkg == null) {
281+
if(info == null) {
284282
return;
285283
}
286284

287285
// Convert to a PackageInfo
288-
PackageInfo info = PackageParser.generatePackageInfo(pkg, null,
289-
PackageManager.GET_PERMISSIONS, 0, 0, null,
290-
new PackageUserState());
291286
PackageInfo installedPkgInfo = null;
292287
// Get requested permissions
293288
if (info.requestedPermissions != null) {
@@ -299,13 +294,13 @@ public AppSecurityPermissions(Context context, PackageParser.Package pkg) {
299294
extractPerms(info, permSet, installedPkgInfo);
300295
}
301296
// Get permissions related to shared user if any
302-
if (pkg.mSharedUserId != null) {
297+
if (info.sharedUserId != null) {
303298
int sharedUid;
304299
try {
305-
sharedUid = mPm.getUidForSharedUser(pkg.mSharedUserId);
300+
sharedUid = mPm.getUidForSharedUser(info.sharedUserId);
306301
getAllUsedPermissions(sharedUid, permSet);
307302
} catch (NameNotFoundException e) {
308-
Log.w(TAG, "Could'nt retrieve shared user id for:"+pkg.packageName);
303+
Log.w(TAG, "Could'nt retrieve shared user id for:"+info.packageName);
309304
}
310305
}
311306
// Retrieve list of permissions

0 commit comments

Comments
 (0)