Merge "Fix appMetadataFilePath when restoring system app" into udc-dev
This commit is contained in:
@@ -499,13 +499,6 @@ final class InstallPackageHelper {
|
|||||||
mPm.setUpCustomResolverActivity(pkg, pkgSetting);
|
mPm.setUpCustomResolverActivity(pkg, pkgSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
File appMetadataFile = new File(pkgSetting.getPath(), APP_METADATA_FILE_NAME);
|
|
||||||
if (appMetadataFile.exists()) {
|
|
||||||
pkgSetting.setAppMetadataFilePath(appMetadataFile.getAbsolutePath());
|
|
||||||
} else {
|
|
||||||
pkgSetting.setAppMetadataFilePath(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pkg.getPackageName().equals("android")) {
|
if (pkg.getPackageName().equals("android")) {
|
||||||
mPm.setPlatformPackage(pkg, pkgSetting);
|
mPm.setPlatformPackage(pkg, pkgSetting);
|
||||||
}
|
}
|
||||||
@@ -2124,6 +2117,13 @@ final class InstallPackageHelper {
|
|||||||
installRequest.setNewUsers(
|
installRequest.setNewUsers(
|
||||||
ps.queryInstalledUsers(mPm.mUserManager.getUserIds(), true));
|
ps.queryInstalledUsers(mPm.mUserManager.getUserIds(), true));
|
||||||
ps.setUpdateAvailable(false /*updateAvailable*/);
|
ps.setUpdateAvailable(false /*updateAvailable*/);
|
||||||
|
|
||||||
|
File appMetadataFile = new File(ps.getPath(), APP_METADATA_FILE_NAME);
|
||||||
|
if (appMetadataFile.exists()) {
|
||||||
|
ps.setAppMetadataFilePath(appMetadataFile.getAbsolutePath());
|
||||||
|
} else {
|
||||||
|
ps.setAppMetadataFilePath(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (installRequest.getReturnCode() == PackageManager.INSTALL_SUCCEEDED) {
|
if (installRequest.getReturnCode() == PackageManager.INSTALL_SUCCEEDED) {
|
||||||
mPm.updateSequenceNumberLP(ps, installRequest.getNewUsers());
|
mPm.updateSequenceNumberLP(ps, installRequest.getNewUsers());
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.server.pm;
|
package com.android.server.pm;
|
||||||
|
|
||||||
|
import static android.Manifest.permission.GET_APP_METADATA;
|
||||||
import static android.content.pm.PackageInstaller.LOCATION_DATA_APP;
|
import static android.content.pm.PackageInstaller.LOCATION_DATA_APP;
|
||||||
import static android.content.pm.PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED;
|
import static android.content.pm.PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED;
|
||||||
import static android.content.pm.PackageManager.FLAG_PERMISSION_REVOKED_COMPAT;
|
import static android.content.pm.PackageManager.FLAG_PERMISSION_REVOKED_COMPAT;
|
||||||
@@ -3576,6 +3577,7 @@ class PackageManagerShellCommand extends ShellCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int runGetAppMetadata() {
|
private int runGetAppMetadata() {
|
||||||
|
mContext.enforceCallingOrSelfPermission(GET_APP_METADATA, "getAppMetadataFd");
|
||||||
final PrintWriter pw = getOutPrintWriter();
|
final PrintWriter pw = getOutPrintWriter();
|
||||||
String pkgName = getNextArgRequired();
|
String pkgName = getNextArgRequired();
|
||||||
ParcelFileDescriptor pfd = null;
|
ParcelFileDescriptor pfd = null;
|
||||||
|
|||||||
@@ -921,6 +921,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
|
|||||||
p.getUsesStaticLibraries(), p.getUsesStaticLibrariesVersions(), p.getMimeGroups(),
|
p.getUsesStaticLibraries(), p.getUsesStaticLibrariesVersions(), p.getMimeGroups(),
|
||||||
mDomainVerificationManager.generateNewId());
|
mDomainVerificationManager.generateNewId());
|
||||||
if (ret != null) {
|
if (ret != null) {
|
||||||
|
ret.setAppMetadataFilePath(p.getAppMetadataFilePath());
|
||||||
ret.getPkgState().setUpdatedSystemApp(false);
|
ret.getPkgState().setUpdatedSystemApp(false);
|
||||||
}
|
}
|
||||||
mDisabledSysPackages.remove(name);
|
mDisabledSysPackages.remove(name);
|
||||||
@@ -3700,6 +3701,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
|
|||||||
ps.setSharedUserAppId(sharedUserAppId);
|
ps.setSharedUserAppId(sharedUserAppId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ps.setAppMetadataFilePath(parser.getAttributeValue(null, "appMetadataFilePath"));
|
||||||
|
|
||||||
int outerDepth = parser.getDepth();
|
int outerDepth = parser.getDepth();
|
||||||
int type;
|
int type;
|
||||||
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
|
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
|
||||||
|
|||||||
Reference in New Issue
Block a user