Loading core/java/android/app/WindowConfiguration.java +8 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.app; import static android.app.ActivityThread.isSystem; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.TestApi; Loading Loading @@ -215,7 +217,12 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu if (mActivityType == activityType) { return; } if (mActivityType != ACTIVITY_TYPE_UNDEFINED // Error check within system server that we are not changing activity type which can be // dangerous. It is okay for things to change in the application process as it doesn't // affect how other things is the system is managed. if (isSystem() && mActivityType != ACTIVITY_TYPE_UNDEFINED && activityType != ACTIVITY_TYPE_UNDEFINED) { throw new IllegalStateException("Can't change activity type once set: " + this + " activityType=" + activityTypeToString(activityType)); Loading services/tests/servicestests/src/com/android/server/wm/ConfigurationContainerTests.java +4 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,9 @@ public class ConfigurationContainerTests { } assertTrue("Can't change activity type once set.", gotException); // TODO: Commenting out for now until we figure-out a good way to test these rules that // should only apply to system process. /* gotException = false; try { // Parent can't change child's activity type once set. Loading @@ -261,6 +264,7 @@ public class ConfigurationContainerTests { gotException = true; } assertTrue("Can't re-parent to a different activity type.", gotException); */ } Loading services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java +3 −8 Original line number Diff line number Diff line Loading @@ -125,14 +125,9 @@ public class WindowConfigurationTests extends WindowTestsBase { config.setActivityType(ACTIVITY_TYPE_HOME); assertEquals(ACTIVITY_TYPE_HOME, config.getActivityType()); boolean gotException = false; try { // Can't change activity type once set. // Allowed to change from app process. config.setActivityType(ACTIVITY_TYPE_STANDARD); } catch (IllegalStateException e) { gotException = true; } assertTrue("Can't change activity type once set.", gotException); assertEquals(ACTIVITY_TYPE_STANDARD, config.getActivityType()); } /** Ensures the configuration app bounds at the root level match the app dimensions. */ Loading Loading
core/java/android/app/WindowConfiguration.java +8 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.app; import static android.app.ActivityThread.isSystem; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.TestApi; Loading Loading @@ -215,7 +217,12 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu if (mActivityType == activityType) { return; } if (mActivityType != ACTIVITY_TYPE_UNDEFINED // Error check within system server that we are not changing activity type which can be // dangerous. It is okay for things to change in the application process as it doesn't // affect how other things is the system is managed. if (isSystem() && mActivityType != ACTIVITY_TYPE_UNDEFINED && activityType != ACTIVITY_TYPE_UNDEFINED) { throw new IllegalStateException("Can't change activity type once set: " + this + " activityType=" + activityTypeToString(activityType)); Loading
services/tests/servicestests/src/com/android/server/wm/ConfigurationContainerTests.java +4 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,9 @@ public class ConfigurationContainerTests { } assertTrue("Can't change activity type once set.", gotException); // TODO: Commenting out for now until we figure-out a good way to test these rules that // should only apply to system process. /* gotException = false; try { // Parent can't change child's activity type once set. Loading @@ -261,6 +264,7 @@ public class ConfigurationContainerTests { gotException = true; } assertTrue("Can't re-parent to a different activity type.", gotException); */ } Loading
services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java +3 −8 Original line number Diff line number Diff line Loading @@ -125,14 +125,9 @@ public class WindowConfigurationTests extends WindowTestsBase { config.setActivityType(ACTIVITY_TYPE_HOME); assertEquals(ACTIVITY_TYPE_HOME, config.getActivityType()); boolean gotException = false; try { // Can't change activity type once set. // Allowed to change from app process. config.setActivityType(ACTIVITY_TYPE_STANDARD); } catch (IllegalStateException e) { gotException = true; } assertTrue("Can't change activity type once set.", gotException); assertEquals(ACTIVITY_TYPE_STANDARD, config.getActivityType()); } /** Ensures the configuration app bounds at the root level match the app dimensions. */ Loading