Loading services/core/java/com/android/server/wm/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -2314,7 +2314,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final int type = getStartingWindowType(newTask, taskSwitch, processRunning, allowTaskSnapshot, activityCreated, activityAllDrawn, snapshot); //TODO(191787740) Remove for T //TODO(191787740) Remove for T+ final boolean useLegacy = type == STARTING_WINDOW_TYPE_SPLASH_SCREEN && mWmService.mStartingSurfaceController.isExceptionApp(packageName, mTargetSdk, () -> { Loading services/core/java/com/android/server/wm/SplashScreenExceptionList.java +2 −2 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ class SplashScreenExceptionList { } /** * Returns true if the packageName is in the list and the target sdk is before S. * Returns true if the packageName is in the list and the target sdk is before or including T. * * @param packageName The package name of the application to check * @param targetSdk The target sdk of the application Loading @@ -82,7 +82,7 @@ class SplashScreenExceptionList { @SuppressWarnings("AndroidFrameworkCompatChange") // Target sdk check public boolean isException(@NonNull String packageName, int targetSdk, @Nullable Supplier<ApplicationInfo> infoSupplier) { if (targetSdk >= Build.VERSION_CODES.S) { if (targetSdk > Build.VERSION_CODES.TIRAMISU) { return false; } Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +5 −1 Original line number Diff line number Diff line Loading @@ -2630,7 +2630,11 @@ public class ActivityRecordTests extends WindowTestsBase { DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER, "splash_screen_exception_list", DEFAULT_COMPONENT_PACKAGE_NAME, false); 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.TIRAMISU, TYPE_PARAMETER_LEGACY_SPLASH_SCREEN); // Above T testLegacySplashScreen(Build.VERSION_CODES.TIRAMISU + 1, 0); } finally { try { DeviceConfig.setProperties(properties); Loading services/tests/wmtests/src/com/android/server/wm/SplashScreenExceptionListTest.java +53 −33 Original line number Diff line number Diff line Loading @@ -90,30 +90,19 @@ public class SplashScreenExceptionListTest { public void packageFromDeviceConfigIgnored() { setExceptionListAndWaitForCallback("com.test.nosplashscreen1,com.test.nosplashscreen2"); assertIsException("com.test.nosplashscreen1", null); assertIsException("com.test.nosplashscreen2", null); assertIsNotException("com.test.nosplashscreen1", VERSION_CODES.S, null); assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.S, null); assertIsNotException("com.test.splashscreen", VERSION_CODES.S, null); assertIsNotException("com.test.splashscreen", VERSION_CODES.R, null); } private void setExceptionListAndWaitForCallback(String commaSeparatedList) { CountDownLatch latch = new CountDownLatch(1); mOnUpdateDeviceConfig = rawList -> { if (commaSeparatedList.equals(rawList)) { latch.countDown(); } }; DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER, KEY_SPLASH_SCREEN_EXCEPTION_LIST, commaSeparatedList, false); try { assertTrue("Timed out waiting for DeviceConfig to be updated.", latch.await(1, TimeUnit.SECONDS)); } catch (InterruptedException e) { Assert.fail(e.getMessage()); } // In list, up to T included assertIsException("com.test.nosplashscreen1", VERSION_CODES.R); assertIsException("com.test.nosplashscreen1", VERSION_CODES.S); assertIsException("com.test.nosplashscreen1", VERSION_CODES.TIRAMISU); // In list, after T assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.TIRAMISU + 1); assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.CUR_DEVELOPMENT); // Not in list, up to T included assertIsNotException("com.test.splashscreen", VERSION_CODES.S); assertIsNotException("com.test.splashscreen", VERSION_CODES.R); assertIsNotException("com.test.splashscreen", VERSION_CODES.TIRAMISU); } @Test Loading @@ -129,16 +118,43 @@ public class SplashScreenExceptionListTest { metaData.putBoolean("android.splashscreen.exception_opt_out", true); assertIsNotException(packageName, VERSION_CODES.R, activityInfo); assertIsNotException(packageName, VERSION_CODES.S, activityInfo); assertIsNotException(packageName, VERSION_CODES.TIRAMISU, activityInfo); // Exception Pre S // Exception up to T metaData.putBoolean("android.splashscreen.exception_opt_out", false); assertIsException(packageName, activityInfo); assertIsNotException(packageName, VERSION_CODES.S, activityInfo); assertIsException(packageName, VERSION_CODES.R, activityInfo); assertIsException(packageName, VERSION_CODES.S, activityInfo); assertIsException(packageName, VERSION_CODES.TIRAMISU, activityInfo); // No Exception after T assertIsNotException(packageName, VERSION_CODES.TIRAMISU + 1, activityInfo); assertIsNotException(packageName, VERSION_CODES.CUR_DEVELOPMENT, activityInfo); // Edge Cases activityInfo.metaData = null; assertIsException(packageName, activityInfo); assertIsException(packageName, null); assertIsException(packageName, VERSION_CODES.R, activityInfo); assertIsException(packageName, VERSION_CODES.R); } private void setExceptionListAndWaitForCallback(String commaSeparatedList) { CountDownLatch latch = new CountDownLatch(1); mOnUpdateDeviceConfig = rawList -> { if (commaSeparatedList.equals(rawList)) { latch.countDown(); } }; DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER, KEY_SPLASH_SCREEN_EXCEPTION_LIST, commaSeparatedList, false); try { assertTrue("Timed out waiting for DeviceConfig to be updated.", latch.await(1, TimeUnit.SECONDS)); } catch (InterruptedException e) { Assert.fail(e.getMessage()); } } private void assertIsNotException(String packageName, int targetSdk) { assertIsNotException(packageName, targetSdk, null); } private void assertIsNotException(String packageName, int targetSdk, Loading @@ -148,10 +164,14 @@ public class SplashScreenExceptionListTest { mList.isException(packageName, targetSdk, () -> activityInfo)); } private void assertIsException(String packageName, int targetSdk) { assertIsException(packageName, targetSdk, null); } private void assertIsException(String packageName, ApplicationInfo activityInfo) { int targetSdk, ApplicationInfo activityInfo) { assertTrue(String.format("%s (sdk=%d) should have been considered as an exception", packageName, VERSION_CODES.R), mList.isException(packageName, VERSION_CODES.R, () -> activityInfo)); packageName, targetSdk), mList.isException(packageName, targetSdk, () -> activityInfo)); } } Loading
services/core/java/com/android/server/wm/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -2314,7 +2314,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final int type = getStartingWindowType(newTask, taskSwitch, processRunning, allowTaskSnapshot, activityCreated, activityAllDrawn, snapshot); //TODO(191787740) Remove for T //TODO(191787740) Remove for T+ final boolean useLegacy = type == STARTING_WINDOW_TYPE_SPLASH_SCREEN && mWmService.mStartingSurfaceController.isExceptionApp(packageName, mTargetSdk, () -> { Loading
services/core/java/com/android/server/wm/SplashScreenExceptionList.java +2 −2 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ class SplashScreenExceptionList { } /** * Returns true if the packageName is in the list and the target sdk is before S. * Returns true if the packageName is in the list and the target sdk is before or including T. * * @param packageName The package name of the application to check * @param targetSdk The target sdk of the application Loading @@ -82,7 +82,7 @@ class SplashScreenExceptionList { @SuppressWarnings("AndroidFrameworkCompatChange") // Target sdk check public boolean isException(@NonNull String packageName, int targetSdk, @Nullable Supplier<ApplicationInfo> infoSupplier) { if (targetSdk >= Build.VERSION_CODES.S) { if (targetSdk > Build.VERSION_CODES.TIRAMISU) { return false; } Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +5 −1 Original line number Diff line number Diff line Loading @@ -2630,7 +2630,11 @@ public class ActivityRecordTests extends WindowTestsBase { DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER, "splash_screen_exception_list", DEFAULT_COMPONENT_PACKAGE_NAME, false); 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.TIRAMISU, TYPE_PARAMETER_LEGACY_SPLASH_SCREEN); // Above T testLegacySplashScreen(Build.VERSION_CODES.TIRAMISU + 1, 0); } finally { try { DeviceConfig.setProperties(properties); Loading
services/tests/wmtests/src/com/android/server/wm/SplashScreenExceptionListTest.java +53 −33 Original line number Diff line number Diff line Loading @@ -90,30 +90,19 @@ public class SplashScreenExceptionListTest { public void packageFromDeviceConfigIgnored() { setExceptionListAndWaitForCallback("com.test.nosplashscreen1,com.test.nosplashscreen2"); assertIsException("com.test.nosplashscreen1", null); assertIsException("com.test.nosplashscreen2", null); assertIsNotException("com.test.nosplashscreen1", VERSION_CODES.S, null); assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.S, null); assertIsNotException("com.test.splashscreen", VERSION_CODES.S, null); assertIsNotException("com.test.splashscreen", VERSION_CODES.R, null); } private void setExceptionListAndWaitForCallback(String commaSeparatedList) { CountDownLatch latch = new CountDownLatch(1); mOnUpdateDeviceConfig = rawList -> { if (commaSeparatedList.equals(rawList)) { latch.countDown(); } }; DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER, KEY_SPLASH_SCREEN_EXCEPTION_LIST, commaSeparatedList, false); try { assertTrue("Timed out waiting for DeviceConfig to be updated.", latch.await(1, TimeUnit.SECONDS)); } catch (InterruptedException e) { Assert.fail(e.getMessage()); } // In list, up to T included assertIsException("com.test.nosplashscreen1", VERSION_CODES.R); assertIsException("com.test.nosplashscreen1", VERSION_CODES.S); assertIsException("com.test.nosplashscreen1", VERSION_CODES.TIRAMISU); // In list, after T assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.TIRAMISU + 1); assertIsNotException("com.test.nosplashscreen2", VERSION_CODES.CUR_DEVELOPMENT); // Not in list, up to T included assertIsNotException("com.test.splashscreen", VERSION_CODES.S); assertIsNotException("com.test.splashscreen", VERSION_CODES.R); assertIsNotException("com.test.splashscreen", VERSION_CODES.TIRAMISU); } @Test Loading @@ -129,16 +118,43 @@ public class SplashScreenExceptionListTest { metaData.putBoolean("android.splashscreen.exception_opt_out", true); assertIsNotException(packageName, VERSION_CODES.R, activityInfo); assertIsNotException(packageName, VERSION_CODES.S, activityInfo); assertIsNotException(packageName, VERSION_CODES.TIRAMISU, activityInfo); // Exception Pre S // Exception up to T metaData.putBoolean("android.splashscreen.exception_opt_out", false); assertIsException(packageName, activityInfo); assertIsNotException(packageName, VERSION_CODES.S, activityInfo); assertIsException(packageName, VERSION_CODES.R, activityInfo); assertIsException(packageName, VERSION_CODES.S, activityInfo); assertIsException(packageName, VERSION_CODES.TIRAMISU, activityInfo); // No Exception after T assertIsNotException(packageName, VERSION_CODES.TIRAMISU + 1, activityInfo); assertIsNotException(packageName, VERSION_CODES.CUR_DEVELOPMENT, activityInfo); // Edge Cases activityInfo.metaData = null; assertIsException(packageName, activityInfo); assertIsException(packageName, null); assertIsException(packageName, VERSION_CODES.R, activityInfo); assertIsException(packageName, VERSION_CODES.R); } private void setExceptionListAndWaitForCallback(String commaSeparatedList) { CountDownLatch latch = new CountDownLatch(1); mOnUpdateDeviceConfig = rawList -> { if (commaSeparatedList.equals(rawList)) { latch.countDown(); } }; DeviceConfig.setProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER, KEY_SPLASH_SCREEN_EXCEPTION_LIST, commaSeparatedList, false); try { assertTrue("Timed out waiting for DeviceConfig to be updated.", latch.await(1, TimeUnit.SECONDS)); } catch (InterruptedException e) { Assert.fail(e.getMessage()); } } private void assertIsNotException(String packageName, int targetSdk) { assertIsNotException(packageName, targetSdk, null); } private void assertIsNotException(String packageName, int targetSdk, Loading @@ -148,10 +164,14 @@ public class SplashScreenExceptionListTest { mList.isException(packageName, targetSdk, () -> activityInfo)); } private void assertIsException(String packageName, int targetSdk) { assertIsException(packageName, targetSdk, null); } private void assertIsException(String packageName, ApplicationInfo activityInfo) { int targetSdk, ApplicationInfo activityInfo) { assertTrue(String.format("%s (sdk=%d) should have been considered as an exception", packageName, VERSION_CODES.R), mList.isException(packageName, VERSION_CODES.R, () -> activityInfo)); packageName, targetSdk), mList.isException(packageName, targetSdk, () -> activityInfo)); } }