Extend splash screen exception list to SC-V2
Extend the support of the exception list for SC-V2 and apps targeting S and SC-V2. Test: atest ActivityRecordTests Test: com.android.server.wm.SplashScreenExceptionListTest Bug: 231708538 Merged-In: I5412e81f70cbc9aac3861d13d85e199e949bedc7 Change-Id: I70a2aa4684c1267fe98e0e2260c61042db9c2e36
This commit is contained in:
@@ -81,7 +81,7 @@ class SplashScreenExceptionList {
|
|||||||
@SuppressWarnings("AndroidFrameworkCompatChange") // Target sdk check
|
@SuppressWarnings("AndroidFrameworkCompatChange") // Target sdk check
|
||||||
public boolean isException(@NonNull String packageName, int targetSdk,
|
public boolean isException(@NonNull String packageName, int targetSdk,
|
||||||
@Nullable Supplier<ApplicationInfo> infoSupplier) {
|
@Nullable Supplier<ApplicationInfo> infoSupplier) {
|
||||||
if (targetSdk >= Build.VERSION_CODES.S) {
|
if (targetSdk > Build.VERSION_CODES.S_V2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2528,7 +2528,9 @@ public class ActivityRecordTests extends WindowTestsBase {
|
|||||||
DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER,
|
DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER,
|
||||||
"splash_screen_exception_list", DEFAULT_COMPONENT_PACKAGE_NAME, false);
|
"splash_screen_exception_list", DEFAULT_COMPONENT_PACKAGE_NAME, false);
|
||||||
testLegacySplashScreen(Build.VERSION_CODES.R, TYPE_PARAMETER_LEGACY_SPLASH_SCREEN);
|
testLegacySplashScreen(Build.VERSION_CODES.R, TYPE_PARAMETER_LEGACY_SPLASH_SCREEN);
|
||||||
testLegacySplashScreen(Build.VERSION_CODES.S, 0);
|
testLegacySplashScreen(Build.VERSION_CODES.S, TYPE_PARAMETER_LEGACY_SPLASH_SCREEN);
|
||||||
|
testLegacySplashScreen(Build.VERSION_CODES.S_V2, TYPE_PARAMETER_LEGACY_SPLASH_SCREEN);
|
||||||
|
testLegacySplashScreen(Build.VERSION_CODES.S_V2 + 1, 0);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
DeviceConfig.setProperties(properties);
|
DeviceConfig.setProperties(properties);
|
||||||
|
|||||||
@@ -80,13 +80,19 @@ public class SplashScreenExceptionListTest {
|
|||||||
public void packageFromDeviceConfigIgnored() {
|
public void packageFromDeviceConfigIgnored() {
|
||||||
setExceptionListAndWaitForCallback("com.test.nosplashscreen1,com.test.nosplashscreen2");
|
setExceptionListAndWaitForCallback("com.test.nosplashscreen1,com.test.nosplashscreen2");
|
||||||
|
|
||||||
assertIsException("com.test.nosplashscreen1", null);
|
// In list, up to SC-V2 included
|
||||||
assertIsException("com.test.nosplashscreen2", null);
|
assertIsException("com.test.nosplashscreen1", VERSION_CODES.R);
|
||||||
|
assertIsException("com.test.nosplashscreen1", VERSION_CODES.S);
|
||||||
|
assertIsException("com.test.nosplashscreen1", VERSION_CODES.S_V2);
|
||||||
|
|
||||||
assertIsNotException("com.test.nosplashscreen1", VERSION_CODES.S, null);
|
// In list, after SC-V2
|
||||||
assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.S, null);
|
assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.S_V2 + 1);
|
||||||
assertIsNotException("com.test.splashscreen", VERSION_CODES.S, null);
|
assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.CUR_DEVELOPMENT);
|
||||||
assertIsNotException("com.test.splashscreen", VERSION_CODES.R, null);
|
|
||||||
|
// Not in list, up to SC-V2 included
|
||||||
|
assertIsNotException("com.test.splashscreen", VERSION_CODES.R);
|
||||||
|
assertIsNotException("com.test.splashscreen", VERSION_CODES.S);
|
||||||
|
assertIsNotException("com.test.splashscreen", VERSION_CODES.S_V2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setExceptionListAndWaitForCallback(String commaSeparatedList) {
|
private void setExceptionListAndWaitForCallback(String commaSeparatedList) {
|
||||||
@@ -123,16 +129,26 @@ public class SplashScreenExceptionListTest {
|
|||||||
metaData.putBoolean("android.splashscreen.exception_opt_out", true);
|
metaData.putBoolean("android.splashscreen.exception_opt_out", true);
|
||||||
assertIsNotException(packageName, VERSION_CODES.R, activityInfo);
|
assertIsNotException(packageName, VERSION_CODES.R, activityInfo);
|
||||||
assertIsNotException(packageName, VERSION_CODES.S, activityInfo);
|
assertIsNotException(packageName, VERSION_CODES.S, activityInfo);
|
||||||
|
assertIsNotException(packageName, VERSION_CODES.S_V2, activityInfo);
|
||||||
|
|
||||||
// Exception Pre S
|
// Exception up to T
|
||||||
metaData.putBoolean("android.splashscreen.exception_opt_out", false);
|
metaData.putBoolean("android.splashscreen.exception_opt_out", false);
|
||||||
assertIsException(packageName, activityInfo);
|
assertIsException(packageName, VERSION_CODES.R, activityInfo);
|
||||||
assertIsNotException(packageName, VERSION_CODES.S, activityInfo);
|
assertIsException(packageName, VERSION_CODES.S, activityInfo);
|
||||||
|
assertIsException(packageName, VERSION_CODES.S_V2, activityInfo);
|
||||||
|
|
||||||
|
// No Exception after T
|
||||||
|
assertIsNotException(packageName, VERSION_CODES.S_V2 + 1, activityInfo);
|
||||||
|
assertIsNotException(packageName, VERSION_CODES.CUR_DEVELOPMENT, activityInfo);
|
||||||
|
|
||||||
// Edge Cases
|
// Edge Cases
|
||||||
activityInfo.metaData = null;
|
activityInfo.metaData = null;
|
||||||
assertIsException(packageName, activityInfo);
|
assertIsException(packageName, VERSION_CODES.R, activityInfo);
|
||||||
assertIsException(packageName, null);
|
assertIsException(packageName, VERSION_CODES.R);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertIsNotException(String packageName, int targetSdk) {
|
||||||
|
assertIsNotException(packageName, targetSdk, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertIsNotException(String packageName, int targetSdk,
|
private void assertIsNotException(String packageName, int targetSdk,
|
||||||
@@ -142,10 +158,14 @@ public class SplashScreenExceptionListTest {
|
|||||||
mList.isException(packageName, targetSdk, () -> activityInfo));
|
mList.isException(packageName, targetSdk, () -> activityInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertIsException(String packageName,
|
private void assertIsException(String packageName, int targetSdk) {
|
||||||
|
assertIsException(packageName, targetSdk, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertIsException(String packageName, int targetSdk,
|
||||||
ApplicationInfo activityInfo) {
|
ApplicationInfo activityInfo) {
|
||||||
assertTrue(String.format("%s (sdk=%d) should have been considered as an exception",
|
assertTrue(String.format("%s (sdk=%d) should have been considered as an exception",
|
||||||
packageName, VERSION_CODES.R),
|
packageName, targetSdk),
|
||||||
mList.isException(packageName, VERSION_CODES.R, () -> activityInfo));
|
mList.isException(packageName, targetSdk, () -> activityInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user