Merge "Deep clone settings for system package update" into honeycomb
This commit is contained in:
@@ -7453,6 +7453,10 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
static class PackageSignatures {
|
static class PackageSignatures {
|
||||||
private Signature[] mSignatures;
|
private Signature[] mSignatures;
|
||||||
|
|
||||||
|
PackageSignatures(PackageSignatures orig) {
|
||||||
|
mSignatures = orig.mSignatures.clone();
|
||||||
|
}
|
||||||
|
|
||||||
PackageSignatures(Signature[] sigs) {
|
PackageSignatures(Signature[] sigs) {
|
||||||
assignSignatures(sigs);
|
assignSignatures(sigs);
|
||||||
}
|
}
|
||||||
@@ -7788,6 +7792,12 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
setFlags(pkgFlags);
|
setFlags(pkgFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GrantedPermissions(GrantedPermissions base) {
|
||||||
|
pkgFlags = base.pkgFlags;
|
||||||
|
grantedPermissions = (HashSet<String>) base.grantedPermissions.clone();
|
||||||
|
gids = base.gids.clone();
|
||||||
|
}
|
||||||
|
|
||||||
void setFlags(int pkgFlags) {
|
void setFlags(int pkgFlags) {
|
||||||
this.pkgFlags = pkgFlags & (
|
this.pkgFlags = pkgFlags & (
|
||||||
ApplicationInfo.FLAG_SYSTEM |
|
ApplicationInfo.FLAG_SYSTEM |
|
||||||
@@ -7815,7 +7825,7 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
int versionCode;
|
int versionCode;
|
||||||
|
|
||||||
boolean uidError;
|
boolean uidError;
|
||||||
|
|
||||||
PackageSignatures signatures = new PackageSignatures();
|
PackageSignatures signatures = new PackageSignatures();
|
||||||
|
|
||||||
boolean permissionsFixed;
|
boolean permissionsFixed;
|
||||||
@@ -7841,6 +7851,44 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
init(codePath, resourcePath, nativeLibraryPathString, pVersionCode);
|
init(codePath, resourcePath, nativeLibraryPathString, pVersionCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New instance of PackageSetting with one-level-deep cloning.
|
||||||
|
*/
|
||||||
|
PackageSettingBase(PackageSettingBase base) {
|
||||||
|
super(base);
|
||||||
|
|
||||||
|
name = base.name;
|
||||||
|
realName = base.realName;
|
||||||
|
codePath = base.codePath;
|
||||||
|
codePathString = base.codePathString;
|
||||||
|
resourcePath = base.resourcePath;
|
||||||
|
resourcePathString = base.resourcePathString;
|
||||||
|
nativeLibraryPathString = base.nativeLibraryPathString;
|
||||||
|
obbPathString = base.obbPathString;
|
||||||
|
timeStamp = base.timeStamp;
|
||||||
|
firstInstallTime = base.firstInstallTime;
|
||||||
|
lastUpdateTime = base.lastUpdateTime;
|
||||||
|
versionCode = base.versionCode;
|
||||||
|
|
||||||
|
uidError = base.uidError;
|
||||||
|
|
||||||
|
signatures = new PackageSignatures(base.signatures);
|
||||||
|
|
||||||
|
permissionsFixed = base.permissionsFixed;
|
||||||
|
haveGids = base.haveGids;
|
||||||
|
|
||||||
|
disabledComponents = (HashSet<String>) base.disabledComponents.clone();
|
||||||
|
|
||||||
|
enabledComponents = (HashSet<String>) base.enabledComponents.clone();
|
||||||
|
|
||||||
|
enabled = base.enabled;
|
||||||
|
installStatus = base.installStatus;
|
||||||
|
|
||||||
|
origPackage = base.origPackage;
|
||||||
|
|
||||||
|
installerPackageName = base.installerPackageName;
|
||||||
|
}
|
||||||
|
|
||||||
void init(File codePath, File resourcePath, String nativeLibraryPathString,
|
void init(File codePath, File resourcePath, String nativeLibraryPathString,
|
||||||
int pVersionCode) {
|
int pVersionCode) {
|
||||||
this.codePath = codePath;
|
this.codePath = codePath;
|
||||||
@@ -7871,6 +7919,9 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
timeStamp = newStamp;
|
timeStamp = newStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a shallow copy of this package settings.
|
||||||
|
*/
|
||||||
public void copyFrom(PackageSettingBase base) {
|
public void copyFrom(PackageSettingBase base) {
|
||||||
grantedPermissions = base.grantedPermissions;
|
grantedPermissions = base.grantedPermissions;
|
||||||
gids = base.gids;
|
gids = base.gids;
|
||||||
@@ -7930,18 +7981,16 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
pkgFlags);
|
pkgFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New instance of PackageSetting replicating the original settings.
|
||||||
|
* Note that it keeps the same PackageParser.Package instance.
|
||||||
|
*/
|
||||||
PackageSetting(PackageSetting orig) {
|
PackageSetting(PackageSetting orig) {
|
||||||
super(orig.name, orig.realName, orig.codePath, orig.resourcePath,
|
super(orig);
|
||||||
orig.nativeLibraryPathString, orig.versionCode, orig.pkgFlags);
|
|
||||||
copyFrom(orig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void copyFrom(PackageSetting base) {
|
userId = orig.userId;
|
||||||
super.copyFrom((PackageSettingBase) base);
|
pkg = orig.pkg;
|
||||||
|
sharedUser = orig.sharedUser;
|
||||||
userId = base.userId;
|
|
||||||
sharedUser = base.sharedUser;
|
|
||||||
pkg = base.pkg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -8173,7 +8222,7 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
// a little trick... when we install the new package, we don't
|
// a little trick... when we install the new package, we don't
|
||||||
// want to modify the existing PackageSetting for the built-in
|
// want to modify the existing PackageSetting for the built-in
|
||||||
// version. so at this point we need a new PackageSetting that
|
// version. so at this point we need a new PackageSetting that
|
||||||
// is okay to much with.
|
// is okay to muck with.
|
||||||
PackageSetting newp = new PackageSetting(p);
|
PackageSetting newp = new PackageSetting(p);
|
||||||
replacePackageLP(name, newp);
|
replacePackageLP(name, newp);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user