Loading core/java/android/content/pm/PackageManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,9 @@ public abstract class PackageManager { /** {@hide} */ public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true; /** {@hide} */ public static final boolean ENABLE_SHARED_UID_MIGRATION = true; /** * This exception is thrown when a given package, application, or component * name cannot be found. Loading core/java/android/content/pm/PackageParser.java +19 −12 Original line number Diff line number Diff line Loading @@ -1944,6 +1944,12 @@ public class PackageParser { TypedArray sa = res.obtainAttributes(parser, com.android.internal.R.styleable.AndroidManifest); int maxSdkVersion = 0; if (PackageManager.ENABLE_SHARED_UID_MIGRATION) { maxSdkVersion = sa.getInteger( com.android.internal.R.styleable.AndroidManifest_sharedUserMaxSdkVersion, 0); } if (maxSdkVersion == 0 || maxSdkVersion >= Build.VERSION.RESOURCES_SDK_INT) { String str = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifest_sharedUserId, 0); if (str != null && str.length() > 0) { Loading @@ -1958,6 +1964,7 @@ public class PackageParser { pkg.mSharedUserLabel = sa.getResourceId( com.android.internal.R.styleable.AndroidManifest_sharedUserLabel, 0); } } pkg.installLocation = sa.getInteger( com.android.internal.R.styleable.AndroidManifest_installLocation, Loading services/core/java/com/android/server/pm/SharedUidMigration.java +4 −10 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.pm; import android.annotation.IntDef; import android.content.pm.PackageManager; import android.os.Build; import android.os.SystemProperties; Loading Loading @@ -59,22 +60,15 @@ public final class SharedUidMigration { @Retention(RetentionPolicy.SOURCE) public @interface Strategy {} @Strategy private static final int DEFAULT = BEST_EFFORT; /** * All shared UID migration is disabled. * This is not a strategy that can be set with system properties. * To disable shared UID migration, change {@link #DEFAULT} to this value. */ private static final int DISABLED = 0; /** * Whether shared UID migration is fully disabled. Disabled means the sharedUserMaxSdkVersion * attribute will be directly ignored in the parsing phase. */ @SuppressWarnings("ConstantConditions") public static boolean isDisabled() { return DEFAULT == DISABLED; return !PackageManager.ENABLE_SHARED_UID_MIGRATION; } /** Loading @@ -88,7 +82,7 @@ public final class SharedUidMigration { final int s = SystemProperties.getInt(PROPERTY_KEY, DEFAULT); // No transition strategies can be used (http://b/221088088) if (s > BEST_EFFORT || s <= DISABLED) { if (s > BEST_EFFORT || s < NEW_INSTALL_ONLY) { return DEFAULT; } return s; Loading services/core/java/com/android/server/pm/parsing/PackageInfoUtils.java +6 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,12 @@ public class PackageInfoUtils { info.isStub = pkg.isStub(); info.coreApp = pkg.isCoreApp(); if (pkgSetting != null && !pkgSetting.hasSharedUser()) { // It is possible that this shared UID app has left info.sharedUserId = null; info.sharedUserLabel = 0; } if ((flags & PackageManager.GET_ACTIVITIES) != 0) { final int N = pkg.getActivities().size(); if (N > 0) { Loading Loading
core/java/android/content/pm/PackageManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,9 @@ public abstract class PackageManager { /** {@hide} */ public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true; /** {@hide} */ public static final boolean ENABLE_SHARED_UID_MIGRATION = true; /** * This exception is thrown when a given package, application, or component * name cannot be found. Loading
core/java/android/content/pm/PackageParser.java +19 −12 Original line number Diff line number Diff line Loading @@ -1944,6 +1944,12 @@ public class PackageParser { TypedArray sa = res.obtainAttributes(parser, com.android.internal.R.styleable.AndroidManifest); int maxSdkVersion = 0; if (PackageManager.ENABLE_SHARED_UID_MIGRATION) { maxSdkVersion = sa.getInteger( com.android.internal.R.styleable.AndroidManifest_sharedUserMaxSdkVersion, 0); } if (maxSdkVersion == 0 || maxSdkVersion >= Build.VERSION.RESOURCES_SDK_INT) { String str = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifest_sharedUserId, 0); if (str != null && str.length() > 0) { Loading @@ -1958,6 +1964,7 @@ public class PackageParser { pkg.mSharedUserLabel = sa.getResourceId( com.android.internal.R.styleable.AndroidManifest_sharedUserLabel, 0); } } pkg.installLocation = sa.getInteger( com.android.internal.R.styleable.AndroidManifest_installLocation, Loading
services/core/java/com/android/server/pm/SharedUidMigration.java +4 −10 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.pm; import android.annotation.IntDef; import android.content.pm.PackageManager; import android.os.Build; import android.os.SystemProperties; Loading Loading @@ -59,22 +60,15 @@ public final class SharedUidMigration { @Retention(RetentionPolicy.SOURCE) public @interface Strategy {} @Strategy private static final int DEFAULT = BEST_EFFORT; /** * All shared UID migration is disabled. * This is not a strategy that can be set with system properties. * To disable shared UID migration, change {@link #DEFAULT} to this value. */ private static final int DISABLED = 0; /** * Whether shared UID migration is fully disabled. Disabled means the sharedUserMaxSdkVersion * attribute will be directly ignored in the parsing phase. */ @SuppressWarnings("ConstantConditions") public static boolean isDisabled() { return DEFAULT == DISABLED; return !PackageManager.ENABLE_SHARED_UID_MIGRATION; } /** Loading @@ -88,7 +82,7 @@ public final class SharedUidMigration { final int s = SystemProperties.getInt(PROPERTY_KEY, DEFAULT); // No transition strategies can be used (http://b/221088088) if (s > BEST_EFFORT || s <= DISABLED) { if (s > BEST_EFFORT || s < NEW_INSTALL_ONLY) { return DEFAULT; } return s; Loading
services/core/java/com/android/server/pm/parsing/PackageInfoUtils.java +6 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,12 @@ public class PackageInfoUtils { info.isStub = pkg.isStub(); info.coreApp = pkg.isCoreApp(); if (pkgSetting != null && !pkgSetting.hasSharedUser()) { // It is possible that this shared UID app has left info.sharedUserId = null; info.sharedUserLabel = 0; } if ((flags & PackageManager.GET_ACTIVITIES) != 0) { final int N = pkg.getActivities().size(); if (N > 0) { Loading