Loading packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java +27 −1 Original line number Original line Diff line number Diff line Loading @@ -29,8 +29,11 @@ import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.DrawableRes; import android.annotation.SuppressLint; import android.annotation.SuppressLint; import android.app.StatusBarManager; import android.app.StatusBarManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.ContentResolver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Handler; Loading Loading @@ -86,6 +89,7 @@ public class RotationButtonController { private RotationButton mRotationButton; private RotationButton mRotationButton; private boolean mIsRecentsAnimationRunning; private boolean mIsRecentsAnimationRunning; private boolean mDocked; private boolean mHomeRotationEnabled; private boolean mHomeRotationEnabled; private int mLastRotationSuggestion; private int mLastRotationSuggestion; private boolean mPendingRotationSuggestion; private boolean mPendingRotationSuggestion; Loading Loading @@ -123,6 +127,12 @@ public class RotationButtonController { () -> mPendingRotationSuggestion = false; () -> mPendingRotationSuggestion = false; private Animator mRotateHideAnimator; private Animator mRotateHideAnimator; private final BroadcastReceiver mDockedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { updateDockedState(intent); } }; private final IRotationWatcher.Stub mRotationWatcher = new IRotationWatcher.Stub() { private final IRotationWatcher.Stub mRotationWatcher = new IRotationWatcher.Stub() { @Override @Override Loading @@ -136,7 +146,8 @@ public class RotationButtonController { // The isVisible check makes the rotation button disappear when we are not locked // The isVisible check makes the rotation button disappear when we are not locked // (e.g. for tabletop auto-rotate). // (e.g. for tabletop auto-rotate). if (rotationLocked || mRotationButton.isVisible()) { if (rotationLocked || mRotationButton.isVisible()) { if (shouldOverrideUserLockPrefs(rotation) && rotationLocked) { // Do not allow a change in rotation to set user rotation when docked. if (shouldOverrideUserLockPrefs(rotation) && rotationLocked && !mDocked) { setRotationLockedAtAngle(rotation); setRotationLockedAtAngle(rotation); } } setRotateSuggestionButtonState(false /* visible */, true /* forced */); setRotateSuggestionButtonState(false /* visible */, true /* forced */); Loading Loading @@ -214,6 +225,10 @@ public class RotationButtonController { } } mListenersRegistered = true; mListenersRegistered = true; updateDockedState(mContext.registerReceiver(mDockedReceiver, new IntentFilter(Intent.ACTION_DOCK_EVENT))); try { try { WindowManagerGlobal.getWindowManagerService() WindowManagerGlobal.getWindowManagerService() .watchRotation(mRotationWatcher, DEFAULT_DISPLAY); .watchRotation(mRotationWatcher, DEFAULT_DISPLAY); Loading @@ -234,6 +249,8 @@ public class RotationButtonController { } } mListenersRegistered = false; mListenersRegistered = false; mContext.unregisterReceiver(mDockedReceiver); try { try { WindowManagerGlobal.getWindowManagerService().removeRotationWatcher(mRotationWatcher); WindowManagerGlobal.getWindowManagerService().removeRotationWatcher(mRotationWatcher); } catch (RemoteException e) { } catch (RemoteException e) { Loading Loading @@ -345,6 +362,15 @@ public class RotationButtonController { updateRotationButtonStateInOverview(); updateRotationButtonStateInOverview(); } } private void updateDockedState(Intent intent) { if (intent == null) { return; } mDocked = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED) != Intent.EXTRA_DOCK_STATE_UNDOCKED; } private void updateRotationButtonStateInOverview() { private void updateRotationButtonStateInOverview() { if (mIsRecentsAnimationRunning && !mHomeRotationEnabled) { if (mIsRecentsAnimationRunning && !mHomeRotationEnabled) { setRotateSuggestionButtonState(false, true /* hideImmediately */); setRotateSuggestionButtonState(false, true /* hideImmediately */); Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/rotation/RotationButtonController.java +27 −1 Original line number Original line Diff line number Diff line Loading @@ -29,8 +29,11 @@ import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.DrawableRes; import android.annotation.SuppressLint; import android.annotation.SuppressLint; import android.app.StatusBarManager; import android.app.StatusBarManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.ContentResolver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Handler; Loading Loading @@ -86,6 +89,7 @@ public class RotationButtonController { private RotationButton mRotationButton; private RotationButton mRotationButton; private boolean mIsRecentsAnimationRunning; private boolean mIsRecentsAnimationRunning; private boolean mDocked; private boolean mHomeRotationEnabled; private boolean mHomeRotationEnabled; private int mLastRotationSuggestion; private int mLastRotationSuggestion; private boolean mPendingRotationSuggestion; private boolean mPendingRotationSuggestion; Loading Loading @@ -123,6 +127,12 @@ public class RotationButtonController { () -> mPendingRotationSuggestion = false; () -> mPendingRotationSuggestion = false; private Animator mRotateHideAnimator; private Animator mRotateHideAnimator; private final BroadcastReceiver mDockedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { updateDockedState(intent); } }; private final IRotationWatcher.Stub mRotationWatcher = new IRotationWatcher.Stub() { private final IRotationWatcher.Stub mRotationWatcher = new IRotationWatcher.Stub() { @Override @Override Loading @@ -136,7 +146,8 @@ public class RotationButtonController { // The isVisible check makes the rotation button disappear when we are not locked // The isVisible check makes the rotation button disappear when we are not locked // (e.g. for tabletop auto-rotate). // (e.g. for tabletop auto-rotate). if (rotationLocked || mRotationButton.isVisible()) { if (rotationLocked || mRotationButton.isVisible()) { if (shouldOverrideUserLockPrefs(rotation) && rotationLocked) { // Do not allow a change in rotation to set user rotation when docked. if (shouldOverrideUserLockPrefs(rotation) && rotationLocked && !mDocked) { setRotationLockedAtAngle(rotation); setRotationLockedAtAngle(rotation); } } setRotateSuggestionButtonState(false /* visible */, true /* forced */); setRotateSuggestionButtonState(false /* visible */, true /* forced */); Loading Loading @@ -214,6 +225,10 @@ public class RotationButtonController { } } mListenersRegistered = true; mListenersRegistered = true; updateDockedState(mContext.registerReceiver(mDockedReceiver, new IntentFilter(Intent.ACTION_DOCK_EVENT))); try { try { WindowManagerGlobal.getWindowManagerService() WindowManagerGlobal.getWindowManagerService() .watchRotation(mRotationWatcher, DEFAULT_DISPLAY); .watchRotation(mRotationWatcher, DEFAULT_DISPLAY); Loading @@ -234,6 +249,8 @@ public class RotationButtonController { } } mListenersRegistered = false; mListenersRegistered = false; mContext.unregisterReceiver(mDockedReceiver); try { try { WindowManagerGlobal.getWindowManagerService().removeRotationWatcher(mRotationWatcher); WindowManagerGlobal.getWindowManagerService().removeRotationWatcher(mRotationWatcher); } catch (RemoteException e) { } catch (RemoteException e) { Loading Loading @@ -345,6 +362,15 @@ public class RotationButtonController { updateRotationButtonStateInOverview(); updateRotationButtonStateInOverview(); } } private void updateDockedState(Intent intent) { if (intent == null) { return; } mDocked = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED) != Intent.EXTRA_DOCK_STATE_UNDOCKED; } private void updateRotationButtonStateInOverview() { private void updateRotationButtonStateInOverview() { if (mIsRecentsAnimationRunning && !mHomeRotationEnabled) { if (mIsRecentsAnimationRunning && !mHomeRotationEnabled) { setRotateSuggestionButtonState(false, true /* hideImmediately */); setRotateSuggestionButtonState(false, true /* hideImmediately */); Loading