Merge "Reset user rotate pref on navbar create" into pi-dev
This commit is contained in:
@@ -41,7 +41,8 @@ import com.android.internal.R;
|
||||
public final class RotationPolicy {
|
||||
private static final String TAG = "RotationPolicy";
|
||||
private static final int CURRENT_ROTATION = -1;
|
||||
private static final int NATURAL_ROTATION = Surface.ROTATION_0;
|
||||
|
||||
public static final int NATURAL_ROTATION = Surface.ROTATION_0;
|
||||
|
||||
private RotationPolicy() {
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN;
|
||||
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
|
||||
import static android.app.StatusBarManager.windowStateToString;
|
||||
|
||||
import static com.android.internal.view.RotationPolicy.NATURAL_ROTATION;
|
||||
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;
|
||||
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_SEMI_TRANSPARENT;
|
||||
import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_WINDOW_STATE;
|
||||
@@ -222,6 +224,13 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
|
||||
|
||||
mRotationLockController = Dependency.get(RotationLockController.class);
|
||||
|
||||
// Reset user rotation pref to match that of the WindowManager if starting in locked mode
|
||||
// This will automatically happen when switching from auto-rotate to locked mode
|
||||
if (mRotationLockController.isRotationLocked()) {
|
||||
final int winRotation = mWindowManager.getDefaultDisplay().getRotation();
|
||||
mRotationLockController.setRotationLockedAtAngle(true, winRotation);
|
||||
}
|
||||
|
||||
// Register the task stack listener
|
||||
mTaskStackListener = new TaskStackListenerImpl();
|
||||
ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);
|
||||
@@ -999,9 +1008,9 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
|
||||
}
|
||||
|
||||
private boolean shouldOverrideUserLockPrefs(final int rotation) {
|
||||
// Only override user prefs when returning to 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.
|
||||
return rotation == Surface.ROTATION_0;
|
||||
return rotation == NATURAL_ROTATION;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user