Loading core/java/android/content/pm/ActivityInfo.java +10 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ import android.util.Printer; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE; /** * Information you can retrieve about a particular application * activity or receiver. This corresponds to information collected Loading Loading @@ -792,6 +790,16 @@ public class ActivityInfo extends ComponentInfo * {@link Configuration}. */ public static final int CONFIG_ROTATION = 0x20000000; /** * Bit in {@link #configChanges} that indicates that the activity * can itself handle changes to the app bounds. Set from the * {@link android.R.attr#configChanges} attribute. This is * not a core resource configuration, but a higher-level value, so its * constant starts at the high bits. * @hide We do not want apps to handle this. It will eventually be moved out of * {@link Configuration}. */ public static final int CONFIG_APP_BOUNDS = 0x10000000; /** @hide * Unfortunately the constants for config changes in native code are Loading core/java/android/content/res/Configuration.java +1 −1 Original line number Diff line number Diff line Loading @@ -1445,7 +1445,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration if ((compareUndefined || delta.appBounds != null) && appBounds != delta.appBounds && (appBounds == null || !appBounds.equals(delta.appBounds))) { changed |= ActivityInfo.CONFIG_SCREEN_SIZE; changed |= ActivityInfo.CONFIG_APP_BOUNDS; } return changed; Loading services/core/java/com/android/server/am/ActivityRecord.java +7 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import static android.content.Intent.CATEGORY_HOME; import static android.content.Intent.CATEGORY_LAUNCHER; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_NO_HISTORY; import static android.content.pm.ActivityInfo.CONFIG_APP_BOUNDS; import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_ROTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT; Loading Loading @@ -2576,6 +2577,12 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo if ((changes & CONFIG_ROTATION) != 0) { changes &= ~CONFIG_ROTATION; } // We don't want app bound changes to cause relaunches. if ((changes & CONFIG_APP_BOUNDS) != 0) { changes &= ~CONFIG_APP_BOUNDS; } return changes; } Loading services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java +14 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.wm; import android.app.ActivityManager; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.graphics.Rect; import android.view.DisplayInfo; Loading Loading @@ -48,6 +49,19 @@ public class AppBoundsTests extends WindowTestsBase { mParentBounds = new Rect(10 /*left*/, 30 /*top*/, 80 /*right*/, 60 /*bottom*/); } /** * Ensures that appBounds causes {@link android.content.pm.ActivityInfo.CONFIG_APP_BOUNDS} diff. */ @Test public void testAppBoundsConfigurationDiff() { final Configuration config = new Configuration(); final Configuration config2 = new Configuration(); config.appBounds = new Rect(0, 1, 1, 0); config2.appBounds = new Rect(0, 2, 2, 0); assertEquals(ActivityInfo.CONFIG_APP_BOUNDS, config.diff(config2)); } /** * Ensures the configuration app bounds at the root level match the app dimensions. */ Loading Loading
core/java/android/content/pm/ActivityInfo.java +10 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ import android.util.Printer; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE; /** * Information you can retrieve about a particular application * activity or receiver. This corresponds to information collected Loading Loading @@ -792,6 +790,16 @@ public class ActivityInfo extends ComponentInfo * {@link Configuration}. */ public static final int CONFIG_ROTATION = 0x20000000; /** * Bit in {@link #configChanges} that indicates that the activity * can itself handle changes to the app bounds. Set from the * {@link android.R.attr#configChanges} attribute. This is * not a core resource configuration, but a higher-level value, so its * constant starts at the high bits. * @hide We do not want apps to handle this. It will eventually be moved out of * {@link Configuration}. */ public static final int CONFIG_APP_BOUNDS = 0x10000000; /** @hide * Unfortunately the constants for config changes in native code are Loading
core/java/android/content/res/Configuration.java +1 −1 Original line number Diff line number Diff line Loading @@ -1445,7 +1445,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration if ((compareUndefined || delta.appBounds != null) && appBounds != delta.appBounds && (appBounds == null || !appBounds.equals(delta.appBounds))) { changed |= ActivityInfo.CONFIG_SCREEN_SIZE; changed |= ActivityInfo.CONFIG_APP_BOUNDS; } return changed; Loading
services/core/java/com/android/server/am/ActivityRecord.java +7 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import static android.content.Intent.CATEGORY_HOME; import static android.content.Intent.CATEGORY_LAUNCHER; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_NO_HISTORY; import static android.content.pm.ActivityInfo.CONFIG_APP_BOUNDS; import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_ROTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT; Loading Loading @@ -2576,6 +2577,12 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo if ((changes & CONFIG_ROTATION) != 0) { changes &= ~CONFIG_ROTATION; } // We don't want app bound changes to cause relaunches. if ((changes & CONFIG_APP_BOUNDS) != 0) { changes &= ~CONFIG_APP_BOUNDS; } return changes; } Loading
services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java +14 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.wm; import android.app.ActivityManager; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.graphics.Rect; import android.view.DisplayInfo; Loading Loading @@ -48,6 +49,19 @@ public class AppBoundsTests extends WindowTestsBase { mParentBounds = new Rect(10 /*left*/, 30 /*top*/, 80 /*right*/, 60 /*bottom*/); } /** * Ensures that appBounds causes {@link android.content.pm.ActivityInfo.CONFIG_APP_BOUNDS} diff. */ @Test public void testAppBoundsConfigurationDiff() { final Configuration config = new Configuration(); final Configuration config2 = new Configuration(); config.appBounds = new Rect(0, 1, 1, 0); config2.appBounds = new Rect(0, 2, 2, 0); assertEquals(ActivityInfo.CONFIG_APP_BOUNDS, config.diff(config2)); } /** * Ensures the configuration app bounds at the root level match the app dimensions. */ Loading