summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-01-06 19:21:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-01-06 19:21:58 +0000
commitf121921d9a8019a6e5fbcaf92edc411b4b8b68e0 (patch)
tree638373c6cd895a7a641b1bdbc2135764b883ba06 /packages
parentf12aa45bcbcd3d41b51c70401fac5786d3d881a5 (diff)
parent8ab172e8d9c2e926921bb52838c2322142fb3c65 (diff)
downloadframeworks_base-f121921d9a8019a6e5fbcaf92edc411b4b8b68e0.zip
frameworks_base-f121921d9a8019a6e5fbcaf92edc411b4b8b68e0.tar.gz
frameworks_base-f121921d9a8019a6e5fbcaf92edc411b4b8b68e0.tar.bz2
Merge "Add rotation-lock to Quick Settings on phones."
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/values-sw600dp/config.xml3
-rw-r--r--packages/SystemUI/res/values/config.xml5
-rw-r--r--packages/SystemUI/res/values/strings.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockController.java31
7 files changed, 33 insertions, 32 deletions
diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml
index 48a02ab..b77f1e0 100644
--- a/packages/SystemUI/res/values-sw600dp/config.xml
+++ b/packages/SystemUI/res/values-sw600dp/config.xml
@@ -29,9 +29,6 @@
<!-- The number of columns that the top level tiles span in the QuickSettings -->
<integer name="quick_settings_user_time_settings_tile_span">1</integer>
- <!-- Whether rotation lock shows up in quick settings or not -->
- <bool name="quick_settings_show_rotation_lock">true</bool>
-
<!-- Enable the "flip settings" panel -->
<bool name="config_hasFlipSettingsPanel">false</bool>
</resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 3869db3..1dd9300 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -50,7 +50,7 @@
<!-- When true, show 1/2G networks as 3G. -->
<bool name="config_showMin3G">false</bool>
- <!-- Show rotation lock button in phone-style notification panel. -->
+ <!-- Show rotation lock toggle in System UI-->
<bool name="config_showRotationLock">true</bool>
<!-- Amount of time to hold off before showing the search panel when the user presses home -->
@@ -84,9 +84,6 @@
<!-- The number of columns that the top level tiles span in the QuickSettings -->
<integer name="quick_settings_user_time_settings_tile_span">1</integer>
- <!-- Whether rotation lock shows up in quick settings or not -->
- <bool name="quick_settings_show_rotation_lock">false</bool>
-
<!-- Whether or not the RSSI tile is capitalized or not. -->
<bool name="quick_settings_rssi_tile_capitalization">true</bool>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 5afd55b..94796af 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -464,6 +464,10 @@
<string name="quick_settings_rotation_unlocked_label">Auto Rotate</string>
<!-- QuickSettings: Rotation Locked [CHAR LIMIT=NONE] -->
<string name="quick_settings_rotation_locked_label">Rotation Locked</string>
+ <!-- QuickSettings: Locked to Portrait [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_rotation_locked_portrait_label">Locked to Portrait</string>
+ <!-- QuickSettings: Locked to Landscape [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_rotation_locked_landscape_label">Locked to Landscape</string>
<!-- QuickSettings: IME [CHAR LIMIT=NONE] -->
<string name="quick_settings_ime_label">Input Method</string>
<!-- QuickSettings: Location [CHAR LIMIT=NONE] -->
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index bbac4ef..b181658 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -534,7 +534,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
mBatteryController = new BatteryController(mContext);
mNetworkController = new NetworkController(mContext);
mBluetoothController = new BluetoothController(mContext);
- mRotationLockController = new RotationLockController(mContext);
+ if (mContext.getResources().getBoolean(R.bool.config_showRotationLock)
+ || QuickSettings.DEBUG_GONE_TILES) {
+ mRotationLockController = new RotationLockController(mContext);
+ }
final SignalClusterView signalCluster =
(SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
index e6fd7d0..4d7ff5e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -176,7 +176,9 @@ class QuickSettings {
bluetoothController.addStateChangedCallback(mModel);
batteryController.addStateChangedCallback(mModel);
locationController.addSettingsChangedCallback(mModel);
- rotationLockController.addRotationLockControllerCallback(mModel);
+ if (rotationLockController != null) {
+ rotationLockController.addRotationLockControllerCallback(mModel);
+ }
}
private void queryForSslCaCerts() {
@@ -503,8 +505,7 @@ class QuickSettings {
}
// Rotation Lock
- if (mContext.getResources().getBoolean(R.bool.quick_settings_show_rotation_lock)
- || DEBUG_GONE_TILES) {
+ if (mRotationLockController != null) {
final QuickSettingsBasicTile rotationLockTile
= new QuickSettingsBasicTile(mContext);
rotationLockTile.setOnClickListener(new View.OnClickListener() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
index 12e08d0..11cba7b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.drawable.Drawable;
@@ -409,6 +410,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
private State mSslCaCertWarningState = new State();
private RotationLockController mRotationLockController;
+ private int mRotationLockedLabel;
public QuickSettingsModel(Context context) {
mContext = context;
@@ -919,6 +921,12 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
mRotationLockTile = view;
mRotationLockCallback = cb;
mRotationLockController = rotationLockController;
+ final int lockOrientation = mRotationLockController.getRotationLockOrientation();
+ mRotationLockedLabel = lockOrientation == Configuration.ORIENTATION_PORTRAIT
+ ? R.string.quick_settings_rotation_locked_portrait_label
+ : lockOrientation == Configuration.ORIENTATION_LANDSCAPE
+ ? R.string.quick_settings_rotation_locked_landscape_label
+ : R.string.quick_settings_rotation_locked_label;
onRotationLockChanged();
}
void onRotationLockChanged() {
@@ -933,7 +941,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback,
? R.drawable.ic_qs_rotation_locked
: R.drawable.ic_qs_auto_rotate;
mRotationLockState.label = rotationLocked
- ? mContext.getString(R.string.quick_settings_rotation_locked_label)
+ ? mContext.getString(mRotationLockedLabel)
: mContext.getString(R.string.quick_settings_rotation_unlocked_label);
mRotationLockCallback.refreshView(mRotationLockTile, mRotationLockState);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockController.java
index 6f61ec8..98d205a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockController.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.policy;
import android.content.Context;
+import android.content.res.Configuration;
import android.os.UserHandle;
import com.android.internal.view.RotationPolicy;
@@ -42,42 +43,32 @@ public final class RotationLockController {
public RotationLockController(Context context) {
mContext = context;
- notifyChanged();
- if (RotationPolicy.isRotationLockToggleSupported(mContext)) {
- RotationPolicy.registerRotationPolicyListener(mContext,
- mRotationPolicyListener, UserHandle.USER_ALL);
- }
+ RotationPolicy.registerRotationPolicyListener(mContext,
+ mRotationPolicyListener, UserHandle.USER_ALL);
}
public void addRotationLockControllerCallback(RotationLockControllerCallback callback) {
mCallbacks.add(callback);
}
+ public int getRotationLockOrientation() {
+ return RotationPolicy.getRotationLockOrientation(mContext);
+ }
+
public boolean isRotationLocked() {
- if (RotationPolicy.isRotationLockToggleSupported(mContext)) {
- return RotationPolicy.isRotationLocked(mContext);
- }
- return false;
+ return RotationPolicy.isRotationLocked(mContext);
}
public void setRotationLocked(boolean locked) {
- if (RotationPolicy.isRotationLockToggleSupported(mContext)) {
- RotationPolicy.setRotationLock(mContext, locked);
- }
+ RotationPolicy.setRotationLock(mContext, locked);
}
public boolean isRotationLockAffordanceVisible() {
- if (RotationPolicy.isRotationLockToggleSupported(mContext)) {
- return RotationPolicy.isRotationLockToggleVisible(mContext);
- }
- return false;
+ return RotationPolicy.isRotationLockToggleVisible(mContext);
}
public void release() {
- if (RotationPolicy.isRotationLockToggleSupported(mContext)) {
- RotationPolicy.unregisterRotationPolicyListener(mContext,
- mRotationPolicyListener);
- }
+ RotationPolicy.unregisterRotationPolicyListener(mContext, mRotationPolicyListener);
}
private void notifyChanged() {