summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java2
3 files changed, 38 insertions, 23 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java
index b0a6d7a..5ac5ad0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java
@@ -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) {
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 35ae118..326cd74 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -105,6 +105,8 @@ public class NetworkController extends BroadcastReceiver {
private int mInetCondition = 0;
private static final int INET_CONDITION_THRESHOLD = 50;
+ private boolean mAirplaneMode = false;
+
// our ui
Context mContext;
ArrayList<ImageView> mPhoneSignalIconViews = new ArrayList<ImageView>();
@@ -170,8 +172,12 @@ public class NetworkController extends BroadcastReceiver {
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
+ filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
context.registerReceiver(this, filter);
+ // AIRPLANE_MODE_CHANGED is sent at boot; we've probably already missed it
+ updateAirplaneMode();
+
// yuck
mBatteryStats = BatteryStatsService.getService();
}
@@ -228,6 +234,9 @@ public class NetworkController extends BroadcastReceiver {
refreshViews();
} else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
refreshViews();
+ } else if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
+ updateAirplaneMode();
+ refreshViews();
}
}
@@ -343,18 +352,17 @@ public class NetworkController extends BroadcastReceiver {
return (! "wifi-only".equals(SystemProperties.get("ro.carrier")));
}
+
+ private void updateAirplaneMode() {
+ mAirplaneMode = (Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.AIRPLANE_MODE_ON, 0) == 1);
+ }
+
private final void updateTelephonySignalStrength() {
- // Display signal strength while in "emergency calls only" mode
- if (mServiceState == null || (!hasService() && !mServiceState.isEmergencyOnly())) {
+ if (!hasService()) {
//Slog.d(TAG, "updateTelephonySignalStrength: no service");
- if (Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.AIRPLANE_MODE_ON, 0) == 1) {
- mPhoneSignalIconId = R.drawable.stat_sys_signal_flightmode;
- mDataSignalIconId = R.drawable.stat_sys_signal_flightmode;
- } else {
- mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
- mDataSignalIconId = R.drawable.stat_sys_signal_0; // note we use 0 instead of null
- }
+ mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
+ mDataSignalIconId = R.drawable.stat_sys_signal_0; // note we use 0 instead of null
} else {
if (mSignalStrength == null) {
mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
@@ -719,6 +727,12 @@ public class NetworkController extends BroadcastReceiver {
label = mContext.getString(R.string.bluetooth_tethered);
combinedSignalIconId = mBluetoothTetherIconId;
dataTypeIconId = 0;
+ } else if (mAirplaneMode &&
+ (mServiceState == null || (!hasService() && !mServiceState.isEmergencyOnly()))) {
+ // Only display the flight-mode icon if not in "emergency calls only" mode.
+ label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
+ combinedSignalIconId = R.drawable.stat_sys_signal_flightmode;
+ dataTypeIconId = 0;
} else {
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
// On devices without mobile radios, we want to show the wifi icon
@@ -732,6 +746,7 @@ public class NetworkController extends BroadcastReceiver {
+ Integer.toHexString(combinedSignalIconId)
+ "/" + getResourceName(combinedSignalIconId)
+ " dataDirectionOverlayIconId=0x" + Integer.toHexString(dataDirectionOverlayIconId)
+ + " mAirplaneMode=" + mAirplaneMode
+ " mDataActivity=" + mDataActivity
+ " mPhoneSignalIconId=0x" + Integer.toHexString(mPhoneSignalIconId)
+ " mDataDirectionIconId=0x" + Integer.toHexString(mDataDirectionIconId)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index 2ec2af0..8a88792 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -164,7 +164,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
}
public void setNotificationCount(int n) {
- Slog.d(TAG, "notificationCount=" + n);
+// Slog.d(TAG, "notificationCount=" + n);
if (!mShowing) {
// just do it, already
setContentFrameVisible(n > 0, false);