Merge "Don't lock rotation to natural rotation when entering overview" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ec09667201
@@ -118,6 +118,7 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
|
|||||||
try {
|
try {
|
||||||
if (mOverviewProxyService.getProxy() != null) {
|
if (mOverviewProxyService.getProxy() != null) {
|
||||||
mOverviewProxyService.getProxy().onOverviewToggle();
|
mOverviewProxyService.getProxy().onOverviewToggle();
|
||||||
|
mOverviewProxyService.notifyToggleRecentApps();
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Cannot send toggle recents through proxy service.", e);
|
Log.e(TAG, "Cannot send toggle recents through proxy service.", e);
|
||||||
|
|||||||
@@ -871,6 +871,12 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void notifyToggleRecentApps() {
|
||||||
|
for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
|
||||||
|
mConnectionCallbacks.get(i).onToggleRecentApps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateEnabledState() {
|
private void updateEnabledState() {
|
||||||
mIsEnabled = mContext.getPackageManager().resolveServiceAsUser(mQuickStepIntent,
|
mIsEnabled = mContext.getPackageManager().resolveServiceAsUser(mQuickStepIntent,
|
||||||
MATCH_SYSTEM_ONLY,
|
MATCH_SYSTEM_ONLY,
|
||||||
@@ -901,6 +907,8 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
|||||||
default void onQuickSwitchToNewTask(@Surface.Rotation int rotation) {}
|
default void onQuickSwitchToNewTask(@Surface.Rotation int rotation) {}
|
||||||
default void onOverviewShown(boolean fromHome) {}
|
default void onOverviewShown(boolean fromHome) {}
|
||||||
default void onQuickScrubStarted() {}
|
default void onQuickScrubStarted() {}
|
||||||
|
/** Notify the recents app (overview) is started by 3-button navigation. */
|
||||||
|
default void onToggleRecentApps() {}
|
||||||
/** Notify changes in the nav bar button alpha */
|
/** Notify changes in the nav bar button alpha */
|
||||||
default void onNavBarButtonAlphaChanged(float alpha, boolean animate) {}
|
default void onNavBarButtonAlphaChanged(float alpha, boolean animate) {}
|
||||||
default void onSystemUiStateChanged(int sysuiStateFlags) {}
|
default void onSystemUiStateChanged(int sysuiStateFlags) {}
|
||||||
|
|||||||
@@ -323,6 +323,20 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
|
|||||||
buttonDispatcher.setAlpha(forceVisible ? 1f : alpha, animate);
|
buttonDispatcher.setAlpha(forceVisible ? 1f : alpha, animate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOverviewShown(boolean fromHome) {
|
||||||
|
// If the overview has fixed orientation that may change display to natural rotation,
|
||||||
|
// we don't want the user rotation to be reset. So after user returns to application,
|
||||||
|
// it can keep in the original rotation.
|
||||||
|
mNavigationBarView.getRotationButtonController().setSkipOverrideUserLockPrefsOnce();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onToggleRecentApps() {
|
||||||
|
// The same case as onOverviewShown but only for 3-button navigation.
|
||||||
|
mNavigationBarView.getRotationButtonController().setSkipOverrideUserLockPrefsOnce();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private NavigationBarTransitions.DarkIntensityListener mOrientationHandleIntensityListener =
|
private NavigationBarTransitions.DarkIntensityListener mOrientationHandleIntensityListener =
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public class RotationButtonController {
|
|||||||
private Consumer<Integer> mRotWatcherListener;
|
private Consumer<Integer> mRotWatcherListener;
|
||||||
private boolean mListenersRegistered = false;
|
private boolean mListenersRegistered = false;
|
||||||
private boolean mIsNavigationBarShowing;
|
private boolean mIsNavigationBarShowing;
|
||||||
|
private boolean mSkipOverrideUserLockPrefsOnce;
|
||||||
|
|
||||||
private final Runnable mRemoveRotationProposal =
|
private final Runnable mRemoveRotationProposal =
|
||||||
() -> setRotateSuggestionButtonState(false /* visible */);
|
() -> setRotateSuggestionButtonState(false /* visible */);
|
||||||
@@ -349,7 +350,20 @@ public class RotationButtonController {
|
|||||||
mUiEventLogger.log(RotationButtonEvent.ROTATION_SUGGESTION_SHOWN);
|
mUiEventLogger.log(RotationButtonEvent.ROTATION_SUGGESTION_SHOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes {@link #shouldOverrideUserLockPrefs} always return {@code false} once. It is used to
|
||||||
|
* avoid losing original user rotation when display rotation is changed by entering the fixed
|
||||||
|
* orientation overview.
|
||||||
|
*/
|
||||||
|
void setSkipOverrideUserLockPrefsOnce() {
|
||||||
|
mSkipOverrideUserLockPrefsOnce = true;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean shouldOverrideUserLockPrefs(final int rotation) {
|
private boolean shouldOverrideUserLockPrefs(final int rotation) {
|
||||||
|
if (mSkipOverrideUserLockPrefsOnce) {
|
||||||
|
mSkipOverrideUserLockPrefsOnce = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Only override user prefs when returning to the natural rotation (normally portrait).
|
// Only override user prefs when returning to the natural rotation (normally portrait).
|
||||||
// Don't let apps that force landscape or 180 alter user lock.
|
// Don't let apps that force landscape or 180 alter user lock.
|
||||||
return rotation == NATURAL_ROTATION;
|
return rotation == NATURAL_ROTATION;
|
||||||
|
|||||||
Reference in New Issue
Block a user