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

Commit 9ba6998b authored by Suchi Amalapurapu's avatar Suchi Amalapurapu Committed by The Android Open Source Project
Browse files

am ea5c0444: When apps switch between system and data partition the code and...

am ea5c0444: When apps switch between system and data partition the code and resource paths should also be updated based on which version is being picked up. update the code and resource paths when a path change is detected

Merge commit 'ea5c0444'

* commit 'ea5c0444':
  When apps switch between system and data partition the code and
parents 02035132 ea5c0444
Loading
Loading
Loading
Loading
+17 −9
Original line number Original line Diff line number Diff line
@@ -60,6 +60,7 @@ import android.net.Uri;
import android.os.Binder;
import android.os.Binder;
import android.os.Build;
import android.os.Build;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Debug;
import android.os.HandlerThread;
import android.os.HandlerThread;
import android.os.Parcel;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.RemoteException;
@@ -2050,7 +2051,8 @@ class PackageManagerService extends IPackageManager.Stub {
                }
                }
            }
            }


            // Just create the setting, don't add it yet
            // Just create the setting, don't add it yet. For already existing packages
            // the PkgSetting exists already and doesn't have to be created.
            pkgSetting = mSettings.getPackageLP(pkg, suid, destCodeFile,
            pkgSetting = mSettings.getPackageLP(pkg, suid, destCodeFile,
                            destResourceFile, pkg.applicationInfo.flags, true, false);
                            destResourceFile, pkg.applicationInfo.flags, true, false);
            if (pkgSetting == null) {
            if (pkgSetting == null) {
@@ -5425,10 +5427,10 @@ class PackageManagerService extends IPackageManager.Stub {
     */
     */
    static class PackageSettingBase extends GrantedPermissions {
    static class PackageSettingBase extends GrantedPermissions {
        final String name;
        final String name;
        final File codePath;
        File codePath;
        final String codePathString;
        String codePathString;
        final File resourcePath;
        File resourcePath;
        final String resourcePathString;
        String resourcePathString;
        private long timeStamp;
        private long timeStamp;
        private String timeStampString = "0";
        private String timeStampString = "0";
        final int versionCode;
        final int versionCode;
@@ -5826,11 +5828,16 @@ class PackageManagerService extends IPackageManager.Stub {
                        // and data partition. Just let the most recent version
                        // and data partition. Just let the most recent version
                        // take precedence.
                        // take precedence.
                        return p;
                        return p;
                    } else if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
                    } else {
                        // Let the app continue with previous uid if code path changes.
                        // Let the app continue with previous uid if code path changes.
                        reportSettingsProblem(Log.WARN,
                        reportSettingsProblem(Log.WARN,
                                "Package " + name + " codePath changed from " + p.codePath
                                "Package " + name + " codePath changed from " + p.codePath
                                + " to " + codePath + "; Retaining data and using new code");
                                + " to " + codePath + "; Retaining data and using new code from " +
                                codePath);
                        p.codePath = codePath;
                        p.resourcePath = resourcePath;
                        p.codePathString = codePath.toString();
                        p.resourcePathString = resourcePath.toString();
                    }
                    }
                } else if (p.sharedUser != sharedUser) {
                } else if (p.sharedUser != sharedUser) {
                    reportSettingsProblem(Log.WARN,
                    reportSettingsProblem(Log.WARN,
@@ -5854,6 +5861,7 @@ class PackageManagerService extends IPackageManager.Stub {
                if (sharedUser != null) {
                if (sharedUser != null) {
                    p.userId = sharedUser.userId;
                    p.userId = sharedUser.userId;
                } else if (MULTIPLE_APPLICATION_UIDS) {
                } else if (MULTIPLE_APPLICATION_UIDS) {
                    // Assign new user id
                    p.userId = newUserIdLP(p);
                    p.userId = newUserIdLP(p);
                } else {
                } else {
                    p.userId = FIRST_APPLICATION_UID;
                    p.userId = FIRST_APPLICATION_UID;