Added telephony display info support
Added the new APIs allowing clients like System UI to display network icons correctly based on the provided telephony display info. Test: Telephony sanity tests Bug: 148540139 Change-Id: I4dfb6eb7a313539e0565a4239d555426f12e503e Merged-In: I4dfb6eb7a313539e0565a4239d555426f12e503e
This commit is contained in:
@@ -45210,6 +45210,19 @@ 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();
|
||||||
@@ -45435,6 +45448,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_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);
|
||||||
@@ -45451,6 +45465,7 @@ package android.telephony {
|
|||||||
field public static final int LISTEN_CELL_LOCATION = 16; // 0x10
|
field public static final int LISTEN_CELL_LOCATION = 16; // 0x10
|
||||||
field public static final int LISTEN_DATA_ACTIVITY = 128; // 0x80
|
field public static final int LISTEN_DATA_ACTIVITY = 128; // 0x80
|
||||||
field public static final int LISTEN_DATA_CONNECTION_STATE = 64; // 0x40
|
field public static final int LISTEN_DATA_CONNECTION_STATE = 64; // 0x40
|
||||||
|
field public static final int LISTEN_DISPLAY_INFO_CHANGED = 1048576; // 0x100000
|
||||||
field public static final int LISTEN_EMERGENCY_NUMBER_LIST = 16777216; // 0x1000000
|
field public static final int LISTEN_EMERGENCY_NUMBER_LIST = 16777216; // 0x1000000
|
||||||
field @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public static final int LISTEN_IMS_CALL_DISCONNECT_CAUSES = 134217728; // 0x8000000
|
field @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public static final int LISTEN_IMS_CALL_DISCONNECT_CAUSES = 134217728; // 0x8000000
|
||||||
field public static final int LISTEN_MESSAGE_WAITING_INDICATOR = 4; // 0x4
|
field public static final int LISTEN_MESSAGE_WAITING_INDICATOR = 4; // 0x4
|
||||||
|
|||||||
@@ -300,6 +300,13 @@ public class PhoneStateListener {
|
|||||||
*/
|
*/
|
||||||
public static final int LISTEN_USER_MOBILE_DATA_STATE = 0x00080000;
|
public static final int LISTEN_USER_MOBILE_DATA_STATE = 0x00080000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen for display info changed event.
|
||||||
|
*
|
||||||
|
* @see #onDisplayInfoChanged
|
||||||
|
*/
|
||||||
|
public static final int LISTEN_DISPLAY_INFO_CHANGED = 0x00100000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen for changes to the phone capability.
|
* Listen for changes to the phone capability.
|
||||||
*
|
*
|
||||||
@@ -836,6 +843,21 @@ public class PhoneStateListener {
|
|||||||
// default implementation empty
|
// default implementation empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
@RequiresPermission((android.Manifest.permission.READ_PHONE_STATE))
|
||||||
|
public void onDisplayInfoChanged(@NonNull DisplayInfo displayInfo) {
|
||||||
|
// default implementation empty
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback invoked when the current emergency number list has changed on the registered
|
* Callback invoked when the current emergency number list has changed on the registered
|
||||||
* subscription.
|
* subscription.
|
||||||
@@ -1201,6 +1223,15 @@ public class PhoneStateListener {
|
|||||||
() -> psl.onUserMobileDataStateChanged(enabled)));
|
() -> psl.onUserMobileDataStateChanged(enabled)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDisplayInfoChanged(DisplayInfo displayInfo) {
|
||||||
|
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
|
||||||
|
if (psl == null) return;
|
||||||
|
|
||||||
|
Binder.withCleanCallingIdentity(
|
||||||
|
() -> mExecutor.execute(
|
||||||
|
() -> psl.onDisplayInfoChanged(displayInfo)));
|
||||||
|
}
|
||||||
|
|
||||||
public void onOemHookRawEvent(byte[] rawData) {
|
public void onOemHookRawEvent(byte[] rawData) {
|
||||||
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
|
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
|
||||||
if (psl == null) return;
|
if (psl == null) return;
|
||||||
|
|||||||
@@ -535,6 +535,24 @@ public class TelephonyRegistryManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify display info changed.
|
||||||
|
*
|
||||||
|
* @param slotIndex The SIM slot index for which display info has changed. Can be
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
public void notifyDisplayInfoChanged(int slotIndex, int subscriptionId,
|
||||||
|
@NonNull DisplayInfo displayInfo) {
|
||||||
|
try {
|
||||||
|
sRegistry.notifyDisplayInfoChanged(slotIndex, subscriptionId, displayInfo);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
// system process is dead
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify IMS call disconnect causes which contains {@link android.telephony.ims.ImsReasonInfo}.
|
* Notify IMS call disconnect causes which contains {@link android.telephony.ims.ImsReasonInfo}.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -20,6 +20,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.PhoneCapability;
|
import android.telephony.PhoneCapability;
|
||||||
import android.telephony.PreciseCallState;
|
import android.telephony.PreciseCallState;
|
||||||
import android.telephony.PreciseDataConnectionState;
|
import android.telephony.PreciseDataConnectionState;
|
||||||
@@ -53,6 +54,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 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);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.net.NetworkCapabilities;
|
|||||||
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.ims.ImsReasonInfo;
|
import android.telephony.ims.ImsReasonInfo;
|
||||||
import android.telephony.PhoneCapability;
|
import android.telephony.PhoneCapability;
|
||||||
import android.telephony.PhysicalChannelConfig;
|
import android.telephony.PhysicalChannelConfig;
|
||||||
@@ -87,6 +88,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 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);
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ 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;
|
||||||
@@ -205,6 +206,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
|
|
||||||
private boolean[] mUserMobileDataState;
|
private boolean[] mUserMobileDataState;
|
||||||
|
|
||||||
|
private DisplayInfo[] mDisplayInfos;
|
||||||
|
|
||||||
private SignalStrength[] mSignalStrength;
|
private SignalStrength[] mSignalStrength;
|
||||||
|
|
||||||
private boolean[] mMessageWaiting;
|
private boolean[] mMessageWaiting;
|
||||||
@@ -283,7 +286,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR
|
PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR
|
||||||
| PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR
|
| PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR
|
||||||
| PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST
|
| PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST
|
||||||
| PhoneStateListener.LISTEN_REGISTRATION_FAILURE;
|
| PhoneStateListener.LISTEN_REGISTRATION_FAILURE
|
||||||
|
| PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED;
|
||||||
|
|
||||||
static final int PRECISE_PHONE_STATE_PERMISSION_MASK =
|
static final int PRECISE_PHONE_STATE_PERMISSION_MASK =
|
||||||
PhoneStateListener.LISTEN_PRECISE_CALL_STATE
|
PhoneStateListener.LISTEN_PRECISE_CALL_STATE
|
||||||
@@ -440,6 +444,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);
|
||||||
|
|
||||||
// ds -> ss switch.
|
// ds -> ss switch.
|
||||||
if (mNumPhones < oldNumPhones) {
|
if (mNumPhones < oldNumPhones) {
|
||||||
@@ -477,6 +482,7 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,6 +540,7 @@ 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];
|
||||||
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;
|
||||||
@@ -561,6 +568,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
mAppOps = mContext.getSystemService(AppOpsManager.class);
|
mAppOps = mContext.getSystemService(AppOpsManager.class);
|
||||||
@@ -971,6 +979,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
remove(r.binder);
|
remove(r.binder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((events & PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED) != 0) {
|
||||||
|
try {
|
||||||
|
if (mDisplayInfos[phoneId] != null) {
|
||||||
|
r.callback.onDisplayInfoChanged(mDisplayInfos[phoneId]);
|
||||||
|
}
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
remove(r.binder);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ((events & PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST) != 0) {
|
if ((events & PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST) != 0) {
|
||||||
try {
|
try {
|
||||||
r.callback.onEmergencyNumberListChanged(mEmergencyNumberList);
|
r.callback.onEmergencyNumberListChanged(mEmergencyNumberList);
|
||||||
@@ -1481,6 +1498,45 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify display network info changed.
|
||||||
|
*
|
||||||
|
* @param phoneId Phone id
|
||||||
|
* @param subId Subscription id
|
||||||
|
* @param displayInfo Display network info
|
||||||
|
*
|
||||||
|
* @see PhoneStateListener#onDisplayInfoChanged(DisplayInfo)
|
||||||
|
*/
|
||||||
|
public void notifyDisplayInfoChanged(int phoneId, int subId,
|
||||||
|
@NonNull DisplayInfo displayInfo) {
|
||||||
|
if (!checkNotifyPermission("notifyDisplayInfoChanged()")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (VDBG) {
|
||||||
|
log("notifyDisplayInfoChanged: PhoneId=" + phoneId
|
||||||
|
+ " subId=" + subId + " displayInfo=" + displayInfo);
|
||||||
|
}
|
||||||
|
synchronized (mRecords) {
|
||||||
|
if (validatePhoneId(phoneId)) {
|
||||||
|
if (mDisplayInfos[phoneId] != null) {
|
||||||
|
mDisplayInfos[phoneId] = displayInfo;
|
||||||
|
for (Record r : mRecords) {
|
||||||
|
if (r.matchPhoneStateListenerEvent(
|
||||||
|
PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED)
|
||||||
|
&& idMatch(r.subId, subId, phoneId)) {
|
||||||
|
try {
|
||||||
|
r.callback.onDisplayInfoChanged(displayInfo);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
mRemoveList.add(r.binder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleRemoveListLocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void notifyCallForwardingChanged(boolean cfi) {
|
public void notifyCallForwardingChanged(boolean cfi) {
|
||||||
notifyCallForwardingChangedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, cfi);
|
notifyCallForwardingChangedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, cfi);
|
||||||
}
|
}
|
||||||
@@ -2641,6 +2697,20 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((events & PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED) != 0) {
|
||||||
|
try {
|
||||||
|
if (VDBG) {
|
||||||
|
log("checkPossibleMissNotify: onDisplayInfoChanged phoneId="
|
||||||
|
+ phoneId + " dpi=" + mDisplayInfos[phoneId]);
|
||||||
|
}
|
||||||
|
if (mDisplayInfos[phoneId] != null) {
|
||||||
|
r.callback.onDisplayInfoChanged(mDisplayInfos[phoneId]);
|
||||||
|
}
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
mRemoveList.add(r.binder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((events & PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR) != 0) {
|
if ((events & PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR) != 0) {
|
||||||
try {
|
try {
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
|
|||||||
@@ -651,4 +651,16 @@ public class Annotation {
|
|||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface UiccAppType{}
|
public @interface UiccAppType{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override network type
|
||||||
|
*/
|
||||||
|
@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})
|
||||||
|
public @interface OverrideNetworkType {}
|
||||||
}
|
}
|
||||||
|
|||||||
18
telephony/java/android/telephony/DisplayInfo.aidl
Normal file
18
telephony/java/android/telephony/DisplayInfo.aidl
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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 android.telephony;
|
||||||
|
|
||||||
|
parcelable DisplayInfo;
|
||||||
172
telephony/java/android/telephony/DisplayInfo.java
Normal file
172
telephony/java/android/telephony/DisplayInfo.java
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2020 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 android.telephony;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.telephony.Annotation.NetworkType;
|
||||||
|
import android.telephony.Annotation.OverrideNetworkType;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DisplayInfo 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 {
|
||||||
|
/**
|
||||||
|
* No override. {@link #getNetworkType()} should be used for display network
|
||||||
|
* type.
|
||||||
|
*/
|
||||||
|
public static final int OVERRIDE_NETWORK_TYPE_NONE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override network type when the device is connected to
|
||||||
|
* {@link TelephonyManager#NETWORK_TYPE_LTE} cellular network and is using carrier aggregation.
|
||||||
|
*/
|
||||||
|
public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override network type when the device is connected to advanced pro
|
||||||
|
* {@link TelephonyManager#NETWORK_TYPE_LTE} cellular network.
|
||||||
|
*/
|
||||||
|
public static final int OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override network type when the device is connected to
|
||||||
|
* {@link TelephonyManager#NETWORK_TYPE_LTE} network and has E-UTRA-NR Dual Connectivity(EN-DC)
|
||||||
|
* capability or is currently connected to the secondary
|
||||||
|
* {@link TelephonyManager#NETWORK_TYPE_NR} cellular network.
|
||||||
|
*/
|
||||||
|
public static final int OVERRIDE_NETWORK_TYPE_NR_NSA = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override network type when the device is connected to
|
||||||
|
* {@link TelephonyManager#NETWORK_TYPE_LTE} network and has E-UTRA-NR Dual Connectivity(EN-DC)
|
||||||
|
* capability or is currently connected to the secondary
|
||||||
|
* {@link TelephonyManager#NETWORK_TYPE_NR} cellular network on millimeter wave bands.
|
||||||
|
*
|
||||||
|
* @see AccessNetworkConstants.NgranBands#FREQUENCY_RANGE_GROUP_2
|
||||||
|
*/
|
||||||
|
public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4;
|
||||||
|
|
||||||
|
@NetworkType
|
||||||
|
private final int mNetworkType;
|
||||||
|
|
||||||
|
@OverrideNetworkType
|
||||||
|
private final int mOverrideNetworkType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param networkType Current packet-switching cellular network type
|
||||||
|
* @param overrideNetworkType The override network type
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public DisplayInfo(@NetworkType int networkType, @OverrideNetworkType int overrideNetworkType) {
|
||||||
|
mNetworkType = networkType;
|
||||||
|
mOverrideNetworkType = overrideNetworkType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public DisplayInfo(Parcel p) {
|
||||||
|
mNetworkType = p.readInt();
|
||||||
|
mOverrideNetworkType = p.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current packet-switching cellular network type. This is the actual network type the
|
||||||
|
* device is camped on.
|
||||||
|
*
|
||||||
|
* @return The network type.
|
||||||
|
*/
|
||||||
|
@NetworkType
|
||||||
|
public int getNetworkType() {
|
||||||
|
return mNetworkType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the override network type. Note the override network type is for market branding
|
||||||
|
* or visualization purposes only. It cannot be treated as the actual network type device is
|
||||||
|
* camped on.
|
||||||
|
*
|
||||||
|
* @return The override network type.
|
||||||
|
*/
|
||||||
|
@OverrideNetworkType
|
||||||
|
public int getOverrideNetworkType() {
|
||||||
|
return mOverrideNetworkType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||||
|
dest.writeInt(mNetworkType);
|
||||||
|
dest.writeInt(mOverrideNetworkType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final @NonNull Parcelable.Creator<DisplayInfo> CREATOR =
|
||||||
|
new Parcelable.Creator<DisplayInfo>() {
|
||||||
|
@Override
|
||||||
|
public DisplayInfo createFromParcel(Parcel source) {
|
||||||
|
return new DisplayInfo(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DisplayInfo[] newArray(int size) {
|
||||||
|
return new DisplayInfo[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
DisplayInfo that = (DisplayInfo) o;
|
||||||
|
return mNetworkType == that.mNetworkType
|
||||||
|
&& mOverrideNetworkType == that.mOverrideNetworkType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(mNetworkType, mOverrideNetworkType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String overrideNetworkTypeToString(@OverrideNetworkType int type) {
|
||||||
|
switch (type) {
|
||||||
|
case OVERRIDE_NETWORK_TYPE_NONE: return "NONE";
|
||||||
|
case OVERRIDE_NETWORK_TYPE_LTE_CA: return "LTE_CA";
|
||||||
|
case OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO: return "LTE_ADV_PRO";
|
||||||
|
case OVERRIDE_NETWORK_TYPE_NR_NSA: return "NR_NSA";
|
||||||
|
case OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE: return "NR_NSA_MMWAVE";
|
||||||
|
default: return "UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DisplayInfo {network=" + TelephonyManager.getNetworkTypeName(mNetworkType)
|
||||||
|
+ ", override=" + overrideNetworkTypeToString(mOverrideNetworkType);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user