Merge change 20037 into donut
* changes: fix issue with gids not being added for packages with shared user id
This commit is contained in:
@@ -2884,7 +2884,7 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
if (gp.gids == null) {
|
if (gp.gids == null) {
|
||||||
gp.gids = mGlobalGids;
|
gp.gids = mGlobalGids;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int N = pkg.requestedPermissions.size();
|
final int N = pkg.requestedPermissions.size();
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
String name = pkg.requestedPermissions.get(i);
|
String name = pkg.requestedPermissions.get(i);
|
||||||
@@ -3755,7 +3755,7 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSettingsLI(String pkgName, File tmpPackageFile,
|
private void updateSettingsLI(String pkgName, File tmpPackageFile,
|
||||||
String destFilePath, File destPackageFile,
|
String destFilePath, File destPackageFile,
|
||||||
File destResourceFile,
|
File destResourceFile,
|
||||||
@@ -4220,7 +4220,7 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
if ( (deletedPs != null) && (deletedPs.sharedUser != null)) {
|
if ( (deletedPs != null) && (deletedPs.sharedUser != null)) {
|
||||||
// remove permissions associated with package
|
// remove permissions associated with package
|
||||||
mSettings.updateSharedUserPerms (deletedPs);
|
mSettings.updateSharedUserPermsLP(deletedPs, mGlobalGids);
|
||||||
}
|
}
|
||||||
// Save settings now
|
// Save settings now
|
||||||
mSettings.writeLP ();
|
mSettings.writeLP ();
|
||||||
@@ -6008,7 +6008,15 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSharedUserPerms (PackageSetting deletedPs) {
|
/*
|
||||||
|
* Update the shared user setting when a package using
|
||||||
|
* specifying the shared user id is removed. The gids
|
||||||
|
* associated with each permission of the deleted package
|
||||||
|
* are removed from the shared user's gid list only if its
|
||||||
|
* not in use by other permissions of packages in the
|
||||||
|
* shared user setting.
|
||||||
|
*/
|
||||||
|
private void updateSharedUserPermsLP(PackageSetting deletedPs, int[] globalGids) {
|
||||||
if ( (deletedPs == null) || (deletedPs.pkg == null)) {
|
if ( (deletedPs == null) || (deletedPs.pkg == null)) {
|
||||||
Log.i(TAG, "Trying to update info for null package. Just ignoring");
|
Log.i(TAG, "Trying to update info for null package. Just ignoring");
|
||||||
return;
|
return;
|
||||||
@@ -6037,13 +6045,14 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update gids
|
// Update gids
|
||||||
int newGids[] = null;
|
int newGids[] = globalGids;
|
||||||
for (PackageSetting pkg:sus.packages) {
|
for (String eachPerm : sus.grantedPermissions) {
|
||||||
newGids = appendInts(newGids, pkg.gids);
|
BasePermission bp = mPermissions.get(eachPerm);
|
||||||
|
newGids = appendInts(newGids, bp.gids);
|
||||||
}
|
}
|
||||||
sus.gids = newGids;
|
sus.gids = newGids;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int removePackageLP(String name) {
|
private int removePackageLP(String name) {
|
||||||
PackageSetting p = mPackages.get(name);
|
PackageSetting p = mPackages.get(name);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user