diff options
author | Michael Bestas <mikeioannina@gmail.com> | 2015-12-07 15:31:59 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-12-12 10:05:58 -0800 |
commit | 02b98156165c56c1e8d563cf3e33d097ffe8762b (patch) | |
tree | 1d0527ae296dd7f503c3c9826411226c084b5d3b /packages/SystemUI/src/com | |
parent | ce0e7c836343facd20724a26b36255d1d6eb1d55 (diff) | |
download | frameworks_base-02b98156165c56c1e8d563cf3e33d097ffe8762b.zip frameworks_base-02b98156165c56c1e8d563cf3e33d097ffe8762b.tar.gz frameworks_base-02b98156165c56c1e8d563cf3e33d097ffe8762b.tar.bz2 |
SystemUI: Revert CAF UI modifications
Revert "SystemUI: Support display for radio tech"
This reverts commit 598421095aacb599d4bc8e8fcea20734d7847d0c.
Revert "SystemUI: Customize StatusBar for Chinese carrier"
This reverts commit d473d0b22ac8704c39d5eedd0d7b12f60a2fa215.
Revert "Statusbar: Add customized icons for Chinese carrier"
This reverts commit a6324c7293bebeff4c6ccee8c2a8af38b7a150a8.
Change-Id: Ib03c7455a04bd7d63a8c0a7d238040099e94e89c
Diffstat (limited to 'packages/SystemUI/src/com')
10 files changed, 22 insertions, 927 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index 426cf4b..e2c0a2d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -200,9 +200,8 @@ public class CellularTile extends QSTile<QSTile.SignalState> { @Override public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, - int qsType, boolean activityIn, boolean activityOut, int dataActivityId, - int mobileActivityId, int stackedDataIcon, int stackedVoiceIcon, - String typeContentDescription, String description, boolean isWide, int subId) { + int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, + String description, boolean isWide, int subId) { if (qsIcon == null) { // Not data sim, don't display. return; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java index e22b94c..b0fc398 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -18,7 +18,6 @@ package com.android.systemui.statusbar; import android.content.Context; import android.content.res.ColorStateList; -import android.content.res.Resources; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.drawable.Animatable; @@ -68,8 +67,8 @@ public class SignalClusterView private int mEthernetIconId = 0; private int mLastEthernetIconId = -1; private boolean mWifiVisible = false; - private int mWifiStrengthId = 0, mWifiActivityId = 0; - private int mLastWifiStrengthId = -1, mLastWifiActivityId = -1; + private int mWifiStrengthId = 0; + private int mLastWifiStrengthId = -1; private boolean mIsAirplaneMode = false; private int mAirplaneIconId = 0; private int mLastAirplaneIconId = -1; @@ -79,12 +78,10 @@ public class SignalClusterView private ArrayList<PhoneState> mPhoneStates = new ArrayList<PhoneState>(); private int mIconTint = Color.WHITE; private float mDarkIntensity; - private int mNoSimsIcon; ViewGroup mEthernetGroup, mWifiGroup; View mNoSimsCombo; ImageView mVpn, mEthernet, mWifi, mAirplane, mNoSims, mEthernetDark, mWifiDark, mNoSimsDark; - ImageView mWifiActivity; View mWifiAirplaneSpacer; View mWifiSignalSpacer; LinearLayout mMobileSignalGroup; @@ -164,7 +161,6 @@ public class SignalClusterView mWifiGroup = (ViewGroup) findViewById(R.id.wifi_combo); mWifi = (ImageView) findViewById(R.id.wifi_signal); mWifiDark = (ImageView) findViewById(R.id.wifi_signal_dark); - mWifiActivity = (ImageView) findViewById(R.id.wifi_inout); mAirplane = (ImageView) findViewById(R.id.airplane); mNoSims = (ImageView) findViewById(R.id.no_sims); mNoSimsDark = (ImageView) findViewById(R.id.no_sims_dark); @@ -188,7 +184,6 @@ public class SignalClusterView mEthernet = null; mWifiGroup = null; mWifi = null; - mWifiActivity = null; mAirplane = null; mMobileSignalGroup.removeAllViews(); mMobileSignalGroup = null; @@ -214,7 +209,6 @@ public class SignalClusterView boolean activityIn, boolean activityOut, String description) { mWifiVisible = statusIcon.visible && !mBlockWifi; mWifiStrengthId = statusIcon.icon; - mWifiActivityId = getWifiActivityId(activityIn, activityOut); mWifiDescription = statusIcon.contentDescription; apply(); @@ -222,9 +216,8 @@ public class SignalClusterView @Override public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, - int qsType, boolean activityIn, boolean activityOut, int dataActivityId, - int mobileActivityId, int stackedDataId, int stackedVoiceId, - String typeContentDescription, String description, boolean isWide, int subId) { + int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, + String description, boolean isWide, int subId) { PhoneState state = getState(subId); if (state == null) { return; @@ -235,10 +228,6 @@ public class SignalClusterView state.mMobileDescription = statusIcon.contentDescription; state.mMobileTypeDescription = typeContentDescription; state.mIsMobileTypeIconWide = statusType != 0 && isWide; - state.mDataActivityId = dataActivityId; - state.mMobileActivityId = mobileActivityId; - state.mStackedDataId = stackedDataId; - state.mStackedVoiceId = stackedVoiceId; apply(); } @@ -300,43 +289,6 @@ public class SignalClusterView return null; } - - private int getWifiActivityId(boolean activityIn, boolean activityOut) { - if (!getContext().getResources().getBoolean(R.bool.config_showWifiActivity)) { - return 0; - } - int activityId = 0; - if (activityIn && activityOut) { - activityId = R.drawable.stat_sys_wifi_inout; - } else if (activityIn) { - activityId = R.drawable.stat_sys_wifi_in; - } else if (activityOut) { - activityId = R.drawable.stat_sys_wifi_out; - } - return activityId; - } - - private int getNoSimIcon() { - int resId = 0; - final String[] noSimArray; - Resources res = getContext().getResources(); - - if (!res.getBoolean(R.bool.config_read_icons_from_xml)) return resId; - - try { - noSimArray = res.getStringArray(R.array.multi_no_sim); - } catch (android.content.res.Resources.NotFoundException e) { - return resId; - } - - if (noSimArray == null) return resId; - - String resName = noSimArray[0]; - resId = res.getIdentifier(resName, null, getContext().getPackageName()); - if (DEBUG) Log.d(TAG, "getNoSimIcon resId = " + resId + " resName = " + resName); - return resId; - } - private PhoneState inflatePhoneState(int subId) { PhoneState state = new PhoneState(subId, mContext); if (mMobileSignalGroup != null) { @@ -391,11 +343,6 @@ public class SignalClusterView mLastWifiStrengthId = -1; } - if (mWifiActivity != null) { - mWifiActivity.setImageDrawable(null); - mLastWifiActivityId = -1; - } - for (PhoneState state : mPhoneStates) { if (state.mMobile != null) { state.mMobile.setImageDrawable(null); @@ -448,10 +395,6 @@ public class SignalClusterView mWifiDark.setImageResource(mWifiStrengthId); mLastWifiStrengthId = mWifiStrengthId; } - if (mWifiActivityId != mLastWifiActivityId) { - mWifiActivity.setImageResource(mWifiActivityId); - mLastWifiActivityId = mWifiActivityId; - } mWifiGroup.setContentDescription(mWifiDescription); mWifiGroup.setVisibility(View.VISIBLE); } else { @@ -459,9 +402,9 @@ public class SignalClusterView } if (DEBUG) Log.d(TAG, - String.format("wifi: %s sig=%d act=%d", + String.format("wifi: %s sig=%d", (mWifiVisible ? "VISIBLE" : "GONE"), - mWifiStrengthId, mWifiActivityId)); + mWifiStrengthId)); boolean anyMobileVisible = false; int firstMobileTypeId = 0; @@ -497,13 +440,6 @@ public class SignalClusterView mWifiSignalSpacer.setVisibility(View.GONE); } - if (mNoSimsVisible && mNoSims != null && mNoSimsDark != null) { - if (mNoSimsIcon == 0) mNoSimsIcon = getNoSimIcon(); - if (mNoSimsIcon != 0) { - mNoSims.setImageResource(mNoSimsIcon); - mNoSimsDark.setImageResource(mNoSimsIcon); - } - } mNoSimsCombo.setVisibility(mNoSimsVisible ? View.VISIBLE : View.GONE); } @@ -546,11 +482,6 @@ public class SignalClusterView private ViewGroup mMobileGroup; private ImageView mMobile, mMobileDark, mMobileType; - private int mDataActivityId = 0, mMobileActivityId = 0; - private int mStackedDataId = 0, mStackedVoiceId = 0; - private ImageView mDataActivity, mMobileActivity, mStackedData, mStackedVoice; - private ViewGroup mMobileSingleGroup, mMobileStackedGroup; - public PhoneState(int subId, Context context) { ViewGroup root = (ViewGroup) LayoutInflater.from(context) .inflate(R.layout.mobile_signal_group, null); @@ -563,14 +494,6 @@ public class SignalClusterView mMobile = (ImageView) root.findViewById(R.id.mobile_signal); mMobileDark = (ImageView) root.findViewById(R.id.mobile_signal_dark); mMobileType = (ImageView) root.findViewById(R.id.mobile_type); - mMobileActivity = (ImageView) root.findViewById(R.id.mobile_inout); - - mDataActivity = (ImageView) root.findViewById(R.id.data_inout); - mStackedData = (ImageView) root.findViewById(R.id.mobile_signal_data); - mStackedVoice = (ImageView) root.findViewById(R.id.mobile_signal_voice); - - mMobileSingleGroup = (ViewGroup) root.findViewById(R.id.mobile_signal_single); - mMobileStackedGroup = (ViewGroup) root.findViewById(R.id.mobile_signal_stacked); } public boolean apply(boolean isSecondaryIcon) { @@ -594,37 +517,6 @@ public class SignalClusterView } mMobileType.setImageResource(mMobileTypeId); - - mDataActivity.setImageResource(mDataActivityId); - Drawable dataActivityDrawable = mDataActivity.getDrawable(); - if (dataActivityDrawable instanceof Animatable) { - Animatable ad = (Animatable) dataActivityDrawable; - if (!ad.isRunning()) { - ad.start(); - } - } - - mMobileActivity.setImageResource(mMobileActivityId); - Drawable mobileActivityDrawable = mMobileActivity.getDrawable(); - if (mobileActivityDrawable instanceof Animatable) { - Animatable ad = (Animatable) mobileActivityDrawable; - if (!ad.isRunning()) { - ad.start(); - } - } - - if (mStackedDataId != 0 && mStackedVoiceId != 0) { - mStackedData.setImageResource(mStackedDataId); - mStackedVoice.setImageResource(mStackedVoiceId); - mMobileSingleGroup.setVisibility(View.GONE); - mMobileStackedGroup.setVisibility(View.VISIBLE); - } else { - mStackedData.setImageResource(0); - mStackedVoice.setImageResource(0); - mMobileSingleGroup.setVisibility(View.VISIBLE); - mMobileStackedGroup.setVisibility(View.GONE); - } - mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription); mMobileGroup.setVisibility(View.VISIBLE); @@ -644,8 +536,6 @@ public class SignalClusterView (mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, mMobileTypeId)); mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE); - mDataActivity.setVisibility(mDataActivityId != 0 ? View.VISIBLE : View.GONE); - mMobileActivity.setVisibility(mMobileActivityId != 0 ? View.VISIBLE : View.GONE); return mMobileVisible; } 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 6de6348..8671ba5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -100,7 +100,6 @@ import android.view.WindowManagerGlobal; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; -import android.view.ViewGroup.MarginLayoutParams; import android.view.ViewStub; import android.view.ViewTreeObserver; import android.view.WindowManager; @@ -367,9 +366,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, int mKeyguardMaxNotificationCount; - // carrier label - private TextView mCarrierLabel; - private boolean mShowCarrierInPanel = false; boolean mExpandedVisible; private int mNavigationBarWindowState = WINDOW_STATE_SHOWING; @@ -1088,23 +1084,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mNetworkController.addEmergencyListener(mHeader); } - mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label); - final boolean showCarrierLabel = mContext.getResources().getBoolean( - R.bool.config_showCarrierLabel); - mShowCarrierInPanel = showCarrierLabel && (mCarrierLabel != null); - if (DEBUG) Log.v(TAG, "carrierlabel=" + mCarrierLabel + " show=" + mShowCarrierInPanel); - if (mShowCarrierInPanel) { - mCarrierLabel.setVisibility(mShowCarrierInPanel ? View.VISIBLE : View.INVISIBLE); - } - - // make sure carrier label is not covered by navigation bar - if (mCarrierLabel != null && mNavigationBarView != null) { - MarginLayoutParams mlp = (MarginLayoutParams) mCarrierLabel.getLayoutParams(); - if (mlp != null && mlp.bottomMargin < mNavigationBarView.mBarSize) { - mlp.bottomMargin = mNavigationBarView.mBarSize; - mCarrierLabel.setLayoutParams(mlp); - } - } mFlashlightController = new FlashlightController(mContext); mKeyguardBottomArea.setFlashlightController(mFlashlightController); mKeyguardBottomArea.setPhoneStatusBar(this); @@ -1863,21 +1842,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mNotificationPanel.notifyVisibleChildrenChanged(); } - protected void updateCarrierLabelVisibility() { - if (!mShowCarrierInPanel) return; - - final boolean makeVisible = mStackScroller.getVisibility() == View.VISIBLE - && mState != StatusBarState.KEYGUARD; - - if ((mCarrierLabel.getVisibility() == View.VISIBLE) != makeVisible) { - if (DEBUG) { - Log.d(TAG, "making carrier label " + (makeVisible?"visible":"invisible")); - } - - mCarrierLabel.setVisibility(makeVisible ? View.VISIBLE : View.INVISIBLE); - } - } - @Override protected void setAreThereNotifications() { @@ -4374,7 +4338,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, updateStackScrollerState(goingToFullShade); updateNotifications(); checkBarModes(); - updateCarrierLabelVisibility(); updateMediaMetaData(false); mKeyguardMonitor.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(), mStatusBarKeyguardViewManager.isSecure()); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java index 69f8846..e618cb8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java @@ -124,19 +124,16 @@ public class CallbackHandler extends Handler implements EmergencyListener, Signa @Override public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon, - final int statusType, final int qsType, final boolean activityIn, - final boolean activityOut, final int dataActivityId, final int mobileActivityId, - final int stackedDataIcon, final int stackedVoiceIcon, - final String typeContentDescription, final String description, final boolean isWide, - final int subId) { + final int statusType, final int qsType,final boolean activityIn, + final boolean activityOut, final String typeContentDescription, + final String description, final boolean isWide, final int subId) { post(new Runnable() { @Override public void run() { for (SignalCallback signalCluster : mSignalCallbacks) { signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType, - activityIn, activityOut, dataActivityId, mobileActivityId, - stackedDataIcon, stackedVoiceIcon, - typeContentDescription, description, isWide, subId); + activityIn, activityOut, typeContentDescription, description, isWide, + subId); } } }); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index 631a4d0..f79b428 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.policy; import android.content.Context; import android.content.Intent; -import android.content.res.Resources; import android.net.NetworkCapabilities; import android.os.Looper; import android.telephony.PhoneStateListener; @@ -57,12 +56,6 @@ public class MobileSignalController extends SignalController< // @VisibleForDemoMode final SparseArray<MobileIconGroup> mNetworkToIconLookup; - private boolean mLastShowSpn; - private String mLastSpn; - private String mLastDataSpn; - private boolean mLastShowPlmn; - private String mLastPlmn; - // Since some pieces of the phone state are interdependent we store it locally, // this could potentially become part of MobileState for simplification/complication // of code. @@ -73,12 +66,6 @@ public class MobileSignalController extends SignalController< private MobileIconGroup mDefaultIcons; private Config mConfig; - private final int STATUS_BAR_STYLE_ANDROID_DEFAULT = 0; - private final int STATUS_BAR_STYLE_CDMA_1X_COMBINED = 1; - private final int STATUS_BAR_STYLE_DEFAULT_DATA = 2; - private final int STATUS_BAR_STYLE_DATA_VOICE = 3; - private int mStyle = STATUS_BAR_STYLE_ANDROID_DEFAULT; - // TODO: Reduce number of vars passed in, if we have the NetworkController, probably don't // need listener lists anymore. public MobileSignalController(Context context, Config config, boolean hasMobileData, @@ -99,14 +86,7 @@ public class MobileSignalController extends SignalController< mNetworkNameDefault = getStringIfExists( com.android.internal.R.string.lockscreen_carrier_default); - if (config.readIconsFromXml) { - TelephonyIcons.readIconsFromXml(context); - mDefaultIcons = !mConfig.showAtLeast3G ? TelephonyIcons.G : TelephonyIcons.THREE_G; - } else { - mapIconSets(); - } - - mStyle = context.getResources().getInteger(R.integer.status_bar_style); + mapIconSets(); String networkName = info.getCarrierName() != null ? info.getCarrierName().toString() : mNetworkNameDefault; @@ -120,9 +100,7 @@ public class MobileSignalController extends SignalController< public void setConfiguration(Config config) { mConfig = config; - if (!config.readIconsFromXml) { - mapIconSets(); - } + mapIconSets(); updateTelephony(); } @@ -225,9 +203,6 @@ public class MobileSignalController extends SignalController< @Override public void notifyListeners() { - if (mConfig.readIconsFromXml) { - generateIconGroup(); - } MobileIconGroup icons = getIcons(); String contentDescription = getStringIfExists(getContentDescription()); @@ -257,14 +232,9 @@ public class MobileSignalController extends SignalController< && mCurrentState.activityOut; showDataIcon &= mCurrentState.isDefault || mCurrentState.iconGroup == TelephonyIcons.ROAMING; - showDataIcon &= mStyle == STATUS_BAR_STYLE_ANDROID_DEFAULT; int typeIcon = showDataIcon ? icons.mDataType : 0; - int dataActivityId = showMobileActivity() ? 0 : icons.mActivityId; - int mobileActivityId = showMobileActivity() ? icons.mActivityId : 0; mCallbackHandler.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon, - activityIn, activityOut, dataActivityId, mobileActivityId, - icons.mStackedDataIcon, icons.mStackedVoiceIcon, - dataContentDescription, description, icons.mIsWide, + activityIn, activityOut, dataContentDescription, description, icons.mIsWide, mSubscriptionInfo.getSubscriptionId()); } @@ -273,15 +243,6 @@ public class MobileSignalController extends SignalController< return new MobileState(); } - @Override - public int getCurrentIconId() { - if (mConfig.readIconsFromXml && mCurrentState.connected) { - return getIcons().mSingleSignalIcon; - } else { - return super.getCurrentIconId(); - } - } - private boolean hasService() { if (mServiceState != null) { // Consider the device to be in service if either voice or data @@ -339,11 +300,6 @@ public class MobileSignalController extends SignalController< } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) { updateDataSim(); notifyListenersIfNecessary(); - } else if (action.equals(Intent.ACTION_LOCALE_CHANGED)) { - if (mConfig.showLocale) { - updateNetworkName(mLastShowSpn, mLastSpn, mLastDataSpn, mLastShowPlmn, mLastPlmn); - notifyListenersIfNecessary(); - } } } @@ -363,75 +319,27 @@ public class MobileSignalController extends SignalController< } } - private String getLocalString(String originalString) { - return android.util.NativeTextHelper.getLocalString(mContext, originalString, - com.android.internal.R.array.origin_carrier_names, - com.android.internal.R.array.locale_carrier_names); - } - - private String getNetworkClassString(ServiceState state) { - if (state != null && (state.getDataRegState() == ServiceState.STATE_IN_SERVICE || - state.getVoiceRegState() == ServiceState.STATE_IN_SERVICE)) { - int voiceNetType = state.getVoiceNetworkType(); - int dataNetType = state.getDataNetworkType(); - int chosenNetType = - ((dataNetType == TelephonyManager.NETWORK_TYPE_UNKNOWN) - ? voiceNetType : dataNetType); - TelephonyManager tm = (TelephonyManager)mContext.getSystemService( - Context.TELEPHONY_SERVICE); - return tm.networkClassToString(chosenNetType); - } else { - return ""; - } - } - /** * Updates the network's name based on incoming spn and plmn. */ void updateNetworkName(boolean showSpn, String spn, String dataSpn, boolean showPlmn, String plmn) { - mLastShowSpn = showSpn; - mLastSpn = spn; - mLastDataSpn = dataSpn; - mLastShowPlmn = showPlmn; - mLastPlmn = plmn; if (CHATTY) { Log.d("CarrierLabel", "updateNetworkName showSpn=" + showSpn + " spn=" + spn + " dataSpn=" + dataSpn + " showPlmn=" + showPlmn + " plmn=" + plmn); } - if (mConfig.showLocale) { - if (showSpn && !TextUtils.isEmpty(spn)) { - spn = getLocalString(spn); - } - if (showSpn && !TextUtils.isEmpty(dataSpn)) { - dataSpn = getLocalString(dataSpn); - } - if (showPlmn && !TextUtils.isEmpty(plmn)) { - plmn = getLocalString(plmn); - } - } - if (showPlmn && showSpn && !TextUtils.isEmpty(spn) && !TextUtils.isEmpty(plmn) - && plmn.equals(spn)) { - showSpn = false; - } - String networkClass = getNetworkClassString(mServiceState); StringBuilder str = new StringBuilder(); StringBuilder strData = new StringBuilder(); if (showPlmn && plmn != null) { str.append(plmn); strData.append(plmn); - if (mConfig.showRat) { - str.append(" ").append(networkClass); - strData.append(" ").append(networkClass); - } } if (showSpn && spn != null) { if (str.length() != 0) { str.append(mNetworkNameSeparator); } str.append(spn); - if (mConfig.showRat) str.append(" ").append(networkClass); } if (str.length() != 0) { mCurrentState.networkName = str.toString(); @@ -443,7 +351,6 @@ public class MobileSignalController extends SignalController< strData.append(mNetworkNameSeparator); } strData.append(dataSpn); - if (mConfig.showRat) strData.append(" ").append(networkClass); } if (strData.length() != 0) { mCurrentState.networkNameData = strData.toString(); @@ -459,7 +366,7 @@ public class MobileSignalController extends SignalController< */ private final void updateTelephony() { if (DEBUG) { - Log.d(mTag, "updateTelephony: hasService=" + hasService() + Log.d(mTag, "updateTelephonySignalStrength: hasService=" + hasService() + " ss=" + mSignalStrength); } mCurrentState.connected = hasService() && mSignalStrength != null; @@ -500,188 +407,9 @@ public class MobileSignalController extends SignalController< mCurrentState.networkName = mServiceState.getOperatorAlphaShort(); } - if (mConfig.readIconsFromXml) { - mCurrentState.voiceLevel = getVoiceSignalLevel(); - } - notifyListenersIfNecessary(); } - private void generateIconGroup() { - final int level = mCurrentState.level; - final int voiceLevel = mCurrentState.voiceLevel; - final int inet = mCurrentState.inetCondition; - final boolean dataConnected = mCurrentState.dataConnected; - final boolean roaming = isRoaming(); - final int voiceType = getVoiceNetworkType(); - final int dataType = getDataNetworkType(); - - int[][] sbIcons = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH; - int[][] qsIcons = TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH; - int[] contentDesc = AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH; - int sbDiscState = TelephonyIcons.TELEPHONY_NO_NETWORK; - int qsDiscState = TelephonyIcons.QS_TELEPHONY_NO_NETWORK; - int discContentDesc = AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0]; - int dataContentDesc, dataTypeIcon, qsDataTypeIcon, dataActivityId; - int singleSignalIcon, stackedDataIcon = 0, stackedVoiceIcon = 0; - - final int slotId = getSimSlotIndex(); - if (slotId < 0 || slotId > mPhone.getPhoneCount()) { - Log.e(mTag, "generateIconGroup invalid slotId:" + slotId); - return; - } - - if (DEBUG) Log.d(mTag, "generateIconGroup slot:" + slotId + " style:" + mStyle - + " connected:" + mCurrentState.connected + " inetCondition:" + inet - + " roaming:" + roaming + " level:" + level + " voiceLevel:" + voiceLevel - + " dataConnected:" + dataConnected - + " dataActivity:" + mCurrentState.dataActivity - + " CS:" + voiceType - + "/" + TelephonyManager.getNetworkTypeName(voiceType) - + ", PS:" + dataType - + "/" + TelephonyManager.getNetworkTypeName(dataType)); - - // Update data icon set - int chosenNetworkType = ((dataType == TelephonyManager.NETWORK_TYPE_UNKNOWN) - ? voiceType : dataType); - TelephonyIcons.updateDataType(slotId, chosenNetworkType, mConfig.showAtLeast3G, - mConfig.show4gForLte, mConfig.hspaDataDistinguishable, inet); - - // Update signal strength icons - singleSignalIcon = TelephonyIcons.getSignalStrengthIcon(slotId, inet, level, roaming); - if (DEBUG) { - Log.d(mTag, "singleSignalIcon:" + getResourceName(singleSignalIcon)); - } - - dataActivityId = (mCurrentState.dataConnected && slotId >= 0) ? - TelephonyIcons.getDataActivity(slotId, mCurrentState.dataActivity) : 0; - - // Convert the icon to unstacked if necessary. - int unstackedSignalIcon = TelephonyIcons.convertMobileStrengthIcon(singleSignalIcon); - if (DEBUG) { - Log.d(mTag, "unstackedSignalIcon:" + getResourceName(unstackedSignalIcon)); - } - if (singleSignalIcon != unstackedSignalIcon) { - stackedDataIcon = singleSignalIcon; - singleSignalIcon = unstackedSignalIcon; - } - - if (mStyle == STATUS_BAR_STYLE_CDMA_1X_COMBINED) { - if (!roaming && showDataAndVoice()) { - stackedVoiceIcon = TelephonyIcons.getStackedVoiceIcon(voiceLevel); - } else if (roaming && dataActivityId != 0) { - // Remove data type indicator if already shown in data activity icon. - singleSignalIcon = TelephonyIcons.getRoamingSignalIconId(level, inet); - } - } - - // Clear satcked data icon if no satcked voice icon. - if (stackedVoiceIcon == 0) stackedDataIcon = 0; - - contentDesc = TelephonyIcons.getSignalStrengthDes(slotId); - sbDiscState = TelephonyIcons.getSignalNullIcon(slotId); - if (DEBUG) { - Log.d(mTag, "singleSignalIcon=" + getResourceName(singleSignalIcon) - + " dataActivityId=" + getResourceName(dataActivityId) - + " stackedDataIcon=" + getResourceName(stackedDataIcon) - + " stackedVoiceIcon=" + getResourceName(stackedVoiceIcon)); - } - - // Update data net type icons - if (dataType == TelephonyManager.NETWORK_TYPE_IWLAN) { - // wimax is a special 4g network not handled by telephony - dataTypeIcon = TelephonyIcons.ICON_4G; - qsDataTypeIcon = TelephonyIcons.QS_DATA_4G; - dataContentDesc = R.string.accessibility_data_connection_4g; - } else { - dataTypeIcon = TelephonyIcons.getDataTypeIcon(slotId); - dataContentDesc = TelephonyIcons.getDataTypeDesc(slotId); - qsDataTypeIcon = TelephonyIcons.getQSDataTypeIcon(slotId); - } - if (roaming) { - dataTypeIcon = TelephonyIcons.ROAMING_ICON; - qsDataTypeIcon = TelephonyIcons.QS_DATA_R; - } - if (DEBUG) { - Log.d(mTag, "updateDataNetType, dataTypeIcon=" + getResourceName(dataTypeIcon) - + " qsDataTypeIcon=" + getResourceName(qsDataTypeIcon) - + " dataContentDesc=" + dataContentDesc); - } - mCurrentState.iconGroup = new MobileIconGroup( - TelephonyManager.getNetworkTypeName(dataType), - sbIcons, qsIcons, contentDesc, 0, 0, sbDiscState, qsDiscState, discContentDesc, - dataContentDesc, dataTypeIcon, false, qsDataTypeIcon, - singleSignalIcon, stackedDataIcon, stackedVoiceIcon, dataActivityId); - } - - private int getSimSlotIndex() { - int slotId = -1; - if (mSubscriptionInfo != null) { - slotId = mSubscriptionInfo.getSimSlotIndex(); - } - if (DEBUG) Log.d(mTag, "getSimSlotIndex, slotId: " + slotId); - return slotId; - } - - private boolean showMobileActivity() { - return (mStyle == STATUS_BAR_STYLE_DEFAULT_DATA) - || (mStyle == STATUS_BAR_STYLE_ANDROID_DEFAULT); - } - - private int getVoiceNetworkType() { - if (mServiceState == null) { - return TelephonyManager.NETWORK_TYPE_UNKNOWN; - } - return mServiceState.getVoiceNetworkType(); - } - - private int getDataNetworkType() { - if (mServiceState == null) { - return TelephonyManager.NETWORK_TYPE_UNKNOWN; - } - return mServiceState.getDataNetworkType(); - } - - private int getVoiceSignalLevel() { - if (mSignalStrength == null) { - return SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN; - } - boolean isCdma = TelephonyManager.PHONE_TYPE_CDMA == TelephonyManager.getDefault() - .getCurrentPhoneType(mSubscriptionInfo.getSubscriptionId()); - return isCdma ? mSignalStrength.getCdmaLevel() : mSignalStrength.getGsmLevel(); - } - - private boolean showDataAndVoice() { - if (mStyle != STATUS_BAR_STYLE_CDMA_1X_COMBINED) { - return false; - } - int dataType = getDataNetworkType(); - int voiceType = getVoiceNetworkType(); - if ((dataType == TelephonyManager.NETWORK_TYPE_EVDO_0 - || dataType == TelephonyManager.NETWORK_TYPE_EVDO_0 - || dataType == TelephonyManager.NETWORK_TYPE_EVDO_A - || dataType == TelephonyManager.NETWORK_TYPE_EVDO_B - || dataType == TelephonyManager.NETWORK_TYPE_EHRPD - || dataType == TelephonyManager.NETWORK_TYPE_LTE - || dataType == TelephonyManager.NETWORK_TYPE_LTE_CA) - && (voiceType == TelephonyManager.NETWORK_TYPE_GSM - || voiceType == TelephonyManager.NETWORK_TYPE_1xRTT - || voiceType == TelephonyManager.NETWORK_TYPE_CDMA)) { - return true; - } - return false; - } - - private boolean show1xOnly() { - int dataType = getDataNetworkType(); - int voiceType = getVoiceNetworkType(); - if (dataType == TelephonyManager.NETWORK_TYPE_1xRTT - || dataType == TelephonyManager.NETWORK_TYPE_CDMA) { - return true; - } - return false; - } - private int getAlternateLteLevel(SignalStrength signalStrength) { int lteRsrp = signalStrength.getLteDbm(); int rsrpLevel = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN; @@ -697,28 +425,12 @@ public class MobileSignalController extends SignalController< return rsrpLevel; } - protected String getResourceName(int resId) { - if (resId != 0) { - final Resources res = mContext.getResources(); - try { - return res.getResourceName(resId); - } catch (android.content.res.Resources.NotFoundException ex) { - return "(unknown)"; - } - } else { - return "(null)"; - } - } - @VisibleForTesting void setActivity(int activity) { mCurrentState.activityIn = activity == TelephonyManager.DATA_ACTIVITY_INOUT || activity == TelephonyManager.DATA_ACTIVITY_IN; mCurrentState.activityOut = activity == TelephonyManager.DATA_ACTIVITY_INOUT || activity == TelephonyManager.DATA_ACTIVITY_OUT; - if (mConfig.readIconsFromXml) { - mCurrentState.dataActivity = activity; - } notifyListenersIfNecessary(); } @@ -754,7 +466,6 @@ public class MobileSignalController extends SignalController< + " dataState=" + state.getDataRegState()); } mServiceState = state; - updateNetworkName(mLastShowSpn, mLastSpn, mLastDataSpn, mLastShowPlmn, mLastPlmn); updateTelephony(); } @@ -793,35 +504,17 @@ public class MobileSignalController extends SignalController< final int mDataType; final boolean mIsWide; final int mQsDataType; - final int mSingleSignalIcon; - final int mStackedDataIcon; - final int mStackedVoiceIcon; - final int mActivityId; public MobileIconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState, int qsDiscState, int discContentDesc, int dataContentDesc, int dataType, boolean isWide, int qsDataType) { - this(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState, - qsDiscState, discContentDesc, dataContentDesc, dataType, isWide, - qsDataType, 0, 0, 0, 0); - } - - public MobileIconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc, - int sbNullState, int qsNullState, int sbDiscState, int qsDiscState, - int discContentDesc, int dataContentDesc, int dataType, boolean isWide, - int qsDataType, int singleSignalIcon, int stackedDataIcon, - int stackedVoicelIcon, int activityId) { super(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState, qsDiscState, discContentDesc); mDataContentDescription = dataContentDesc; mDataType = dataType; mIsWide = isWide; mQsDataType = qsDataType; - mSingleSignalIcon = singleSignalIcon; - mStackedDataIcon = stackedDataIcon; - mStackedVoiceIcon = stackedVoicelIcon; - mActivityId = activityId; } } @@ -834,8 +527,6 @@ public class MobileSignalController extends SignalController< boolean airplaneMode; boolean carrierNetworkChangeMode; boolean isDefault; - int dataActivity; - int voiceLevel; @Override public void copyFrom(State s) { @@ -849,8 +540,6 @@ public class MobileSignalController extends SignalController< isEmergency = state.isEmergency; airplaneMode = state.airplaneMode; carrierNetworkChangeMode = state.carrierNetworkChangeMode; - dataActivity = state.dataActivity; - voiceLevel = state.voiceLevel; } @Override @@ -864,7 +553,6 @@ public class MobileSignalController extends SignalController< builder.append("isDefault=").append(isDefault).append(','); builder.append("isEmergency=").append(isEmergency).append(','); builder.append("airplaneMode=").append(airplaneMode).append(','); - builder.append("voiceLevel=").append(voiceLevel).append(','); builder.append("carrierNetworkChangeMode=").append(carrierNetworkChangeMode); } @@ -878,7 +566,6 @@ public class MobileSignalController extends SignalController< && ((MobileState) o).isEmergency == isEmergency && ((MobileState) o).airplaneMode == airplaneMode && ((MobileState) o).carrierNetworkChangeMode == carrierNetworkChangeMode - && ((MobileState) o).voiceLevel == voiceLevel && ((MobileState) o).isDefault == isDefault; } } 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 1ed147f..8023ea6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -39,10 +39,8 @@ public interface NetworkController { boolean activityIn, boolean activityOut, String description); void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, - int qsType, boolean activityIn, boolean activityOut, int dataActivityId, - int mobileActivityId, int stackedDataIcon, int stackedVoiceIcon, - String typeContentDescription, String description, - boolean isWide, int subId); + int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, + String description, boolean isWide, int subId); void setSubs(List<SubscriptionInfo> subs); void setNoSims(boolean show); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index bf7e489..b59f283 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -210,7 +210,6 @@ public class NetworkControllerImpl extends BroadcastReceiver filter.addAction(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); filter.addAction(ConnectivityManager.INET_CONDITION_ACTION); - filter.addAction(Intent.ACTION_LOCALE_CHANGED); filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); mContext.registerReceiver(this, filter, null, mReceiverHandler); mListening = true; @@ -378,10 +377,6 @@ public class NetworkControllerImpl extends BroadcastReceiver } else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) { // Might have different subscriptions now. updateMobileControllers(); - } else if (action.equals(Intent.ACTION_LOCALE_CHANGED)) { - for (MobileSignalController controller : mMobileSignalControllers.values()) { - controller.handleBroadcast(intent); - } } else if (action.equals(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED)) { mLastServiceState = ServiceState.newFromBundle(intent.getExtras()); if (mMobileSignalControllers.size() == 0) { @@ -831,10 +826,7 @@ public class NetworkControllerImpl extends BroadcastReceiver boolean alwaysShowCdmaRssi = false; boolean show4gForLte = false; boolean hspaDataDistinguishable; - boolean readIconsFromXml; boolean showRsrpSignalLevelforLTE; - boolean showLocale; - boolean showRat; static Config readConfig(Context context) { Config config = new Config(); @@ -846,14 +838,8 @@ public class NetworkControllerImpl extends BroadcastReceiver config.show4gForLte = res.getBoolean(R.bool.config_show4GForLTE); config.hspaDataDistinguishable = res.getBoolean(R.bool.config_hspa_data_distinguishable); - config.readIconsFromXml = res.getBoolean(R.bool.config_read_icons_from_xml); config.showRsrpSignalLevelforLTE = res.getBoolean(R.bool.config_showRsrpSignalLevelforLTE); - config.showLocale = - res.getBoolean(com.android.internal.R.bool.config_monitor_locale_change); - config.showRat = - res.getBoolean(com.android.internal.R.bool.config_display_rat); - return config; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java index 511ad2b..dce889f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java @@ -36,9 +36,8 @@ public class SignalCallbackAdapter implements SignalCallback { @Override public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, - int qsType, boolean activityIn, boolean activityOut, int dataActivity, - int mobileActivity, int stackedDataIcon, int stackedVoiceIcon, - String typeContentDescription, String description, boolean isWide, int subId) { + int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, + String description, boolean isWide, int subId) { } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java index 2c9f2b9..68f8191 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java @@ -1,6 +1,4 @@ /* - * Copyright (c) 2015, The Linux Foundation. All rights reserved. - * Not a Contribution. * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,14 +16,6 @@ package com.android.systemui.statusbar.policy; -import android.content.Context; -import android.content.res.Resources; -import android.content.res.TypedArray; -import android.telephony.SignalStrength; -import android.telephony.TelephonyManager; -import android.util.Log; -import android.util.SparseArray; - import com.android.systemui.R; import com.android.systemui.statusbar.policy.MobileSignalController.MobileIconGroup; @@ -78,20 +68,6 @@ class TelephonyIcons { R.drawable.stat_sys_signal_4_fully } }; - //Default roaming icons with R indicator - static final int[][] TELEPHONY_SIGNAL_STRENGTH_ROAMING_R = { - { R.drawable.stat_sys_signal_0_default_roam, - R.drawable.stat_sys_signal_1_default_roam, - R.drawable.stat_sys_signal_2_default_roam, - R.drawable.stat_sys_signal_3_default_roam, - R.drawable.stat_sys_signal_4_default_roam }, - { R.drawable.stat_sys_signal_0_default_fully_roam, - R.drawable.stat_sys_signal_1_default_fully_roam, - R.drawable.stat_sys_signal_2_default_fully_roam, - R.drawable.stat_sys_signal_3_default_fully_roam, - R.drawable.stat_sys_signal_4_default_fully_roam } - }; - //CarrierNetworkChange static final int[][] TELEPHONY_CARRIER_NETWORK_CHANGE = { { R.drawable.stat_sys_signal_carrier_network_change_animation, @@ -253,403 +229,6 @@ class TelephonyIcons { static final int QS_ICON_1X = R.drawable.ic_qs_signal_1x; static final int QS_ICON_CARRIER_NETWORK_CHANGE = R.drawable.ic_qs_signal_carrier_network_change_animation; - static final int DATA_TYPE_UNKNOWN = 0; - static final int DATA_TYPE_G = 1; - static final int DATA_TYPE_E = 2; - static final int DATA_TYPE_2G = 3; - static final int DATA_TYPE_3G = 4; - static final int DATA_TYPE_4G = 5; - static final int DATA_TYPE_H = 6; - static final int DATA_TYPE_HP = 7; - static final int DATA_TYPE_1X = 8; - static final int DATA_TYPE_LTE = 9; - - static final int SIGNAL_STRENGTH_TYPE_G = 0; - static final int SIGNAL_STRENGTH_TYPE_E = 1; - static final int SIGNAL_STRENGTH_TYPE_3G = 2; - static final int SIGNAL_STRENGTH_TYPE_4G = 3; - static final int SIGNAL_STRENGTH_TYPE_H = 4; - static final int SIGNAL_STRENGTH_TYPE_HP = 5; - static final int SIGNAL_STRENGTH_TYPE_1X = 6; - static final int SIGNAL_STRENGTH_TYPE_CDMA = 7; - static final int SIGNAL_STRENGTH_TYPE_UMTS = 8; - - static final boolean DEBUG = true; - static final int DEFAULT_SUB = 0; - static final int INET_TYPE_NUM = 2; - static final int SIGNAL_LEVEL_NUM = SignalStrength.NUM_SIGNAL_STRENGTH_BINS; - static final String TAG = "TelephonyIcons"; - static final String NS = "com.android.systemui"; - - static String[] mDataTypeArray, mDataTypeGenerationArray; - static String[] mDataTypeDescriptionArray, mDataTypeGenerationDescArray; - static String[] mDataActivityArray; - static String[] mSignalStrengthArray, mSignalStrengthRoamingArray; - static String[] mSignalNullArray; - static String[] mSignalStrengthDesc; - - static int[] mSelectedDataTypeIcon; - static int[] mSelectedQSDataTypeIcon; - static String[] mSelectedDataTypeDesc; - static int[] mSelectedDataActivityIndex; - static int[] mSelectedSignalStreagthIndex; - static SparseArray<Integer> mStacked2SingleIconLookup; - - private static Resources mRes; - private static boolean isInitiated = false; - - static void readIconsFromXml(Context context) { - if (isInitiated) { - log(TAG, "readIconsFromXml, already read!"); - return; - } - - mRes = context.getResources(); - try { - mDataTypeArray = mRes.getStringArray(R.array.multi_data_type); - mDataTypeDescriptionArray = mRes.getStringArray( - R.array.telephony_data_type_description); - mDataTypeGenerationArray = mRes.getStringArray( - R.array.telephony_data_type_generation); - mDataTypeGenerationDescArray = mRes.getStringArray( - R.array.telephony_data_type_generation_description); - mDataActivityArray = mRes.getStringArray(R.array.multi_data_activity); - mSignalStrengthArray = mRes.getStringArray(R.array.multi_signal_strength); - mSignalStrengthRoamingArray = mRes.getStringArray( - R.array.multi_signal_strength_roaming); - mSignalNullArray = mRes.getStringArray(R.array.multi_signal_null); - mSignalStrengthDesc = mRes.getStringArray(R.array.signal_strength_description); - initStacked2SingleIconLookup(); - } catch (android.content.res.Resources.NotFoundException e) { - isInitiated = false; - log(TAG, "readIconsFromXml, exception happened: " + e); - return; - } - - if (mSelectedDataTypeIcon == null - && mDataTypeArray.length != 0) { - mSelectedDataTypeIcon = new int[mDataTypeArray.length]; - } - if (mSelectedQSDataTypeIcon == null - && mDataTypeArray.length != 0) { - mSelectedQSDataTypeIcon = new int[mDataTypeArray.length]; - } - if (mSelectedDataTypeDesc == null - && mDataTypeArray.length != 0) { - mSelectedDataTypeDesc = new String[mDataTypeArray.length]; - } - if (mSelectedDataActivityIndex == null - && mDataActivityArray.length != 0) { - mSelectedDataActivityIndex = new int[mDataActivityArray.length]; - } - if (mSelectedSignalStreagthIndex == null - && mSignalStrengthArray.length != 0) { - mSelectedSignalStreagthIndex = new int[mSignalStrengthArray.length]; - } - isInitiated = true; - } - - static void initStacked2SingleIconLookup() { - mStacked2SingleIconLookup = new SparseArray<>(); - TypedArray stackedIcons = mRes.obtainTypedArray(R.array.stacked_signal_icons); - TypedArray singleIcons = mRes.obtainTypedArray(R.array.single_signal_icons); - - mStacked2SingleIconLookup.clear(); - for (int i = 0; i < stackedIcons.length() && i < singleIcons.length(); i++) { - mStacked2SingleIconLookup.put(stackedIcons.getResourceId(i,0), - singleIcons.getResourceId(i,0)); - } - stackedIcons.recycle(); - singleIcons.recycle(); - log(TAG, "initStacked2SingleIconLookup: size=" + mStacked2SingleIconLookup.size()); - } - - static int getSignalNullIcon(int slot) { - if (mSignalNullArray == null) { - return 0; - } - String resName = mSignalNullArray[slot]; - log(TAG, "null signal icon name: " + resName); - int resId = mRes.getIdentifier(resName, null, NS); - return resId; - } - - static void updateDataType(int slot, int type, boolean showAtLeast3G, - boolean show4GforLte, boolean hspaDistinguishable, int inet) { - log(TAG, "updateDataType " - + String.format("slot=%d, type=%d, inetCondition=%d", - slot, type, inet) - + " showAtLeast3G=" + String.valueOf(showAtLeast3G) - + " show4GforLte=" + String.valueOf(show4GforLte) - + " hspaDistinguishable=" + String.valueOf(hspaDistinguishable)); - - String resName = mDataTypeArray[slot]; - int resId = mRes.getIdentifier(resName, null, NS); - String[] dataTypeArray = mRes.getStringArray(resId); - - log(TAG, "data type item name: " + resName + " id:" + resId); - - switch (type) { - case TelephonyManager.NETWORK_TYPE_UNKNOWN: - if (!showAtLeast3G) { - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = 0; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedDataActivityIndex[slot] = 0; - mSelectedSignalStreagthIndex[slot] = 0; - break; - } else { - // fall through - } - case TelephonyManager.NETWORK_TYPE_EDGE: - if (!showAtLeast3G) { - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_E; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedDataActivityIndex[slot] = DATA_TYPE_E; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_E; - break; - } else { - // fall through - } - case TelephonyManager.NETWORK_TYPE_UMTS: - case TelephonyManager.NETWORK_TYPE_TD_SCDMA: - mSelectedDataActivityIndex[slot] = DATA_TYPE_3G; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_3G; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_UMTS; - break; - case TelephonyManager.NETWORK_TYPE_HSDPA: - case TelephonyManager.NETWORK_TYPE_HSUPA: - case TelephonyManager.NETWORK_TYPE_HSPA: - if (hspaDistinguishable) { - mSelectedDataActivityIndex[slot] = DATA_TYPE_H; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_H; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_H; - } else { - mSelectedDataActivityIndex[slot] = DATA_TYPE_3G; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - mDataTypeGenerationArray[0], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_3G; - mSelectedDataTypeDesc[slot] = mDataTypeGenerationDescArray[0]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_3G; - - } - break; - case TelephonyManager.NETWORK_TYPE_HSPAP: - if (hspaDistinguishable) { - mSelectedDataActivityIndex[slot] = DATA_TYPE_HP; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_H; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_HP; - } else { - mSelectedDataActivityIndex[slot] = DATA_TYPE_3G; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - mDataTypeGenerationArray[0], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_3G; - mSelectedDataTypeDesc[slot] = mDataTypeGenerationDescArray[0]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_3G; - } - break; - case TelephonyManager.NETWORK_TYPE_CDMA: - if (!showAtLeast3G) { - mSelectedDataActivityIndex[slot] = DATA_TYPE_1X; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_1X; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_CDMA; - break; - } else { - // fall through - } - case TelephonyManager.NETWORK_TYPE_1xRTT: - if (!showAtLeast3G) { - mSelectedDataActivityIndex[slot] = DATA_TYPE_1X; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_1X; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_1X; - break; - } else { - // fall through - } - case TelephonyManager.NETWORK_TYPE_EVDO_0: //fall through - case TelephonyManager.NETWORK_TYPE_EVDO_A: - case TelephonyManager.NETWORK_TYPE_EVDO_B: - case TelephonyManager.NETWORK_TYPE_EHRPD: - mSelectedDataActivityIndex[slot] = DATA_TYPE_3G; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_3G; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_3G; - break; - case TelephonyManager.NETWORK_TYPE_LTE: - case TelephonyManager.NETWORK_TYPE_LTE_CA: - if (show4GforLte) { - mSelectedDataActivityIndex[slot] = DATA_TYPE_4G; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - mDataTypeGenerationArray[1], null, NS); - if ( type == TelephonyManager.NETWORK_TYPE_LTE_CA) { - //Select 4G+ icon. - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - mDataTypeGenerationArray[2], null, NS); - } - mSelectedQSDataTypeIcon[slot] = QS_DATA_4G; - mSelectedDataTypeDesc[slot] = mDataTypeGenerationDescArray[1]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_4G; - } else { - mSelectedDataActivityIndex[slot] = DATA_TYPE_LTE; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_LTE; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_4G; - } - break; - case TelephonyManager.NETWORK_TYPE_GPRS: - case TelephonyManager.NETWORK_TYPE_GSM: - if (!showAtLeast3G) { - mSelectedDataActivityIndex[slot] = DATA_TYPE_G; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - dataTypeArray[type], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_G; - mSelectedDataTypeDesc[slot] = mDataTypeDescriptionArray[type]; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_G; - } else { - mSelectedDataActivityIndex[slot] = DATA_TYPE_3G; - mSelectedDataTypeIcon[slot] = mRes.getIdentifier( - mDataTypeGenerationArray[0], null, NS); - mSelectedQSDataTypeIcon[slot] = QS_DATA_3G; - mSelectedDataTypeDesc[slot] = mDataTypeGenerationDescArray[0];; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_3G; - } - break; - default: - mSelectedDataActivityIndex[slot] = DATA_TYPE_UNKNOWN; - mSelectedDataTypeIcon[slot] = 0; - mSelectedQSDataTypeIcon[slot] = 0; - mSelectedDataTypeDesc[slot] = ""; - mSelectedSignalStreagthIndex[slot] = SIGNAL_STRENGTH_TYPE_G; - break; - } - log(TAG, "updateDataType " + String.format( - "mSelectedDataTypeIcon[%d]=%d, mSelectedDataActivityIndex=%d", - slot, mSelectedDataTypeIcon[slot], mSelectedDataActivityIndex[slot])); - } - - - static int getQSDataTypeIcon(int slot) { - return mSelectedQSDataTypeIcon[slot]; - } - - static int getDataTypeIcon(int slot) { - log(TAG, "getDataTypeIcon " + String.format("sub=%d", slot)); - return mSelectedDataTypeIcon[slot]; - } - - static int getDataTypeDesc(int slot) { - return mRes.getIdentifier(mSelectedDataTypeDesc[slot], null, NS); - } - - static int getDataActivity(int slot, int activity) { - log(TAG, String.format("getDataActivity, slot=%d, activity=%d", - slot, activity)); - - String[] dataActivityArray = mRes.getStringArray( - mRes.getIdentifier(mDataActivityArray[slot], null, NS)); - String[] selectedTypeArray = mRes.getStringArray(mRes.getIdentifier( - dataActivityArray[mSelectedDataActivityIndex[slot]], null, NS)); - - return mRes.getIdentifier(selectedTypeArray[activity], null, NS); - } - - static int getSignalStrengthIcon(int slot, int inet, int level, boolean roaming) { - log(TAG, "getSignalStrengthIcon: " + String.format( - "slot=%d, inetCondition=%d, level=%d, roaming=%b", slot, inet, level, roaming)); - - String[] signalStrengthArray, selectedTypeArray; - - signalStrengthArray = mRes.getStringArray(mRes.getIdentifier(!roaming ? - mSignalStrengthArray[slot] : mSignalStrengthRoamingArray[slot], null, NS)); - log(TAG, String.format("signalStrengthArray.length=%d", signalStrengthArray.length)); - - selectedTypeArray = mRes.getStringArray(mRes.getIdentifier( - signalStrengthArray[mSelectedSignalStreagthIndex[slot]], null, NS)); - log(TAG, String.format("selectedTypeArray.length=%d", selectedTypeArray.length)); - - String[] inetArray = mRes.getStringArray( - mRes.getIdentifier(selectedTypeArray[inet], null, NS)); - log(TAG, String.format("inetArray.length=%d", inetArray.length)); - - return mRes.getIdentifier(inetArray[level], null, NS); - } - - - static int convertMobileStrengthIcon(int stackedIcon) { - if (mStacked2SingleIconLookup == null) { - return stackedIcon; - } - int index = mStacked2SingleIconLookup.indexOfKey(stackedIcon); - if (index >= 0) { - return mStacked2SingleIconLookup.get(stackedIcon); - } - return stackedIcon; - } - - static int getStackedVoiceIcon(int level) { - int retValue = 0; - switch(level){ - case SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN: - retValue = R.drawable.stat_sys_signal_0_2g; - break; - case SignalStrength.SIGNAL_STRENGTH_POOR: - retValue = R.drawable.stat_sys_signal_1_2g; - break; - case SignalStrength.SIGNAL_STRENGTH_MODERATE: - retValue = R.drawable.stat_sys_signal_2_2g; - break; - case SignalStrength.SIGNAL_STRENGTH_GOOD: - retValue = R.drawable.stat_sys_signal_3_2g; - break; - case SignalStrength.SIGNAL_STRENGTH_GREAT: - retValue = R.drawable.stat_sys_signal_4_2g; - break; - default: - break; - } - return retValue; - } - - static int getRoamingSignalIconId(int level, int inet){ - return TELEPHONY_SIGNAL_STRENGTH_ROAMING_R[inet][level]; - } - - static int[] getSignalStrengthDes(int slot) { - int[] resId = new int[SIGNAL_LEVEL_NUM]; - for (int i = 0; i < SIGNAL_LEVEL_NUM; i++) { - resId[i] = mRes.getIdentifier(mSignalStrengthDesc[i], null, NS); - } - return resId; - } - - private static void log(String tag, String str){ - if (DEBUG) { - Log.d(tag, str); - } - } - static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup( "CARRIER_NETWORK_CHANGE", diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java index 29be2c9..9b1e72a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java @@ -29,7 +29,6 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.AsyncChannel; -import com.android.systemui.R; import com.android.systemui.statusbar.policy.NetworkController.IconState; import java.util.List; @@ -76,10 +75,8 @@ public class WifiSignalController extends @Override public void notifyListeners() { // only show wifi in the cluster if connected or if wifi-only - boolean visibleWhenEnabled = mContext.getResources().getBoolean( - R.bool.config_showWifiIndicatorWhenEnabled); boolean wifiVisible = mCurrentState.enabled - && (mCurrentState.connected || !mHasMobileData || visibleWhenEnabled); + && (mCurrentState.connected || !mHasMobileData); String wifiDesc = wifiVisible ? mCurrentState.ssid : null; boolean ssidPresent = wifiVisible && mCurrentState.ssid != null; String contentDescription = getStringIfExists(getContentDescription()); |