Add separate roaming icon for status bar + QS
Now data + roaming will be shown at the same time. Test: runtest systemui Bug: 31205845 Change-Id: I8fe167a0909c952ad0824e24e178857df2541554
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
<!--
|
||||
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="8.0dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="6.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M2.800000,7.900000l-1.000000,0.000000L1.800000,11.000000L0.200000,11.000000L0.200000,2.500000l2.700000,0.000000c0.900000,0.000000 1.500000,0.200000 2.000000,0.700000s0.700000,1.100000 0.700000,1.900000c0.000000,0.600000 -0.100000,1.100000 -0.300000,1.500000S4.800000,7.200000 4.400000,7.400000l1.500000,3.500000L5.900000,11.000000L4.100000,11.000000L2.800000,7.900000zM1.800000,6.500000l1.100000,0.000000c0.400000,0.000000 0.600000,-0.100000 0.800000,-0.400000S4.000000,5.600000 4.000000,5.200000c0.000000,-0.400000 -0.100000,-0.800000 -0.300000,-1.000000S3.300000,3.800000 2.900000,3.800000L1.800000,3.800000L1.800000,6.500000z"/>
|
||||
</vector>
|
||||
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="4.25dp"
|
||||
android:width="8.5dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="6.0"
|
||||
android:viewportHeight="24.0">
|
||||
android:viewportHeight="12.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M2.800000,7.900000l-1.000000,0.000000L1.800000,11.000000L0.200000,11.000000L0.200000,2.500000l2.700000,0.000000c0.900000,0.000000 1.500000,0.200000 2.000000,0.700000s0.700000,1.100000 0.700000,1.900000c0.000000,0.600000 -0.100000,1.100000 -0.300000,1.500000S4.800000,7.200000 4.400000,7.400000l1.500000,3.500000L5.900000,11.000000L4.100000,11.000000L2.800000,7.900000zM1.800000,6.500000l1.100000,0.000000c0.400000,0.000000 0.600000,-0.100000 0.800000,-0.400000S4.000000,5.600000 4.000000,5.200000c0.000000,-0.400000 -0.100000,-0.800000 -0.300000,-1.000000S3.300000,3.800000 2.900000,3.800000L1.800000,3.800000L1.800000,6.500000z"/>
|
||||
@@ -59,6 +59,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textAppearance="@style/TextAppearance.QS.DataUsage" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -82,4 +83,13 @@
|
||||
android:textAppearance="@style/TextAppearance.QS.DataUsage.Secondary" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.systemui.qs.tiles.DataUsageDetailView>
|
||||
<TextView
|
||||
android:id="@+id/roaming_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:text="@string/accessibility_data_connection_roaming"
|
||||
android:textAppearance="@style/TextAppearance.QS.DataUsage.Secondary"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.android.systemui.qs.tiles.DataUsageDetailView>
|
||||
|
||||
@@ -43,4 +43,15 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/mobile_roaming"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="17dp"
|
||||
android:paddingStart="22dp"
|
||||
android:paddingTop="1.5dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/stat_sys_roaming"
|
||||
android:contentDescription="@string/accessibility_data_connection_roaming"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
@@ -189,8 +189,8 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
||||
translationXBuilder.addFloat(label, "translationX", -xDiff, 0);
|
||||
translationYBuilder.addFloat(label, "translationY", -yDiff, 0);
|
||||
|
||||
mTopFiveQs.add(tileIcon);
|
||||
mAllViews.add(tileIcon);
|
||||
mTopFiveQs.add(tileView.getIcon());
|
||||
mAllViews.add(tileView.getIcon());
|
||||
mAllViews.add(quickTileView);
|
||||
} else if (mFullRows && isIconInAnimatedRow(count)) {
|
||||
// TODO: Refactor some of this, it shares a lot with the above block.
|
||||
|
||||
@@ -35,7 +35,7 @@ import com.android.systemui.qs.QSTile;
|
||||
import com.android.systemui.qs.SignalTileView;
|
||||
import com.android.systemui.statusbar.policy.NetworkController;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.IconState;
|
||||
import com.android.systemui.statusbar.policy.SignalCallbackAdapter;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
|
||||
|
||||
/** Quick settings tile: Cellular **/
|
||||
public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
@@ -183,9 +183,10 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
String enabledDesc;
|
||||
boolean noSim;
|
||||
boolean isDataTypeIconWide;
|
||||
boolean roaming;
|
||||
}
|
||||
|
||||
private final class CellSignalCallback extends SignalCallbackAdapter {
|
||||
private final class CellSignalCallback implements SignalCallback {
|
||||
private final CallbackInfo mInfo = new CallbackInfo();
|
||||
@Override
|
||||
public void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon,
|
||||
@@ -197,7 +198,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
@Override
|
||||
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
String description, boolean isWide, int subId) {
|
||||
String description, boolean isWide, int subId, boolean roaming) {
|
||||
if (qsIcon == null) {
|
||||
// Not data sim, don't display.
|
||||
return;
|
||||
@@ -211,6 +212,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
mInfo.activityOut = activityOut;
|
||||
mInfo.enabledDesc = description;
|
||||
mInfo.isDataTypeIconWide = qsType != 0 && isWide;
|
||||
mInfo.roaming = roaming;
|
||||
refreshState(mInfo);
|
||||
}
|
||||
|
||||
@@ -280,6 +282,8 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
final DataUsageController.DataUsageInfo info = mDataController.getDataUsageInfo();
|
||||
if (info == null) return v;
|
||||
v.bind(info);
|
||||
v.findViewById(R.id.roaming_text).setVisibility(mSignalCallback.mInfo.roaming
|
||||
? View.VISIBLE : View.INVISIBLE);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import com.android.systemui.qs.SignalTileView;
|
||||
import com.android.systemui.statusbar.policy.NetworkController;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.AccessPointController;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.IconState;
|
||||
import com.android.systemui.statusbar.policy.SignalCallbackAdapter;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -245,7 +245,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
|
||||
}
|
||||
}
|
||||
|
||||
protected final class WifiSignalCallback extends SignalCallbackAdapter {
|
||||
protected final class WifiSignalCallback implements SignalCallback {
|
||||
final CallbackInfo mInfo = new CallbackInfo();
|
||||
|
||||
@Override
|
||||
|
||||
@@ -271,7 +271,7 @@ public class SignalClusterView
|
||||
@Override
|
||||
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
String description, boolean isWide, int subId) {
|
||||
String description, boolean isWide, int subId, boolean roaming) {
|
||||
PhoneState state = getState(subId);
|
||||
if (state == null) {
|
||||
return;
|
||||
@@ -282,6 +282,7 @@ public class SignalClusterView
|
||||
state.mMobileDescription = statusIcon.contentDescription;
|
||||
state.mMobileTypeDescription = typeContentDescription;
|
||||
state.mIsMobileTypeIconWide = statusType != 0 && isWide;
|
||||
state.mRoaming = roaming;
|
||||
|
||||
apply();
|
||||
}
|
||||
@@ -591,7 +592,8 @@ public class SignalClusterView
|
||||
private String mMobileDescription, mMobileTypeDescription;
|
||||
|
||||
private ViewGroup mMobileGroup;
|
||||
private ImageView mMobile, mMobileDark, mMobileType;
|
||||
private ImageView mMobile, mMobileDark, mMobileType, mMobileRoaming;
|
||||
public boolean mRoaming;
|
||||
|
||||
public PhoneState(int subId, Context context) {
|
||||
ViewGroup root = (ViewGroup) LayoutInflater.from(context)
|
||||
@@ -605,6 +607,7 @@ 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);
|
||||
mMobileRoaming = (ImageView) root.findViewById(R.id.mobile_roaming);
|
||||
}
|
||||
|
||||
public boolean apply(boolean isSecondaryIcon) {
|
||||
@@ -640,6 +643,7 @@ public class SignalClusterView
|
||||
(mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, mMobileTypeId));
|
||||
|
||||
mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE);
|
||||
mMobileRoaming.setVisibility(mRoaming ? View.VISIBLE : View.GONE);
|
||||
|
||||
return mMobileVisible;
|
||||
}
|
||||
@@ -699,6 +703,8 @@ public class SignalClusterView
|
||||
StatusBarIconController.getDarkIntensity(tintArea, mMobile, darkIntensity),
|
||||
mMobile, mMobileDark);
|
||||
setTint(mMobileType, StatusBarIconController.getTint(tintArea, mMobileType, tint));
|
||||
setTint(mMobileRoaming, StatusBarIconController.getTint(tintArea, mMobileRoaming,
|
||||
tint));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.os.UserManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
@@ -43,6 +44,10 @@ import com.android.systemui.qs.QuickQSPanel;
|
||||
import com.android.systemui.qs.TouchAnimator;
|
||||
import com.android.systemui.qs.TouchAnimator.Builder;
|
||||
import com.android.systemui.statusbar.policy.BatteryController;
|
||||
import com.android.systemui.statusbar.policy.NetworkController;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.EmergencyListener;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.IconState;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
|
||||
import com.android.systemui.statusbar.policy.NextAlarmController;
|
||||
import com.android.systemui.statusbar.policy.NextAlarmController.NextAlarmChangeCallback;
|
||||
import com.android.systemui.statusbar.policy.UserInfoController;
|
||||
@@ -50,7 +55,8 @@ import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChange
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
|
||||
public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
NextAlarmChangeCallback, OnClickListener, OnUserInfoChangedListener {
|
||||
NextAlarmChangeCallback, OnClickListener, OnUserInfoChangedListener, EmergencyListener,
|
||||
SignalCallback {
|
||||
|
||||
private static final String TAG = "QuickStatusBarHeader";
|
||||
|
||||
@@ -91,6 +97,8 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
private View mEdit;
|
||||
private boolean mShowFullAlarm;
|
||||
private float mDateTimeTranslation;
|
||||
private SparseBooleanArray mRoamingsBySubId = new SparseBooleanArray();
|
||||
private boolean mIsRoaming;
|
||||
|
||||
public QuickStatusBarHeader(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -265,7 +273,7 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
protected void updateVisibilities() {
|
||||
updateAlarmVisibilities();
|
||||
updateDateTimePosition();
|
||||
mEmergencyOnly.setVisibility(mExpanded && mShowEmergencyCallsOnly
|
||||
mEmergencyOnly.setVisibility(mExpanded && (mShowEmergencyCallsOnly || mIsRoaming)
|
||||
? View.VISIBLE : View.INVISIBLE);
|
||||
mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility(
|
||||
TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE);
|
||||
@@ -276,15 +284,21 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
}
|
||||
|
||||
private void updateDateTimePosition() {
|
||||
mDateTimeAlarmGroup.setTranslationY(mShowEmergencyCallsOnly
|
||||
mDateTimeAlarmGroup.setTranslationY(mShowEmergencyCallsOnly || mIsRoaming
|
||||
? mExpansionAmount * mDateTimeTranslation : 0);
|
||||
}
|
||||
|
||||
private void updateListeners() {
|
||||
if (mListening) {
|
||||
mNextAlarmController.addStateChangedCallback(this);
|
||||
if (mHost.getNetworkController().hasVoiceCallingFeature()) {
|
||||
mHost.getNetworkController().addEmergencyListener(this);
|
||||
mHost.getNetworkController().addSignalCallback(this);
|
||||
}
|
||||
} else {
|
||||
mNextAlarmController.removeStateChangedCallback(this);
|
||||
mHost.getNetworkController().removeEmergencyListener(this);
|
||||
mHost.getNetworkController().removeSignalCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,6 +397,29 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
String description, boolean isWide, int subId, boolean roaming) {
|
||||
mRoamingsBySubId.put(subId, roaming);
|
||||
boolean isRoaming = calculateRoaming();
|
||||
if (mIsRoaming != isRoaming) {
|
||||
mIsRoaming = isRoaming;
|
||||
mEmergencyOnly.setText(mIsRoaming ? R.string.accessibility_data_connection_roaming
|
||||
: com.android.internal.R.string.emergency_calls_only);
|
||||
if (mExpanded) {
|
||||
updateEverything();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean calculateRoaming() {
|
||||
for (int i = 0; i < mRoamingsBySubId.size(); i++) {
|
||||
if (mRoamingsBySubId.valueAt(i)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserInfoChanged(String name, Drawable picture) {
|
||||
mMultiUserAvatar.setImageDrawable(picture);
|
||||
|
||||
@@ -125,14 +125,14 @@ public class CallbackHandler extends Handler implements EmergencyListener, Signa
|
||||
public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon,
|
||||
final int statusType, final int qsType,final boolean activityIn,
|
||||
final boolean activityOut, final String typeContentDescription,
|
||||
final String description, final boolean isWide, final int subId) {
|
||||
final String description, final boolean isWide, final int subId, boolean roaming) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (SignalCallback signalCluster : mSignalCallbacks) {
|
||||
signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType,
|
||||
activityIn, activityOut, typeContentDescription, description, isWide,
|
||||
subId);
|
||||
subId, roaming);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -226,10 +226,8 @@ public class MobileSignalController extends SignalController<
|
||||
final boolean dataDisabled = mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED
|
||||
&& mCurrentState.userSetup;
|
||||
|
||||
// Show icon in QS when we are connected or need to show roaming or data is disabled.
|
||||
boolean showDataIcon = mCurrentState.dataConnected
|
||||
|| mCurrentState.iconGroup == TelephonyIcons.ROAMING
|
||||
|| dataDisabled;
|
||||
// Show icon in QS when we are connected or data is disabled.
|
||||
boolean showDataIcon = mCurrentState.dataConnected || dataDisabled;
|
||||
IconState statusIcon = new IconState(mCurrentState.enabled && !mCurrentState.airplaneMode,
|
||||
getCurrentIconId(), contentDescription);
|
||||
|
||||
@@ -249,13 +247,11 @@ public class MobileSignalController extends SignalController<
|
||||
boolean activityOut = mCurrentState.dataConnected
|
||||
&& !mCurrentState.carrierNetworkChangeMode
|
||||
&& mCurrentState.activityOut;
|
||||
showDataIcon &= mCurrentState.isDefault
|
||||
|| mCurrentState.iconGroup == TelephonyIcons.ROAMING
|
||||
|| dataDisabled;
|
||||
showDataIcon &= mCurrentState.isDefault || dataDisabled;
|
||||
int typeIcon = showDataIcon ? icons.mDataType : 0;
|
||||
callback.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
||||
activityIn, activityOut, dataContentDescription, description, icons.mIsWide,
|
||||
mSubscriptionInfo.getSubscriptionId());
|
||||
mSubscriptionInfo.getSubscriptionId(), mCurrentState.roaming);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -405,10 +401,9 @@ public class MobileSignalController extends SignalController<
|
||||
mCurrentState.dataConnected = mCurrentState.connected
|
||||
&& mDataState == TelephonyManager.DATA_CONNECTED;
|
||||
|
||||
mCurrentState.roaming = isRoaming();
|
||||
if (isCarrierNetworkChangeActive()) {
|
||||
mCurrentState.iconGroup = TelephonyIcons.CARRIER_NETWORK_CHANGE;
|
||||
} else if (isRoaming()) {
|
||||
mCurrentState.iconGroup = TelephonyIcons.ROAMING;
|
||||
} else if (isDataDisabled()) {
|
||||
mCurrentState.iconGroup = TelephonyIcons.DATA_DISABLED;
|
||||
}
|
||||
@@ -541,6 +536,7 @@ public class MobileSignalController extends SignalController<
|
||||
boolean carrierNetworkChangeMode;
|
||||
boolean isDefault;
|
||||
boolean userSetup;
|
||||
boolean roaming;
|
||||
|
||||
@Override
|
||||
public void copyFrom(State s) {
|
||||
@@ -555,6 +551,7 @@ public class MobileSignalController extends SignalController<
|
||||
airplaneMode = state.airplaneMode;
|
||||
carrierNetworkChangeMode = state.carrierNetworkChangeMode;
|
||||
userSetup = state.userSetup;
|
||||
roaming = state.roaming;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -565,6 +562,7 @@ public class MobileSignalController extends SignalController<
|
||||
builder.append("networkName=").append(networkName).append(',');
|
||||
builder.append("networkNameData=").append(networkNameData).append(',');
|
||||
builder.append("dataConnected=").append(dataConnected).append(',');
|
||||
builder.append("roaming=").append(roaming).append(',');
|
||||
builder.append("isDefault=").append(isDefault).append(',');
|
||||
builder.append("isEmergency=").append(isEmergency).append(',');
|
||||
builder.append("airplaneMode=").append(airplaneMode).append(',');
|
||||
@@ -584,7 +582,8 @@ public class MobileSignalController extends SignalController<
|
||||
&& ((MobileState) o).airplaneMode == airplaneMode
|
||||
&& ((MobileState) o).carrierNetworkChangeMode == carrierNetworkChangeMode
|
||||
&& ((MobileState) o).userSetup == userSetup
|
||||
&& ((MobileState) o).isDefault == isDefault;
|
||||
&& ((MobileState) o).isDefault == isDefault
|
||||
&& ((MobileState) o).roaming == roaming;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface NetworkController {
|
||||
|
||||
default void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
String description, boolean isWide, int subId) {}
|
||||
String description, boolean isWide, int subId, boolean roaming) {}
|
||||
default void setSubs(List<SubscriptionInfo> subs) {}
|
||||
default void setNoSims(boolean show) {}
|
||||
|
||||
|
||||
@@ -787,9 +787,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
datatype.equals("h") ? TelephonyIcons.H :
|
||||
datatype.equals("lte") ? TelephonyIcons.LTE :
|
||||
datatype.equals("lte+") ? TelephonyIcons.LTE_PLUS :
|
||||
datatype.equals("roam") ? TelephonyIcons.ROAMING :
|
||||
TelephonyIcons.UNKNOWN;
|
||||
}
|
||||
if (args.containsKey("roam")) {
|
||||
controller.getState().roaming = "show".equals(args.getString("roam"));
|
||||
}
|
||||
int[][] icons = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH;
|
||||
String level = args.getString("level");
|
||||
if (level != null) {
|
||||
@@ -797,6 +799,10 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
: Math.min(Integer.parseInt(level), icons[0].length - 1);
|
||||
controller.getState().connected = controller.getState().level >= 0;
|
||||
}
|
||||
String activity = args.getString("activity");
|
||||
if (activity != null) {
|
||||
controller.setActivity(Integer.parseInt(activity));
|
||||
}
|
||||
controller.getState().enabled = show;
|
||||
controller.notifyListeners();
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
*/
|
||||
package com.android.systemui.statusbar.policy;
|
||||
|
||||
import android.telephony.SubscriptionInfo;
|
||||
|
||||
import com.android.systemui.statusbar.policy.NetworkController.IconState;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Provides empty implementations of SignalCallback for those that only want some of
|
||||
* the callbacks.
|
||||
*/
|
||||
public class SignalCallbackAdapter implements SignalCallback {
|
||||
|
||||
@Override
|
||||
public void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon,
|
||||
boolean activityIn, boolean activityOut, String description) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
String description, boolean isWide, int subId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubs(List<SubscriptionInfo> subs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoSims(boolean show) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEthernetIndicators(IconState icon) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsAirplaneMode(IconState icon) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMobileDataEnabled(boolean enabled) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -95,8 +95,6 @@ class TelephonyIcons {
|
||||
R.drawable.ic_qs_signal_carrier_network_change_animation }
|
||||
};
|
||||
|
||||
static final int QS_DATA_R = R.drawable.ic_qs_signal_r;
|
||||
|
||||
//***** Data connection icons
|
||||
|
||||
//GSM/UMTS
|
||||
@@ -211,7 +209,7 @@ class TelephonyIcons {
|
||||
static final int QS_DATA_LTE_PLUS = R.drawable.ic_qs_signal_lte_plus;
|
||||
|
||||
static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
|
||||
static final int ROAMING_ICON = R.drawable.stat_sys_data_fully_connected_roam;
|
||||
static final int ROAMING_ICON = R.drawable.stat_sys_roaming;
|
||||
static final int ICON_LTE = R.drawable.stat_sys_data_fully_connected_lte;
|
||||
static final int ICON_LTE_PLUS = R.drawable.stat_sys_data_fully_connected_lte_plus;
|
||||
static final int ICON_G = R.drawable.stat_sys_data_fully_connected_g;
|
||||
@@ -410,21 +408,6 @@ class TelephonyIcons {
|
||||
TelephonyIcons.QS_DATA_LTE_PLUS
|
||||
);
|
||||
|
||||
static final MobileIconGroup ROAMING = new MobileIconGroup(
|
||||
"Roaming",
|
||||
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING,
|
||||
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
|
||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||
0, 0,
|
||||
TelephonyIcons.TELEPHONY_NO_NETWORK,
|
||||
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
|
||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||
R.string.accessibility_data_connection_roaming,
|
||||
TelephonyIcons.ROAMING_ICON,
|
||||
false,
|
||||
TelephonyIcons.QS_DATA_R
|
||||
);
|
||||
|
||||
static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
|
||||
"DataDisabled",
|
||||
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
|
||||
|
||||
@@ -31,6 +31,8 @@ import org.mockito.MockitoAnnotations;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.mockito.Matchers.eq;
|
||||
|
||||
@SmallTest
|
||||
public class CallbackHandlerTest extends AndroidTestCase {
|
||||
|
||||
@@ -102,8 +104,9 @@ public class CallbackHandlerTest extends AndroidTestCase {
|
||||
int qsType = R.drawable.ic_qs_signal_1x;
|
||||
boolean wide = true;
|
||||
int subId = 5;
|
||||
boolean roaming = true;
|
||||
mHandler.setMobileDataIndicators(status, qs, type, qsType, in, out, typeDescription,
|
||||
description, wide, subId);
|
||||
description, wide, subId, roaming);
|
||||
waitForCallbacks();
|
||||
|
||||
ArgumentCaptor<IconState> statusArg = ArgumentCaptor.forClass(IconState.class);
|
||||
@@ -119,7 +122,7 @@ public class CallbackHandlerTest extends AndroidTestCase {
|
||||
Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(),
|
||||
qsArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), inArg.capture(),
|
||||
outArg.capture(), typeContentArg.capture(), descArg.capture(), wideArg.capture(),
|
||||
subIdArg.capture());
|
||||
subIdArg.capture(), eq(roaming));
|
||||
assertEquals(status, statusArg.getValue());
|
||||
assertEquals(qs, qsArg.getValue());
|
||||
assertEquals(type, (int) typeIconArg.getValue());
|
||||
|
||||
@@ -43,6 +43,13 @@ import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyBoolean;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -279,10 +286,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
iconArg.capture(),
|
||||
ArgumentCaptor.forClass(Integer.class).capture(),
|
||||
typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(),
|
||||
ArgumentCaptor.forClass(String.class).capture(),
|
||||
ArgumentCaptor.forClass(String.class).capture(),
|
||||
ArgumentCaptor.forClass(Boolean.class).capture(),
|
||||
ArgumentCaptor.forClass(Integer.class).capture());
|
||||
anyString(), anyString(), anyBoolean(), anyInt(), anyBoolean());
|
||||
IconState iconState = iconArg.getValue();
|
||||
assertEquals("Visibility in, quick settings", visible, iconState.visible);
|
||||
assertEquals("Signal icon in, quick settings", icon, iconState.icon);
|
||||
@@ -294,21 +298,46 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon) {
|
||||
verifyLastMobileDataIndicators(visible, icon, typeIcon, false);
|
||||
}
|
||||
|
||||
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon,
|
||||
boolean roaming) {
|
||||
ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
|
||||
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
|
||||
// TODO: Verify all fields.
|
||||
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
|
||||
iconArg.capture(),
|
||||
ArgumentCaptor.forClass(IconState.class).capture(),
|
||||
any(),
|
||||
typeIconArg.capture(),
|
||||
ArgumentCaptor.forClass(Integer.class).capture(),
|
||||
ArgumentCaptor.forClass(Boolean.class).capture(),
|
||||
ArgumentCaptor.forClass(Boolean.class).capture(),
|
||||
ArgumentCaptor.forClass(String.class).capture(),
|
||||
ArgumentCaptor.forClass(String.class).capture(),
|
||||
ArgumentCaptor.forClass(Boolean.class).capture(),
|
||||
ArgumentCaptor.forClass(Integer.class).capture());
|
||||
anyInt(), anyBoolean(), anyBoolean(), anyString(), anyString(), anyBoolean(),
|
||||
anyInt(), eq(roaming));
|
||||
IconState iconState = iconArg.getValue();
|
||||
|
||||
assertEquals("Signal icon in status bar", icon, iconState.icon);
|
||||
assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue());
|
||||
assertEquals("Visibility in status bar", visible, iconState.visible);
|
||||
}
|
||||
|
||||
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon,
|
||||
boolean qsVisible, int qsIcon, int qsTypeIcon, boolean dataIn, boolean dataOut) {
|
||||
ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
|
||||
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<IconState> qsIconArg = ArgumentCaptor.forClass(IconState.class);
|
||||
ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<Boolean> dataInArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
ArgumentCaptor<Boolean> dataOutArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
|
||||
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
|
||||
iconArg.capture(),
|
||||
qsIconArg.capture(),
|
||||
typeIconArg.capture(),
|
||||
qsTypeIconArg.capture(),
|
||||
dataInArg.capture(),
|
||||
dataOutArg.capture(),
|
||||
anyString(), anyString(), anyBoolean(), anyInt(), anyBoolean());
|
||||
|
||||
IconState iconState = iconArg.getValue();
|
||||
|
||||
assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue());
|
||||
|
||||
@@ -17,18 +17,6 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
||||
TelephonyIcons.QS_DATA_3G);
|
||||
}
|
||||
|
||||
public void testRoamingDataIcon() {
|
||||
setupDefaultSignal();
|
||||
setGsmRoaming(true);
|
||||
|
||||
verifyLastMobileDataIndicators(true,
|
||||
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][DEFAULT_LEVEL],
|
||||
TelephonyIcons.ROAMING_ICON);
|
||||
verifyLastQsMobileDataIndicators(true,
|
||||
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL],
|
||||
TelephonyIcons.QS_DATA_R, false, false);
|
||||
}
|
||||
|
||||
public void test2gDataIcon() {
|
||||
setupDefaultSignal();
|
||||
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
|
||||
|
||||
@@ -140,13 +140,12 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
||||
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
|
||||
setupDefaultSignal();
|
||||
setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
|
||||
setGsmRoaming(true);
|
||||
setLevel(testStrength);
|
||||
|
||||
verifyLastMobileDataIndicators(true,
|
||||
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][testStrength],
|
||||
TelephonyIcons.ROAMING_ICON);
|
||||
DEFAULT_ICON, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +159,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
||||
|
||||
verifyLastMobileDataIndicators(true,
|
||||
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][testStrength],
|
||||
TelephonyIcons.ROAMING_ICON);
|
||||
TelephonyIcons.DATA_1X[1][0 /* No direction */], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,9 +93,10 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
|
||||
setGsmRoaming(true);
|
||||
// Still be on wifi though.
|
||||
setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
|
||||
setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
|
||||
verifyLastMobileDataIndicators(true,
|
||||
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][DEFAULT_LEVEL],
|
||||
TelephonyIcons.ROAMING_ICON);
|
||||
0, true);
|
||||
}
|
||||
|
||||
protected void setWifiActivity(int activity) {
|
||||
|
||||
Reference in New Issue
Block a user