am e47dc360: Merge "SysUI: Actual MSIM status bar support" into lmp-mr1-dev
* commit 'e47dc36071884600c2b3c1dfe1ffe031fc9f0fde': SysUI: Actual MSIM status bar support
This commit is contained in:
25
packages/SystemUI/res/drawable/stat_sys_no_sims.xml
Normal file
25
packages/SystemUI/res/drawable/stat_sys_no_sims.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="17dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
|
||||
<path
|
||||
android:fillColor="#4DFFFFFF"
|
||||
android:pathData="M19.0,5.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0l-7.0,0.0L7.7,5.3L19.0,16.7L19.0,5.0zM3.7,3.9L2.4,5.2L5.0,7.8L5.0,19.0c0.0,1.1 0.9,2.0 2.0,2.0l10.0,0.0c0.4,0.0 0.7,-0.1 1.0,-0.3l1.9,1.9l1.3,-1.3L3.7,3.9z"/>
|
||||
</vector>
|
||||
36
packages/SystemUI/res/layout/mobile_signal_group.xml
Normal file
36
packages/SystemUI/res/layout/mobile_signal_group.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* apps/common/assets/default/default/skins/StatusBar.xml
|
||||
**
|
||||
** Copyright 2011, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/mobile_combo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/mobile_signal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/mobile_type"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
</FrameLayout>
|
||||
@@ -50,27 +50,18 @@
|
||||
android:layout_height="4dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/mobile_signal_group"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
>
|
||||
<FrameLayout
|
||||
android:id="@+id/mobile_combo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/mobile_signal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/mobile_type"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/no_sims"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/stat_sys_no_sims"
|
||||
/>
|
||||
<View
|
||||
android:id="@+id/wifi_airplane_spacer"
|
||||
android:layout_width="4dp"
|
||||
|
||||
@@ -515,6 +515,9 @@
|
||||
type icon is wide. -->
|
||||
<dimen name="wide_type_icon_start_padding">2dp</dimen>
|
||||
|
||||
<!-- Extra padding between multiple phone signal icons. -->
|
||||
<dimen name="secondary_telephony_padding">2dp</dimen>
|
||||
|
||||
<!-- Extra padding between the mobile data type icon and the strength indicator when the data
|
||||
type icon is wide for the tile in quick settings. -->
|
||||
<dimen name="wide_type_icon_start_padding_qs">3dp</dimen>
|
||||
|
||||
@@ -147,16 +147,15 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
}
|
||||
|
||||
private final NetworkSignalChangedCallback mCallback = new NetworkSignalChangedCallback() {
|
||||
private boolean mWifiEnabled;
|
||||
private boolean mWifiConnected;
|
||||
private boolean mAirplaneModeEnabled;
|
||||
private final CallbackInfo mInfo = new CallbackInfo();
|
||||
|
||||
@Override
|
||||
public void onWifiSignalChanged(boolean enabled, boolean connected, int wifiSignalIconId,
|
||||
boolean activityIn, boolean activityOut,
|
||||
String wifiSignalContentDescriptionId, String description) {
|
||||
mWifiEnabled = enabled;
|
||||
mWifiConnected = connected;
|
||||
mInfo.wifiEnabled = enabled;
|
||||
mInfo.wifiConnected = connected;
|
||||
refreshState(mInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,28 +163,35 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
int mobileSignalIconId,
|
||||
String mobileSignalContentDescriptionId, int dataTypeIconId,
|
||||
boolean activityIn, boolean activityOut,
|
||||
String dataTypeContentDescriptionId, String description, boolean noSim,
|
||||
String dataTypeContentDescriptionId, String description,
|
||||
boolean isDataTypeIconWide) {
|
||||
final CallbackInfo info = new CallbackInfo(); // TODO pool?
|
||||
info.enabled = enabled;
|
||||
info.wifiEnabled = mWifiEnabled;
|
||||
info.wifiConnected = mWifiConnected;
|
||||
info.airplaneModeEnabled = mAirplaneModeEnabled;
|
||||
info.mobileSignalIconId = mobileSignalIconId;
|
||||
info.signalContentDescription = mobileSignalContentDescriptionId;
|
||||
info.dataTypeIconId = dataTypeIconId;
|
||||
info.dataContentDescription = dataTypeContentDescriptionId;
|
||||
info.activityIn = activityIn;
|
||||
info.activityOut = activityOut;
|
||||
info.enabledDesc = description;
|
||||
info.noSim = noSim;
|
||||
info.isDataTypeIconWide = isDataTypeIconWide;
|
||||
refreshState(info);
|
||||
mInfo.enabled = enabled;
|
||||
mInfo.mobileSignalIconId = mobileSignalIconId;
|
||||
mInfo.signalContentDescription = mobileSignalContentDescriptionId;
|
||||
mInfo.dataTypeIconId = dataTypeIconId;
|
||||
mInfo.dataContentDescription = dataTypeContentDescriptionId;
|
||||
mInfo.activityIn = activityIn;
|
||||
mInfo.activityOut = activityOut;
|
||||
mInfo.enabledDesc = description;
|
||||
mInfo.isDataTypeIconWide = isDataTypeIconWide;
|
||||
refreshState(mInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoSimVisibleChanged(boolean visible) {
|
||||
mInfo.noSim = visible;
|
||||
if (mInfo.noSim) {
|
||||
// Make sure signal gets cleared out when no sims.
|
||||
mInfo.mobileSignalIconId = 0;
|
||||
mInfo.dataTypeIconId = 0;
|
||||
}
|
||||
refreshState(mInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAirplaneModeChanged(boolean enabled) {
|
||||
mAirplaneModeEnabled = enabled;
|
||||
mInfo.airplaneModeEnabled = enabled;
|
||||
refreshState(mInfo);
|
||||
}
|
||||
|
||||
public void onMobileDataEnabled(boolean enabled) {
|
||||
@@ -203,7 +209,8 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
@Override
|
||||
public Boolean getToggleState() {
|
||||
return mDataController.isMobileDataSupported()
|
||||
? mDataController.isMobileDataEnabled() : null;
|
||||
? mDataController.isMobileDataEnabled()
|
||||
: null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -217,11 +217,15 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
|
||||
int mobileSignalIconId,
|
||||
String mobileSignalContentDescriptionId, int dataTypeIconId,
|
||||
boolean activityIn, boolean activityOut,
|
||||
String dataTypeContentDescriptionId, String description, boolean noSim,
|
||||
String dataTypeContentDescriptionId, String description,
|
||||
boolean isDataTypeIconWide) {
|
||||
// noop
|
||||
}
|
||||
|
||||
public void onNoSimVisibleChanged(boolean noSims) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAirplaneModeChanged(boolean enabled) {
|
||||
// noop
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
package com.android.systemui.statusbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
@@ -29,6 +31,9 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.policy.NetworkControllerImpl;
|
||||
import com.android.systemui.statusbar.policy.SecurityController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// Intimately tied to the design of res/layout/signal_cluster_view.xml
|
||||
public class SignalClusterView
|
||||
extends LinearLayout
|
||||
@@ -41,23 +46,24 @@ public class SignalClusterView
|
||||
NetworkControllerImpl mNC;
|
||||
SecurityController mSC;
|
||||
|
||||
private boolean mNoSimsVisible = false;
|
||||
private boolean mVpnVisible = false;
|
||||
private boolean mWifiVisible = false;
|
||||
private int mWifiStrengthId = 0;
|
||||
private boolean mMobileVisible = false;
|
||||
private int mMobileStrengthId = 0, mMobileTypeId = 0;
|
||||
private boolean mIsAirplaneMode = false;
|
||||
private int mAirplaneIconId = 0;
|
||||
private int mAirplaneContentDescription;
|
||||
private String mWifiDescription, mMobileDescription, mMobileTypeDescription;
|
||||
private boolean mIsMobileTypeIconWide;
|
||||
private String mWifiDescription;
|
||||
private ArrayList<PhoneState> mPhoneStates = new ArrayList<PhoneState>();
|
||||
|
||||
ViewGroup mWifiGroup, mMobileGroup;
|
||||
ImageView mVpn, mWifi, mMobile, mMobileType, mAirplane;
|
||||
ViewGroup mWifiGroup;
|
||||
ImageView mVpn, mWifi, mAirplane, mNoSims;
|
||||
View mWifiAirplaneSpacer;
|
||||
View mWifiSignalSpacer;
|
||||
LinearLayout mMobileSignalGroup;
|
||||
|
||||
private int mWideTypeIconStartPadding;
|
||||
private int mSecondaryTelephonyPadding;
|
||||
private int mEndPadding;
|
||||
private int mEndPaddingNothingVisible;
|
||||
|
||||
@@ -90,6 +96,8 @@ public class SignalClusterView
|
||||
super.onFinishInflate();
|
||||
mWideTypeIconStartPadding = getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.wide_type_icon_start_padding);
|
||||
mSecondaryTelephonyPadding = getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.secondary_telephony_padding);
|
||||
mEndPadding = getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.signal_cluster_battery_padding);
|
||||
mEndPaddingNothingVisible = getContext().getResources().getDimensionPixelSize(
|
||||
@@ -103,12 +111,14 @@ public class SignalClusterView
|
||||
mVpn = (ImageView) findViewById(R.id.vpn);
|
||||
mWifiGroup = (ViewGroup) findViewById(R.id.wifi_combo);
|
||||
mWifi = (ImageView) findViewById(R.id.wifi_signal);
|
||||
mMobileGroup = (ViewGroup) findViewById(R.id.mobile_combo);
|
||||
mMobile = (ImageView) findViewById(R.id.mobile_signal);
|
||||
mMobileType = (ImageView) findViewById(R.id.mobile_type);
|
||||
mAirplane = (ImageView) findViewById(R.id.airplane);
|
||||
mNoSims = (ImageView) findViewById(R.id.no_sims);
|
||||
mWifiAirplaneSpacer = findViewById(R.id.wifi_airplane_spacer);
|
||||
mWifiSignalSpacer = findViewById(R.id.wifi_signal_spacer);
|
||||
mMobileSignalGroup = (LinearLayout) findViewById(R.id.mobile_signal_group);
|
||||
for (PhoneState state : mPhoneStates) {
|
||||
mMobileSignalGroup.addView(state.mMobileGroup);
|
||||
}
|
||||
|
||||
apply();
|
||||
}
|
||||
@@ -118,10 +128,9 @@ public class SignalClusterView
|
||||
mVpn = null;
|
||||
mWifiGroup = null;
|
||||
mWifi = null;
|
||||
mMobileGroup = null;
|
||||
mMobile = null;
|
||||
mMobileType = null;
|
||||
mAirplane = null;
|
||||
mMobileSignalGroup.removeAllViews();
|
||||
mMobileSignalGroup = null;
|
||||
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
@@ -149,17 +158,55 @@ public class SignalClusterView
|
||||
|
||||
@Override
|
||||
public void setMobileDataIndicators(boolean visible, int strengthIcon, int typeIcon,
|
||||
String contentDescription, String typeContentDescription, boolean isTypeIconWide) {
|
||||
mMobileVisible = visible;
|
||||
mMobileStrengthId = strengthIcon;
|
||||
mMobileTypeId = typeIcon;
|
||||
mMobileDescription = contentDescription;
|
||||
mMobileTypeDescription = typeContentDescription;
|
||||
mIsMobileTypeIconWide = isTypeIconWide;
|
||||
String contentDescription, String typeContentDescription, boolean isTypeIconWide,
|
||||
int subId) {
|
||||
PhoneState state = getOrInflateState(subId);
|
||||
state.mMobileVisible = visible;
|
||||
state.mMobileStrengthId = strengthIcon;
|
||||
state.mMobileTypeId = typeIcon;
|
||||
state.mMobileDescription = contentDescription;
|
||||
state.mMobileTypeDescription = typeContentDescription;
|
||||
state.mIsMobileTypeIconWide = isTypeIconWide;
|
||||
|
||||
apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoSims(boolean show) {
|
||||
mNoSimsVisible = show;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubs(List<SubscriptionInfo> subs) {
|
||||
// Clear out all old subIds.
|
||||
mPhoneStates.clear();
|
||||
if (mMobileSignalGroup != null) {
|
||||
mMobileSignalGroup.removeAllViews();
|
||||
}
|
||||
final int n = subs.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
inflatePhoneState(subs.get(i).getSubscriptionId());
|
||||
}
|
||||
}
|
||||
|
||||
private PhoneState getOrInflateState(int subId) {
|
||||
for (PhoneState state : mPhoneStates) {
|
||||
if (state.mSubId == subId) {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
return inflatePhoneState(subId);
|
||||
}
|
||||
|
||||
private PhoneState inflatePhoneState(int subId) {
|
||||
PhoneState state = new PhoneState(subId, mContext);
|
||||
if (mMobileSignalGroup != null) {
|
||||
mMobileSignalGroup.addView(state.mMobileGroup);
|
||||
}
|
||||
mPhoneStates.add(state);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsAirplaneMode(boolean is, int airplaneIconId, int contentDescription) {
|
||||
mIsAirplaneMode = is;
|
||||
@@ -175,8 +222,9 @@ public class SignalClusterView
|
||||
// ignore content description, so populate manually
|
||||
if (mWifiVisible && mWifiGroup != null && mWifiGroup.getContentDescription() != null)
|
||||
event.getText().add(mWifiGroup.getContentDescription());
|
||||
if (mMobileVisible && mMobileGroup != null && mMobileGroup.getContentDescription() != null)
|
||||
event.getText().add(mMobileGroup.getContentDescription());
|
||||
for (PhoneState state : mPhoneStates) {
|
||||
state.populateAccessibilityEvent(event);
|
||||
}
|
||||
return super.dispatchPopulateAccessibilityEvent(event);
|
||||
}
|
||||
|
||||
@@ -188,12 +236,13 @@ public class SignalClusterView
|
||||
mWifi.setImageDrawable(null);
|
||||
}
|
||||
|
||||
if (mMobile != null) {
|
||||
mMobile.setImageDrawable(null);
|
||||
}
|
||||
|
||||
if (mMobileType != null) {
|
||||
mMobileType.setImageDrawable(null);
|
||||
for (PhoneState state : mPhoneStates) {
|
||||
if (state.mMobile != null) {
|
||||
state.mMobile.setImageDrawable(null);
|
||||
}
|
||||
if (state.mMobileType != null) {
|
||||
state.mMobileType.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
if(mAirplane != null) {
|
||||
@@ -227,19 +276,17 @@ public class SignalClusterView
|
||||
(mWifiVisible ? "VISIBLE" : "GONE"),
|
||||
mWifiStrengthId));
|
||||
|
||||
if (mMobileVisible && !mIsAirplaneMode) {
|
||||
mMobile.setImageResource(mMobileStrengthId);
|
||||
mMobileType.setImageResource(mMobileTypeId);
|
||||
mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription);
|
||||
mMobileGroup.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mMobileGroup.setVisibility(View.GONE);
|
||||
boolean anyMobileVisible = false;
|
||||
for (PhoneState state : mPhoneStates) {
|
||||
if (state.apply(anyMobileVisible)) {
|
||||
anyMobileVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsAirplaneMode) {
|
||||
mAirplane.setImageResource(mAirplaneIconId);
|
||||
mAirplane.setContentDescription(mAirplaneContentDescription != 0 ?
|
||||
mContext.getString(mAirplaneContentDescription) : "");
|
||||
mContext.getString(mAirplaneContentDescription) : null);
|
||||
mAirplane.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mAirplane.setVisibility(View.GONE);
|
||||
@@ -251,23 +298,73 @@ public class SignalClusterView
|
||||
mWifiAirplaneSpacer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (mMobileVisible && mMobileTypeId != 0 && mWifiVisible) {
|
||||
if ((anyMobileVisible || mNoSimsVisible) && mWifiVisible) {
|
||||
mWifiSignalSpacer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mWifiSignalSpacer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mMobile.setPaddingRelative(mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0, 0, 0, 0);
|
||||
mNoSims.setVisibility(mNoSimsVisible ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (DEBUG) Log.d(TAG,
|
||||
String.format("mobile: %s sig=%d typ=%d",
|
||||
(mMobileVisible ? "VISIBLE" : "GONE"),
|
||||
mMobileStrengthId, mMobileTypeId));
|
||||
|
||||
mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
boolean anythingVisible = mWifiVisible || mIsAirplaneMode || mMobileVisible || mVpnVisible;
|
||||
boolean anythingVisible = mNoSimsVisible || mWifiVisible || mIsAirplaneMode
|
||||
|| anyMobileVisible || mVpnVisible;
|
||||
setPaddingRelative(0, 0, anythingVisible ? mEndPadding : mEndPaddingNothingVisible, 0);
|
||||
}
|
||||
|
||||
private class PhoneState {
|
||||
private final int mSubId;
|
||||
private boolean mMobileVisible = false;
|
||||
private int mMobileStrengthId = 0, mMobileTypeId = 0;
|
||||
private boolean mIsMobileTypeIconWide;
|
||||
private String mMobileDescription, mMobileTypeDescription;
|
||||
|
||||
private ViewGroup mMobileGroup;
|
||||
private ImageView mMobile, mMobileType;
|
||||
|
||||
public PhoneState(int subId, Context context) {
|
||||
ViewGroup root = (ViewGroup) LayoutInflater.from(context)
|
||||
.inflate(R.layout.mobile_signal_group, null);
|
||||
setViews(root);
|
||||
mSubId = subId;
|
||||
}
|
||||
|
||||
public void setViews(ViewGroup root) {
|
||||
mMobileGroup = root;
|
||||
mMobile = (ImageView) root.findViewById(R.id.mobile_signal);
|
||||
mMobileType = (ImageView) root.findViewById(R.id.mobile_type);
|
||||
}
|
||||
|
||||
public boolean apply(boolean isSecondaryIcon) {
|
||||
if (mMobileVisible && !mIsAirplaneMode) {
|
||||
mMobile.setImageResource(mMobileStrengthId);
|
||||
mMobileType.setImageResource(mMobileTypeId);
|
||||
mMobileGroup.setContentDescription(mMobileTypeDescription
|
||||
+ " " + mMobileDescription);
|
||||
mMobileGroup.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mMobileGroup.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// When this isn't next to wifi, give it some extra padding between the signals.
|
||||
mMobileGroup.setPaddingRelative(isSecondaryIcon ? mSecondaryTelephonyPadding : 0,
|
||||
0, 0, 0);
|
||||
mMobile.setPaddingRelative(mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0,
|
||||
0, 0, 0);
|
||||
|
||||
if (DEBUG) Log.d(TAG, String.format("mobile: %s sig=%d typ=%d",
|
||||
(mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, mMobileTypeId));
|
||||
|
||||
mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
return mMobileVisible;
|
||||
}
|
||||
|
||||
public void populateAccessibilityEvent(AccessibilityEvent event) {
|
||||
if (mMobileVisible && mMobileGroup != null
|
||||
&& mMobileGroup.getContentDescription() != null) {
|
||||
event.getText().add(mMobileGroup.getContentDescription());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -851,14 +851,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// set up the dynamic hide/show of the label
|
||||
// TODO: uncomment, handle this for the Stack scroller aswell
|
||||
// ((NotificationRowLayout) mStackScroller)
|
||||
// .setOnSizeChangedListener(new OnSizeChangedListener() {
|
||||
// @Override
|
||||
// public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
|
||||
// updateCarrierLabelVisibility(false);
|
||||
}
|
||||
|
||||
mFlashlightController = new FlashlightController(mContext);
|
||||
|
||||
@@ -33,5 +33,6 @@ public class AccessibilityContentDescriptions {
|
||||
R.string.accessibility_wifi_three_bars,
|
||||
R.string.accessibility_wifi_signal_full
|
||||
};
|
||||
|
||||
static final int WIFI_NO_CONNECTION = R.string.accessibility_no_wifi;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import android.net.NetworkStatsHistory;
|
||||
import android.net.NetworkTemplate;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.format.Time;
|
||||
@@ -213,7 +214,8 @@ public class MobileDataControllerImpl implements NetworkController.MobileDataCon
|
||||
|
||||
private static String getActiveSubscriberId(Context context) {
|
||||
final TelephonyManager tele = TelephonyManager.from(context);
|
||||
final String actualSubscriberId = tele.getSubscriberId();
|
||||
final String actualSubscriberId = tele.getSubscriberId(
|
||||
SubscriptionManager.getDefaultDataSubId());
|
||||
return actualSubscriberId;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,9 @@ public interface NetworkController {
|
||||
void onMobileDataSignalChanged(boolean enabled, int mobileSignalIconId,
|
||||
String mobileSignalContentDescriptionId, int dataTypeIconId,
|
||||
boolean activityIn, boolean activityOut,
|
||||
String dataTypeContentDescriptionId, String description, boolean noSim,
|
||||
String dataTypeContentDescriptionId, String description,
|
||||
boolean isDataTypeIconWide);
|
||||
void onNoSimVisibleChanged(boolean visible);
|
||||
void onAirplaneModeChanged(boolean enabled);
|
||||
void onMobileDataEnabled(boolean enabled);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,8 @@ import android.net.wifi.WifiManager;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SignalStrength;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.util.Log;
|
||||
@@ -25,6 +27,8 @@ import org.mockito.Mockito;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NetworkControllerBaseTest extends AndroidTestCase {
|
||||
private static final String TAG = "NetworkControllerBaseTest";
|
||||
@@ -44,6 +48,7 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
||||
private ServiceState mServiceState;
|
||||
protected ConnectivityManager mMockCm;
|
||||
protected WifiManager mMockWm;
|
||||
protected SubscriptionManager mMockSm;
|
||||
protected TelephonyManager mMockTm;
|
||||
protected Config mConfig;
|
||||
|
||||
@@ -56,6 +61,7 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
||||
|
||||
mMockWm = mock(WifiManager.class);
|
||||
mMockTm = mock(TelephonyManager.class);
|
||||
mMockSm = mock(SubscriptionManager.class);
|
||||
mMockCm = mock(ConnectivityManager.class);
|
||||
when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(true);
|
||||
|
||||
@@ -64,14 +70,22 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
||||
|
||||
mConfig = new Config();
|
||||
mConfig.hspaDataDistinguishable = true;
|
||||
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm,
|
||||
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
|
||||
mConfig, mock(AccessPointControllerImpl.class),
|
||||
mock(MobileDataControllerImpl.class));
|
||||
setupNetworkController();
|
||||
}
|
||||
|
||||
protected void setupNetworkController() {
|
||||
mPhoneStateListener = mNetworkController.mMobileSignalController.mPhoneStateListener;
|
||||
// For now just pretend to be the data sim, so we can test that too.
|
||||
final int subId = SubscriptionManager.getDefaultDataSubId();
|
||||
SubscriptionInfo subscription = mock(SubscriptionInfo.class);
|
||||
List<SubscriptionInfo> subs = new ArrayList<SubscriptionInfo>();
|
||||
when(subscription.getSubscriptionId()).thenReturn(subId);
|
||||
subs.add(subscription);
|
||||
mNetworkController.setCurrentSubscriptions(subs);
|
||||
mPhoneStateListener =
|
||||
mNetworkController.mMobileSignalControllers.get(subId).mPhoneStateListener;
|
||||
mSignalCluster = mock(SignalCluster.class);
|
||||
mNetworkSignalChangedCallback = mock(NetworkSignalChangedCallback.class);
|
||||
mNetworkController.addSignalCluster(mSignalCluster);
|
||||
@@ -182,13 +196,12 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
||||
}
|
||||
|
||||
protected void verifyLastQsMobileDataIndicators(boolean visible, int icon, int typeIcon,
|
||||
boolean dataIn, boolean dataOut, boolean noSim) {
|
||||
boolean dataIn, boolean dataOut) {
|
||||
ArgumentCaptor<Integer> iconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<Boolean> visibleArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
ArgumentCaptor<Boolean> dataInArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
ArgumentCaptor<Boolean> dataOutArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
ArgumentCaptor<Boolean> noSimArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
|
||||
Mockito.verify(mNetworkSignalChangedCallback, Mockito.atLeastOnce())
|
||||
.onMobileDataSignalChanged(visibleArg.capture(), iconArg.capture(),
|
||||
@@ -198,7 +211,6 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
||||
dataOutArg.capture(),
|
||||
ArgumentCaptor.forClass(String.class).capture(),
|
||||
ArgumentCaptor.forClass(String.class).capture(),
|
||||
noSimArg.capture(),
|
||||
ArgumentCaptor.forClass(Boolean.class).capture());
|
||||
assertEquals("Visibility in, quick settings", visible, (boolean) visibleArg.getValue());
|
||||
assertEquals("Signal icon in, quick settings", icon, (int) iconArg.getValue());
|
||||
@@ -207,7 +219,6 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
||||
(boolean) dataInArg.getValue());
|
||||
assertEquals("Data direction out, in quick settings", dataOut,
|
||||
(boolean) dataOutArg.getValue());
|
||||
assertEquals("Sim state in quick settings", noSim, (boolean) noSimArg.getValue());
|
||||
}
|
||||
|
||||
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon) {
|
||||
@@ -220,7 +231,8 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
||||
visibleArg.capture(), iconArg.capture(), typeIconArg.capture(),
|
||||
ArgumentCaptor.forClass(String.class).capture(),
|
||||
ArgumentCaptor.forClass(String.class).capture(),
|
||||
ArgumentCaptor.forClass(Boolean.class).capture());
|
||||
ArgumentCaptor.forClass(Boolean.class).capture(),
|
||||
ArgumentCaptor.forClass(Integer.class).capture());
|
||||
|
||||
assertEquals("Signal icon in status bar", icon, (int) iconArg.getValue());
|
||||
assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue());
|
||||
|
||||
@@ -22,7 +22,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
||||
TelephonyIcons.ROAMING_ICON);
|
||||
verifyLastQsMobileDataIndicators(true,
|
||||
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL],
|
||||
TelephonyIcons.QS_DATA_R[1], false, false, false);
|
||||
TelephonyIcons.QS_DATA_R[1], false, false);
|
||||
}
|
||||
|
||||
public void test2gDataIcon() {
|
||||
@@ -86,14 +86,14 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
||||
|
||||
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, DEFAULT_ICON);
|
||||
verifyLastQsMobileDataIndicators(true, DEFAULT_QS_SIGNAL_STRENGTH,
|
||||
DEFAULT_QS_ICON, in, out, false);
|
||||
DEFAULT_QS_ICON, in, out);
|
||||
|
||||
}
|
||||
|
||||
private void verifyDataIndicators(int dataIcon, int qsDataIcon) {
|
||||
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, dataIcon);
|
||||
verifyLastQsMobileDataIndicators(true, DEFAULT_QS_SIGNAL_STRENGTH, qsDataIcon, false,
|
||||
false, false);
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
||||
// Turn off mobile network support.
|
||||
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
|
||||
// Create a new NetworkController as this is currently handled in constructor.
|
||||
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm,
|
||||
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
|
||||
mConfig, mock(AccessPointControllerImpl.class),
|
||||
mock(MobileDataControllerImpl.class));
|
||||
setupNetworkController();
|
||||
@@ -90,7 +90,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
||||
|
||||
verifyLastQsMobileDataIndicators(true,
|
||||
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
|
||||
DEFAULT_QS_ICON, false, false, false);
|
||||
DEFAULT_QS_ICON, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
||||
|
||||
verifyLastQsMobileDataIndicators(true,
|
||||
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
|
||||
TelephonyIcons.QS_ICON_1X, false, false, false);
|
||||
TelephonyIcons.QS_ICON_1X, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user