diff options
author | Mike Corrigan <michael.corrigan@motorola.com> | 2011-02-24 15:24:47 -0600 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2011-03-01 13:20:07 -0500 |
commit | bd15112a29eefb93e62235574b694746044c9261 (patch) | |
tree | 0e89aedbce8489ce94238ada2680e45259c023af /packages/SystemUI/src/com/android/systemui/statusbar/policy | |
parent | 0eb6af892948ba23bf9de5c5a6172c6ec50f8f71 (diff) | |
download | frameworks_base-bd15112a29eefb93e62235574b694746044c9261.zip frameworks_base-bd15112a29eefb93e62235574b694746044c9261.tar.gz frameworks_base-bd15112a29eefb93e62235574b694746044c9261.tar.bz2 |
Fix the display priority of the airplane mode icon.
The airplane icon is used as a fallback when no
other radios are available *and* the AIRPLANE_MODE_ON system
setting is set to 1. (NetworkController now tracks changes to
the setting via ACTION_AIRPLANE_MODE_CHANGED broadcasts.)
This fixes wifi-only devices, for which the previous logic
did not correctly and consistently detect airplane mode.
Bug: 3489820
Change-Id: I226bb0e977f6a5fd3f2d829ba51ca54c5c910ef3
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/policy')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java | 34 |
1 files changed, 24 insertions, 10 deletions
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 f2c838a..0dc7e8d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -98,6 +98,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>(); @@ -155,8 +157,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(); } @@ -212,6 +218,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(); } } @@ -379,18 +388,16 @@ public class NetworkController extends BroadcastReceiver { return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr; } + 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; @@ -734,6 +741,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 @@ -747,6 +760,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) |