Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9fe08450 authored by William Loh's avatar William Loh Committed by Automerger Merge Worker
Browse files

Merge "Fix appMetadataFilePath when restoring system app" into udc-dev am: 2c1d1981

parents 197b1fd3 2c1d1981
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -499,13 +499,6 @@ final class InstallPackageHelper {
            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")) {
            mPm.setPlatformPackage(pkg, pkgSetting);
        }
@@ -2124,6 +2117,13 @@ final class InstallPackageHelper {
                installRequest.setNewUsers(
                        ps.queryInstalledUsers(mPm.mUserManager.getUserIds(), true));
                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) {
                mPm.updateSequenceNumberLP(ps, installRequest.getNewUsers());
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

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.PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED;
import static android.content.pm.PackageManager.FLAG_PERMISSION_REVOKED_COMPAT;
@@ -3576,6 +3577,7 @@ class PackageManagerShellCommand extends ShellCommand {
    }

    private int runGetAppMetadata() {
        mContext.enforceCallingOrSelfPermission(GET_APP_METADATA, "getAppMetadataFd");
        final PrintWriter pw = getOutPrintWriter();
        String pkgName = getNextArgRequired();
        ParcelFileDescriptor pfd = null;
+3 −0
Original line number Diff line number Diff line
@@ -921,6 +921,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                p.getUsesStaticLibraries(), p.getUsesStaticLibrariesVersions(), p.getMimeGroups(),
                mDomainVerificationManager.generateNewId());
        if (ret != null) {
            ret.setAppMetadataFilePath(p.getAppMetadataFilePath());
            ret.getPkgState().setUpdatedSystemApp(false);
        }
        mDisabledSysPackages.remove(name);
@@ -3700,6 +3701,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            ps.setSharedUserAppId(sharedUserAppId);
        }

        ps.setAppMetadataFilePath(parser.getAttributeValue(null, "appMetadataFilePath"));

        int outerDepth = parser.getDepth();
        int type;
        while ((type = parser.next()) != XmlPullParser.END_DOCUMENT