Merge "[flexiglass] Fixes crashloop in LockscreenScene." into main
diff --git a/AconfigFlags.bp b/AconfigFlags.bp
index fd92979b..ea2eaa0 100644
--- a/AconfigFlags.bp
+++ b/AconfigFlags.bp
@@ -80,6 +80,14 @@
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+java_aconfig_library {
+ name: "android.security.flags-aconfig-java-host",
+ aconfig_declarations: "android.security.flags-aconfig",
+ host_supported: true,
+ test: true,
+ defaults: ["framework-minus-apex-aconfig-java-defaults"],
+}
+
// OS
aconfig_declarations {
name: "android.os.flags-aconfig",
diff --git a/cmds/idmap2/libidmap2/XmlParser.cpp b/cmds/idmap2/libidmap2/XmlParser.cpp
index 1d78460..7807155 100644
--- a/cmds/idmap2/libidmap2/XmlParser.cpp
+++ b/cmds/idmap2/libidmap2/XmlParser.cpp
@@ -130,11 +130,14 @@
}
Result<Res_value> XmlParser::Node::GetAttributeValue(const std::string& name) const {
+ String16 name16;
return FindAttribute(parser_, name, [&](size_t index) -> bool {
- size_t len;
- const String16 key16(parser_.getAttributeName(index, &len));
- std::string key = String8(key16).c_str();
- return key == name;
+ if (name16.empty()) {
+ name16 = String16(name.c_str(), name.size());
+ }
+ size_t key_len;
+ const auto key16 = parser_.getAttributeName(index, &key_len);
+ return key16 && name16.size() == key_len && name16 == key16;
});
}
diff --git a/core/java/android/content/pm/parsing/ApkLite.java b/core/java/android/content/pm/parsing/ApkLite.java
index 0127adc..71cfd1b 100644
--- a/core/java/android/content/pm/parsing/ApkLite.java
+++ b/core/java/android/content/pm/parsing/ApkLite.java
@@ -139,6 +139,39 @@
*/
private final boolean mIsSdkLibrary;
+ /**
+ * Indicates whether this application's data will be cleared on a failed restore.
+ */
+ private final boolean mClearUserDataAllowed;
+
+ /**
+ * Set to <code>false</code> if the application does not wish to permit any OS-driven
+ * backups of its data; <code>true</code> otherwise.
+ */
+ private final boolean mBackupAllowed;
+
+ /**
+ * When set, the default data storage directory for this app is pointed at
+ * the device-protected location.
+ */
+ private final boolean mDefaultToDeviceProtectedStorage;
+
+ /**
+ * If {@code true} this app requests full external storage access.
+ */
+ private final boolean mRequestLegacyExternalStorage;
+
+ /**
+ * Indicates whether this application has declared its user data as fragile, causing the
+ * system to prompt the user on whether to keep the user data on uninstall.
+ */
+ private final boolean mUserDataFragile;
+
+ /**
+ * Indicates whether this application's data will be cleared on a failed restore.
+ */
+ private final boolean mClearUserDataOnFailedRestoreAllowed;
+
public ApkLite(String path, String packageName, String splitName, boolean isFeatureSplit,
String configForSplit, String usesSplitName, boolean isSplitRequired, int versionCode,
int versionCodeMajor, int revisionCode, int installLocation,
@@ -149,7 +182,10 @@
String requiredSystemPropertyName, String requiredSystemPropertyValue,
int minSdkVersion, int targetSdkVersion, int rollbackDataPolicy,
Set<String> requiredSplitTypes, Set<String> splitTypes,
- boolean hasDeviceAdminReceiver, boolean isSdkLibrary) {
+ boolean hasDeviceAdminReceiver, boolean isSdkLibrary, boolean clearUserDataAllowed,
+ boolean backupAllowed, boolean defaultToDeviceProtectedStorage,
+ boolean requestLegacyExternalStorage, boolean userDataFragile,
+ boolean clearUserDataOnFailedRestoreAllowed) {
mPath = path;
mPackageName = packageName;
mSplitName = splitName;
@@ -183,6 +219,12 @@
mRollbackDataPolicy = rollbackDataPolicy;
mHasDeviceAdminReceiver = hasDeviceAdminReceiver;
mIsSdkLibrary = isSdkLibrary;
+ mClearUserDataAllowed = clearUserDataAllowed;
+ mBackupAllowed = backupAllowed;
+ mDefaultToDeviceProtectedStorage = defaultToDeviceProtectedStorage;
+ mRequestLegacyExternalStorage = requestLegacyExternalStorage;
+ mUserDataFragile = userDataFragile;
+ mClearUserDataOnFailedRestoreAllowed = clearUserDataOnFailedRestoreAllowed;
}
public ApkLite(String path, ArchivedPackageParcel archivedPackage) {
@@ -219,6 +261,12 @@
mRollbackDataPolicy = 0;
mHasDeviceAdminReceiver = false;
mIsSdkLibrary = false;
+ mClearUserDataAllowed = archivedPackage.clearUserDataAllowed;
+ mBackupAllowed = archivedPackage.backupAllowed;
+ mDefaultToDeviceProtectedStorage = archivedPackage.defaultToDeviceProtectedStorage;
+ mRequestLegacyExternalStorage = archivedPackage.requestLegacyExternalStorage;
+ mUserDataFragile = archivedPackage.userDataFragile;
+ mClearUserDataOnFailedRestoreAllowed = archivedPackage.clearUserDataOnFailedRestoreAllowed;
}
/**
@@ -511,6 +559,9 @@
return mRollbackDataPolicy;
}
+ /**
+ * Indicates if this app contains a {@link android.app.admin.DeviceAdminReceiver}.
+ */
@DataClass.Generated.Member
public boolean isHasDeviceAdminReceiver() {
return mHasDeviceAdminReceiver;
@@ -524,11 +575,62 @@
return mIsSdkLibrary;
}
+ /**
+ * Indicates whether this application's data will be cleared on a failed restore.
+ */
+ @DataClass.Generated.Member
+ public boolean isClearUserDataAllowed() {
+ return mClearUserDataAllowed;
+ }
+
+ /**
+ * Set to <code>false</code> if the application does not wish to permit any OS-driven
+ * backups of its data; <code>true</code> otherwise.
+ */
+ @DataClass.Generated.Member
+ public boolean isBackupAllowed() {
+ return mBackupAllowed;
+ }
+
+ /**
+ * When set, the default data storage directory for this app is pointed at
+ * the device-protected location.
+ */
+ @DataClass.Generated.Member
+ public boolean isDefaultToDeviceProtectedStorage() {
+ return mDefaultToDeviceProtectedStorage;
+ }
+
+ /**
+ * If {@code true} this app requests full external storage access.
+ */
+ @DataClass.Generated.Member
+ public boolean isRequestLegacyExternalStorage() {
+ return mRequestLegacyExternalStorage;
+ }
+
+ /**
+ * Indicates whether this application has declared its user data as fragile, causing the
+ * system to prompt the user on whether to keep the user data on uninstall.
+ */
+ @DataClass.Generated.Member
+ public boolean isUserDataFragile() {
+ return mUserDataFragile;
+ }
+
+ /**
+ * Indicates whether this application's data will be cleared on a failed restore.
+ */
+ @DataClass.Generated.Member
+ public boolean isClearUserDataOnFailedRestoreAllowed() {
+ return mClearUserDataOnFailedRestoreAllowed;
+ }
+
@DataClass.Generated(
- time = 1643063342990L,
+ time = 1693422809896L,
codegenVersion = "1.0.23",
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/ApkLite.java",
- inputSignatures = "private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.NonNull java.lang.String mPath\nprivate final @android.annotation.Nullable java.lang.String mSplitName\nprivate final @android.annotation.Nullable java.lang.String mUsesSplitName\nprivate final @android.annotation.Nullable java.lang.String mConfigForSplit\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mSplitTypes\nprivate final int mVersionCodeMajor\nprivate final int mVersionCode\nprivate final int mRevisionCode\nprivate final int mInstallLocation\nprivate final int mMinSdkVersion\nprivate final int mTargetSdkVersion\nprivate final @android.annotation.NonNull android.content.pm.VerifierInfo[] mVerifiers\nprivate final @android.annotation.NonNull android.content.pm.SigningDetails mSigningDetails\nprivate final boolean mFeatureSplit\nprivate final boolean mIsolatedSplits\nprivate final boolean mSplitRequired\nprivate final boolean mCoreApp\nprivate final boolean mDebuggable\nprivate final boolean mProfileableByShell\nprivate final boolean mMultiArch\nprivate final boolean mUse32bitAbi\nprivate final boolean mExtractNativeLibs\nprivate final boolean mUseEmbeddedDex\nprivate final @android.annotation.Nullable java.lang.String mTargetPackageName\nprivate final boolean mOverlayIsStatic\nprivate final int mOverlayPriority\nprivate final @android.annotation.Nullable java.lang.String mRequiredSystemPropertyName\nprivate final @android.annotation.Nullable java.lang.String mRequiredSystemPropertyValue\nprivate final int mRollbackDataPolicy\nprivate final boolean mHasDeviceAdminReceiver\nprivate final boolean mIsSdkLibrary\npublic long getLongVersionCode()\nprivate boolean hasAnyRequiredSplitTypes()\nclass ApkLite extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genConstDefs=false)")
+ inputSignatures = "private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.NonNull java.lang.String mPath\nprivate final @android.annotation.Nullable java.lang.String mSplitName\nprivate final @android.annotation.Nullable java.lang.String mUsesSplitName\nprivate final @android.annotation.Nullable java.lang.String mConfigForSplit\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mSplitTypes\nprivate final int mVersionCodeMajor\nprivate final int mVersionCode\nprivate final int mRevisionCode\nprivate final int mInstallLocation\nprivate final int mMinSdkVersion\nprivate final int mTargetSdkVersion\nprivate final @android.annotation.NonNull android.content.pm.VerifierInfo[] mVerifiers\nprivate final @android.annotation.NonNull android.content.pm.SigningDetails mSigningDetails\nprivate final boolean mFeatureSplit\nprivate final boolean mIsolatedSplits\nprivate final boolean mSplitRequired\nprivate final boolean mCoreApp\nprivate final boolean mDebuggable\nprivate final boolean mProfileableByShell\nprivate final boolean mMultiArch\nprivate final boolean mUse32bitAbi\nprivate final boolean mExtractNativeLibs\nprivate final boolean mUseEmbeddedDex\nprivate final @android.annotation.Nullable java.lang.String mTargetPackageName\nprivate final boolean mOverlayIsStatic\nprivate final int mOverlayPriority\nprivate final @android.annotation.Nullable java.lang.String mRequiredSystemPropertyName\nprivate final @android.annotation.Nullable java.lang.String mRequiredSystemPropertyValue\nprivate final int mRollbackDataPolicy\nprivate final boolean mHasDeviceAdminReceiver\nprivate final boolean mIsSdkLibrary\nprivate final boolean mClearUserDataAllowed\nprivate final boolean mBackupAllowed\nprivate final boolean mDefaultToDeviceProtectedStorage\nprivate final boolean mRequestLegacyExternalStorage\nprivate final boolean mUserDataFragile\nprivate final boolean mClearUserDataOnFailedRestoreAllowed\npublic long getLongVersionCode()\nprivate boolean hasAnyRequiredSplitTypes()\nclass ApkLite extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genConstDefs=false)")
@Deprecated
private void __metadata() {}
diff --git a/core/java/android/content/pm/parsing/ApkLiteParseUtils.java b/core/java/android/content/pm/parsing/ApkLiteParseUtils.java
index 7e67396..066ff689 100644
--- a/core/java/android/content/pm/parsing/ApkLiteParseUtils.java
+++ b/core/java/android/content/pm/parsing/ApkLiteParseUtils.java
@@ -40,6 +40,7 @@
import android.util.Slog;
import com.android.internal.util.ArrayUtils;
+import com.android.internal.util.XmlUtils;
import libcore.io.IoUtils;
@@ -446,6 +447,13 @@
int overlayPriority = 0;
int rollbackDataPolicy = 0;
+ boolean clearUserDataAllowed = true;
+ boolean backupAllowed = true;
+ boolean defaultToDeviceProtectedStorage = false;
+ String requestLegacyExternalStorage = null;
+ boolean userDataFragile = false;
+ boolean clearUserDataOnFailedRestoreAllowed = true;
+
String requiredSystemPropertyName = null;
String requiredSystemPropertyValue = null;
@@ -484,6 +492,23 @@
"extractNativeLibs", true);
useEmbeddedDex = parser.getAttributeBooleanValue(ANDROID_RES_NAMESPACE,
"useEmbeddedDex", false);
+
+ clearUserDataAllowed = parser.getAttributeBooleanValue(ANDROID_RES_NAMESPACE,
+ "allowClearUserDataOnFailedRestore", true);
+ backupAllowed = parser.getAttributeBooleanValue(ANDROID_RES_NAMESPACE,
+ "allowBackup", true);
+ defaultToDeviceProtectedStorage = parser.getAttributeBooleanValue(
+ ANDROID_RES_NAMESPACE,
+ "defaultToDeviceProtectedStorage", false);
+ userDataFragile = parser.getAttributeBooleanValue(ANDROID_RES_NAMESPACE,
+ "hasFragileUserData", false);
+ clearUserDataOnFailedRestoreAllowed = parser.getAttributeBooleanValue(
+ ANDROID_RES_NAMESPACE,
+ "allowClearUserDataOnFailedRestore", true);
+
+ requestLegacyExternalStorage = parser.getAttributeValue(ANDROID_RES_NAMESPACE,
+ "requestLegacyExternalStorage");
+
rollbackDataPolicy = parser.getAttributeIntValue(ANDROID_RES_NAMESPACE,
"rollbackDataPolicy", 0);
String permission = parser.getAttributeValue(ANDROID_RES_NAMESPACE,
@@ -604,6 +629,9 @@
return input.skip(message);
}
+ boolean isRequestLegacyExternalStorage = XmlUtils.convertValueToBoolean(
+ requestLegacyExternalStorage, targetSdkVersion < Build.VERSION_CODES.Q);
+
return input.success(
new ApkLite(codePath, packageSplit.first, packageSplit.second, isFeatureSplit,
configForSplit, usesSplitName, isSplitRequired, versionCode,
@@ -613,7 +641,9 @@
overlayIsStatic, overlayPriority, requiredSystemPropertyName,
requiredSystemPropertyValue, minSdkVersion, targetSdkVersion,
rollbackDataPolicy, requiredSplitTypes.first, requiredSplitTypes.second,
- hasDeviceAdminReceiver, isSdkLibrary));
+ hasDeviceAdminReceiver, isSdkLibrary, clearUserDataAllowed, backupAllowed,
+ defaultToDeviceProtectedStorage, isRequestLegacyExternalStorage,
+ userDataFragile, clearUserDataOnFailedRestoreAllowed));
}
private static boolean isDeviceAdminReceiver(
diff --git a/core/java/android/content/pm/parsing/PackageLite.java b/core/java/android/content/pm/parsing/PackageLite.java
index 51dbde3..4638af7 100644
--- a/core/java/android/content/pm/parsing/PackageLite.java
+++ b/core/java/android/content/pm/parsing/PackageLite.java
@@ -112,6 +112,33 @@
* Indicates if this package is a sdk.
*/
private final boolean mIsSdkLibrary;
+ /**
+ * Indicates whether this application's data will be cleared on a failed restore.
+ */
+ private final boolean mClearUserDataAllowed;
+ /**
+ * Set to <code>false</code> if the application does not wish to permit any OS-driven
+ * backups of its data; <code>true</code> otherwise.
+ */
+ private final boolean mBackupAllowed;
+ /**
+ * When set, the default data storage directory for this app is pointed at
+ * the device-protected location.
+ */
+ private final boolean mDefaultToDeviceProtectedStorage;
+ /**
+ * If {@code true} this app requests full external storage access.
+ */
+ private final boolean mRequestLegacyExternalStorage;
+ /**
+ * Indicates whether this application has declared its user data as fragile, causing the
+ * system to prompt the user on whether to keep the user data on uninstall.
+ */
+ private final boolean mUserDataFragile;
+ /**
+ * Indicates whether this application's data will be cleared on a failed restore.
+ */
+ private final boolean mClearUserDataOnFailedRestoreAllowed;
public PackageLite(String path, String baseApkPath, ApkLite baseApk,
String[] splitNames, boolean[] isFeatureSplits, String[] usesSplitNames,
@@ -148,6 +175,12 @@
mSplitApkPaths = splitApkPaths;
mSplitRevisionCodes = splitRevisionCodes;
mTargetSdk = targetSdk;
+ mClearUserDataAllowed = baseApk.isClearUserDataAllowed();
+ mBackupAllowed = baseApk.isBackupAllowed();
+ mDefaultToDeviceProtectedStorage = baseApk.isDefaultToDeviceProtectedStorage();
+ mRequestLegacyExternalStorage = baseApk.isRequestLegacyExternalStorage();
+ mUserDataFragile = baseApk.isUserDataFragile();
+ mClearUserDataOnFailedRestoreAllowed = baseApk.isClearUserDataOnFailedRestoreAllowed();
}
/**
@@ -426,11 +459,62 @@
return mIsSdkLibrary;
}
+ /**
+ * Indicates whether this application's data will be cleared on a failed restore.
+ */
+ @DataClass.Generated.Member
+ public boolean isClearUserDataAllowed() {
+ return mClearUserDataAllowed;
+ }
+
+ /**
+ * Set to <code>false</code> if the application does not wish to permit any OS-driven
+ * backups of its data; <code>true</code> otherwise.
+ */
+ @DataClass.Generated.Member
+ public boolean isBackupAllowed() {
+ return mBackupAllowed;
+ }
+
+ /**
+ * When set, the default data storage directory for this app is pointed at
+ * the device-protected location.
+ */
+ @DataClass.Generated.Member
+ public boolean isDefaultToDeviceProtectedStorage() {
+ return mDefaultToDeviceProtectedStorage;
+ }
+
+ /**
+ * If {@code true} this app requests full external storage access.
+ */
+ @DataClass.Generated.Member
+ public boolean isRequestLegacyExternalStorage() {
+ return mRequestLegacyExternalStorage;
+ }
+
+ /**
+ * Indicates whether this application has declared its user data as fragile, causing the
+ * system to prompt the user on whether to keep the user data on uninstall.
+ */
+ @DataClass.Generated.Member
+ public boolean isUserDataFragile() {
+ return mUserDataFragile;
+ }
+
+ /**
+ * Indicates whether this application's data will be cleared on a failed restore.
+ */
+ @DataClass.Generated.Member
+ public boolean isClearUserDataOnFailedRestoreAllowed() {
+ return mClearUserDataOnFailedRestoreAllowed;
+ }
+
@DataClass.Generated(
- time = 1693264166050L,
+ time = 1693423910860L,
codegenVersion = "1.0.23",
sourceFile = "frameworks/base/core/java/android/content/pm/parsing/PackageLite.java",
- inputSignatures = "private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.NonNull java.lang.String mPath\nprivate final @android.annotation.NonNull java.lang.String mBaseApkPath\nprivate final @android.annotation.Nullable java.lang.String[] mSplitApkPaths\nprivate final @android.annotation.Nullable java.lang.String[] mSplitNames\nprivate final @android.annotation.Nullable java.lang.String[] mUsesSplitNames\nprivate final @android.annotation.Nullable java.lang.String[] mConfigForSplit\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mBaseRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String>[] mRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String>[] mSplitTypes\nprivate final int mVersionCodeMajor\nprivate final int mVersionCode\nprivate final int mTargetSdk\nprivate final int mBaseRevisionCode\nprivate final @android.annotation.Nullable int[] mSplitRevisionCodes\nprivate final int mInstallLocation\nprivate final @android.annotation.NonNull android.content.pm.VerifierInfo[] mVerifiers\nprivate final @android.annotation.NonNull android.content.pm.SigningDetails mSigningDetails\nprivate final @android.annotation.Nullable boolean[] mIsFeatureSplits\nprivate final boolean mIsolatedSplits\nprivate final boolean mSplitRequired\nprivate final boolean mCoreApp\nprivate final boolean mDebuggable\nprivate final boolean mMultiArch\nprivate final boolean mUse32bitAbi\nprivate final boolean mExtractNativeLibs\nprivate final boolean mProfileableByShell\nprivate final boolean mUseEmbeddedDex\nprivate final boolean mIsSdkLibrary\npublic java.util.List<java.lang.String> getAllApkPaths()\npublic long getLongVersionCode()\nprivate boolean hasAnyRequiredSplitTypes()\nclass PackageLite extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genConstDefs=false)")
+ inputSignatures = "private final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.NonNull java.lang.String mPath\nprivate final @android.annotation.NonNull java.lang.String mBaseApkPath\nprivate final @android.annotation.Nullable java.lang.String[] mSplitApkPaths\nprivate final @android.annotation.Nullable java.lang.String[] mSplitNames\nprivate final @android.annotation.Nullable java.lang.String[] mUsesSplitNames\nprivate final @android.annotation.Nullable java.lang.String[] mConfigForSplit\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String> mBaseRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String>[] mRequiredSplitTypes\nprivate final @android.annotation.Nullable java.util.Set<java.lang.String>[] mSplitTypes\nprivate final int mVersionCodeMajor\nprivate final int mVersionCode\nprivate final int mTargetSdk\nprivate final int mBaseRevisionCode\nprivate final @android.annotation.Nullable int[] mSplitRevisionCodes\nprivate final int mInstallLocation\nprivate final @android.annotation.NonNull android.content.pm.VerifierInfo[] mVerifiers\nprivate final @android.annotation.NonNull android.content.pm.SigningDetails mSigningDetails\nprivate final @android.annotation.Nullable boolean[] mIsFeatureSplits\nprivate final boolean mIsolatedSplits\nprivate final boolean mSplitRequired\nprivate final boolean mCoreApp\nprivate final boolean mDebuggable\nprivate final boolean mMultiArch\nprivate final boolean mUse32bitAbi\nprivate final boolean mExtractNativeLibs\nprivate final boolean mProfileableByShell\nprivate final boolean mUseEmbeddedDex\nprivate final boolean mIsSdkLibrary\nprivate final boolean mClearUserDataAllowed\nprivate final boolean mBackupAllowed\nprivate final boolean mDefaultToDeviceProtectedStorage\nprivate final boolean mRequestLegacyExternalStorage\nprivate final boolean mUserDataFragile\nprivate final boolean mClearUserDataOnFailedRestoreAllowed\npublic java.util.List<java.lang.String> getAllApkPaths()\npublic long getLongVersionCode()\nprivate boolean hasAnyRequiredSplitTypes()\nclass PackageLite extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genConstDefs=false)")
@Deprecated
private void __metadata() {}
diff --git a/core/java/android/content/res/ResourcesImpl.java b/core/java/android/content/res/ResourcesImpl.java
index 76b29e6..5cc3b92 100644
--- a/core/java/android/content/res/ResourcesImpl.java
+++ b/core/java/android/content/res/ResourcesImpl.java
@@ -27,7 +27,6 @@
import android.annotation.RawRes;
import android.annotation.StyleRes;
import android.annotation.StyleableRes;
-import android.app.ResourcesManager;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo.Config;
@@ -430,49 +429,35 @@
if ((configChanges & ActivityInfo.CONFIG_LOCALE) != 0) {
if (locales.size() > 1) {
String[] availableLocales;
- if (ResourcesManager.getInstance().getLocaleList().isEmpty()) {
- // The LocaleList has changed. We must query the AssetManager's
- // available Locales and figure out the best matching Locale in the new
- // LocaleList.
- availableLocales = mAssets.getNonSystemLocales();
+ // The LocaleList has changed. We must query the AssetManager's
+ // available Locales and figure out the best matching Locale in the new
+ // LocaleList.
+ availableLocales = mAssets.getNonSystemLocales();
+ if (LocaleList.isPseudoLocalesOnly(availableLocales)) {
+ // No app defined locales, so grab the system locales.
+ availableLocales = mAssets.getLocales();
if (LocaleList.isPseudoLocalesOnly(availableLocales)) {
- // No app defined locales, so grab the system locales.
- availableLocales = mAssets.getLocales();
- if (LocaleList.isPseudoLocalesOnly(availableLocales)) {
- availableLocales = null;
- }
+ availableLocales = null;
}
+ }
- if (availableLocales != null) {
- final Locale bestLocale = locales.getFirstMatchWithEnglishSupported(
- availableLocales);
- if (bestLocale != null) {
- selectedLocales = new String[]{
- adjustLanguageTag(bestLocale.toLanguageTag())};
- if (!bestLocale.equals(locales.get(0))) {
- mConfiguration.setLocales(
- new LocaleList(bestLocale, locales));
- }
+ if (availableLocales != null) {
+ final Locale bestLocale = locales.getFirstMatchWithEnglishSupported(
+ availableLocales);
+ if (bestLocale != null) {
+ selectedLocales = new String[]{
+ adjustLanguageTag(bestLocale.toLanguageTag())};
+ if (!bestLocale.equals(locales.get(0))) {
+ mConfiguration.setLocales(
+ new LocaleList(bestLocale, locales));
}
}
- } else {
- selectedLocales = locales.getIntersection(
- ResourcesManager.getInstance().getLocaleList());
- defaultLocale = ResourcesManager.getInstance()
- .getLocaleList().get(0).toLanguageTag();
}
}
}
if (selectedLocales == null) {
- if (ResourcesManager.getInstance().getLocaleList().isEmpty()) {
- selectedLocales = new String[]{
- adjustLanguageTag(locales.get(0).toLanguageTag())};
- } else {
- selectedLocales = new String[locales.size()];
- for (int i = 0; i < locales.size(); i++) {
- selectedLocales[i] = adjustLanguageTag(locales.get(i).toLanguageTag());
- }
- }
+ selectedLocales = new String[]{
+ adjustLanguageTag(locales.get(0).toLanguageTag())};
}
if (mConfiguration.densityDpi != Configuration.DENSITY_DPI_UNDEFINED) {
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index c0a44b1..f1ae9be 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -890,10 +890,13 @@
mSystemCallingHideSoftInput = true;
mCurHideInputToken = hideInputToken;
mCurStatsToken = statsToken;
- hideSoftInput(flags, resultReceiver);
- mCurStatsToken = null;
- mCurHideInputToken = null;
- mSystemCallingHideSoftInput = false;
+ try {
+ hideSoftInput(flags, resultReceiver);
+ } finally {
+ mCurStatsToken = null;
+ mCurHideInputToken = null;
+ mSystemCallingHideSoftInput = false;
+ }
}
/**
diff --git a/core/java/android/view/HandwritingInitiator.java b/core/java/android/view/HandwritingInitiator.java
index 23afb03..a208d1f 100644
--- a/core/java/android/view/HandwritingInitiator.java
+++ b/core/java/android/view/HandwritingInitiator.java
@@ -81,6 +81,8 @@
private int mConnectionCount = 0;
private final InputMethodManager mImm;
+ private final Rect mTempRect = new Rect();
+
private final RectF mTempRectF = new RectF();
private final Region mTempRegion = new Region();
@@ -401,8 +403,9 @@
final View cachedHoverTarget = getCachedHoverTarget();
if (cachedHoverTarget != null) {
- final Rect handwritingArea = getViewHandwritingArea(cachedHoverTarget);
- if (isInHandwritingArea(handwritingArea, hoverX, hoverY, cachedHoverTarget,
+ final Rect handwritingArea = mTempRect;
+ if (getViewHandwritingArea(cachedHoverTarget, handwritingArea)
+ && isInHandwritingArea(handwritingArea, hoverX, hoverY, cachedHoverTarget,
/* isHover */ true)
&& shouldTriggerStylusHandwritingForView(cachedHoverTarget)) {
return cachedHoverTarget;
@@ -445,8 +448,9 @@
// directly return the connectedView.
final View connectedView = getConnectedView();
if (connectedView != null) {
- Rect handwritingArea = getViewHandwritingArea(connectedView);
- if (isInHandwritingArea(handwritingArea, x, y, connectedView, isHover)
+ Rect handwritingArea = mTempRect;
+ if (getViewHandwritingArea(connectedView, handwritingArea)
+ && isInHandwritingArea(handwritingArea, x, y, connectedView, isHover)
&& shouldTriggerStylusHandwritingForView(connectedView)) {
return connectedView;
}
@@ -528,28 +532,30 @@
/**
* Return the handwriting area of the given view, represented in the window's coordinate.
* If the view didn't set any handwriting area, it will return the view's boundary.
- * It will return null if the view or its handwriting area is not visible.
*
- * The handwriting area is clipped to its visible part.
+ * <p> The handwriting area is clipped to its visible part.
* Notice that the returned rectangle is the view's original handwriting area without the
- * view's handwriting area extends.
+ * view's handwriting area extends. </p>
+ *
+ * @param view the {@link View} whose handwriting area we want to compute.
+ * @param rect the {@link Rect} to receive the result.
+ *
+ * @return true if the view's handwriting area is still visible, or false if it's clipped and
+ * fully invisible. This method only consider the clip by given view's parents, but not the case
+ * where a view is covered by its sibling view.
*/
- @Nullable
- private static Rect getViewHandwritingArea(@NonNull View view) {
+ private static boolean getViewHandwritingArea(@NonNull View view, @NonNull Rect rect) {
final ViewParent viewParent = view.getParent();
if (viewParent != null && view.isAttachedToWindow() && view.isAggregatedVisible()) {
final Rect localHandwritingArea = view.getHandwritingArea();
- final Rect globalHandwritingArea = new Rect();
if (localHandwritingArea != null) {
- globalHandwritingArea.set(localHandwritingArea);
+ rect.set(localHandwritingArea);
} else {
- globalHandwritingArea.set(0, 0, view.getWidth(), view.getHeight());
+ rect.set(0, 0, view.getWidth(), view.getHeight());
}
- if (viewParent.getChildVisibleRect(view, globalHandwritingArea, null)) {
- return globalHandwritingArea;
- }
+ return viewParent.getChildVisibleRect(view, rect, null);
}
- return null;
+ return false;
}
/**
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 62e37a4..b8385c6 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -1318,8 +1318,8 @@
* that have the ignore orientation request display setting enabled by OEMs
* (enables compatibility mode for fixed orientation on Android 12 (API
* level 31) or higher; see
- * <a href="https://developer.android.com/guide/topics/large-screens/large-screen-app-compatibility">
- * Large screen app compatibility</a>
+ * <a href="https://developer.android.com/guide/topics/large-screens/large-screen-compatibility-mode">
+ * Large screen compatibility mode</a>
* for more details).
*
* <p>To opt out of the user aspect ratio compatibility override, add this property
@@ -1358,8 +1358,8 @@
* that have the ignore orientation request display setting enabled by OEMs
* (enables compatibility mode for fixed orientation on Android 12 (API
* level 31) or higher; see
- * <a href="https://developer.android.com/guide/topics/large-screens/large-screen-app-compatibility">
- * Large screen app compatibility</a>
+ * <a href="https://developer.android.com/guide/topics/large-screens/large-screen-compatibility-mode">
+ * Large screen compatibility mode</a>
* for more details).
*
* <p>To opt out of the full-screen option of the user aspect ratio compatibility
diff --git a/core/tests/coretests/res/layout/viewgroup_test.xml b/core/tests/coretests/res/layout/viewgroup_test.xml
index 04f4f52..9b57047 100644
--- a/core/tests/coretests/res/layout/viewgroup_test.xml
+++ b/core/tests/coretests/res/layout/viewgroup_test.xml
@@ -42,8 +42,8 @@
android:id="@+id/view_translate"
android:layout_width="20dp"
android:layout_height="10dp"
- android:translationX="10dp"
- android:translationY="20dp"
+ android:translationX="10px"
+ android:translationY="20px"
android:text="Hello World!"
android:background="#2F00FF00" />
<FrameLayout
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/WindowExtensionsImpl.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/WindowExtensionsImpl.java
index 55eabb0..c3d8f9a 100644
--- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/WindowExtensionsImpl.java
+++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/WindowExtensionsImpl.java
@@ -16,12 +16,14 @@
package androidx.window.extensions;
+import android.app.ActivityTaskManager;
import android.app.ActivityThread;
import android.app.Application;
import android.content.Context;
import android.window.TaskFragmentOrganizer;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.window.common.DeviceStateManagerFoldingFeatureProducer;
import androidx.window.common.RawFoldingFeatureProducer;
import androidx.window.extensions.area.WindowAreaComponent;
@@ -111,9 +113,13 @@
* {@link WindowExtensions#getWindowLayoutComponent()}.
* @return {@link ActivityEmbeddingComponent} OEM implementation.
*/
- @NonNull
+ @Nullable
public ActivityEmbeddingComponent getActivityEmbeddingComponent() {
if (mSplitController == null) {
+ if (!ActivityTaskManager.supportsMultiWindow(getApplication())) {
+ // Disable AE for device that doesn't support multi window.
+ return null;
+ }
synchronized (mLock) {
if (mSplitController == null) {
mSplitController = new SplitController(
diff --git a/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/WindowExtensionsTest.java b/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/WindowExtensionsTest.java
index d189ae2..45564cb 100644
--- a/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/WindowExtensionsTest.java
+++ b/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/WindowExtensionsTest.java
@@ -16,8 +16,11 @@
package androidx.window.extensions;
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+
import static com.google.common.truth.Truth.assertThat;
+import android.app.ActivityTaskManager;
import android.platform.test.annotations.Presubmit;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -52,7 +55,11 @@
@Test
public void testGetActivityEmbeddingComponent() {
- assertThat(mExtensions.getActivityEmbeddingComponent()).isNotNull();
+ if (ActivityTaskManager.supportsMultiWindow(getInstrumentation().getContext())) {
+ assertThat(mExtensions.getActivityEmbeddingComponent()).isNotNull();
+ } else {
+ assertThat(mExtensions.getActivityEmbeddingComponent()).isNull();
+ }
}
@Test
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java
index e3922d6..018d674 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java
@@ -1059,7 +1059,21 @@
private void resetPrevPip(@NonNull TransitionInfo.Change prevPipTaskChange,
@NonNull SurfaceControl.Transaction startTransaction) {
final SurfaceControl leash = prevPipTaskChange.getLeash();
- startTransaction.remove(leash);
+ final Rect bounds = prevPipTaskChange.getEndAbsBounds();
+ final Point offset = prevPipTaskChange.getEndRelOffset();
+ bounds.offset(-offset.x, -offset.y);
+
+ startTransaction.setWindowCrop(leash, null);
+ startTransaction.setMatrix(leash, 1, 0, 0, 1);
+ startTransaction.setCornerRadius(leash, 0);
+ startTransaction.setPosition(leash, bounds.left, bounds.top);
+
+ if (mHasFadeOut && prevPipTaskChange.getTaskInfo().isVisible()) {
+ if (mPipAnimationController.getCurrentAnimator() != null) {
+ mPipAnimationController.getCurrentAnimator().cancel();
+ }
+ startTransaction.setAlpha(leash, 1);
+ }
mHasFadeOut = false;
mCurrentPipTaskToken = null;
diff --git a/packages/SystemUI/src/com/android/keyguard/PinShapeNonHintingView.java b/packages/SystemUI/src/com/android/keyguard/PinShapeNonHintingView.java
index 56c0953..5f33ef9 100644
--- a/packages/SystemUI/src/com/android/keyguard/PinShapeNonHintingView.java
+++ b/packages/SystemUI/src/com/android/keyguard/PinShapeNonHintingView.java
@@ -61,7 +61,7 @@
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
- if (getChildCount() > 0) {
+ if (getChildCount() > 2) {
View firstChild = getChildAt(0);
boolean isVisible = firstChild.getLocalVisibleRect(mFirstChildVisibleRect);
boolean clipped = mFirstChildVisibleRect.left > 0
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
index 845bf25..0fb1b48 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
+++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
@@ -768,7 +768,7 @@
/** Enable the share wifi button in Quick Settings internet dialog. */
@JvmField
- val SHARE_WIFI_QS_BUTTON = unreleasedFlag("share_wifi_qs_button")
+ val SHARE_WIFI_QS_BUTTON = unreleasedFlag("share_wifi_qs_button", teamfood = true)
/** Enable haptic slider component in the brightness slider */
@JvmField
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
index 2814732..8b0b0ae 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
@@ -78,6 +78,22 @@
}
if (featureFlags.isEnabled(Flags.MIGRATE_SPLIT_KEYGUARD_BOTTOM_AREA)) {
+ launch { viewModel.alpha.collect { alpha -> view.alpha = alpha } }
+ }
+
+ if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) {
+ launch {
+ viewModel.translationY.collect {
+ val statusView =
+ view.requireViewById<View>(R.id.keyguard_status_view)
+ statusView.translationY = it
+ }
+ }
+ }
+ }
+
+ repeatOnLifecycle(Lifecycle.State.STARTED) {
+ if (featureFlags.isEnabled(Flags.MIGRATE_SPLIT_KEYGUARD_BOTTOM_AREA)) {
launch {
viewModel.keyguardRootViewVisibilityState.collect { visibilityState ->
view.animate().cancel()
@@ -111,18 +127,6 @@
}
}
}
-
- launch { viewModel.alpha.collect { alpha -> view.alpha = alpha } }
- }
-
- if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) {
- launch {
- viewModel.translationY.collect {
- val statusView =
- view.requireViewById<View>(R.id.keyguard_status_view)
- statusView.translationY = it
- }
- }
}
}
}
diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java
index bf88580..1554072 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerSession.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java
@@ -2805,9 +2805,18 @@
throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
"Session not sealed");
}
- Objects.requireNonNull(mPackageName);
- Objects.requireNonNull(mSigningDetails);
- Objects.requireNonNull(mResolvedBaseFile);
+ if (mPackageName == null) {
+ throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
+ "Session no package name");
+ }
+ if (mSigningDetails == null) {
+ throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
+ "Session no signing data");
+ }
+ if (mResolvedBaseFile == null) {
+ throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
+ "Session no resolved base file");
+ }
final PackageLite result;
if (!isApexSession()) {
// For mode inherit existing, it would link/copy existing files to stage dir in
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 64e8f7a..8faadba 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -116,7 +116,11 @@
import android.content.pm.VerifierDeviceIdentity;
import android.content.pm.VersionedPackage;
import android.content.pm.overlay.OverlayPaths;
+import android.content.pm.parsing.ApkLite;
+import android.content.pm.parsing.ApkLiteParseUtils;
import android.content.pm.parsing.PackageLite;
+import android.content.pm.parsing.result.ParseResult;
+import android.content.pm.parsing.result.ParseTypeImpl;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Bitmap;
@@ -6301,33 +6305,32 @@
@Override
public ArchivedPackageParcel getArchivedPackage(String apkPath) {
- final ParsedPackage parsedPackage;
- try (PackageParser2 pp = mInjector.getPreparingPackageParser()) {
- parsedPackage = pp.parsePackage(new File(apkPath),
- getDefParseFlags() | ParsingPackageUtils.PARSE_COLLECT_CERTIFICATES, false);
- } catch (PackageManagerException e) {
- throw new IllegalArgumentException("Failed parse", e);
+ ParseTypeImpl input = ParseTypeImpl.forDefaultParsing();
+ ParseResult<ApkLite> result = ApkLiteParseUtils.parseApkLite(input.reset(),
+ new File(apkPath), ParsingPackageUtils.PARSE_COLLECT_CERTIFICATES);
+ if (result.isError()) {
+ throw new IllegalArgumentException(result.getErrorMessage(), result.getException());
}
+ final ApkLite apk = result.getResult();
ArchivedPackageParcel archPkg = new ArchivedPackageParcel();
- archPkg.packageName = parsedPackage.getPackageName();
- archPkg.signingDetails = parsedPackage.getSigningDetails();
+ archPkg.packageName = apk.getPackageName();
+ archPkg.signingDetails = apk.getSigningDetails();
- long longVersionCode = parsedPackage.getLongVersionCode();
- archPkg.versionCodeMajor = (int) (longVersionCode >> 32);
- archPkg.versionCode = (int) longVersionCode;
+ archPkg.versionCodeMajor = apk.getVersionCodeMajor();
+ archPkg.versionCode = apk.getVersionCode();
- archPkg.targetSdkVersion = parsedPackage.getTargetSdkVersion();
+ archPkg.targetSdkVersion = apk.getTargetSdkVersion();
// These get translated in flags important for user data management.
- archPkg.clearUserDataAllowed = parsedPackage.isClearUserDataAllowed();
- archPkg.backupAllowed = parsedPackage.isBackupAllowed();
+ archPkg.clearUserDataAllowed = apk.isClearUserDataAllowed();
+ archPkg.backupAllowed = apk.isBackupAllowed();
archPkg.defaultToDeviceProtectedStorage =
- parsedPackage.isDefaultToDeviceProtectedStorage();
- archPkg.requestLegacyExternalStorage = parsedPackage.isRequestLegacyExternalStorage();
- archPkg.userDataFragile = parsedPackage.isUserDataFragile();
+ apk.isDefaultToDeviceProtectedStorage();
+ archPkg.requestLegacyExternalStorage = apk.isRequestLegacyExternalStorage();
+ archPkg.userDataFragile = apk.isUserDataFragile();
archPkg.clearUserDataOnFailedRestoreAllowed =
- parsedPackage.isClearUserDataOnFailedRestoreAllowed();
+ apk.isClearUserDataOnFailedRestoreAllowed();
return archPkg;
}
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index d2adfdd..f04f338 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -2916,11 +2916,7 @@
StringBuilder sb = new StringBuilder();
for (final PackageSetting ps : mPackages.values()) {
- // TODO(b/135203078): This doesn't handle multiple users
- final String dataPath = PackageInfoUtils.getDataDir(ps, UserHandle.USER_SYSTEM)
- .getAbsolutePath();
-
- if (ps.getPkg() == null || dataPath == null) {
+ if (ps.getPkg() == null) {
if (!"android".equals(ps.getPackageName())) {
Slog.w(TAG, "Skipping " + ps + " due to missing metadata");
}
@@ -2932,6 +2928,10 @@
continue;
}
+ // TODO(b/135203078): This doesn't handle multiple users
+ final File dataDir = PackageInfoUtils.getDataDir(ps, UserHandle.USER_SYSTEM);
+ final String dataPath = dataDir == null ? "null" : dataDir.getAbsolutePath();
+
final boolean isDebug = ps.getPkg().isDebuggable();
final IntArray gids = new IntArray();
for (final int userId : userIds) {
@@ -2973,7 +2973,7 @@
sb.append(ps.getSeInfo());
sb.append(" ");
final int gidsSize = gids.size();
- if (gids != null && gids.size() > 0) {
+ if (gids.size() > 0) {
sb.append(gids.get(0));
for (int i = 1; i < gidsSize; i++) {
sb.append(",");
diff --git a/services/core/java/com/android/server/pm/UserTypeFactory.java b/services/core/java/com/android/server/pm/UserTypeFactory.java
index b7f9aaf..85b60a0 100644
--- a/services/core/java/com/android/server/pm/UserTypeFactory.java
+++ b/services/core/java/com/android/server/pm/UserTypeFactory.java
@@ -51,6 +51,7 @@
import android.util.ArrayMap;
import android.util.Slog;
+import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.XmlUtils;
@@ -284,9 +285,9 @@
.setBadgeLabels(
com.android.internal.R.string.private_profile_label_badge)
.setBadgeColors(
- com.android.internal.R.color.system_accent1_900)
+ R.color.black)
.setDarkThemeBadgeColors(
- com.android.internal.R.color.system_accent1_900)
+ R.color.white)
.setDefaultRestrictions(getDefaultProfileRestrictions())
.setDefaultSecureSettings(getDefaultNonManagedProfileSecureSettings())
.setDefaultUserProperties(new UserProperties.Builder()
diff --git a/services/core/java/com/android/server/pm/pkg/parsing/ParsingPackageUtils.java b/services/core/java/com/android/server/pm/pkg/parsing/ParsingPackageUtils.java
index d9ad353..2d55b9f 100644
--- a/services/core/java/com/android/server/pm/pkg/parsing/ParsingPackageUtils.java
+++ b/services/core/java/com/android/server/pm/pkg/parsing/ParsingPackageUtils.java
@@ -513,17 +513,21 @@
// parseBaseAppBasicFlags
pkg
// Default true
- .setBackupAllowed(true)
- .setClearUserDataAllowed(true)
- .setClearUserDataOnFailedRestoreAllowed(true)
+ .setBackupAllowed(lite.isBackupAllowed())
+ .setClearUserDataAllowed(lite.isClearUserDataAllowed())
+ .setClearUserDataOnFailedRestoreAllowed(
+ lite.isClearUserDataOnFailedRestoreAllowed())
.setAllowNativeHeapPointerTagging(true)
.setEnabled(true)
.setExtractNativeLibrariesRequested(true)
// targetSdkVersion gated
.setAllowAudioPlaybackCapture(targetSdk >= Build.VERSION_CODES.Q)
.setHardwareAccelerated(targetSdk >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
- .setRequestLegacyExternalStorage(targetSdk < Build.VERSION_CODES.Q)
+ .setRequestLegacyExternalStorage(lite.isRequestLegacyExternalStorage())
.setCleartextTrafficAllowed(targetSdk < Build.VERSION_CODES.P)
+ // Default false
+ .setDefaultToDeviceProtectedStorage(lite.isDefaultToDeviceProtectedStorage())
+ .setUserDataFragile(lite.isUserDataFragile())
// Ints
.setCategory(ApplicationInfo.CATEGORY_UNDEFINED)
// Floats Default 0f
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 6085488..90e67df 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -3363,7 +3363,11 @@
// current focused activity could be another activity in the same Task if activities are
// displayed on adjacent TaskFragments.
final ActivityRecord currentFocusedApp = mDisplayContent.mFocusedApp;
- if (currentFocusedApp != null && currentFocusedApp.task == task) {
+ final int topFocusedDisplayId = mRootWindowContainer.getTopFocusedDisplayContent() != null
+ ? mRootWindowContainer.getTopFocusedDisplayContent().getDisplayId()
+ : INVALID_DISPLAY;
+ if (currentFocusedApp != null && currentFocusedApp.task == task
+ && topFocusedDisplayId == mDisplayContent.getDisplayId()) {
final Task topFocusableTask = mDisplayContent.getTask(
(t) -> t.isLeafTask() && t.isFocusable(), true /* traverseTopToBottom */);
if (task == topFocusableTask) {