Merge changes Ibdaec230,I06d5e569,I5e2eb489,I116b5f63,I6fa7adaa into sc-v2-dev am: 974aa5add4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15750022 Change-Id: Ibe3ad06e0fab96f551dc9d93205c440a997046e2
This commit is contained in:
@@ -239,6 +239,11 @@ public class SignalIcon {
|
|||||||
return dataConnected && !carrierNetworkChangeMode && activityOut;
|
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);
|
||||||
@@ -254,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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -385,92 +385,82 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|||||||
dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
|
dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean dataDisabled = mCurrentState.isDataDisabledOrNotDefault();
|
final QsInfo qsInfo = getQsInfo(contentDescription, icons.dataType);
|
||||||
|
final SbInfo sbInfo = getSbInfo(contentDescription, icons.dataType);
|
||||||
|
|
||||||
if (mProviderModelBehavior) {
|
MobileDataIndicators mobileDataIndicators = new MobileDataIndicators(
|
||||||
// Show icon in QS when we are connected or data is disabled.
|
sbInfo.icon,
|
||||||
boolean showDataIcon = mCurrentState.dataConnected || dataDisabled;
|
qsInfo.icon,
|
||||||
|
sbInfo.ratTypeIcon,
|
||||||
|
qsInfo.ratTypeIcon,
|
||||||
|
mCurrentState.hasActivityIn(),
|
||||||
|
mCurrentState.hasActivityOut(),
|
||||||
|
dataContentDescription,
|
||||||
|
dataContentDescriptionHtml,
|
||||||
|
qsInfo.description,
|
||||||
|
mSubscriptionInfo.getSubscriptionId(),
|
||||||
|
mCurrentState.roaming,
|
||||||
|
sbInfo.showTriangle);
|
||||||
|
callback.setMobileDataIndicators(mobileDataIndicators);
|
||||||
|
}
|
||||||
|
|
||||||
int qsTypeIcon = 0;
|
private QsInfo getQsInfo(String contentDescription, int dataTypeIcon) {
|
||||||
IconState qsIcon = null;
|
int qsTypeIcon = 0;
|
||||||
CharSequence description = null;
|
IconState qsIcon = null;
|
||||||
// Only send data sim callbacks to QS.
|
CharSequence qsDescription = null;
|
||||||
if (mCurrentState.dataSim && mCurrentState.isDefault) {
|
|
||||||
qsTypeIcon =
|
boolean pm = mProviderModelSetting || mProviderModelBehavior;
|
||||||
(showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.dataType : 0;
|
if (mCurrentState.dataSim) {
|
||||||
qsIcon = new IconState(mCurrentState.enabled
|
// If using provider model behavior, only show QS icons if the state is also default
|
||||||
&& !mCurrentState.isEmergency, getQsCurrentIconId(), contentDescription);
|
if (pm && !mCurrentState.isDefault) {
|
||||||
description = mCurrentState.isEmergency ? null : mCurrentState.networkName;
|
return new QsInfo(qsTypeIcon, qsIcon, qsDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
showDataIcon &= mCurrentState.dataSim && mCurrentState.isDefault;
|
if (mCurrentState.showQuickSettingsRatIcon() || mConfig.alwaysShowDataRatIcon) {
|
||||||
boolean showTriangle = showDataIcon && !mCurrentState.airplaneMode;
|
qsTypeIcon = dataTypeIcon;
|
||||||
int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.dataType : 0;
|
}
|
||||||
showDataIcon |= mCurrentState.roaming;
|
|
||||||
IconState statusIcon = new IconState(showDataIcon && !mCurrentState.airplaneMode,
|
boolean qsIconVisible = mCurrentState.enabled && !mCurrentState.isEmergency;
|
||||||
|
qsIcon = new IconState(qsIconVisible, getQsCurrentIconId(), contentDescription);
|
||||||
|
|
||||||
|
if (!mCurrentState.isEmergency) {
|
||||||
|
qsDescription = mCurrentState.networkName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
showTriangle = showDataIconStatusBar && !mCurrentState.airplaneMode;
|
||||||
qsIcon,
|
|
||||||
typeIcon,
|
|
||||||
qsTypeIcon,
|
|
||||||
mCurrentState.hasActivityIn(),
|
|
||||||
mCurrentState.hasActivityOut(),
|
|
||||||
dataContentDescription,
|
|
||||||
dataContentDescriptionHtml,
|
|
||||||
description,
|
|
||||||
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.dataType : 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.dataType : 0;
|
|
||||||
qsIcon = new IconState(
|
|
||||||
mCurrentState.enabled && !mCurrentState.isEmergency,
|
|
||||||
getQsCurrentIconId(), contentDescription);
|
|
||||||
description = mCurrentState.isEmergency ? null : mCurrentState.networkName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
mCurrentState.hasActivityIn(),
|
|
||||||
mCurrentState.hasActivityOut(),
|
|
||||||
dataContentDescription,
|
|
||||||
dataContentDescriptionHtml,
|
|
||||||
description,
|
|
||||||
mSubscriptionInfo.getSubscriptionId(),
|
|
||||||
mCurrentState.roaming,
|
|
||||||
showTriangle);
|
|
||||||
callback.setMobileDataIndicators(mobileDataIndicators);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new SbInfo(showTriangle, typeIcon, statusIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -844,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++) {
|
||||||
@@ -865,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,7 +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 int subId;
|
public int subId;
|
||||||
public boolean roaming;
|
public boolean roaming;
|
||||||
public boolean showTriangle;
|
public boolean showTriangle;
|
||||||
@@ -108,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, 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;
|
||||||
@@ -118,7 +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.subId = subId;
|
this.subId = subId;
|
||||||
this.roaming = roaming;
|
this.roaming = roaming;
|
||||||
this.showTriangle = showTriangle;
|
this.showTriangle = showTriangle;
|
||||||
@@ -135,7 +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(",subId=").append(subId)
|
.append(",subId=").append(subId)
|
||||||
.append(",roaming=").append(roaming)
|
.append(",roaming=").append(roaming)
|
||||||
.append(",showTriangle=").append(showTriangle)
|
.append(",showTriangle=").append(showTriangle)
|
||||||
@@ -183,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;
|
||||||
@@ -217,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();
|
||||||
@@ -227,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +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(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