Move content resolver call to constructor and cache
Changing fixed rotation enabled system setting flag
should be followed by a restart of launcher for it
to take effect.
Bug: 149571513
Change-Id: I84fbb654c325076571a038604fa929984d22f254
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index ef3d174..4954588 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -610,7 +610,7 @@
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.PAUSE_NOT_DETECTED, "handleOrientationSetup.1");
}
- if (!isFixedRotationTransformEnabled(this)) {
+ if (!isFixedRotationTransformEnabled()) {
return;
}
mDeviceState.enableMultipleRegions(baseInputConsumer instanceof OtherActivityInputConsumer);
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index 1da7ccf..6e7c423 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -178,7 +178,7 @@
}
private void setupOrientationSwipeHandler() {
- if (!isFixedRotationTransformEnabled(mContext)) {
+ if (!isFixedRotationTransformEnabled()) {
return;
}
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 4c47d7f..5745990 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -123,6 +123,9 @@
private SysUINavigationMode.NavigationModeChangeListener mNavModeChangeListener =
newMode -> setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, newMode != TWO_BUTTONS);
+ /** TODO: Remove once R ships. This is unlikely to change across different swipe gestures. */
+ private static boolean sFixedRotationEnabled;
+
private final Context mContext;
private final ContentResolver mContentResolver;
private final SharedPreferences mSharedPrefs;
@@ -165,7 +168,9 @@
if (originalSmallestWidth < 600) {
mFlags |= FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_DENSITY;
}
- if (isFixedRotationTransformEnabled(context)) {
+ sFixedRotationEnabled = Settings.Global.getInt(
+ context.getContentResolver(), FIXED_ROTATION_TRANSFORM_SETTING_NAME, 1) == 1;
+ if (sFixedRotationEnabled) {
mFlags |= FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_FLAG;
}
initFlags();
@@ -519,9 +524,8 @@
* Returns true if system can keep Launcher fixed to portrait layout even if the
* foreground app is rotated
*/
- public static boolean isFixedRotationTransformEnabled(Context context) {
- return Settings.Global.getInt(
- context.getContentResolver(), FIXED_ROTATION_TRANSFORM_SETTING_NAME, 1) == 1;
+ public static boolean isFixedRotationTransformEnabled() {
+ return sFixedRotationEnabled;
}
@NonNull