Merge "Don't rely on nav mode change listener for oriented state" into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot
2020-06-18 04:44:31 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 28 deletions
@@ -1059,8 +1059,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
private void animateRecentsRotationInPlace(int newRotation) {
if (mOrientationState.canLauncherRotate()) {
// Update the rotation but let system take care of the rotation animation
setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
// Let system take care of the rotation
return;
}
AnimatorSet pa = setRecentsChangedOrientation(true);
@@ -116,9 +116,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE | FLAG_SYSTEM_ROTATION_ALLOWED
| FLAG_ROTATION_WATCHER_SUPPORTED | FLAG_ROTATION_WATCHER_ENABLED;
private SysUINavigationMode.NavigationModeChangeListener mNavModeChangeListener =
newMode -> setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, newMode != TWO_BUTTONS);
private final Context mContext;
private final ContentResolver mContentResolver;
private final SharedPreferences mSharedPrefs;
@@ -266,10 +263,9 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
private void initFlags() {
SysUINavigationMode.Mode currentMode = SysUINavigationMode.getMode(mContext);
if (mOrientationListener.canDetectOrientation() &&
currentMode != TWO_BUTTONS) {
mFlags |= FLAG_ROTATION_WATCHER_SUPPORTED;
}
boolean rotationWatcherSupported = mOrientationListener.canDetectOrientation() &&
currentMode != TWO_BUTTONS;
setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, rotationWatcherSupported);
// initialize external flags
updateAutoRotateSetting();
@@ -286,9 +282,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
mContentResolver.registerContentObserver(
Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION),
false, mSystemAutoRotateObserver);
SysUINavigationMode.Mode currentMode =
SysUINavigationMode.INSTANCE.get(mContext)
.addModeChangeListener(mNavModeChangeListener);
}
initFlags();
}
@@ -300,8 +293,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
if (isMultipleOrientationSupportedByDevice()) {
mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
mContentResolver.unregisterContentObserver(mSystemAutoRotateObserver);
SysUINavigationMode.INSTANCE.get(mContext)
.removeModeChangeListener(mNavModeChangeListener);
}
setRotationWatcherEnabled(false);
}
@@ -347,20 +338,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
setFlag(FLAG_ROTATION_WATCHER_ENABLED, isEnabled);
}
public int getTouchRotationDegrees() {
switch (mTouchRotation) {
case ROTATION_90:
return 90;
case ROTATION_180:
return 180;
case ROTATION_270:
return 270;
case ROTATION_0:
default:
return 0;
}
}
/**
* Returns the scale and pivot so that the provided taskRect can fit the provided full size
*/