Merge "Renamed DisplayInfo to TelephonyDisplayInfo"

This commit is contained in:
Jack Yu
2020-04-20 21:16:17 +00:00
committed by Gerrit Code Review
12 changed files with 109 additions and 95 deletions

View File

@@ -45247,19 +45247,6 @@ package android.telephony {
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ClosedSubscriberGroupInfo> CREATOR; field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ClosedSubscriberGroupInfo> CREATOR;
} }
public final class DisplayInfo implements android.os.Parcelable {
method public int describeContents();
method public int getNetworkType();
method public int getOverrideNetworkType();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DisplayInfo> CREATOR;
field public static final int OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO = 2; // 0x2
field public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1; // 0x1
field public static final int OVERRIDE_NETWORK_TYPE_NONE = 0; // 0x0
field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA = 3; // 0x3
field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4; // 0x4
}
public class IccOpenLogicalChannelResponse implements android.os.Parcelable { public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
method public int describeContents(); method public int describeContents();
method public int getChannel(); method public int getChannel();
@@ -45486,7 +45473,7 @@ package android.telephony {
method public void onDataActivity(int); method public void onDataActivity(int);
method public void onDataConnectionStateChanged(int); method public void onDataConnectionStateChanged(int);
method public void onDataConnectionStateChanged(int, int); method public void onDataConnectionStateChanged(int, int);
method @RequiresPermission("android.permission.READ_PHONE_STATE") public void onDisplayInfoChanged(@NonNull android.telephony.DisplayInfo); method @RequiresPermission("android.permission.READ_PHONE_STATE") public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo);
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo); method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
method public void onMessageWaitingIndicatorChanged(boolean); method public void onMessageWaitingIndicatorChanged(boolean);
method @RequiresPermission("android.permission.MODIFY_PHONE_STATE") public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState); method @RequiresPermission("android.permission.MODIFY_PHONE_STATE") public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
@@ -45902,6 +45889,19 @@ package android.telephony {
method public android.telephony.SubscriptionPlan.Builder setTitle(@Nullable CharSequence); method public android.telephony.SubscriptionPlan.Builder setTitle(@Nullable CharSequence);
} }
public final class TelephonyDisplayInfo implements android.os.Parcelable {
method public int describeContents();
method public int getNetworkType();
method public int getOverrideNetworkType();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.TelephonyDisplayInfo> CREATOR;
field public static final int OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO = 2; // 0x2
field public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1; // 0x1
field public static final int OVERRIDE_NETWORK_TYPE_NONE = 0; // 0x0
field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA = 3; // 0x3
field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4; // 0x4
}
public class TelephonyManager { public class TelephonyManager {
method public boolean canChangeDtmfToneLength(); method public boolean canChangeDtmfToneLength();
method @Nullable public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle); method @Nullable public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);

View File

@@ -893,16 +893,16 @@ public class PhoneStateListener {
/** /**
* Callback invoked when the display info has changed on the registered subscription. * Callback invoked when the display info has changed on the registered subscription.
* <p> The {@link DisplayInfo} contains status information shown to the user based on * <p> The {@link TelephonyDisplayInfo} contains status information shown to the user based on
* carrier policy. * carrier policy.
* *
* Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling
* app has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}). * app has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}).
* *
* @param displayInfo The display information. * @param telephonyDisplayInfo The display information.
*/ */
@RequiresPermission((android.Manifest.permission.READ_PHONE_STATE)) @RequiresPermission((android.Manifest.permission.READ_PHONE_STATE))
public void onDisplayInfoChanged(@NonNull DisplayInfo displayInfo) { public void onDisplayInfoChanged(@NonNull TelephonyDisplayInfo telephonyDisplayInfo) {
// default implementation empty // default implementation empty
} }
@@ -1285,13 +1285,13 @@ public class PhoneStateListener {
() -> psl.onUserMobileDataStateChanged(enabled))); () -> psl.onUserMobileDataStateChanged(enabled)));
} }
public void onDisplayInfoChanged(DisplayInfo displayInfo) { public void onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo) {
PhoneStateListener psl = mPhoneStateListenerWeakRef.get(); PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
if (psl == null) return; if (psl == null) return;
Binder.withCleanCallingIdentity( Binder.withCleanCallingIdentity(
() -> mExecutor.execute( () -> mExecutor.execute(
() -> psl.onDisplayInfoChanged(displayInfo))); () -> psl.onDisplayInfoChanged(telephonyDisplayInfo)));
} }
public void onOemHookRawEvent(byte[] rawData) { public void onOemHookRawEvent(byte[] rawData) {

View File

@@ -500,12 +500,12 @@ public class TelephonyRegistryManager {
* derived from {@code subscriptionId} except when {@code subscriptionId} is invalid, such as * derived from {@code subscriptionId} except when {@code subscriptionId} is invalid, such as
* when the device is in emergency-only mode. * when the device is in emergency-only mode.
* @param subscriptionId Subscription id for which display network info has changed. * @param subscriptionId Subscription id for which display network info has changed.
* @param displayInfo The display info. * @param telephonyDisplayInfo The display info.
*/ */
public void notifyDisplayInfoChanged(int slotIndex, int subscriptionId, public void notifyDisplayInfoChanged(int slotIndex, int subscriptionId,
@NonNull DisplayInfo displayInfo) { @NonNull TelephonyDisplayInfo telephonyDisplayInfo) {
try { try {
sRegistry.notifyDisplayInfoChanged(slotIndex, subscriptionId, displayInfo); sRegistry.notifyDisplayInfoChanged(slotIndex, subscriptionId, telephonyDisplayInfo);
} catch (RemoteException ex) { } catch (RemoteException ex) {
// system process is dead // system process is dead
} }

View File

@@ -21,7 +21,7 @@ import android.telephony.CallAttributes;
import android.telephony.CellIdentity; import android.telephony.CellIdentity;
import android.telephony.CellInfo; import android.telephony.CellInfo;
import android.telephony.DataConnectionRealTimeInfo; import android.telephony.DataConnectionRealTimeInfo;
import android.telephony.DisplayInfo; import android.telephony.TelephonyDisplayInfo;
import android.telephony.PhoneCapability; import android.telephony.PhoneCapability;
import android.telephony.PreciseCallState; import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState; import android.telephony.PreciseDataConnectionState;
@@ -55,7 +55,7 @@ oneway interface IPhoneStateListener {
void onOemHookRawEvent(in byte[] rawData); void onOemHookRawEvent(in byte[] rawData);
void onCarrierNetworkChange(in boolean active); void onCarrierNetworkChange(in boolean active);
void onUserMobileDataStateChanged(in boolean enabled); void onUserMobileDataStateChanged(in boolean enabled);
void onDisplayInfoChanged(in DisplayInfo displayInfo); void onDisplayInfoChanged(in TelephonyDisplayInfo telephonyDisplayInfo);
void onPhoneCapabilityChanged(in PhoneCapability capability); void onPhoneCapabilityChanged(in PhoneCapability capability);
void onActiveDataSubIdChanged(in int subId); void onActiveDataSubIdChanged(in int subId);
void onRadioPowerStateChanged(in int state); void onRadioPowerStateChanged(in int state);

View File

@@ -23,7 +23,7 @@ import android.telephony.BarringInfo;
import android.telephony.CallQuality; import android.telephony.CallQuality;
import android.telephony.CellIdentity; import android.telephony.CellIdentity;
import android.telephony.CellInfo; import android.telephony.CellInfo;
import android.telephony.DisplayInfo; import android.telephony.TelephonyDisplayInfo;
import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.ImsReasonInfo;
import android.telephony.PhoneCapability; import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig; import android.telephony.PhysicalChannelConfig;
@@ -89,7 +89,7 @@ interface ITelephonyRegistry {
void notifyOpportunisticSubscriptionInfoChanged(); void notifyOpportunisticSubscriptionInfoChanged();
void notifyCarrierNetworkChange(in boolean active); void notifyCarrierNetworkChange(in boolean active);
void notifyUserMobileDataStateChangedForPhoneId(in int phoneId, in int subId, in boolean state); void notifyUserMobileDataStateChangedForPhoneId(in int phoneId, in int subId, in boolean state);
void notifyDisplayInfoChanged(int slotIndex, int subId, in DisplayInfo displayInfo); void notifyDisplayInfoChanged(int slotIndex, int subId, in TelephonyDisplayInfo telephonyDisplayInfo);
void notifyPhoneCapabilityChanged(in PhoneCapability capability); void notifyPhoneCapabilityChanged(in PhoneCapability capability);
void notifyActiveDataSubIdChanged(int activeDataSubId); void notifyActiveDataSubIdChanged(int activeDataSubId);
void notifyRadioPowerStateChanged(in int phoneId, in int subId, in int state); void notifyRadioPowerStateChanged(in int phoneId, in int subId, in int state);

View File

@@ -25,12 +25,12 @@ import android.provider.Settings.Global;
import android.telephony.Annotation; import android.telephony.Annotation;
import android.telephony.CellSignalStrength; import android.telephony.CellSignalStrength;
import android.telephony.CellSignalStrengthCdma; import android.telephony.CellSignalStrengthCdma;
import android.telephony.DisplayInfo;
import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener;
import android.telephony.ServiceState; import android.telephony.ServiceState;
import android.telephony.SignalStrength; import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
@@ -75,8 +75,9 @@ public class MobileSignalController extends SignalController<
// this could potentially become part of MobileState for simplification/complication // this could potentially become part of MobileState for simplification/complication
// of code. // of code.
private int mDataState = TelephonyManager.DATA_DISCONNECTED; private int mDataState = TelephonyManager.DATA_DISCONNECTED;
private DisplayInfo mDisplayInfo = new DisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN, private TelephonyDisplayInfo mTelephonyDisplayInfo =
DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE); new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
private ServiceState mServiceState; private ServiceState mServiceState;
private SignalStrength mSignalStrength; private SignalStrength mSignalStrength;
private MobileIconGroup mDefaultIcons; private MobileIconGroup mDefaultIcons;
@@ -245,41 +246,52 @@ public class MobileSignalController extends SignalController<
mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_HSPAP), hPlusGroup); mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_HSPAP), hPlusGroup);
if (mConfig.show4gForLte) { if (mConfig.show4gForLte) {
mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_LTE), mNetworkToIconLookup.put(toIconKey(
TelephonyManager.NETWORK_TYPE_LTE),
TelephonyIcons.FOUR_G); TelephonyIcons.FOUR_G);
if (mConfig.hideLtePlus) { if (mConfig.hideLtePlus) {
mNetworkToIconLookup.put(toDisplayIconKey( mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.FOUR_G); TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA),
TelephonyIcons.FOUR_G);
} else { } else {
mNetworkToIconLookup.put(toDisplayIconKey( mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.FOUR_G_PLUS); TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA),
TelephonyIcons.FOUR_G_PLUS);
} }
} else { } else {
mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_LTE), mNetworkToIconLookup.put(toIconKey(
TelephonyManager.NETWORK_TYPE_LTE),
TelephonyIcons.LTE); TelephonyIcons.LTE);
if (mConfig.hideLtePlus) { if (mConfig.hideLtePlus) {
mNetworkToIconLookup.put(toDisplayIconKey( mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.LTE); TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA),
TelephonyIcons.LTE);
} else { } else {
mNetworkToIconLookup.put(toDisplayIconKey( mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.LTE_PLUS); TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA),
TelephonyIcons.LTE_PLUS);
} }
} }
mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_IWLAN), mNetworkToIconLookup.put(toIconKey(
TelephonyManager.NETWORK_TYPE_IWLAN),
TelephonyIcons.WFC); TelephonyIcons.WFC);
mNetworkToIconLookup.put(toDisplayIconKey( mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO), TelephonyIcons.LTE_CA_5G_E); TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO),
TelephonyIcons.LTE_CA_5G_E);
mNetworkToIconLookup.put(toDisplayIconKey( mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA), TelephonyIcons.NR_5G); TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA),
TelephonyIcons.NR_5G);
mNetworkToIconLookup.put(toDisplayIconKey( mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE), TelephonyIcons.NR_5G_PLUS); TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE),
TelephonyIcons.NR_5G_PLUS);
} }
private String getIconKey() { private String getIconKey() {
if (mDisplayInfo.getOverrideNetworkType() == DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) { if (mTelephonyDisplayInfo.getOverrideNetworkType()
return toIconKey(mDisplayInfo.getNetworkType()); == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) {
return toIconKey(mTelephonyDisplayInfo.getNetworkType());
} else { } else {
return toDisplayIconKey(mDisplayInfo.getOverrideNetworkType()); return toDisplayIconKey(mTelephonyDisplayInfo.getOverrideNetworkType());
} }
} }
@@ -289,13 +301,13 @@ public class MobileSignalController extends SignalController<
private String toDisplayIconKey(@Annotation.OverrideNetworkType int displayNetworkType) { private String toDisplayIconKey(@Annotation.OverrideNetworkType int displayNetworkType) {
switch (displayNetworkType) { switch (displayNetworkType) {
case DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA: case TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA:
return toIconKey(TelephonyManager.NETWORK_TYPE_LTE) + "_CA"; return toIconKey(TelephonyManager.NETWORK_TYPE_LTE) + "_CA";
case DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO: case TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO:
return toIconKey(TelephonyManager.NETWORK_TYPE_LTE) + "_CA_Plus"; return toIconKey(TelephonyManager.NETWORK_TYPE_LTE) + "_CA_Plus";
case DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA: case TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA:
return "5G"; return "5G";
case DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE: case TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE:
return "5G_Plus"; return "5G_Plus";
default: default:
return "unsupported"; return "unsupported";
@@ -507,14 +519,14 @@ public class MobileSignalController extends SignalController<
/** /**
* Updates the current state based on mServiceState, mSignalStrength, mDataState, * Updates the current state based on mServiceState, mSignalStrength, mDataState,
* mDisplayInfo, and mSimState. It should be called any time one of these is updated. * mTelephonyDisplayInfo, and mSimState. It should be called any time one of these is updated.
* This will call listeners if necessary. * This will call listeners if necessary.
*/ */
private final void updateTelephony() { private final void updateTelephony() {
if (DEBUG) { if (DEBUG) {
Log.d(mTag, "updateTelephonySignalStrength: hasService=" + Log.d(mTag, "updateTelephonySignalStrength: hasService=" +
Utils.isInService(mServiceState) + " ss=" + mSignalStrength Utils.isInService(mServiceState) + " ss=" + mSignalStrength
+ " displayInfo=" + mDisplayInfo); + " displayInfo=" + mTelephonyDisplayInfo);
} }
checkDefaultData(); checkDefaultData();
mCurrentState.connected = Utils.isInService(mServiceState) && mSignalStrength != null; mCurrentState.connected = Utils.isInService(mServiceState) && mSignalStrength != null;
@@ -600,7 +612,7 @@ public class MobileSignalController extends SignalController<
pw.println(" mSubscription=" + mSubscriptionInfo + ","); pw.println(" mSubscription=" + mSubscriptionInfo + ",");
pw.println(" mServiceState=" + mServiceState + ","); pw.println(" mServiceState=" + mServiceState + ",");
pw.println(" mSignalStrength=" + mSignalStrength + ","); pw.println(" mSignalStrength=" + mSignalStrength + ",");
pw.println(" mDisplayInfo=" + mDisplayInfo + ","); 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() + ",");
@@ -639,8 +651,9 @@ public class MobileSignalController extends SignalController<
+ " type=" + networkType); + " type=" + networkType);
} }
mDataState = state; mDataState = state;
if (networkType != mDisplayInfo.getNetworkType()) { if (networkType != mTelephonyDisplayInfo.getNetworkType()) {
mDisplayInfo = new DisplayInfo(networkType, DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE); mTelephonyDisplayInfo = new TelephonyDisplayInfo(networkType,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
} }
updateTelephony(); updateTelephony();
} }
@@ -670,11 +683,11 @@ public class MobileSignalController extends SignalController<
} }
@Override @Override
public void onDisplayInfoChanged(DisplayInfo displayInfo) { public void onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo) {
if (DEBUG) { if (DEBUG) {
Log.d(mTag, "onDisplayInfoChanged: displayInfo=" + displayInfo); Log.d(mTag, "onDisplayInfoChanged: telephonyDisplayInfo=" + telephonyDisplayInfo);
} }
mDisplayInfo = displayInfo; mTelephonyDisplayInfo = telephonyDisplayInfo;
updateTelephony(); updateTelephony();
} }
} }

View File

@@ -42,13 +42,13 @@ import android.net.wifi.WifiManager;
import android.os.Handler; import android.os.Handler;
import android.provider.Settings; import android.provider.Settings;
import android.provider.Settings.Global; import android.provider.Settings.Global;
import android.telephony.DisplayInfo;
import android.telephony.NetworkRegistrationInfo; import android.telephony.NetworkRegistrationInfo;
import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener;
import android.telephony.ServiceState; import android.telephony.ServiceState;
import android.telephony.SignalStrength; import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.testing.TestableLooper; import android.testing.TestableLooper;
import android.testing.TestableResources; import android.testing.TestableResources;
@@ -94,7 +94,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected PhoneStateListener mPhoneStateListener; protected PhoneStateListener mPhoneStateListener;
protected SignalStrength mSignalStrength; protected SignalStrength mSignalStrength;
protected ServiceState mServiceState; protected ServiceState mServiceState;
protected DisplayInfo mDisplayInfo; protected TelephonyDisplayInfo mTelephonyDisplayInfo;
protected ConnectivityManager mMockCm; protected ConnectivityManager mMockCm;
protected WifiManager mMockWm; protected WifiManager mMockWm;
protected SubscriptionManager mMockSm; protected SubscriptionManager mMockSm;
@@ -145,7 +145,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
mSignalStrength = mock(SignalStrength.class); mSignalStrength = mock(SignalStrength.class);
mServiceState = mock(ServiceState.class); mServiceState = mock(ServiceState.class);
mDisplayInfo = mock(DisplayInfo.class); mTelephonyDisplayInfo = mock(TelephonyDisplayInfo.class);
mConfig = new Config(); mConfig = new Config();
mConfig.hspaDataDistinguishable = true; mConfig.hspaDataDistinguishable = true;
@@ -319,7 +319,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected void updateServiceState() { protected void updateServiceState() {
Log.d(TAG, "Sending Service State: " + mServiceState); Log.d(TAG, "Sending Service State: " + mServiceState);
mPhoneStateListener.onServiceStateChanged(mServiceState); mPhoneStateListener.onServiceStateChanged(mServiceState);
mPhoneStateListener.onDisplayInfoChanged(mDisplayInfo); mPhoneStateListener.onDisplayInfoChanged(mTelephonyDisplayInfo);
} }
public void updateCallState(int state) { public void updateCallState(int state) {
@@ -335,7 +335,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
.build(); .build();
when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN)) when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN))
.thenReturn(fakeRegInfo); .thenReturn(fakeRegInfo);
when(mDisplayInfo.getNetworkType()).thenReturn(dataNetType); when(mTelephonyDisplayInfo.getNetworkType()).thenReturn(dataNetType);
mPhoneStateListener.onDataConnectionStateChanged(dataState, dataNetType); mPhoneStateListener.onDataConnectionStateChanged(dataState, dataNetType);
} }

View File

@@ -235,7 +235,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
.build(); .build();
when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN)) when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN))
.thenReturn(fakeRegInfo); .thenReturn(fakeRegInfo);
when(mDisplayInfo.getNetworkType()).thenReturn(TelephonyManager.NETWORK_TYPE_HSPA); when(mTelephonyDisplayInfo.getNetworkType()).thenReturn(TelephonyManager.NETWORK_TYPE_HSPA);
updateServiceState(); updateServiceState();
verifyDataIndicators(TelephonyIcons.ICON_H); verifyDataIndicators(TelephonyIcons.ICON_H);
} }

View File

@@ -63,7 +63,6 @@ import android.telephony.CellSignalStrengthTdscdma;
import android.telephony.CellSignalStrengthWcdma; import android.telephony.CellSignalStrengthWcdma;
import android.telephony.DataFailCause; import android.telephony.DataFailCause;
import android.telephony.DisconnectCause; import android.telephony.DisconnectCause;
import android.telephony.DisplayInfo;
import android.telephony.LocationAccessPolicy; import android.telephony.LocationAccessPolicy;
import android.telephony.PhoneCapability; import android.telephony.PhoneCapability;
import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener;
@@ -75,6 +74,7 @@ import android.telephony.ServiceState;
import android.telephony.SignalStrength; import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting; import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber; import android.telephony.emergency.EmergencyNumber;
@@ -239,7 +239,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private boolean[] mUserMobileDataState; private boolean[] mUserMobileDataState;
private DisplayInfo[] mDisplayInfos; private TelephonyDisplayInfo[] mTelephonyDisplayInfos;
private SignalStrength[] mSignalStrength; private SignalStrength[] mSignalStrength;
@@ -479,7 +479,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mCallAttributes = copyOf(mCallAttributes, mNumPhones); mCallAttributes = copyOf(mCallAttributes, mNumPhones);
mOutgoingCallEmergencyNumber = copyOf(mOutgoingCallEmergencyNumber, mNumPhones); mOutgoingCallEmergencyNumber = copyOf(mOutgoingCallEmergencyNumber, mNumPhones);
mOutgoingSmsEmergencyNumber = copyOf(mOutgoingSmsEmergencyNumber, mNumPhones); mOutgoingSmsEmergencyNumber = copyOf(mOutgoingSmsEmergencyNumber, mNumPhones);
mDisplayInfos = copyOf(mDisplayInfos, mNumPhones); mTelephonyDisplayInfos = copyOf(mTelephonyDisplayInfos, mNumPhones);
// ds -> ss switch. // ds -> ss switch.
if (mNumPhones < oldNumPhones) { if (mNumPhones < oldNumPhones) {
@@ -518,8 +518,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mForegroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE; mForegroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE;
mBackgroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE; mBackgroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE;
mPreciseDataConnectionStates.add(new HashMap<String, PreciseDataConnectionState>()); mPreciseDataConnectionStates.add(new HashMap<String, PreciseDataConnectionState>());
mDisplayInfos[i] = null;
mBarringInfo.add(i, new BarringInfo()); mBarringInfo.add(i, new BarringInfo());
mTelephonyDisplayInfos[i] = null;
} }
} }
@@ -578,8 +578,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mEmergencyNumberList = new HashMap<>(); mEmergencyNumberList = new HashMap<>();
mOutgoingCallEmergencyNumber = new EmergencyNumber[numPhones]; mOutgoingCallEmergencyNumber = new EmergencyNumber[numPhones];
mOutgoingSmsEmergencyNumber = new EmergencyNumber[numPhones]; mOutgoingSmsEmergencyNumber = new EmergencyNumber[numPhones];
mDisplayInfos = new DisplayInfo[numPhones];
mBarringInfo = new ArrayList<>(); mBarringInfo = new ArrayList<>();
mTelephonyDisplayInfos = new TelephonyDisplayInfo[numPhones];
for (int i = 0; i < numPhones; i++) { for (int i = 0; i < numPhones; i++) {
mCallState[i] = TelephonyManager.CALL_STATE_IDLE; mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
mDataActivity[i] = TelephonyManager.DATA_ACTIVITY_NONE; mDataActivity[i] = TelephonyManager.DATA_ACTIVITY_NONE;
@@ -607,8 +607,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mForegroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE; mForegroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE;
mBackgroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE; mBackgroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE;
mPreciseDataConnectionStates.add(new HashMap<String, PreciseDataConnectionState>()); mPreciseDataConnectionStates.add(new HashMap<String, PreciseDataConnectionState>());
mDisplayInfos[i] = null;
mBarringInfo.add(i, new BarringInfo()); mBarringInfo.add(i, new BarringInfo());
mTelephonyDisplayInfos[i] = null;
} }
mAppOps = mContext.getSystemService(AppOpsManager.class); mAppOps = mContext.getSystemService(AppOpsManager.class);
@@ -1025,8 +1025,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
if ((events & PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED) != 0) { if ((events & PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED) != 0) {
try { try {
if (mDisplayInfos[phoneId] != null) { if (mTelephonyDisplayInfos[phoneId] != null) {
r.callback.onDisplayInfoChanged(mDisplayInfos[phoneId]); r.callback.onDisplayInfoChanged(mTelephonyDisplayInfos[phoneId]);
} }
} catch (RemoteException ex) { } catch (RemoteException ex) {
remove(r.binder); remove(r.binder);
@@ -1586,28 +1586,28 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
* *
* @param phoneId Phone id * @param phoneId Phone id
* @param subId Subscription id * @param subId Subscription id
* @param displayInfo Display network info * @param telephonyDisplayInfo Display network info
* *
* @see PhoneStateListener#onDisplayInfoChanged(DisplayInfo) * @see PhoneStateListener#onDisplayInfoChanged(TelephonyDisplayInfo)
*/ */
public void notifyDisplayInfoChanged(int phoneId, int subId, public void notifyDisplayInfoChanged(int phoneId, int subId,
@NonNull DisplayInfo displayInfo) { @NonNull TelephonyDisplayInfo telephonyDisplayInfo) {
if (!checkNotifyPermission("notifyDisplayInfoChanged()")) { if (!checkNotifyPermission("notifyDisplayInfoChanged()")) {
return; return;
} }
if (VDBG) { if (VDBG) {
log("notifyDisplayInfoChanged: PhoneId=" + phoneId log("notifyDisplayInfoChanged: PhoneId=" + phoneId
+ " subId=" + subId + " displayInfo=" + displayInfo); + " subId=" + subId + " telephonyDisplayInfo=" + telephonyDisplayInfo);
} }
synchronized (mRecords) { synchronized (mRecords) {
if (validatePhoneId(phoneId)) { if (validatePhoneId(phoneId)) {
mDisplayInfos[phoneId] = displayInfo; mTelephonyDisplayInfos[phoneId] = telephonyDisplayInfo;
for (Record r : mRecords) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent( if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED) PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED)
&& idMatch(r.subId, subId, phoneId)) { && idMatch(r.subId, subId, phoneId)) {
try { try {
r.callback.onDisplayInfoChanged(displayInfo); r.callback.onDisplayInfoChanged(telephonyDisplayInfo);
} catch (RemoteException ex) { } catch (RemoteException ex) {
mRemoveList.add(r.binder); mRemoveList.add(r.binder);
} }
@@ -2829,10 +2829,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
try { try {
if (VDBG) { if (VDBG) {
log("checkPossibleMissNotify: onDisplayInfoChanged phoneId=" log("checkPossibleMissNotify: onDisplayInfoChanged phoneId="
+ phoneId + " dpi=" + mDisplayInfos[phoneId]); + phoneId + " dpi=" + mTelephonyDisplayInfos[phoneId]);
} }
if (mDisplayInfos[phoneId] != null) { if (mTelephonyDisplayInfos[phoneId] != null) {
r.callback.onDisplayInfoChanged(mDisplayInfos[phoneId]); r.callback.onDisplayInfoChanged(mTelephonyDisplayInfos[phoneId]);
} }
} catch (RemoteException ex) { } catch (RemoteException ex) {
mRemoveList.add(r.binder); mRemoveList.add(r.binder);

View File

@@ -628,10 +628,10 @@ public class Annotation {
*/ */
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = "OVERRIDE_NETWORK_TYPE_", value = { @IntDef(prefix = "OVERRIDE_NETWORK_TYPE_", value = {
DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA, TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA,
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO, TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO,
DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA, TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA,
DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE}) TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE})
public @interface OverrideNetworkType {} public @interface OverrideNetworkType {}
} }

View File

@@ -15,4 +15,4 @@
*/ */
package android.telephony; package android.telephony;
parcelable DisplayInfo; parcelable TelephonyDisplayInfo;

View File

@@ -25,12 +25,12 @@ import android.telephony.Annotation.OverrideNetworkType;
import java.util.Objects; import java.util.Objects;
/** /**
* DisplayInfo contains telephony-related information used for display purposes only. This * TelephonyDisplayInfo contains telephony-related information used for display purposes only. This
* information is provided in accordance with carrier policy and branding preferences; it is not * information is provided in accordance with carrier policy and branding preferences; it is not
* necessarily a precise or accurate representation of the current state and should be treated * necessarily a precise or accurate representation of the current state and should be treated
* accordingly. * accordingly.
*/ */
public final class DisplayInfo implements Parcelable { public final class TelephonyDisplayInfo implements Parcelable {
/** /**
* No override. {@link #getNetworkType()} should be used for display network * No override. {@link #getNetworkType()} should be used for display network
* type. * type.
@@ -81,13 +81,14 @@ public final class DisplayInfo implements Parcelable {
* *
* @hide * @hide
*/ */
public DisplayInfo(@NetworkType int networkType, @OverrideNetworkType int overrideNetworkType) { public TelephonyDisplayInfo(@NetworkType int networkType,
@OverrideNetworkType int overrideNetworkType) {
mNetworkType = networkType; mNetworkType = networkType;
mOverrideNetworkType = overrideNetworkType; mOverrideNetworkType = overrideNetworkType;
} }
/** @hide */ /** @hide */
public DisplayInfo(Parcel p) { public TelephonyDisplayInfo(Parcel p) {
mNetworkType = p.readInt(); mNetworkType = p.readInt();
mOverrideNetworkType = p.readInt(); mOverrideNetworkType = p.readInt();
} }
@@ -121,16 +122,16 @@ public final class DisplayInfo implements Parcelable {
dest.writeInt(mOverrideNetworkType); dest.writeInt(mOverrideNetworkType);
} }
public static final @NonNull Parcelable.Creator<DisplayInfo> CREATOR = public static final @NonNull Parcelable.Creator<TelephonyDisplayInfo> CREATOR =
new Parcelable.Creator<DisplayInfo>() { new Parcelable.Creator<TelephonyDisplayInfo>() {
@Override @Override
public DisplayInfo createFromParcel(Parcel source) { public TelephonyDisplayInfo createFromParcel(Parcel source) {
return new DisplayInfo(source); return new TelephonyDisplayInfo(source);
} }
@Override @Override
public DisplayInfo[] newArray(int size) { public TelephonyDisplayInfo[] newArray(int size) {
return new DisplayInfo[size]; return new TelephonyDisplayInfo[size];
} }
}; };
@@ -143,7 +144,7 @@ public final class DisplayInfo implements Parcelable {
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null || getClass() != o.getClass()) return false;
DisplayInfo that = (DisplayInfo) o; TelephonyDisplayInfo that = (TelephonyDisplayInfo) o;
return mNetworkType == that.mNetworkType return mNetworkType == that.mNetworkType
&& mOverrideNetworkType == that.mOverrideNetworkType; && mOverrideNetworkType == that.mOverrideNetworkType;
} }
@@ -166,7 +167,7 @@ public final class DisplayInfo implements Parcelable {
@Override @Override
public String toString() { public String toString() {
return "DisplayInfo {network=" + TelephonyManager.getNetworkTypeName(mNetworkType) return "TelephonyDisplayInfo {network=" + TelephonyManager.getNetworkTypeName(mNetworkType)
+ ", override=" + overrideNetworkTypeToString(mOverrideNetworkType); + ", override=" + overrideNetworkTypeToString(mOverrideNetworkType);
} }
} }