Merge "Renamed DisplayInfo to TelephonyDisplayInfo" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-03-19 14:29:24 +00:00
committed by Android (Google) Code Review
13 changed files with 112 additions and 98 deletions

View File

@@ -47459,19 +47459,6 @@ package android.telephony {
field public static final int VSNCP_TIMEOUT = 2236; // 0x8bc
}
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 {
method public int describeContents();
method public int getChannel();
@@ -47698,7 +47685,7 @@ package android.telephony {
method public void onDataActivity(int);
method public void onDataConnectionStateChanged(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 public void onMessageWaitingIndicatorChanged(boolean);
method @RequiresPermission("android.permission.MODIFY_PHONE_STATE") public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
@@ -48122,6 +48109,19 @@ package android.telephony {
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 {
method public boolean canChangeDtmfToneLength();
method @Nullable public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);

View File

@@ -3792,7 +3792,7 @@ package android.telephony {
method public void notifyDataActivityChanged(int, int);
method public void notifyDataConnectionForSubscriber(int, int, int, @Nullable android.telephony.PreciseDataConnectionState);
method public void notifyDisconnectCause(int, int, int, int);
method public void notifyDisplayInfoChanged(int, int, @NonNull android.telephony.DisplayInfo);
method public void notifyDisplayInfoChanged(int, int, @NonNull android.telephony.TelephonyDisplayInfo);
method public void notifyEmergencyNumberList(int, int);
method public void notifyImsDisconnectCause(int, @NonNull android.telephony.ims.ImsReasonInfo);
method public void notifyMessageWaitingChanged(int, int, boolean);

View File

@@ -855,16 +855,16 @@ public class PhoneStateListener {
/**
* 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.
*
* Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling
* 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))
public void onDisplayInfoChanged(@NonNull DisplayInfo displayInfo) {
public void onDisplayInfoChanged(@NonNull TelephonyDisplayInfo telephonyDisplayInfo) {
// default implementation empty
}
@@ -1247,13 +1247,13 @@ public class PhoneStateListener {
() -> psl.onUserMobileDataStateChanged(enabled)));
}
public void onDisplayInfoChanged(DisplayInfo displayInfo) {
public void onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo) {
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
if (psl == null) return;
Binder.withCleanCallingIdentity(
() -> mExecutor.execute(
() -> psl.onDisplayInfoChanged(displayInfo)));
() -> psl.onDisplayInfoChanged(telephonyDisplayInfo)));
}
public void onOemHookRawEvent(byte[] rawData) {

View File

@@ -590,12 +590,12 @@ public class TelephonyRegistryManager {
* derived from {@code subscriptionId} except when {@code subscriptionId} is invalid, such as
* when the device is in emergency-only mode.
* @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,
@NonNull DisplayInfo displayInfo) {
@NonNull TelephonyDisplayInfo telephonyDisplayInfo) {
try {
sRegistry.notifyDisplayInfoChanged(slotIndex, subscriptionId, displayInfo);
sRegistry.notifyDisplayInfoChanged(slotIndex, subscriptionId, telephonyDisplayInfo);
} catch (RemoteException ex) {
// system process is dead
}

View File

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

View File

@@ -23,7 +23,7 @@ import android.telephony.BarringInfo;
import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.DisplayInfo;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig;
@@ -88,7 +88,7 @@ interface ITelephonyRegistry {
void notifyOpportunisticSubscriptionInfoChanged();
void notifyCarrierNetworkChange(in boolean active);
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 notifyActiveDataSubIdChanged(int activeDataSubId);
void notifyRadioPowerStateChanged(in int phoneId, in int subId, in int state);

View File

@@ -26,12 +26,12 @@ import android.telephony.Annotation;
import android.telephony.CdmaEriInformation;
import android.telephony.CellSignalStrength;
import android.telephony.CellSignalStrengthCdma;
import android.telephony.DisplayInfo;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.text.Html;
import android.text.TextUtils;
@@ -75,8 +75,9 @@ public class MobileSignalController extends SignalController<
// this could potentially become part of MobileState for simplification/complication
// of code.
private int mDataState = TelephonyManager.DATA_DISCONNECTED;
private DisplayInfo mDisplayInfo = new DisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN,
DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
private TelephonyDisplayInfo mTelephonyDisplayInfo =
new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
private ServiceState mServiceState;
private SignalStrength mSignalStrength;
private MobileIconGroup mDefaultIcons;
@@ -240,41 +241,52 @@ public class MobileSignalController extends SignalController<
mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_HSPAP), hPlusGroup);
if (mConfig.show4gForLte) {
mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_LTE),
mNetworkToIconLookup.put(toIconKey(
TelephonyManager.NETWORK_TYPE_LTE),
TelephonyIcons.FOUR_G);
if (mConfig.hideLtePlus) {
mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.FOUR_G);
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA),
TelephonyIcons.FOUR_G);
} else {
mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.FOUR_G_PLUS);
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA),
TelephonyIcons.FOUR_G_PLUS);
}
} else {
mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_LTE),
mNetworkToIconLookup.put(toIconKey(
TelephonyManager.NETWORK_TYPE_LTE),
TelephonyIcons.LTE);
if (mConfig.hideLtePlus) {
mNetworkToIconLookup.put(toDisplayIconKey(
DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.LTE);
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA),
TelephonyIcons.LTE);
} else {
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);
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(
DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA), TelephonyIcons.NR_5G);
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA),
TelephonyIcons.NR_5G);
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() {
if (mDisplayInfo.getOverrideNetworkType() == DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) {
return toIconKey(mDisplayInfo.getNetworkType());
if (mTelephonyDisplayInfo.getOverrideNetworkType()
== TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) {
return toIconKey(mTelephonyDisplayInfo.getNetworkType());
} else {
return toDisplayIconKey(mDisplayInfo.getOverrideNetworkType());
return toDisplayIconKey(mTelephonyDisplayInfo.getOverrideNetworkType());
}
}
@@ -284,13 +296,13 @@ public class MobileSignalController extends SignalController<
private String toDisplayIconKey(@Annotation.OverrideNetworkType int displayNetworkType) {
switch (displayNetworkType) {
case DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA:
case TelephonyDisplayInfo.OVERRIDE_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";
case DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA:
case TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA:
return "5G";
case DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE:
case TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE:
return "5G_Plus";
default:
return "unsupported";
@@ -502,14 +514,14 @@ public class MobileSignalController extends SignalController<
/**
* 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.
*/
private final void updateTelephony() {
if (DEBUG) {
Log.d(mTag, "updateTelephonySignalStrength: hasService=" +
Utils.isInService(mServiceState) + " ss=" + mSignalStrength
+ " displayInfo=" + mDisplayInfo);
+ " displayInfo=" + mTelephonyDisplayInfo);
}
checkDefaultData();
mCurrentState.connected = Utils.isInService(mServiceState) && mSignalStrength != null;
@@ -595,7 +607,7 @@ public class MobileSignalController extends SignalController<
pw.println(" mSubscription=" + mSubscriptionInfo + ",");
pw.println(" mServiceState=" + mServiceState + ",");
pw.println(" mSignalStrength=" + mSignalStrength + ",");
pw.println(" mDisplayInfo=" + mDisplayInfo + ",");
pw.println(" mTelephonyDisplayInfo=" + mTelephonyDisplayInfo + ",");
pw.println(" mDataState=" + mDataState + ",");
pw.println(" mInflateSignalStrengths=" + mInflateSignalStrengths + ",");
pw.println(" isDataDisabled=" + isDataDisabled() + ",");
@@ -634,8 +646,9 @@ public class MobileSignalController extends SignalController<
+ " type=" + networkType);
}
mDataState = state;
if (networkType != mDisplayInfo.getNetworkType()) {
mDisplayInfo = new DisplayInfo(networkType, DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
if (networkType != mTelephonyDisplayInfo.getNetworkType()) {
mTelephonyDisplayInfo = new TelephonyDisplayInfo(networkType,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
}
updateTelephony();
}
@@ -665,11 +678,11 @@ public class MobileSignalController extends SignalController<
}
@Override
public void onDisplayInfoChanged(DisplayInfo displayInfo) {
public void onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo) {
if (DEBUG) {
Log.d(mTag, "onDisplayInfoChanged: displayInfo=" + displayInfo);
Log.d(mTag, "onDisplayInfoChanged: telephonyDisplayInfo=" + telephonyDisplayInfo);
}
mDisplayInfo = displayInfo;
mTelephonyDisplayInfo = telephonyDisplayInfo;
updateTelephony();
}
}

View File

@@ -45,13 +45,13 @@ import android.provider.Settings;
import android.provider.Settings.Global;
import android.telephony.CdmaEriInformation;
import android.telephony.CellSignalStrength;
import android.telephony.DisplayInfo;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.testing.TestableLooper;
import android.testing.TestableResources;
@@ -97,7 +97,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected PhoneStateListener mPhoneStateListener;
protected SignalStrength mSignalStrength;
protected ServiceState mServiceState;
protected DisplayInfo mDisplayInfo;
protected TelephonyDisplayInfo mTelephonyDisplayInfo;
protected NetworkRegistrationInfo mFakeRegInfo;
protected ConnectivityManager mMockCm;
protected WifiManager mMockWm;
@@ -161,7 +161,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
mSignalStrength = mock(SignalStrength.class);
mServiceState = mock(ServiceState.class);
mDisplayInfo = mock(DisplayInfo.class);
mTelephonyDisplayInfo = mock(TelephonyDisplayInfo.class);
mFakeRegInfo = new NetworkRegistrationInfo.Builder()
.setTransportType(TRANSPORT_TYPE_WWAN)
@@ -170,8 +170,8 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
.build();
doReturn(mFakeRegInfo).when(mServiceState)
.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN);
doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mDisplayInfo).getNetworkType();
doReturn(DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE).when(mDisplayInfo)
doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mTelephonyDisplayInfo).getNetworkType();
doReturn(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE).when(mTelephonyDisplayInfo)
.getOverrideNetworkType();
mEriInformation = new CdmaEriInformation(CdmaEriInformation.ERI_OFF,
@@ -348,7 +348,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected void updateServiceState() {
Log.d(TAG, "Sending Service State: " + mServiceState);
mPhoneStateListener.onServiceStateChanged(mServiceState);
mPhoneStateListener.onDisplayInfoChanged(mDisplayInfo);
mPhoneStateListener.onDisplayInfoChanged(mTelephonyDisplayInfo);
}
public void updateCallState(int state) {
@@ -364,7 +364,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
.build();
when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN))
.thenReturn(fakeRegInfo);
when(mDisplayInfo.getNetworkType()).thenReturn(dataNetType);
when(mTelephonyDisplayInfo.getNetworkType()).thenReturn(dataNetType);
mPhoneStateListener.onDataConnectionStateChanged(dataState, dataNetType);
}

View File

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

View File

@@ -61,7 +61,6 @@ import android.telephony.CellSignalStrengthTdscdma;
import android.telephony.CellSignalStrengthWcdma;
import android.telephony.DataFailCause;
import android.telephony.DisconnectCause;
import android.telephony.DisplayInfo;
import android.telephony.LocationAccessPolicy;
import android.telephony.PhoneCapability;
import android.telephony.PhoneStateListener;
@@ -73,6 +72,7 @@ import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;
@@ -205,7 +205,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private boolean[] mUserMobileDataState;
private DisplayInfo[] mDisplayInfos;
private TelephonyDisplayInfo[] mTelephonyDisplayInfos;
private SignalStrength[] mSignalStrength;
@@ -446,7 +446,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mCallAttributes = copyOf(mCallAttributes, mNumPhones);
mOutgoingCallEmergencyNumber = copyOf(mOutgoingCallEmergencyNumber, mNumPhones);
mOutgoingSmsEmergencyNumber = copyOf(mOutgoingSmsEmergencyNumber, mNumPhones);
mDisplayInfos = copyOf(mDisplayInfos, mNumPhones);
mTelephonyDisplayInfos = copyOf(mTelephonyDisplayInfos, mNumPhones);
// ds -> ss switch.
if (mNumPhones < oldNumPhones) {
@@ -486,7 +486,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mBackgroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE;
mPreciseDataConnectionStates.add(new HashMap<Integer, PreciseDataConnectionState>());
mBarringInfo.add(i, new BarringInfo());
mDisplayInfos[i] = null;
mTelephonyDisplayInfos[i] = null;
}
}
@@ -545,7 +545,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mOutgoingCallEmergencyNumber = new EmergencyNumber[numPhones];
mOutgoingSmsEmergencyNumber = new EmergencyNumber[numPhones];
mBarringInfo = new ArrayList<>();
mDisplayInfos = new DisplayInfo[numPhones];
mTelephonyDisplayInfos = new TelephonyDisplayInfo[numPhones];
for (int i = 0; i < numPhones; i++) {
mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
mDataActivity[i] = TelephonyManager.DATA_ACTIVITY_NONE;
@@ -574,7 +574,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mBackgroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE;
mPreciseDataConnectionStates.add(new HashMap<Integer, PreciseDataConnectionState>());
mBarringInfo.add(i, new BarringInfo());
mDisplayInfos[i] = null;
mTelephonyDisplayInfos[i] = null;
}
mAppOps = mContext.getSystemService(AppOpsManager.class);
@@ -987,8 +987,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
if ((events & PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED) != 0) {
try {
if (mDisplayInfos[phoneId] != null) {
r.callback.onDisplayInfoChanged(mDisplayInfos[phoneId]);
if (mTelephonyDisplayInfos[phoneId] != null) {
r.callback.onDisplayInfoChanged(mTelephonyDisplayInfos[phoneId]);
}
} catch (RemoteException ex) {
remove(r.binder);
@@ -1522,28 +1522,28 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
*
* @param phoneId Phone 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,
@NonNull DisplayInfo displayInfo) {
@NonNull TelephonyDisplayInfo telephonyDisplayInfo) {
if (!checkNotifyPermission("notifyDisplayInfoChanged()")) {
return;
}
if (VDBG) {
log("notifyDisplayInfoChanged: PhoneId=" + phoneId
+ " subId=" + subId + " displayInfo=" + displayInfo);
+ " subId=" + subId + " telephonyDisplayInfo=" + telephonyDisplayInfo);
}
synchronized (mRecords) {
if (validatePhoneId(phoneId)) {
mDisplayInfos[phoneId] = displayInfo;
mTelephonyDisplayInfos[phoneId] = telephonyDisplayInfo;
for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED)
&& idMatch(r.subId, subId, phoneId)) {
try {
r.callback.onDisplayInfoChanged(displayInfo);
r.callback.onDisplayInfoChanged(telephonyDisplayInfo);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
@@ -2787,10 +2787,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
try {
if (VDBG) {
log("checkPossibleMissNotify: onDisplayInfoChanged phoneId="
+ phoneId + " dpi=" + mDisplayInfos[phoneId]);
+ phoneId + " dpi=" + mTelephonyDisplayInfos[phoneId]);
}
if (mDisplayInfos[phoneId] != null) {
r.callback.onDisplayInfoChanged(mDisplayInfos[phoneId]);
if (mTelephonyDisplayInfos[phoneId] != null) {
r.callback.onDisplayInfoChanged(mTelephonyDisplayInfos[phoneId]);
}
} catch (RemoteException ex) {
mRemoveList.add(r.binder);

View File

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

View File

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

View File

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