diff options
| author | 2020-06-22 13:51:25 +0000 | |
|---|---|---|
| committer | 2020-06-22 13:51:25 +0000 | |
| commit | 3192bde42576164048e1a85ab49513528f471381 (patch) | |
| tree | 09575a065bfe7e3ed4898b7aa0bc6f5f3317c190 | |
| parent | 45b4885a90ed97189578667d03b962deac8b4386 (diff) | |
| parent | bda315692640c8bf6fbc61f572d5c7aa2069ef45 (diff) | |
Merge "Remove fixed-rotation-transform setting" into rvc-dev am: bda3156926
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11907893
Change-Id: Ib1a4495745f01d3cd5f76dfd43013c458ae9d01c
10 files changed, 12 insertions, 109 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java index cad1c91975bf..5926a5b86acd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; -import android.database.ContentObserver; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.PointF; @@ -31,15 +30,11 @@ import android.graphics.Region; import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManager.DisplayListener; import android.hardware.input.InputManager; -import android.net.Uri; -import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemProperties; -import android.os.UserHandle; import android.provider.DeviceConfig; -import android.provider.Settings; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; @@ -92,8 +87,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa private static final String TAG = "EdgeBackGestureHandler"; private static final int MAX_LONG_PRESS_TIMEOUT = SystemProperties.getInt( "gestures.back_timeout", 250); - private static final String FIXED_ROTATION_TRANSFORM_SETTING_NAME = "fixed_rotation_transform"; - private ISystemGestureExclusionListener mGestureExclusionListener = new ISystemGestureExclusionListener.Stub() { @@ -119,14 +112,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa } }; - private final ContentObserver mFixedRotationObserver = new ContentObserver( - new Handler(Looper.getMainLooper())) { - @Override - public void onChange(boolean selfChange, Uri uri) { - updatedFixedRotation(); - } - }; - private TaskStackChangeListener mTaskStackListener = new TaskStackChangeListener() { @Override public void onTaskStackChanged() { @@ -162,7 +147,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa // We temporarily disable back gesture when user is quickswitching // between apps of different orientations private boolean mDisabledForQuickstep; - private boolean mFixedRotationFlagEnabled; private final PointF mDownPoint = new PointF(); private final PointF mEndPoint = new PointF(); @@ -290,13 +274,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa */ public void onNavBarAttached() { mIsAttached = true; - updatedFixedRotation(); - if (mFixedRotationFlagEnabled) { - setRotationCallbacks(true); - } - mContext.getContentResolver().registerContentObserver( - Settings.Global.getUriFor(FIXED_ROTATION_TRANSFORM_SETTING_NAME), - false /* notifyForDescendants */, mFixedRotationObserver, UserHandle.USER_ALL); + mOverviewProxyService.addCallback(mQuickSwitchListener); updateIsEnabled(); startTracking(); } @@ -306,22 +284,11 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa */ public void onNavBarDetached() { mIsAttached = false; - if (mFixedRotationFlagEnabled) { - setRotationCallbacks(false); - } - mContext.getContentResolver().unregisterContentObserver(mFixedRotationObserver); + mOverviewProxyService.removeCallback(mQuickSwitchListener); updateIsEnabled(); stopTracking(); } - private void setRotationCallbacks(boolean enable) { - if (enable) { - mOverviewProxyService.addCallback(mQuickSwitchListener); - } else { - mOverviewProxyService.removeCallback(mQuickSwitchListener); - } - } - /** * @see NavigationModeController.ModeChangedListener#onNavigationModeChanged */ @@ -641,17 +608,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa InputManager.getInstance().injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); } - private void updatedFixedRotation() { - boolean oldFlag = mFixedRotationFlagEnabled; - mFixedRotationFlagEnabled = Settings.Global.getInt(mContext.getContentResolver(), - FIXED_ROTATION_TRANSFORM_SETTING_NAME, 0) != 0; - if (oldFlag == mFixedRotationFlagEnabled) { - return; - } - - setRotationCallbacks(mFixedRotationFlagEnabled); - } - public void setInsets(int leftInset, int rightInset) { mLeftInset = leftInset; mRightInset = rightInset; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java index df121f0faaf9..90548ba7ba82 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java @@ -152,8 +152,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback private static final String EXTRA_DISABLE2_STATE = "disabled2_state"; private static final String EXTRA_APPEARANCE = "appearance"; private static final String EXTRA_TRANSIENT_STATE = "transient_state"; - private static final String FIXED_ROTATION_TRANSFORM_SETTING_NAME = "fixed_rotation_transform"; - /** Allow some time inbetween the long press for back and recents. */ private static final int LOCK_TO_APP_GESTURE_TOLERENCE = 200; @@ -225,7 +223,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback private WindowManager.LayoutParams mOrientationParams; private int mStartingQuickSwitchRotation; private int mCurrentRotation; - private boolean mFixedRotationEnabled; private ViewTreeObserver.OnGlobalLayoutListener mOrientationHandleGlobalLayoutListener; private UiEventLogger mUiEventLogger; @@ -370,14 +367,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback } }; - private final ContentObserver mFixedRotationObserver = new ContentObserver( - new Handler(Looper.getMainLooper())) { - @Override - public void onChange(boolean selfChange, Uri uri) { - updatedFixedRotation(); - } - }; - private final DeviceConfig.OnPropertiesChangedListener mOnPropertiesChangedListener = new DeviceConfig.OnPropertiesChangedListener() { @Override @@ -439,10 +428,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false /* notifyForDescendants */, mAssistContentObserver, UserHandle.USER_ALL); - mContentResolver.registerContentObserver( - Settings.Global.getUriFor(FIXED_ROTATION_TRANSFORM_SETTING_NAME), - false /* notifyForDescendants */, mFixedRotationObserver, UserHandle.USER_ALL); - if (savedInstanceState != null) { mDisabledFlags1 = savedInstanceState.getInt(EXTRA_DISABLE_STATE, 0); mDisabledFlags2 = savedInstanceState.getInt(EXTRA_DISABLE2_STATE, 0); @@ -468,7 +453,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback mNavigationModeController.removeListener(this); mAccessibilityManagerWrapper.removeCallback(mAccessibilityListener); mContentResolver.unregisterContentObserver(mAssistContentObserver); - mContentResolver.unregisterContentObserver(mFixedRotationObserver); DeviceConfig.removeOnPropertiesChangedListener(mOnPropertiesChangedListener); } @@ -499,7 +483,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback } mNavigationBarView.setNavigationIconHints(mNavigationIconHints); mNavigationBarView.setWindowVisible(isNavBarWindowVisible()); - updatedFixedRotation(); prepareNavigationBarView(); checkNavBarModes(); @@ -693,14 +676,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback return delta; } - private void updatedFixedRotation() { - mFixedRotationEnabled = Settings.Global.getInt(mContentResolver, - FIXED_ROTATION_TRANSFORM_SETTING_NAME, 0) != 0; - if (!canShowSecondaryHandle()) { - resetSecondaryHandle(); - } - } - @Override public void dump(String prefix, FileDescriptor fd, PrintWriter pw, String[] args) { if (mNavigationBarView != null) { @@ -1409,7 +1384,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback } private boolean canShowSecondaryHandle() { - return mFixedRotationEnabled && mNavBarMode == NAV_BAR_MODE_GESTURAL; + return mNavBarMode == NAV_BAR_MODE_GESTURAL; } private final Consumer<Integer> mRotationWatcher = rotation -> { diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 5e3688029bec..512cd8b659bc 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1425,7 +1425,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ @Surface.Rotation int rotationForActivityInDifferentOrientation(@NonNull ActivityRecord r) { - if (!mWmService.mIsFixedRotationTransformEnabled) { + if (!WindowManagerService.ENABLE_FIXED_ROTATION_TRANSFORM) { return ROTATION_UNDEFINED; } if (r.inMultiWindowMode() @@ -1453,7 +1453,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ boolean handleTopActivityLaunchingInDifferentOrientation(@NonNull ActivityRecord r, boolean checkOpening) { - if (!mWmService.mIsFixedRotationTransformEnabled) { + if (!WindowManagerService.ENABLE_FIXED_ROTATION_TRANSFORM) { return false; } if (r.isFinishingFixedRotationTransform()) { diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 706673caba8a..52fb941ebfc0 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -415,6 +415,13 @@ public class WindowManagerService extends IWindowManager.Stub static boolean sEnableTripleBuffering = !SystemProperties.getBoolean( DISABLE_TRIPLE_BUFFERING_PROPERTY, false); + /** + * Allows a fullscreen windowing mode activity to launch in its desired orientation directly + * when the display has different orientation. + */ + static final boolean ENABLE_FIXED_ROTATION_TRANSFORM = + SystemProperties.getBoolean("persist.wm.fixed_rotation_transform", true); + // Enums for animation scale update types. @Retention(RetentionPolicy.SOURCE) @IntDef({WINDOW_ANIMATION_SCALE, TRANSITION_ANIMATION_SCALE, ANIMATION_DURATION_SCALE}) @@ -431,10 +438,6 @@ public class WindowManagerService extends IWindowManager.Stub /** System UI can create more window context... */ private static final int SYSTEM_UI_MULTIPLIER = 2; - // TODO(b/143053092): Remove the settings if it becomes stable. - private static final String FIXED_ROTATION_TRANSFORM_SETTING_NAME = "fixed_rotation_transform"; - boolean mIsFixedRotationTransformEnabled; - final WindowManagerConstants mConstants; final WindowTracing mWindowTracing; @@ -765,8 +768,6 @@ public class WindowManagerService extends IWindowManager.Stub DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM); private final Uri mRenderShadowsInCompositorUri = Settings.Global.getUriFor( DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR); - private final Uri mFixedRotationTransformUri = Settings.Global.getUriFor( - FIXED_ROTATION_TRANSFORM_SETTING_NAME); public SettingsObserver() { super(new Handler()); @@ -791,8 +792,6 @@ public class WindowManagerService extends IWindowManager.Stub UserHandle.USER_ALL); resolver.registerContentObserver(mRenderShadowsInCompositorUri, false, this, UserHandle.USER_ALL); - resolver.registerContentObserver(mFixedRotationTransformUri, false, this, - UserHandle.USER_ALL); } @Override @@ -836,11 +835,6 @@ public class WindowManagerService extends IWindowManager.Stub return; } - if (mFixedRotationTransformUri.equals(uri)) { - updateFixedRotationTransform(); - return; - } - @UpdateAnimationScaleMode final int mode; if (mWindowAnimationScaleUri.equals(uri)) { @@ -860,7 +854,6 @@ public class WindowManagerService extends IWindowManager.Stub void loadSettings() { updateSystemUiSettings(); updatePointerLocation(); - updateFixedRotationTransform(); } void updateSystemUiSettings() { @@ -932,17 +925,6 @@ public class WindowManagerService extends IWindowManager.Stub mAtmService.mSizeCompatFreeform = sizeCompatFreeform; } - - void updateFixedRotationTransform() { - final int enabled = Settings.Global.getInt(mContext.getContentResolver(), - FIXED_ROTATION_TRANSFORM_SETTING_NAME, 2); - if (enabled == 2) { - // Make sure who read the settings won't use inconsistent default value. - Settings.Global.putInt(mContext.getContentResolver(), - FIXED_ROTATION_TRANSFORM_SETTING_NAME, 1); - } - mIsFixedRotationTransformEnabled = enabled != 0; - } } private void setShadowRenderer() { diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java index 29b96ebdc090..2171d75256f2 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java @@ -1423,7 +1423,6 @@ public class ActivityRecordTests extends ActivityTestsBase { @Test public void testActivityOnCancelFixedRotationTransform() { - mService.mWindowManager.mIsFixedRotationTransformEnabled = true; final DisplayRotation displayRotation = mActivity.mDisplayContent.getDisplayRotation(); spyOn(displayRotation); @@ -1480,7 +1479,6 @@ public class ActivityRecordTests extends ActivityTestsBase { @Test public void testIsSnapshotCompatible() { - mService.mWindowManager.mIsFixedRotationTransformEnabled = true; final TaskSnapshot snapshot = new TaskSnapshotPersisterTestBase.TaskSnapshotBuilder() .setRotation(mActivity.getWindowConfiguration().getRotation()) .build(); @@ -1494,7 +1492,6 @@ public class ActivityRecordTests extends ActivityTestsBase { @Test public void testFixedRotationSnapshotStartingWindow() { - mService.mWindowManager.mIsFixedRotationTransformEnabled = true; // TaskSnapshotSurface requires a fullscreen opaque window. final WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.TYPE_APPLICATION_STARTING); diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java index a16bd2a72a83..4dbf79a4a5a6 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java @@ -455,7 +455,6 @@ public class AppWindowTokenTests extends WindowTestsBase { @Test public void testTransferStartingWindowSetFixedRotation() { - mWm.mIsFixedRotationTransformEnabled = true; final ActivityRecord topActivity = createTestActivityRecordForGivenTask(mTask); mTask.positionChildAt(topActivity, POSITION_TOP); mActivity.addStartingWindow(mPackageName, diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 545901e550c1..0b04480877fc 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -1067,7 +1067,6 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testApplyTopFixedRotationTransform() { - mWm.mIsFixedRotationTransformEnabled = true; final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy(); // Only non-movable (gesture) navigation bar will be animated by fixed rotation animation. doReturn(false).when(displayPolicy).navigationBarCanMove(); @@ -1183,7 +1182,6 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testNoFixedRotationWithPip() { - mWm.mIsFixedRotationTransformEnabled = true; // Make resume-top really update the activity state. doReturn(false).when(mWm.mAtmService).isBooting(); doReturn(true).when(mWm.mAtmService).isBooted(); diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java index 243468aba8e8..8e85e7b96d1f 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java @@ -321,7 +321,6 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { @Test public void testRecentViewInFixedPortraitWhenTopAppInLandscape() { - mWm.mIsFixedRotationTransformEnabled = true; mWm.setRecentsAnimationController(mController); final ActivityRecord homeActivity = createHomeActivity(); @@ -390,7 +389,6 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { @Test public void testWallpaperHasFixedRotationApplied() { - mWm.mIsFixedRotationTransformEnabled = true; mWm.setRecentsAnimationController(mController); // Create a portrait home activity, a wallpaper and a landscape activity displayed on top. diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java index e742b32ff4b8..130e5550b2a2 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java @@ -511,7 +511,6 @@ public class SizeCompatTests extends ActivityTestsBase { @Test public void testLaunchWithFixedRotationTransform() { - mService.mWindowManager.mIsFixedRotationTransformEnabled = true; final int dw = 1000; final int dh = 2500; final int notchHeight = 200; diff --git a/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java index 373f363e31ff..53ede60e9ac7 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java @@ -101,7 +101,6 @@ public class WallpaperControllerTests extends WindowTestsBase { public void testWallpaperSizeWithFixedTransform() { // No wallpaper final DisplayContent dc = createNewDisplay(); - dc.mWmService.mIsFixedRotationTransformEnabled = true; // No wallpaper WSA Surface WindowToken wallpaperWindowToken = new WallpaperWindowToken(mWm, mock(IBinder.class), |