Loading packages/SystemUI/res/layout-xlarge/status_bar_settings_view.xml +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ <TextView android:id="@+id/rotate_label" style="@style/StatusBarPanelSettingsContents" android:text="@string/status_bar_settings_rotation_lock" android:text="@string/status_bar_settings_auto_rotation" /> <Switch android:id="@+id/rotate_checkbox" Loading packages/SystemUI/res/values/strings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ <string name="status_bar_settings_airplane">Airplane mode</string> <!-- Label in system panel saying the device will use the orientation sensor to rotate [CHAR LIMIT=30] --> <string name="status_bar_settings_rotation_lock">Lock screen orientation</string> <string name="status_bar_settings_auto_rotation">Auto-rotate screen</string> <!-- Abbreviation / label for mute brightness mode button. Should be all caps. [CHAR LIMIT=6] --> <string name="status_bar_settings_mute_label">MUTE</string> Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java +12 −12 Original line number Diff line number Diff line Loading @@ -35,39 +35,39 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe private Context mContext; private CompoundButton mCheckBox; private boolean mLockRotation; private boolean mAutoRotation; public AutoRotateController(Context context, CompoundButton checkbox) { mContext = context; mLockRotation = getLockRotation(); mAutoRotation = getAutoRotation(); mCheckBox = checkbox; checkbox.setChecked(mLockRotation); checkbox.setChecked(mAutoRotation); checkbox.setOnCheckedChangeListener(this); } public void onCheckedChanged(CompoundButton view, boolean checked) { if (checked != mLockRotation) { setLockRotation(checked); if (checked != mAutoRotation) { setAutoRotation(checked); } } private boolean getLockRotation() { private boolean getAutoRotation() { ContentResolver cr = mContext.getContentResolver(); return 0 == Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); return 0 != Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); } private void setLockRotation(final boolean locked) { mLockRotation = locked; private void setAutoRotation(final boolean autorotate) { mAutoRotation = autorotate; AsyncTask.execute(new Runnable() { public void run() { try { IWindowManager wm = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); ContentResolver cr = mContext.getContentResolver(); if (locked) { wm.freezeRotation(); } else { if (autorotate) { wm.thawRotation(); } else { wm.freezeRotation(); } } catch (RemoteException exc) { } Loading Loading
packages/SystemUI/res/layout-xlarge/status_bar_settings_view.xml +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ <TextView android:id="@+id/rotate_label" style="@style/StatusBarPanelSettingsContents" android:text="@string/status_bar_settings_rotation_lock" android:text="@string/status_bar_settings_auto_rotation" /> <Switch android:id="@+id/rotate_checkbox" Loading
packages/SystemUI/res/values/strings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ <string name="status_bar_settings_airplane">Airplane mode</string> <!-- Label in system panel saying the device will use the orientation sensor to rotate [CHAR LIMIT=30] --> <string name="status_bar_settings_rotation_lock">Lock screen orientation</string> <string name="status_bar_settings_auto_rotation">Auto-rotate screen</string> <!-- Abbreviation / label for mute brightness mode button. Should be all caps. [CHAR LIMIT=6] --> <string name="status_bar_settings_mute_label">MUTE</string> Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java +12 −12 Original line number Diff line number Diff line Loading @@ -35,39 +35,39 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe private Context mContext; private CompoundButton mCheckBox; private boolean mLockRotation; private boolean mAutoRotation; public AutoRotateController(Context context, CompoundButton checkbox) { mContext = context; mLockRotation = getLockRotation(); mAutoRotation = getAutoRotation(); mCheckBox = checkbox; checkbox.setChecked(mLockRotation); checkbox.setChecked(mAutoRotation); checkbox.setOnCheckedChangeListener(this); } public void onCheckedChanged(CompoundButton view, boolean checked) { if (checked != mLockRotation) { setLockRotation(checked); if (checked != mAutoRotation) { setAutoRotation(checked); } } private boolean getLockRotation() { private boolean getAutoRotation() { ContentResolver cr = mContext.getContentResolver(); return 0 == Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); return 0 != Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); } private void setLockRotation(final boolean locked) { mLockRotation = locked; private void setAutoRotation(final boolean autorotate) { mAutoRotation = autorotate; AsyncTask.execute(new Runnable() { public void run() { try { IWindowManager wm = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); ContentResolver cr = mContext.getContentResolver(); if (locked) { wm.freezeRotation(); } else { if (autorotate) { wm.thawRotation(); } else { wm.freezeRotation(); } } catch (RemoteException exc) { } Loading