Merge changes Ibdaec230,I06d5e569,I5e2eb489,I116b5f63,I6fa7adaa into sc-v2-dev
* changes: Create QsInfo and SbInfo boxes for MobileSignalController Move some logic to MobileState Remove qsDataType since it was the same as dataType Remove isWide from MobileIconGroup Move callback anonymous classes out of constructor
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.settingslib;
|
package com.android.settingslib;
|
||||||
|
|
||||||
|
import com.android.settingslib.mobile.TelephonyIcons;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -40,9 +42,17 @@ public class SignalIcon {
|
|||||||
// For logging.
|
// For logging.
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|
||||||
public IconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
|
public IconGroup(
|
||||||
int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
|
String name,
|
||||||
int discContentDesc) {
|
int[][] sbIcons,
|
||||||
|
int[][] qsIcons,
|
||||||
|
int[] contentDesc,
|
||||||
|
int sbNullState,
|
||||||
|
int qsNullState,
|
||||||
|
int sbDiscState,
|
||||||
|
int qsDiscState,
|
||||||
|
int discContentDesc
|
||||||
|
) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.sbIcons = sbIcons;
|
this.sbIcons = sbIcons;
|
||||||
this.qsIcons = qsIcons;
|
this.qsIcons = qsIcons;
|
||||||
@@ -131,6 +141,19 @@ public class SignalIcon {
|
|||||||
&& other.activityOut == activityOut
|
&& other.activityOut == activityOut
|
||||||
&& other.rssi == rssi;
|
&& other.rssi == rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(
|
||||||
|
connected,
|
||||||
|
enabled,
|
||||||
|
level,
|
||||||
|
inetCondition,
|
||||||
|
iconGroup,
|
||||||
|
activityIn,
|
||||||
|
activityOut,
|
||||||
|
rssi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,18 +162,31 @@ public class SignalIcon {
|
|||||||
public static class MobileIconGroup extends IconGroup {
|
public static class MobileIconGroup extends IconGroup {
|
||||||
public final int dataContentDescription; // mContentDescriptionDataType
|
public final int dataContentDescription; // mContentDescriptionDataType
|
||||||
public final int dataType;
|
public final int dataType;
|
||||||
public final boolean isWide;
|
|
||||||
public final int qsDataType;
|
|
||||||
|
|
||||||
public MobileIconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
|
public MobileIconGroup(
|
||||||
int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
|
String name,
|
||||||
int discContentDesc, int dataContentDesc, int dataType, boolean isWide) {
|
int[][] sbIcons,
|
||||||
super(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState,
|
int[][] qsIcons,
|
||||||
qsDiscState, discContentDesc);
|
int[] contentDesc,
|
||||||
|
int sbNullState,
|
||||||
|
int qsNullState,
|
||||||
|
int sbDiscState,
|
||||||
|
int qsDiscState,
|
||||||
|
int discContentDesc,
|
||||||
|
int dataContentDesc,
|
||||||
|
int dataType
|
||||||
|
) {
|
||||||
|
super(name,
|
||||||
|
sbIcons,
|
||||||
|
qsIcons,
|
||||||
|
contentDesc,
|
||||||
|
sbNullState,
|
||||||
|
qsNullState,
|
||||||
|
sbDiscState,
|
||||||
|
qsDiscState,
|
||||||
|
discContentDesc);
|
||||||
this.dataContentDescription = dataContentDesc;
|
this.dataContentDescription = dataContentDesc;
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
this.isWide = isWide;
|
|
||||||
this.qsDataType = dataType; // TODO: remove this field
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,6 +223,27 @@ public class SignalIcon {
|
|||||||
defaultDataOff = state.defaultDataOff;
|
defaultDataOff = state.defaultDataOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return true if this state is disabled or not default data */
|
||||||
|
public boolean isDataDisabledOrNotDefault() {
|
||||||
|
return (iconGroup == TelephonyIcons.DATA_DISABLED
|
||||||
|
|| (iconGroup == TelephonyIcons.NOT_DEFAULT_DATA)) && userSetup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return if this state is considered to have inbound activity */
|
||||||
|
public boolean hasActivityIn() {
|
||||||
|
return dataConnected && !carrierNetworkChangeMode && activityIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return if this state is considered to have outbound activity */
|
||||||
|
public boolean hasActivityOut() {
|
||||||
|
return dataConnected && !carrierNetworkChangeMode && activityOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return true if this state should show a RAT icon in quick settings */
|
||||||
|
public boolean showQuickSettingsRatIcon() {
|
||||||
|
return dataConnected || isDataDisabledOrNotDefault();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void toString(StringBuilder builder) {
|
protected void toString(StringBuilder builder) {
|
||||||
super.toString(builder);
|
super.toString(builder);
|
||||||
@@ -202,7 +259,8 @@ public class SignalIcon {
|
|||||||
builder.append("carrierNetworkChangeMode=").append(carrierNetworkChangeMode)
|
builder.append("carrierNetworkChangeMode=").append(carrierNetworkChangeMode)
|
||||||
.append(',');
|
.append(',');
|
||||||
builder.append("userSetup=").append(userSetup).append(',');
|
builder.append("userSetup=").append(userSetup).append(',');
|
||||||
builder.append("defaultDataOff=").append(defaultDataOff);
|
builder.append("defaultDataOff=").append(defaultDataOff).append(',');
|
||||||
|
builder.append("showQuickSettingsRatIcon=").append(showQuickSettingsRatIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -220,5 +278,21 @@ public class SignalIcon {
|
|||||||
&& ((MobileState) o).roaming == roaming
|
&& ((MobileState) o).roaming == roaming
|
||||||
&& ((MobileState) o).defaultDataOff == defaultDataOff;
|
&& ((MobileState) o).defaultDataOff == defaultDataOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode(),
|
||||||
|
networkName,
|
||||||
|
networkNameData,
|
||||||
|
dataSim,
|
||||||
|
dataConnected,
|
||||||
|
isEmergency,
|
||||||
|
airplaneMode,
|
||||||
|
carrierNetworkChangeMode,
|
||||||
|
userSetup,
|
||||||
|
isDefault,
|
||||||
|
roaming,
|
||||||
|
defaultDataOff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,178 +50,194 @@ public class TelephonyIcons {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.carrier_network_change_mode,
|
R.string.carrier_network_change_mode,
|
||||||
0,
|
0
|
||||||
false);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup THREE_G = new MobileIconGroup(
|
public static final MobileIconGroup THREE_G = new MobileIconGroup(
|
||||||
"3G",
|
"3G",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_3g,
|
R.string.data_connection_3g,
|
||||||
TelephonyIcons.ICON_3G,
|
TelephonyIcons.ICON_3G
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup WFC = new MobileIconGroup(
|
public static final MobileIconGroup WFC = new MobileIconGroup(
|
||||||
"WFC",
|
"WFC",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
0, 0, false);
|
0,
|
||||||
|
0);
|
||||||
|
|
||||||
public static final MobileIconGroup UNKNOWN = new MobileIconGroup(
|
public static final MobileIconGroup UNKNOWN = new MobileIconGroup(
|
||||||
"Unknown",
|
"Unknown",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
0, 0, false);
|
0,
|
||||||
|
0);
|
||||||
|
|
||||||
public static final MobileIconGroup E = new MobileIconGroup(
|
public static final MobileIconGroup E = new MobileIconGroup(
|
||||||
"E",
|
"E",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_edge,
|
R.string.data_connection_edge,
|
||||||
TelephonyIcons.ICON_E,
|
TelephonyIcons.ICON_E
|
||||||
false);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup ONE_X = new MobileIconGroup(
|
public static final MobileIconGroup ONE_X = new MobileIconGroup(
|
||||||
"1X",
|
"1X",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_cdma,
|
R.string.data_connection_cdma,
|
||||||
TelephonyIcons.ICON_1X,
|
TelephonyIcons.ICON_1X
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup G = new MobileIconGroup(
|
public static final MobileIconGroup G = new MobileIconGroup(
|
||||||
"G",
|
"G",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_gprs,
|
R.string.data_connection_gprs,
|
||||||
TelephonyIcons.ICON_G,
|
TelephonyIcons.ICON_G
|
||||||
false);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup H = new MobileIconGroup(
|
public static final MobileIconGroup H = new MobileIconGroup(
|
||||||
"H",
|
"H",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_3_5g,
|
R.string.data_connection_3_5g,
|
||||||
TelephonyIcons.ICON_H,
|
TelephonyIcons.ICON_H
|
||||||
false);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup H_PLUS = new MobileIconGroup(
|
public static final MobileIconGroup H_PLUS = new MobileIconGroup(
|
||||||
"H+",
|
"H+",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_3_5g_plus,
|
R.string.data_connection_3_5g_plus,
|
||||||
TelephonyIcons.ICON_H_PLUS,
|
TelephonyIcons.ICON_H_PLUS
|
||||||
false);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup FOUR_G = new MobileIconGroup(
|
public static final MobileIconGroup FOUR_G = new MobileIconGroup(
|
||||||
"4G",
|
"4G",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_4g,
|
R.string.data_connection_4g,
|
||||||
TelephonyIcons.ICON_4G,
|
TelephonyIcons.ICON_4G
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup FOUR_G_PLUS = new MobileIconGroup(
|
public static final MobileIconGroup FOUR_G_PLUS = new MobileIconGroup(
|
||||||
"4G+",
|
"4G+",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_4g_plus,
|
R.string.data_connection_4g_plus,
|
||||||
TelephonyIcons.ICON_4G_PLUS,
|
TelephonyIcons.ICON_4G_PLUS
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup LTE = new MobileIconGroup(
|
public static final MobileIconGroup LTE = new MobileIconGroup(
|
||||||
"LTE",
|
"LTE",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_lte,
|
R.string.data_connection_lte,
|
||||||
TelephonyIcons.ICON_LTE,
|
TelephonyIcons.ICON_LTE
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup LTE_PLUS = new MobileIconGroup(
|
public static final MobileIconGroup LTE_PLUS = new MobileIconGroup(
|
||||||
"LTE+",
|
"LTE+",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_lte_plus,
|
R.string.data_connection_lte_plus,
|
||||||
TelephonyIcons.ICON_LTE_PLUS,
|
TelephonyIcons.ICON_LTE_PLUS
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup LTE_CA_5G_E = new MobileIconGroup(
|
public static final MobileIconGroup LTE_CA_5G_E = new MobileIconGroup(
|
||||||
"5Ge",
|
"5Ge",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_5ge_html,
|
R.string.data_connection_5ge_html,
|
||||||
TelephonyIcons.ICON_5G_E,
|
TelephonyIcons.ICON_5G_E
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup NR_5G = new MobileIconGroup(
|
public static final MobileIconGroup NR_5G = new MobileIconGroup(
|
||||||
"5G",
|
"5G",
|
||||||
@@ -234,8 +250,8 @@ public class TelephonyIcons {
|
|||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_5g,
|
R.string.data_connection_5g,
|
||||||
TelephonyIcons.ICON_5G,
|
TelephonyIcons.ICON_5G
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup NR_5G_PLUS = new MobileIconGroup(
|
public static final MobileIconGroup NR_5G_PLUS = new MobileIconGroup(
|
||||||
"5G_PLUS",
|
"5G_PLUS",
|
||||||
@@ -248,34 +264,36 @@ public class TelephonyIcons {
|
|||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_5g_plus,
|
R.string.data_connection_5g_plus,
|
||||||
TelephonyIcons.ICON_5G_PLUS,
|
TelephonyIcons.ICON_5G_PLUS
|
||||||
true);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
|
public static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
|
||||||
"DataDisabled",
|
"DataDisabled",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.cell_data_off_content_description,
|
R.string.cell_data_off_content_description,
|
||||||
0,
|
0
|
||||||
false);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup NOT_DEFAULT_DATA = new MobileIconGroup(
|
public static final MobileIconGroup NOT_DEFAULT_DATA = new MobileIconGroup(
|
||||||
"NotDefaultData",
|
"NotDefaultData",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||||
0, 0,
|
0,
|
||||||
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.not_default_data_content_description,
|
R.string.not_default_data_content_description,
|
||||||
0,
|
0
|
||||||
false);
|
);
|
||||||
|
|
||||||
public static final MobileIconGroup CARRIER_MERGED_WIFI = new MobileIconGroup(
|
public static final MobileIconGroup CARRIER_MERGED_WIFI = new MobileIconGroup(
|
||||||
"CWF",
|
"CWF",
|
||||||
@@ -288,8 +306,8 @@ public class TelephonyIcons {
|
|||||||
/* qsDiscState= */ 0,
|
/* qsDiscState= */ 0,
|
||||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||||
R.string.data_connection_carrier_wifi,
|
R.string.data_connection_carrier_wifi,
|
||||||
TelephonyIcons.ICON_CWF,
|
TelephonyIcons.ICON_CWF
|
||||||
/* isWide= */ true);
|
);
|
||||||
|
|
||||||
// When adding a new MobileIconGround, check if the dataContentDescription has to be filtered
|
// When adding a new MobileIconGround, check if the dataContentDescription has to be filtered
|
||||||
// in QSCarrier#hasValidTypeContentDescription
|
// in QSCarrier#hasValidTypeContentDescription
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.settingslib;
|
||||||
|
|
||||||
|
import static junit.framework.Assert.assertFalse;
|
||||||
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.android.settingslib.mobile.TelephonyIcons;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class MobileStateTest {
|
||||||
|
|
||||||
|
private SignalIcon.MobileState mState = new SignalIcon.MobileState();
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsDataDisabledOrNotDefault_dataDisabled() {
|
||||||
|
mState.iconGroup = TelephonyIcons.DATA_DISABLED;
|
||||||
|
mState.userSetup = true;
|
||||||
|
|
||||||
|
assertTrue(mState.isDataDisabledOrNotDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsDataDisabledOrNotDefault_notDefaultData() {
|
||||||
|
mState.iconGroup = TelephonyIcons.NOT_DEFAULT_DATA;
|
||||||
|
mState.userSetup = true;
|
||||||
|
|
||||||
|
assertTrue(mState.isDataDisabledOrNotDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsDataDisabledOrNotDefault_notDisabled() {
|
||||||
|
mState.iconGroup = TelephonyIcons.G;
|
||||||
|
mState.userSetup = true;
|
||||||
|
|
||||||
|
assertFalse(mState.isDataDisabledOrNotDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHasActivityIn_noData_noActivity() {
|
||||||
|
mState.dataConnected = false;
|
||||||
|
mState.carrierNetworkChangeMode = false;
|
||||||
|
mState.activityIn = false;
|
||||||
|
|
||||||
|
assertFalse(mState.hasActivityIn());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHasActivityIn_noData_activityIn() {
|
||||||
|
mState.dataConnected = false;
|
||||||
|
mState.carrierNetworkChangeMode = false;
|
||||||
|
mState.activityIn = true;
|
||||||
|
|
||||||
|
assertFalse(mState.hasActivityIn());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHasActivityIn_dataConnected_activityIn() {
|
||||||
|
mState.dataConnected = true;
|
||||||
|
mState.carrierNetworkChangeMode = false;
|
||||||
|
mState.activityIn = true;
|
||||||
|
|
||||||
|
assertTrue(mState.hasActivityIn());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHasActivityIn_carrierNetworkChange() {
|
||||||
|
mState.dataConnected = true;
|
||||||
|
mState.carrierNetworkChangeMode = true;
|
||||||
|
mState.activityIn = true;
|
||||||
|
|
||||||
|
assertFalse(mState.hasActivityIn());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHasActivityOut_noData_noActivity() {
|
||||||
|
mState.dataConnected = false;
|
||||||
|
mState.carrierNetworkChangeMode = false;
|
||||||
|
mState.activityOut = false;
|
||||||
|
|
||||||
|
assertFalse(mState.hasActivityOut());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHasActivityOut_noData_activityOut() {
|
||||||
|
mState.dataConnected = false;
|
||||||
|
mState.carrierNetworkChangeMode = false;
|
||||||
|
mState.activityOut = true;
|
||||||
|
|
||||||
|
assertFalse(mState.hasActivityOut());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHasActivityOut_dataConnected_activityOut() {
|
||||||
|
mState.dataConnected = true;
|
||||||
|
mState.carrierNetworkChangeMode = false;
|
||||||
|
mState.activityOut = true;
|
||||||
|
|
||||||
|
assertTrue(mState.hasActivityOut());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHasActivityOut_carrierNetworkChange() {
|
||||||
|
mState.dataConnected = true;
|
||||||
|
mState.carrierNetworkChangeMode = true;
|
||||||
|
mState.activityOut = true;
|
||||||
|
|
||||||
|
assertFalse(mState.hasActivityOut());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -275,7 +275,7 @@ public class CellularTile extends QSTileImpl<SignalState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mInfo.dataSubscriptionName = mController.getMobileDataNetworkName();
|
mInfo.dataSubscriptionName = mController.getMobileDataNetworkName();
|
||||||
mInfo.dataContentDescription = indicators.description != null
|
mInfo.dataContentDescription = indicators.qsDescription != null
|
||||||
? indicators.typeContentDescriptionHtml : null;
|
? indicators.typeContentDescriptionHtml : null;
|
||||||
mInfo.activityIn = indicators.activityIn;
|
mInfo.activityIn = indicators.activityIn;
|
||||||
mInfo.activityOut = indicators.activityOut;
|
mInfo.activityOut = indicators.activityOut;
|
||||||
|
|||||||
@@ -279,9 +279,9 @@ public class InternetTile extends QSTileImpl<SignalState> {
|
|||||||
// Not data sim, don't display.
|
// Not data sim, don't display.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mCellularInfo.mDataSubscriptionName = indicators.description == null
|
mCellularInfo.mDataSubscriptionName = indicators.qsDescription == null
|
||||||
? mController.getMobileDataNetworkName() : indicators.description;
|
? mController.getMobileDataNetworkName() : indicators.qsDescription;
|
||||||
mCellularInfo.mDataContentDescription = indicators.description != null
|
mCellularInfo.mDataContentDescription = indicators.qsDescription != null
|
||||||
? indicators.typeContentDescriptionHtml : null;
|
? indicators.typeContentDescriptionHtml : null;
|
||||||
mCellularInfo.mMobileSignalIconId = indicators.qsIcon.icon;
|
mCellularInfo.mMobileSignalIconId = indicators.qsIcon.icon;
|
||||||
mCellularInfo.mQsTypeIcon = indicators.qsType;
|
mCellularInfo.mQsTypeIcon = indicators.qsType;
|
||||||
|
|||||||
@@ -91,8 +91,7 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
private int mImsType = IMS_TYPE_WWAN;
|
private int mImsType = IMS_TYPE_WWAN;
|
||||||
// Save entire info for logging, we only use the id.
|
// Save entire info for logging, we only use the id.
|
||||||
final SubscriptionInfo mSubscriptionInfo;
|
final SubscriptionInfo mSubscriptionInfo;
|
||||||
// @VisibleForDemoMode
|
private Map<String, MobileIconGroup> mNetworkToIconLookup;
|
||||||
Map<String, MobileIconGroup> mNetworkToIconLookup;
|
|
||||||
|
|
||||||
// Since some pieces of the phone state are interdependent we store it locally,
|
// Since some pieces of the phone state are interdependent we store it locally,
|
||||||
// this could potentially become part of MobileState for simplification/complication
|
// this could potentially become part of MobileState for simplification/complication
|
||||||
@@ -108,8 +107,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
private Config mConfig;
|
private Config mConfig;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean mInflateSignalStrengths = false;
|
boolean mInflateSignalStrengths = false;
|
||||||
private MobileStatusTracker.Callback mCallback;
|
|
||||||
private RegistrationCallback mRegistrationCallback;
|
|
||||||
private int mLastWwanLevel;
|
private int mLastWwanLevel;
|
||||||
private int mLastWlanLevel;
|
private int mLastWlanLevel;
|
||||||
private int mLastWlanCrossSimLevel;
|
private int mLastWlanCrossSimLevel;
|
||||||
@@ -121,51 +118,8 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
// Where to copy the next state into.
|
// Where to copy the next state into.
|
||||||
private int mMobileStatusHistoryIndex;
|
private int mMobileStatusHistoryIndex;
|
||||||
|
|
||||||
// TODO: Reduce number of vars passed in, if we have the NetworkController, probably don't
|
private final MobileStatusTracker.Callback mMobileCallback =
|
||||||
// need listener lists anymore.
|
new MobileStatusTracker.Callback() {
|
||||||
public MobileSignalController(
|
|
||||||
Context context,
|
|
||||||
Config config,
|
|
||||||
boolean hasMobileData,
|
|
||||||
TelephonyManager phone,
|
|
||||||
CallbackHandler callbackHandler,
|
|
||||||
NetworkControllerImpl networkController,
|
|
||||||
SubscriptionInfo info,
|
|
||||||
SubscriptionDefaults defaults,
|
|
||||||
Looper receiverLooper,
|
|
||||||
CarrierConfigTracker carrierConfigTracker,
|
|
||||||
FeatureFlags featureFlags
|
|
||||||
) {
|
|
||||||
super("MobileSignalController(" + info.getSubscriptionId() + ")", context,
|
|
||||||
NetworkCapabilities.TRANSPORT_CELLULAR, callbackHandler,
|
|
||||||
networkController);
|
|
||||||
mCarrierConfigTracker = carrierConfigTracker;
|
|
||||||
mConfig = config;
|
|
||||||
mPhone = phone;
|
|
||||||
mDefaults = defaults;
|
|
||||||
mSubscriptionInfo = info;
|
|
||||||
mNetworkNameSeparator = getTextIfExists(R.string.status_bar_network_name_separator)
|
|
||||||
.toString();
|
|
||||||
mNetworkNameDefault = getTextIfExists(
|
|
||||||
com.android.internal.R.string.lockscreen_carrier_default).toString();
|
|
||||||
mReceiverHandler = new Handler(receiverLooper);
|
|
||||||
|
|
||||||
mNetworkToIconLookup = mapIconSets(mConfig);
|
|
||||||
mDefaultIcons = getDefaultIcons(mConfig);
|
|
||||||
|
|
||||||
String networkName = info.getCarrierName() != null ? info.getCarrierName().toString()
|
|
||||||
: mNetworkNameDefault;
|
|
||||||
mLastState.networkName = mCurrentState.networkName = networkName;
|
|
||||||
mLastState.networkNameData = mCurrentState.networkNameData = networkName;
|
|
||||||
mLastState.enabled = mCurrentState.enabled = hasMobileData;
|
|
||||||
mLastState.iconGroup = mCurrentState.iconGroup = mDefaultIcons;
|
|
||||||
mObserver = new ContentObserver(new Handler(receiverLooper)) {
|
|
||||||
@Override
|
|
||||||
public void onChange(boolean selfChange) {
|
|
||||||
updateTelephony();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mCallback = new MobileStatusTracker.Callback() {
|
|
||||||
private String mLastStatus;
|
private String mLastStatus;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -194,7 +148,7 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mRegistrationCallback = new RegistrationCallback() {
|
private final RegistrationCallback mRegistrationCallback = new RegistrationCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onRegistered(ImsRegistrationAttributes attributes) {
|
public void onRegistered(ImsRegistrationAttributes attributes) {
|
||||||
Log.d(mTag, "onRegistered: " + "attributes=" + attributes);
|
Log.d(mTag, "onRegistered: " + "attributes=" + attributes);
|
||||||
@@ -239,9 +193,54 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
notifyCallStateChange(statusIcon, mSubscriptionInfo.getSubscriptionId());
|
notifyCallStateChange(statusIcon, mSubscriptionInfo.getSubscriptionId());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
TelephonyManager phone,
|
||||||
|
CallbackHandler callbackHandler,
|
||||||
|
NetworkControllerImpl networkController,
|
||||||
|
SubscriptionInfo info,
|
||||||
|
SubscriptionDefaults defaults,
|
||||||
|
Looper receiverLooper,
|
||||||
|
CarrierConfigTracker carrierConfigTracker,
|
||||||
|
FeatureFlags featureFlags
|
||||||
|
) {
|
||||||
|
super("MobileSignalController(" + info.getSubscriptionId() + ")", context,
|
||||||
|
NetworkCapabilities.TRANSPORT_CELLULAR, callbackHandler,
|
||||||
|
networkController);
|
||||||
|
mCarrierConfigTracker = carrierConfigTracker;
|
||||||
|
mConfig = config;
|
||||||
|
mPhone = phone;
|
||||||
|
mDefaults = defaults;
|
||||||
|
mSubscriptionInfo = info;
|
||||||
|
mNetworkNameSeparator = getTextIfExists(
|
||||||
|
R.string.status_bar_network_name_separator).toString();
|
||||||
|
mNetworkNameDefault = getTextIfExists(
|
||||||
|
com.android.internal.R.string.lockscreen_carrier_default).toString();
|
||||||
|
mReceiverHandler = new Handler(receiverLooper);
|
||||||
|
|
||||||
|
mNetworkToIconLookup = mapIconSets(mConfig);
|
||||||
|
mDefaultIcons = getDefaultIcons(mConfig);
|
||||||
|
|
||||||
|
String networkName = info.getCarrierName() != null ? info.getCarrierName().toString()
|
||||||
|
: mNetworkNameDefault;
|
||||||
|
mLastState.networkName = mCurrentState.networkName = networkName;
|
||||||
|
mLastState.networkNameData = mCurrentState.networkNameData = networkName;
|
||||||
|
mLastState.enabled = mCurrentState.enabled = hasMobileData;
|
||||||
|
mLastState.iconGroup = mCurrentState.iconGroup = mDefaultIcons;
|
||||||
|
mObserver = new ContentObserver(new Handler(receiverLooper)) {
|
||||||
|
@Override
|
||||||
|
public void onChange(boolean selfChange) {
|
||||||
|
updateTelephony();
|
||||||
|
}
|
||||||
|
};
|
||||||
mImsMmTelManager = ImsMmTelManager.createForSubscriptionId(info.getSubscriptionId());
|
mImsMmTelManager = ImsMmTelManager.createForSubscriptionId(info.getSubscriptionId());
|
||||||
mMobileStatusTracker = new MobileStatusTracker(mPhone, receiverLooper,
|
mMobileStatusTracker = new MobileStatusTracker(mPhone, receiverLooper,
|
||||||
info, mDefaults, mCallback);
|
info, mDefaults, mMobileCallback);
|
||||||
mProviderModelBehavior = featureFlags.isCombinedStatusBarSignalIconsEnabled();
|
mProviderModelBehavior = featureFlags.isCombinedStatusBarSignalIconsEnabled();
|
||||||
mProviderModelSetting = featureFlags.isProviderModelSettingEnabled();
|
mProviderModelSetting = featureFlags.isProviderModelSettingEnabled();
|
||||||
}
|
}
|
||||||
@@ -385,89 +384,83 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
if (mCurrentState.inetCondition == 0) {
|
if (mCurrentState.inetCondition == 0) {
|
||||||
dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
|
dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
|
||||||
}
|
}
|
||||||
final boolean dataDisabled = (mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED
|
|
||||||
|| (mCurrentState.iconGroup == TelephonyIcons.NOT_DEFAULT_DATA))
|
|
||||||
&& mCurrentState.userSetup;
|
|
||||||
|
|
||||||
if (mProviderModelBehavior) {
|
final QsInfo qsInfo = getQsInfo(contentDescription, icons.dataType);
|
||||||
// Show icon in QS when we are connected or data is disabled.
|
final SbInfo sbInfo = getSbInfo(contentDescription, icons.dataType);
|
||||||
boolean showDataIcon = mCurrentState.dataConnected || dataDisabled;
|
|
||||||
|
|
||||||
|
MobileDataIndicators mobileDataIndicators = new MobileDataIndicators(
|
||||||
|
sbInfo.icon,
|
||||||
|
qsInfo.icon,
|
||||||
|
sbInfo.ratTypeIcon,
|
||||||
|
qsInfo.ratTypeIcon,
|
||||||
|
mCurrentState.hasActivityIn(),
|
||||||
|
mCurrentState.hasActivityOut(),
|
||||||
|
dataContentDescription,
|
||||||
|
dataContentDescriptionHtml,
|
||||||
|
qsInfo.description,
|
||||||
|
mSubscriptionInfo.getSubscriptionId(),
|
||||||
|
mCurrentState.roaming,
|
||||||
|
sbInfo.showTriangle);
|
||||||
|
callback.setMobileDataIndicators(mobileDataIndicators);
|
||||||
|
}
|
||||||
|
|
||||||
|
private QsInfo getQsInfo(String contentDescription, int dataTypeIcon) {
|
||||||
int qsTypeIcon = 0;
|
int qsTypeIcon = 0;
|
||||||
IconState qsIcon = null;
|
IconState qsIcon = null;
|
||||||
CharSequence description = null;
|
CharSequence qsDescription = null;
|
||||||
// Only send data sim callbacks to QS.
|
|
||||||
if (mCurrentState.dataSim && mCurrentState.isDefault) {
|
boolean pm = mProviderModelSetting || mProviderModelBehavior;
|
||||||
qsTypeIcon =
|
if (mCurrentState.dataSim) {
|
||||||
(showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0;
|
// If using provider model behavior, only show QS icons if the state is also default
|
||||||
qsIcon = new IconState(mCurrentState.enabled
|
if (pm && !mCurrentState.isDefault) {
|
||||||
&& !mCurrentState.isEmergency, getQsCurrentIconId(), contentDescription);
|
return new QsInfo(qsTypeIcon, qsIcon, qsDescription);
|
||||||
description = mCurrentState.isEmergency ? null : mCurrentState.networkName;
|
|
||||||
}
|
}
|
||||||
boolean activityIn = mCurrentState.dataConnected
|
|
||||||
&& !mCurrentState.carrierNetworkChangeMode
|
if (mCurrentState.showQuickSettingsRatIcon() || mConfig.alwaysShowDataRatIcon) {
|
||||||
&& mCurrentState.activityIn;
|
qsTypeIcon = dataTypeIcon;
|
||||||
boolean activityOut = mCurrentState.dataConnected
|
}
|
||||||
&& !mCurrentState.carrierNetworkChangeMode
|
|
||||||
&& mCurrentState.activityOut;
|
boolean qsIconVisible = mCurrentState.enabled && !mCurrentState.isEmergency;
|
||||||
showDataIcon &= mCurrentState.dataSim && mCurrentState.isDefault;
|
qsIcon = new IconState(qsIconVisible, getQsCurrentIconId(), contentDescription);
|
||||||
boolean showTriangle = showDataIcon && !mCurrentState.airplaneMode;
|
|
||||||
int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.dataType : 0;
|
if (!mCurrentState.isEmergency) {
|
||||||
showDataIcon |= mCurrentState.roaming;
|
qsDescription = mCurrentState.networkName;
|
||||||
IconState statusIcon = new IconState(showDataIcon && !mCurrentState.airplaneMode,
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new QsInfo(qsTypeIcon, qsIcon, qsDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SbInfo getSbInfo(String contentDescription, int dataTypeIcon) {
|
||||||
|
final boolean dataDisabled = mCurrentState.isDataDisabledOrNotDefault();
|
||||||
|
boolean showTriangle = false;
|
||||||
|
int typeIcon = 0;
|
||||||
|
IconState statusIcon = null;
|
||||||
|
|
||||||
|
if (mProviderModelBehavior) {
|
||||||
|
boolean showDataIconStatusBar = (mCurrentState.dataConnected || dataDisabled)
|
||||||
|
&& (mCurrentState.dataSim && mCurrentState.isDefault);
|
||||||
|
typeIcon =
|
||||||
|
(showDataIconStatusBar || mConfig.alwaysShowDataRatIcon) ? dataTypeIcon : 0;
|
||||||
|
showDataIconStatusBar |= mCurrentState.roaming;
|
||||||
|
statusIcon = new IconState(
|
||||||
|
showDataIconStatusBar && !mCurrentState.airplaneMode,
|
||||||
getCurrentIconId(), contentDescription);
|
getCurrentIconId(), contentDescription);
|
||||||
MobileDataIndicators mobileDataIndicators = new MobileDataIndicators(
|
|
||||||
statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
showTriangle = showDataIconStatusBar && !mCurrentState.airplaneMode;
|
||||||
activityIn, activityOut, dataContentDescription, dataContentDescriptionHtml,
|
|
||||||
description, icons.isWide, mSubscriptionInfo.getSubscriptionId(),
|
|
||||||
mCurrentState.roaming, showTriangle);
|
|
||||||
callback.setMobileDataIndicators(mobileDataIndicators);
|
|
||||||
} else {
|
} else {
|
||||||
boolean showDataIcon = mCurrentState.dataConnected || dataDisabled;
|
statusIcon = new IconState(
|
||||||
IconState statusIcon = new IconState(
|
|
||||||
mCurrentState.enabled && !mCurrentState.airplaneMode,
|
mCurrentState.enabled && !mCurrentState.airplaneMode,
|
||||||
getCurrentIconId(), contentDescription);
|
getCurrentIconId(), contentDescription);
|
||||||
|
|
||||||
int qsTypeIcon = 0;
|
boolean showDataIconInStatusBar =
|
||||||
IconState qsIcon = null;
|
(mCurrentState.dataConnected && mCurrentState.isDefault) || dataDisabled;
|
||||||
CharSequence description = null;
|
typeIcon =
|
||||||
// Only send data sim callbacks to QS.
|
(showDataIconInStatusBar || mConfig.alwaysShowDataRatIcon) ? dataTypeIcon : 0;
|
||||||
if (mProviderModelSetting) {
|
showTriangle = mCurrentState.enabled && !mCurrentState.airplaneMode;
|
||||||
if (mCurrentState.dataSim && mCurrentState.isDefault) {
|
|
||||||
qsTypeIcon =
|
|
||||||
(showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0;
|
|
||||||
qsIcon = new IconState(
|
|
||||||
mCurrentState.enabled && !mCurrentState.isEmergency,
|
|
||||||
getQsCurrentIconId(), contentDescription);
|
|
||||||
description = mCurrentState.isEmergency ? null : mCurrentState.networkName;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (mCurrentState.dataSim) {
|
|
||||||
qsTypeIcon =
|
|
||||||
(showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0;
|
|
||||||
qsIcon = new IconState(
|
|
||||||
mCurrentState.enabled && !mCurrentState.isEmergency,
|
|
||||||
getQsCurrentIconId(), contentDescription);
|
|
||||||
description = mCurrentState.isEmergency ? null : mCurrentState.networkName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean activityIn = mCurrentState.dataConnected
|
return new SbInfo(showTriangle, typeIcon, statusIcon);
|
||||||
&& !mCurrentState.carrierNetworkChangeMode
|
|
||||||
&& mCurrentState.activityIn;
|
|
||||||
boolean activityOut = mCurrentState.dataConnected
|
|
||||||
&& !mCurrentState.carrierNetworkChangeMode
|
|
||||||
&& mCurrentState.activityOut;
|
|
||||||
showDataIcon &= mCurrentState.isDefault || dataDisabled;
|
|
||||||
int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.dataType : 0;
|
|
||||||
boolean showTriangle = mCurrentState.enabled && !mCurrentState.airplaneMode;
|
|
||||||
MobileDataIndicators mobileDataIndicators = new MobileDataIndicators(
|
|
||||||
statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
|
||||||
activityIn, activityOut, dataContentDescription, dataContentDescriptionHtml,
|
|
||||||
description, icons.isWide, mSubscriptionInfo.getSubscriptionId(),
|
|
||||||
mCurrentState.roaming, showTriangle);
|
|
||||||
callback.setMobileDataIndicators(mobileDataIndicators);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -841,12 +834,15 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
public void dump(PrintWriter pw) {
|
public void dump(PrintWriter pw) {
|
||||||
super.dump(pw);
|
super.dump(pw);
|
||||||
pw.println(" mSubscription=" + mSubscriptionInfo + ",");
|
pw.println(" mSubscription=" + mSubscriptionInfo + ",");
|
||||||
|
pw.println(" mProviderModelSetting=" + mProviderModelSetting + ",");
|
||||||
|
pw.println(" mProviderModelBehavior=" + mProviderModelBehavior + ",");
|
||||||
pw.println(" mServiceState=" + mServiceState + ",");
|
pw.println(" mServiceState=" + mServiceState + ",");
|
||||||
pw.println(" mSignalStrength=" + mSignalStrength + ",");
|
pw.println(" mSignalStrength=" + mSignalStrength + ",");
|
||||||
pw.println(" mTelephonyDisplayInfo=" + mTelephonyDisplayInfo + ",");
|
pw.println(" mTelephonyDisplayInfo=" + mTelephonyDisplayInfo + ",");
|
||||||
pw.println(" mDataState=" + mDataState + ",");
|
pw.println(" mDataState=" + mDataState + ",");
|
||||||
pw.println(" mInflateSignalStrengths=" + mInflateSignalStrengths + ",");
|
pw.println(" mInflateSignalStrengths=" + mInflateSignalStrengths + ",");
|
||||||
pw.println(" isDataDisabled=" + isDataDisabled() + ",");
|
pw.println(" isDataDisabled=" + isDataDisabled() + ",");
|
||||||
|
pw.println(" mNetworkToIconLookup=" + mNetworkToIconLookup + ",");
|
||||||
pw.println(" MobileStatusHistory");
|
pw.println(" MobileStatusHistory");
|
||||||
int size = 0;
|
int size = 0;
|
||||||
for (int i = 0; i < STATUS_HISTORY_SIZE; i++) {
|
for (int i = 0; i < STATUS_HISTORY_SIZE; i++) {
|
||||||
@@ -862,4 +858,31 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
+ mMobileStatusHistory[i & (STATUS_HISTORY_SIZE - 1)]);
|
+ mMobileStatusHistory[i & (STATUS_HISTORY_SIZE - 1)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Box for QS icon info */
|
||||||
|
private static final class QsInfo {
|
||||||
|
final int ratTypeIcon;
|
||||||
|
final IconState icon;
|
||||||
|
final CharSequence description;
|
||||||
|
|
||||||
|
QsInfo(int typeIcon, IconState iconState, CharSequence desc) {
|
||||||
|
ratTypeIcon = typeIcon;
|
||||||
|
icon = iconState;
|
||||||
|
description = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Box for StatusBar icon info */
|
||||||
|
private static final class SbInfo {
|
||||||
|
final boolean showTriangle;
|
||||||
|
final int ratTypeIcon;
|
||||||
|
final IconState icon;
|
||||||
|
|
||||||
|
SbInfo(boolean show, int typeIcon, IconState iconState) {
|
||||||
|
showTriangle = show;
|
||||||
|
ratTypeIcon = typeIcon;
|
||||||
|
icon = iconState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
.append(",qsIcon=").append(qsIcon == null ? "" : qsIcon.toString())
|
.append(",qsIcon=").append(qsIcon == null ? "" : qsIcon.toString())
|
||||||
.append(",activityIn=").append(activityIn)
|
.append(",activityIn=").append(activityIn)
|
||||||
.append(",activityOut=").append(activityOut)
|
.append(",activityOut=").append(activityOut)
|
||||||
.append(",description=").append(description)
|
.append(",qsDescription=").append(description)
|
||||||
.append(",isTransient=").append(isTransient)
|
.append(",isTransient=").append(isTransient)
|
||||||
.append(",statusLabel=").append(statusLabel)
|
.append(",statusLabel=").append(statusLabel)
|
||||||
.append(']').toString();
|
.append(']').toString();
|
||||||
@@ -100,8 +100,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
public boolean activityOut;
|
public boolean activityOut;
|
||||||
public CharSequence typeContentDescription;
|
public CharSequence typeContentDescription;
|
||||||
public CharSequence typeContentDescriptionHtml;
|
public CharSequence typeContentDescriptionHtml;
|
||||||
public CharSequence description;
|
public CharSequence qsDescription;
|
||||||
public boolean isWide;
|
|
||||||
public int subId;
|
public int subId;
|
||||||
public boolean roaming;
|
public boolean roaming;
|
||||||
public boolean showTriangle;
|
public boolean showTriangle;
|
||||||
@@ -109,7 +108,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
public MobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
public MobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||||
int qsType, boolean activityIn, boolean activityOut,
|
int qsType, boolean activityIn, boolean activityOut,
|
||||||
CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml,
|
CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml,
|
||||||
CharSequence description, boolean isWide, int subId, boolean roaming,
|
CharSequence qsDescription, int subId, boolean roaming,
|
||||||
boolean showTriangle) {
|
boolean showTriangle) {
|
||||||
this.statusIcon = statusIcon;
|
this.statusIcon = statusIcon;
|
||||||
this.qsIcon = qsIcon;
|
this.qsIcon = qsIcon;
|
||||||
@@ -119,8 +118,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
this.activityOut = activityOut;
|
this.activityOut = activityOut;
|
||||||
this.typeContentDescription = typeContentDescription;
|
this.typeContentDescription = typeContentDescription;
|
||||||
this.typeContentDescriptionHtml = typeContentDescriptionHtml;
|
this.typeContentDescriptionHtml = typeContentDescriptionHtml;
|
||||||
this.description = description;
|
this.qsDescription = qsDescription;
|
||||||
this.isWide = isWide;
|
|
||||||
this.subId = subId;
|
this.subId = subId;
|
||||||
this.roaming = roaming;
|
this.roaming = roaming;
|
||||||
this.showTriangle = showTriangle;
|
this.showTriangle = showTriangle;
|
||||||
@@ -137,8 +135,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
.append(",activityOut=").append(activityOut)
|
.append(",activityOut=").append(activityOut)
|
||||||
.append(",typeContentDescription=").append(typeContentDescription)
|
.append(",typeContentDescription=").append(typeContentDescription)
|
||||||
.append(",typeContentDescriptionHtml=").append(typeContentDescriptionHtml)
|
.append(",typeContentDescriptionHtml=").append(typeContentDescriptionHtml)
|
||||||
.append(",description=").append(description)
|
.append(",description=").append(qsDescription)
|
||||||
.append(",isWide=").append(isWide)
|
|
||||||
.append(",subId=").append(subId)
|
.append(",subId=").append(subId)
|
||||||
.append(",roaming=").append(roaming)
|
.append(",roaming=").append(roaming)
|
||||||
.append(",showTriangle=").append(showTriangle)
|
.append(",showTriangle=").append(showTriangle)
|
||||||
@@ -186,11 +183,13 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
default void setCallIndicator(IconState statusIcon, int subId) {}
|
default void setCallIndicator(IconState statusIcon, int subId) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface EmergencyListener {
|
/** */
|
||||||
|
interface EmergencyListener {
|
||||||
void setEmergencyCallsOnly(boolean emergencyOnly);
|
void setEmergencyCallsOnly(boolean emergencyOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IconState {
|
/** */
|
||||||
|
class IconState {
|
||||||
public final boolean visible;
|
public final boolean visible;
|
||||||
public final int icon;
|
public final int icon;
|
||||||
public final String contentDescription;
|
public final String contentDescription;
|
||||||
@@ -220,7 +219,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
* Tracks changes in access points. Allows listening for changes, scanning for new APs,
|
* Tracks changes in access points. Allows listening for changes, scanning for new APs,
|
||||||
* and connecting to new ones.
|
* and connecting to new ones.
|
||||||
*/
|
*/
|
||||||
public interface AccessPointController {
|
interface AccessPointController {
|
||||||
void addAccessPointCallback(AccessPointCallback callback);
|
void addAccessPointCallback(AccessPointCallback callback);
|
||||||
void removeAccessPointCallback(AccessPointCallback callback);
|
void removeAccessPointCallback(AccessPointCallback callback);
|
||||||
void scanForAccessPoints();
|
void scanForAccessPoints();
|
||||||
@@ -230,7 +229,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|||||||
boolean canConfigWifi();
|
boolean canConfigWifi();
|
||||||
boolean canConfigMobileData();
|
boolean canConfigMobileData();
|
||||||
|
|
||||||
public interface AccessPointCallback {
|
interface AccessPointCallback {
|
||||||
void onAccessPointsChanged(List<WifiEntry> accessPoints);
|
void onAccessPointsChanged(List<WifiEntry> accessPoints);
|
||||||
void onSettingsActivityTriggered(Intent settingsIntent);
|
void onSettingsActivityTriggered(Intent settingsIntent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public class WifiSignalController extends
|
|||||||
int qsTypeIcon = 0;
|
int qsTypeIcon = 0;
|
||||||
IconState qsIcon = null;
|
IconState qsIcon = null;
|
||||||
if (sbVisible) {
|
if (sbVisible) {
|
||||||
qsTypeIcon = icons.qsDataType;
|
qsTypeIcon = icons.dataType;
|
||||||
qsIcon = new IconState(mCurrentState.connected, getQsCurrentIconIdForCarrierWifi(),
|
qsIcon = new IconState(mCurrentState.connected, getQsCurrentIconIdForCarrierWifi(),
|
||||||
contentDescription);
|
contentDescription);
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ public class WifiSignalController extends
|
|||||||
MobileDataIndicators mobileDataIndicators = new MobileDataIndicators(
|
MobileDataIndicators mobileDataIndicators = new MobileDataIndicators(
|
||||||
statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
||||||
mCurrentState.activityIn, mCurrentState.activityOut, dataContentDescription,
|
mCurrentState.activityIn, mCurrentState.activityOut, dataContentDescription,
|
||||||
dataContentDescriptionHtml, description, icons.isWide,
|
dataContentDescriptionHtml, description,
|
||||||
mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true
|
mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true
|
||||||
);
|
);
|
||||||
callback.setMobileDataIndicators(mobileDataIndicators);
|
callback.setMobileDataIndicators(mobileDataIndicators);
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
|
|||||||
MobileDataIndicators indicators = new MobileDataIndicators(
|
MobileDataIndicators indicators = new MobileDataIndicators(
|
||||||
mock(NetworkController.IconState.class),
|
mock(NetworkController.IconState.class),
|
||||||
mock(NetworkController.IconState.class),
|
mock(NetworkController.IconState.class),
|
||||||
0, 0, true, true, "", "", "", true, 0, true, true);
|
0, 0, true, true, "", "", "", 0, true, true);
|
||||||
mSignalCallback.setMobileDataIndicators(indicators);
|
mSignalCallback.setMobileDataIndicators(indicators);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class CallbackHandlerTest extends SysuiTestCase {
|
|||||||
boolean roaming = true;
|
boolean roaming = true;
|
||||||
MobileDataIndicators indicators = new MobileDataIndicators(
|
MobileDataIndicators indicators = new MobileDataIndicators(
|
||||||
status, qs, type, qsType, in, out, typeDescription,
|
status, qs, type, qsType, in, out, typeDescription,
|
||||||
typeDescriptionHtml, description, wide, subId, roaming, true);
|
typeDescriptionHtml, description, subId, roaming, true);
|
||||||
mHandler.setMobileDataIndicators(indicators);
|
mHandler.setMobileDataIndicators(indicators);
|
||||||
waitForCallbacks();
|
waitForCallbacks();
|
||||||
|
|
||||||
@@ -141,8 +141,7 @@ public class CallbackHandlerTest extends SysuiTestCase {
|
|||||||
assertEquals(out, expected.activityOut);
|
assertEquals(out, expected.activityOut);
|
||||||
assertEquals(typeDescription, expected.typeContentDescription);
|
assertEquals(typeDescription, expected.typeContentDescription);
|
||||||
assertEquals(typeDescriptionHtml, expected.typeContentDescriptionHtml);
|
assertEquals(typeDescriptionHtml, expected.typeContentDescriptionHtml);
|
||||||
assertEquals(description, expected.description);
|
assertEquals(description, expected.qsDescription);
|
||||||
assertEquals(wide, expected.isWide);
|
|
||||||
assertEquals(subId, expected.subId);
|
assertEquals(subId, expected.subId);
|
||||||
assertTrue(expected.roaming);
|
assertTrue(expected.roaming);
|
||||||
assertTrue(expected.showTriangle);
|
assertTrue(expected.showTriangle);
|
||||||
|
|||||||
Reference in New Issue
Block a user