Loading services/core/java/com/android/server/wm/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -3055,7 +3055,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A @Override boolean providesOrientation() { return mStyleFillsParent; return mStyleFillsParent || mOccludesParent; } @Override Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +7 −0 Original line number Diff line number Diff line Loading @@ -2627,6 +2627,13 @@ public class ActivityRecordTests extends WindowTestsBase { // Can specify orientation if the current orientation candidate is orientation behind. assertEquals(SCREEN_ORIENTATION_LANDSCAPE, activity.getOrientation(SCREEN_ORIENTATION_BEHIND)); final ActivityRecord translucentActivity = new ActivityBuilder(mAtm) .setActivityTheme(android.R.style.Theme_Translucent) .setCreateTask(true).build(); assertFalse(translucentActivity.providesOrientation()); translucentActivity.setOccludesParent(true); assertTrue(translucentActivity.providesOrientation()); } @Test Loading services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java +12 −0 Original line number Diff line number Diff line Loading @@ -1184,6 +1184,7 @@ class WindowTestsBase extends SystemServiceTestsBase { private boolean mCreateTask = false; private Task mParentTask; private int mActivityFlags; private int mActivityTheme; private int mLaunchMode; private int mResizeMode = RESIZE_MODE_RESIZEABLE; private float mMaxAspectRatio; Loading Loading @@ -1232,6 +1233,14 @@ class WindowTestsBase extends SystemServiceTestsBase { return this; } ActivityBuilder setActivityTheme(int theme) { mActivityTheme = theme; // Use the real package of test so it can get a valid context for theme. mComponent = ComponentName.createRelative(mService.mContext.getPackageName(), DEFAULT_COMPONENT_CLASS_NAME + sCurrentActivityId++); return this; } ActivityBuilder setActivityFlags(int flags) { mActivityFlags = flags; return this; Loading Loading @@ -1381,6 +1390,9 @@ class WindowTestsBase extends SystemServiceTestsBase { if (mTargetActivity != null) { aInfo.targetActivity = mTargetActivity; } if (mActivityTheme != 0) { aInfo.theme = mActivityTheme; } aInfo.flags |= mActivityFlags; aInfo.launchMode = mLaunchMode; aInfo.resizeMode = mResizeMode; Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -3055,7 +3055,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A @Override boolean providesOrientation() { return mStyleFillsParent; return mStyleFillsParent || mOccludesParent; } @Override Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +7 −0 Original line number Diff line number Diff line Loading @@ -2627,6 +2627,13 @@ public class ActivityRecordTests extends WindowTestsBase { // Can specify orientation if the current orientation candidate is orientation behind. assertEquals(SCREEN_ORIENTATION_LANDSCAPE, activity.getOrientation(SCREEN_ORIENTATION_BEHIND)); final ActivityRecord translucentActivity = new ActivityBuilder(mAtm) .setActivityTheme(android.R.style.Theme_Translucent) .setCreateTask(true).build(); assertFalse(translucentActivity.providesOrientation()); translucentActivity.setOccludesParent(true); assertTrue(translucentActivity.providesOrientation()); } @Test Loading
services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java +12 −0 Original line number Diff line number Diff line Loading @@ -1184,6 +1184,7 @@ class WindowTestsBase extends SystemServiceTestsBase { private boolean mCreateTask = false; private Task mParentTask; private int mActivityFlags; private int mActivityTheme; private int mLaunchMode; private int mResizeMode = RESIZE_MODE_RESIZEABLE; private float mMaxAspectRatio; Loading Loading @@ -1232,6 +1233,14 @@ class WindowTestsBase extends SystemServiceTestsBase { return this; } ActivityBuilder setActivityTheme(int theme) { mActivityTheme = theme; // Use the real package of test so it can get a valid context for theme. mComponent = ComponentName.createRelative(mService.mContext.getPackageName(), DEFAULT_COMPONENT_CLASS_NAME + sCurrentActivityId++); return this; } ActivityBuilder setActivityFlags(int flags) { mActivityFlags = flags; return this; Loading Loading @@ -1381,6 +1390,9 @@ class WindowTestsBase extends SystemServiceTestsBase { if (mTargetActivity != null) { aInfo.targetActivity = mTargetActivity; } if (mActivityTheme != 0) { aInfo.theme = mActivityTheme; } aInfo.flags |= mActivityFlags; aInfo.launchMode = mLaunchMode; aInfo.resizeMode = mResizeMode; Loading