Merge "Revert "Update PackageInfo APIs to reflect shared UID status"" into tm-dev am: c972201018
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17115523 Change-Id: I35d575db612f0c2500d1f422ee2e1a5593456ccf
This commit is contained in:
@@ -121,9 +121,6 @@ public abstract class PackageManager {
|
|||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true;
|
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
|
* This exception is thrown when a given package, application, or component
|
||||||
* name cannot be found.
|
* name cannot be found.
|
||||||
|
|||||||
@@ -1944,26 +1944,19 @@ public class PackageParser {
|
|||||||
TypedArray sa = res.obtainAttributes(parser,
|
TypedArray sa = res.obtainAttributes(parser,
|
||||||
com.android.internal.R.styleable.AndroidManifest);
|
com.android.internal.R.styleable.AndroidManifest);
|
||||||
|
|
||||||
int maxSdkVersion = 0;
|
String str = sa.getNonConfigurationString(
|
||||||
if (PackageManager.ENABLE_SHARED_UID_MIGRATION) {
|
com.android.internal.R.styleable.AndroidManifest_sharedUserId, 0);
|
||||||
maxSdkVersion = sa.getInteger(
|
if (str != null && str.length() > 0) {
|
||||||
com.android.internal.R.styleable.AndroidManifest_sharedUserMaxSdkVersion, 0);
|
String nameError = validateName(str, true, true);
|
||||||
}
|
if (nameError != null && !"android".equals(pkg.packageName)) {
|
||||||
if (maxSdkVersion == 0 || maxSdkVersion >= Build.VERSION.RESOURCES_SDK_INT) {
|
outError[0] = "<manifest> specifies bad sharedUserId name \""
|
||||||
String str = sa.getNonConfigurationString(
|
+ str + "\": " + nameError;
|
||||||
com.android.internal.R.styleable.AndroidManifest_sharedUserId, 0);
|
mParseError = PackageManager.INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID;
|
||||||
if (str != null && str.length() > 0) {
|
return null;
|
||||||
String nameError = validateName(str, true, true);
|
|
||||||
if (nameError != null && !"android".equals(pkg.packageName)) {
|
|
||||||
outError[0] = "<manifest> specifies bad sharedUserId name \""
|
|
||||||
+ str + "\": " + nameError;
|
|
||||||
mParseError = PackageManager.INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
pkg.mSharedUserId = str.intern();
|
|
||||||
pkg.mSharedUserLabel = sa.getResourceId(
|
|
||||||
com.android.internal.R.styleable.AndroidManifest_sharedUserLabel, 0);
|
|
||||||
}
|
}
|
||||||
|
pkg.mSharedUserId = str.intern();
|
||||||
|
pkg.mSharedUserLabel = sa.getResourceId(
|
||||||
|
com.android.internal.R.styleable.AndroidManifest_sharedUserLabel, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg.installLocation = sa.getInteger(
|
pkg.installLocation = sa.getInteger(
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.android.server.pm;
|
package com.android.server.pm;
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
|
|
||||||
@@ -60,15 +59,22 @@ public final class SharedUidMigration {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface Strategy {}
|
public @interface Strategy {}
|
||||||
|
|
||||||
@Strategy
|
|
||||||
private static final int DEFAULT = BEST_EFFORT;
|
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
|
* Whether shared UID migration is fully disabled. Disabled means the sharedUserMaxSdkVersion
|
||||||
* attribute will be directly ignored in the parsing phase.
|
* attribute will be directly ignored in the parsing phase.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
public static boolean isDisabled() {
|
public static boolean isDisabled() {
|
||||||
return !PackageManager.ENABLE_SHARED_UID_MIGRATION;
|
return DEFAULT == DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +88,7 @@ public final class SharedUidMigration {
|
|||||||
|
|
||||||
final int s = SystemProperties.getInt(PROPERTY_KEY, DEFAULT);
|
final int s = SystemProperties.getInt(PROPERTY_KEY, DEFAULT);
|
||||||
// No transition strategies can be used (http://b/221088088)
|
// No transition strategies can be used (http://b/221088088)
|
||||||
if (s > BEST_EFFORT || s < NEW_INSTALL_ONLY) {
|
if (s > BEST_EFFORT || s <= DISABLED) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
@@ -122,12 +122,6 @@ public class PackageInfoUtils {
|
|||||||
info.isStub = pkg.isStub();
|
info.isStub = pkg.isStub();
|
||||||
info.coreApp = pkg.isCoreApp();
|
info.coreApp = pkg.isCoreApp();
|
||||||
|
|
||||||
if (!pkgSetting.hasSharedUser()) {
|
|
||||||
// It is possible that this shared UID app has left
|
|
||||||
info.sharedUserId = null;
|
|
||||||
info.sharedUserLabel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((flags & PackageManager.GET_ACTIVITIES) != 0) {
|
if ((flags & PackageManager.GET_ACTIVITIES) != 0) {
|
||||||
final int N = pkg.getActivities().size();
|
final int N = pkg.getActivities().size();
|
||||||
if (N > 0) {
|
if (N > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user