Merge "[Telephony] PhoneStateListener redesign for new event"
This commit is contained in:
@@ -40495,6 +40495,12 @@ package android.telephony {
|
||||
field public static final int SCAN_TYPE_PERIODIC = 1; // 0x1
|
||||
}
|
||||
|
||||
public final class PhoneCapability implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhoneCapability> CREATOR;
|
||||
}
|
||||
|
||||
public class PhoneNumberFormattingTextWatcher implements android.text.TextWatcher {
|
||||
ctor public PhoneNumberFormattingTextWatcher();
|
||||
ctor public PhoneNumberFormattingTextWatcher(String);
|
||||
@@ -40564,10 +40570,10 @@ package android.telephony {
|
||||
|
||||
public class PhoneStateListener {
|
||||
ctor public PhoneStateListener();
|
||||
ctor public PhoneStateListener(@NonNull java.util.concurrent.Executor);
|
||||
ctor @Deprecated public PhoneStateListener(@NonNull java.util.concurrent.Executor);
|
||||
method public void onActiveDataSubscriptionIdChanged(int);
|
||||
method public void onBarringInfoChanged(@NonNull android.telephony.BarringInfo);
|
||||
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onCallDisconnectCauseChanged(int, int);
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onCallDisconnectCauseChanged(int, int);
|
||||
method public void onCallForwardingIndicatorChanged(boolean);
|
||||
method public void onCallStateChanged(int, String);
|
||||
method public void onCellInfoChanged(java.util.List<android.telephony.CellInfo>);
|
||||
@@ -40575,36 +40581,140 @@ 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.TelephonyDisplayInfo);
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo);
|
||||
method public void onEmergencyNumberListChanged(@NonNull java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>>);
|
||||
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
|
||||
method @RequiresPermission(android.Manifest.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);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
|
||||
method public void onRegistrationFailed(@NonNull android.telephony.CellIdentity, @NonNull String, int, int, int);
|
||||
method public void onServiceStateChanged(android.telephony.ServiceState);
|
||||
method @Deprecated public void onSignalStrengthChanged(int);
|
||||
method public void onSignalStrengthsChanged(android.telephony.SignalStrength);
|
||||
method public void onUserMobileDataStateChanged(boolean);
|
||||
field public static final int LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE = 4194304; // 0x400000
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_BARRING_INFO = -2147483648; // 0x80000000
|
||||
field @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public static final int LISTEN_CALL_DISCONNECT_CAUSES = 33554432; // 0x2000000
|
||||
field public static final int LISTEN_CALL_FORWARDING_INDICATOR = 8; // 0x8
|
||||
field public static final int LISTEN_CALL_STATE = 32; // 0x20
|
||||
field public static final int LISTEN_CELL_INFO = 1024; // 0x400
|
||||
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_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 @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 @Deprecated public static final int LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE = 4194304; // 0x400000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_BARRING_INFO = -2147483648; // 0x80000000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_CALL_DISCONNECT_CAUSES = 33554432; // 0x2000000
|
||||
field @Deprecated public static final int LISTEN_CALL_FORWARDING_INDICATOR = 8; // 0x8
|
||||
field @Deprecated public static final int LISTEN_CALL_STATE = 32; // 0x20
|
||||
field @Deprecated public static final int LISTEN_CELL_INFO = 1024; // 0x400
|
||||
field @Deprecated public static final int LISTEN_CELL_LOCATION = 16; // 0x10
|
||||
field @Deprecated public static final int LISTEN_DATA_ACTIVITY = 128; // 0x80
|
||||
field @Deprecated public static final int LISTEN_DATA_CONNECTION_STATE = 64; // 0x40
|
||||
field @Deprecated public static final int LISTEN_DISPLAY_INFO_CHANGED = 1048576; // 0x100000
|
||||
field @Deprecated public static final int LISTEN_EMERGENCY_NUMBER_LIST = 16777216; // 0x1000000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_IMS_CALL_DISCONNECT_CAUSES = 134217728; // 0x8000000
|
||||
field @Deprecated public static final int LISTEN_MESSAGE_WAITING_INDICATOR = 4; // 0x4
|
||||
field public static final int LISTEN_NONE = 0; // 0x0
|
||||
field @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 4096; // 0x1000
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_REGISTRATION_FAILURE = 1073741824; // 0x40000000
|
||||
field public static final int LISTEN_SERVICE_STATE = 1; // 0x1
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 4096; // 0x1000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_REGISTRATION_FAILURE = 1073741824; // 0x40000000
|
||||
field @Deprecated public static final int LISTEN_SERVICE_STATE = 1; // 0x1
|
||||
field @Deprecated public static final int LISTEN_SIGNAL_STRENGTH = 2; // 0x2
|
||||
field public static final int LISTEN_SIGNAL_STRENGTHS = 256; // 0x100
|
||||
field public static final int LISTEN_USER_MOBILE_DATA_STATE = 524288; // 0x80000
|
||||
field @Deprecated public static final int LISTEN_SIGNAL_STRENGTHS = 256; // 0x100
|
||||
field @Deprecated public static final int LISTEN_USER_MOBILE_DATA_STATE = 524288; // 0x80000
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.ActiveDataSubscriptionIdChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onActiveDataSubscriptionIdChanged(int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.AlwaysReportedSignalStrengthChangedListener {
|
||||
method @RequiresPermission("android.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH") public void onSignalStrengthsChanged(@NonNull android.telephony.SignalStrength);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.BarringInfoChangedListener {
|
||||
method @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void onBarringInfoChanged(@NonNull android.telephony.BarringInfo);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.CallDisconnectCauseChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onCallDisconnectCauseChanged(int, int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.CallForwardingIndicatorChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onCallForwardingIndicatorChanged(boolean);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.CallStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_CALL_LOG) public void onCallStateChanged(int, @Nullable String);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.CarrierNetworkChangeListener {
|
||||
method public void onCarrierNetworkChange(boolean);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.CellInfoChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void onCellInfoChanged(@NonNull java.util.List<android.telephony.CellInfo>);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.CellLocationChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void onCellLocationChanged(@NonNull android.telephony.CellLocation);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.DataActivationStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void onDataActivationStateChanged(int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.DataActivityListener {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void onDataActivity(int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.DataConnectionStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void onDataConnectionStateChanged(int, int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.DisplayInfoChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.EmergencyNumberListChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onEmergencyNumberListChanged(@NonNull java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>>);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.ImsCallDisconnectCauseChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.MessageWaitingIndicatorChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onMessageWaitingIndicatorChanged(boolean);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.PhoneCapabilityChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void onPhoneCapabilityChanged(@NonNull android.telephony.PhoneCapability);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.PreciseDataConnectionStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.RegistrationFailedListener {
|
||||
method @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void onRegistrationFailed(@NonNull android.telephony.CellIdentity, @NonNull String, int, int, int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.ServiceStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void onServiceStateChanged(@NonNull android.telephony.ServiceState);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.SignalStrengthsChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void onSignalStrengthsChanged(@NonNull android.telephony.SignalStrength);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.UserMobileDataStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void onUserMobileDataStateChanged(boolean);
|
||||
}
|
||||
|
||||
public final class PhysicalChannelConfig implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public int getCellBandwidthDownlink();
|
||||
method public int getChannelNumber();
|
||||
method public int getConnectionStatus();
|
||||
method public int getNetworkType();
|
||||
method @IntRange(from=0, to=1007) public int getPhysicalCellId();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field public static final int CHANNEL_NUMBER_UNKNOWN = -1; // 0xffffffff
|
||||
field public static final int CONNECTION_PRIMARY_SERVING = 1; // 0x1
|
||||
field public static final int CONNECTION_SECONDARY_SERVING = 2; // 0x2
|
||||
field public static final int CONNECTION_UNKNOWN = -1; // 0xffffffff
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhysicalChannelConfig> CREATOR;
|
||||
field public static final int PHYSICAL_CELL_ID_UNKNOWN = -1; // 0xffffffff
|
||||
}
|
||||
|
||||
public final class PreciseDataConnectionState implements android.os.Parcelable {
|
||||
@@ -41115,7 +41225,8 @@ package android.telephony {
|
||||
method public boolean isVoiceCapable();
|
||||
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
|
||||
method public boolean isWorldPhone();
|
||||
method public void listen(android.telephony.PhoneStateListener, int);
|
||||
method @Deprecated public void listen(android.telephony.PhoneStateListener, int);
|
||||
method public void registerPhoneStateListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.PhoneStateListener);
|
||||
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestCellInfoUpdate(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback);
|
||||
method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, java.util.concurrent.Executor, android.telephony.TelephonyScanManager.NetworkScanCallback);
|
||||
method public void sendDialerSpecialCode(String);
|
||||
@@ -41138,6 +41249,7 @@ package android.telephony {
|
||||
method @Deprecated public void setVoicemailRingtoneUri(android.telecom.PhoneAccountHandle, android.net.Uri);
|
||||
method @Deprecated public void setVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle, boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void switchMultiSimConfig(int);
|
||||
method public void unregisterPhoneStateListener(@NonNull android.telephony.PhoneStateListener);
|
||||
method public void updateAvailableNetworks(@NonNull java.util.List<android.telephony.AvailableNetworkInfo>, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
||||
field public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE = "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE";
|
||||
field public static final String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL";
|
||||
|
||||
@@ -9813,17 +9813,87 @@ package android.telephony {
|
||||
method public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber, int);
|
||||
method @Deprecated public void onOutgoingEmergencySms(@NonNull android.telephony.emergency.EmergencyNumber);
|
||||
method public void onOutgoingEmergencySms(@NonNull android.telephony.emergency.EmergencyNumber, int);
|
||||
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onPreciseCallStateChanged(@NonNull android.telephony.PreciseCallState);
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onPreciseCallStateChanged(@NonNull android.telephony.PreciseCallState);
|
||||
method public void onRadioPowerStateChanged(int);
|
||||
method public void onSrvccStateChanged(int);
|
||||
method public void onVoiceActivationStateChanged(int);
|
||||
field @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public static final int LISTEN_CALL_ATTRIBUTES_CHANGED = 67108864; // 0x4000000
|
||||
field @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public static final int LISTEN_OUTGOING_EMERGENCY_CALL = 268435456; // 0x10000000
|
||||
field @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public static final int LISTEN_OUTGOING_EMERGENCY_SMS = 536870912; // 0x20000000
|
||||
field @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public static final int LISTEN_PRECISE_CALL_STATE = 2048; // 0x800
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int LISTEN_RADIO_POWER_STATE_CHANGED = 8388608; // 0x800000
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int LISTEN_SRVCC_STATE_CHANGED = 16384; // 0x4000
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int LISTEN_VOICE_ACTIVATION_STATE = 131072; // 0x20000
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED = 23; // 0x17
|
||||
field @RequiresPermission("android.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH") public static final int EVENT_ALWAYS_REPORTED_SIGNAL_STRENGTH_CHANGED = 10; // 0xa
|
||||
field @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static final int EVENT_BARRING_INFO_CHANGED = 32; // 0x20
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_CALL_ATTRIBUTES_CHANGED = 27; // 0x1b
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_CALL_DISCONNECT_CAUSE_CHANGED = 26; // 0x1a
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int EVENT_CALL_FORWARDING_INDICATOR_CHANGED = 4; // 0x4
|
||||
field @RequiresPermission(android.Manifest.permission.READ_CALL_LOG) public static final int EVENT_CALL_STATE_CHANGED = 6; // 0x6
|
||||
field public static final int EVENT_CARRIER_NETWORK_CHANGED = 17; // 0x11
|
||||
field @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static final int EVENT_CELL_INFO_CHANGED = 11; // 0xb
|
||||
field @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static final int EVENT_CELL_LOCATION_CHANGED = 5; // 0x5
|
||||
field public static final int EVENT_DATA_ACTIVATION_STATE_CHANGED = 19; // 0x13
|
||||
field public static final int EVENT_DATA_ACTIVITY_CHANGED = 8; // 0x8
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_DATA_CONNECTION_REAL_TIME_INFO_CHANGED = 14; // 0xe
|
||||
field public static final int EVENT_DATA_CONNECTION_STATE_CHANGED = 7; // 0x7
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_DATA_ENABLED_CHANGED = 34; // 0x22
|
||||
field public static final int EVENT_DISPLAY_INFO_CHANGED = 21; // 0x15
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int EVENT_EMERGENCY_NUMBER_LIST_CHANGED = 25; // 0x19
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_IMS_CALL_DISCONNECT_CAUSE_CHANGED = 28; // 0x1c
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int EVENT_MESSAGE_WAITING_INDICATOR_CHANGED = 3; // 0x3
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int EVENT_OEM_HOOK_RAW = 15; // 0xf
|
||||
field @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public static final int EVENT_OUTGOING_EMERGENCY_CALL = 29; // 0x1d
|
||||
field @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public static final int EVENT_OUTGOING_EMERGENCY_SMS = 30; // 0x1e
|
||||
field public static final int EVENT_PHONE_CAPABILITY_CHANGED = 22; // 0x16
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED = 33; // 0x21
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_PRECISE_CALL_STATE_CHANGED = 12; // 0xc
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_PRECISE_DATA_CONNECTION_STATE_CHANGED = 13; // 0xd
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int EVENT_RADIO_POWER_STATE_CHANGED = 24; // 0x18
|
||||
field @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static final int EVENT_REGISTRATION_FAILURE = 31; // 0x1f
|
||||
field public static final int EVENT_SERVICE_STATE_CHANGED = 1; // 0x1
|
||||
field public static final int EVENT_SIGNAL_STRENGTHS_CHANGED = 9; // 0x9
|
||||
field public static final int EVENT_SIGNAL_STRENGTH_CHANGED = 2; // 0x2
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int EVENT_SRVCC_STATE_CHANGED = 16; // 0x10
|
||||
field public static final int EVENT_USER_MOBILE_DATA_STATE_CHANGED = 20; // 0x14
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int EVENT_VOICE_ACTIVATION_STATE_CHANGED = 18; // 0x12
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_CALL_ATTRIBUTES_CHANGED = 67108864; // 0x4000000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public static final int LISTEN_OUTGOING_EMERGENCY_CALL = 268435456; // 0x10000000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public static final int LISTEN_OUTGOING_EMERGENCY_SMS = 536870912; // 0x20000000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_PRECISE_CALL_STATE = 2048; // 0x800
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int LISTEN_RADIO_POWER_STATE_CHANGED = 8388608; // 0x800000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int LISTEN_SRVCC_STATE_CHANGED = 16384; // 0x4000
|
||||
field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int LISTEN_VOICE_ACTIVATION_STATE = 131072; // 0x20000
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.CallAttributesChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onCallAttributesChanged(@NonNull android.telephony.CallAttributes);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.DataEnabledChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onDataEnabledChanged(boolean, int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.OutgoingEmergencyCallListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber, int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.OutgoingEmergencySmsListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public void onOutgoingEmergencySms(@NonNull android.telephony.emergency.EmergencyNumber, int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.PhysicalChannelConfigChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onPhysicalChannelConfigChanged(@NonNull java.util.List<android.telephony.PhysicalChannelConfig>);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.PreciseCallStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onPreciseCallStateChanged(@NonNull android.telephony.PreciseCallState);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.RadioPowerStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void onRadioPowerStateChanged(int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.SrvccStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void onSrvccStateChanged(int);
|
||||
}
|
||||
|
||||
public static interface PhoneStateListener.VoiceActivationStateChangedListener {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void onVoiceActivationStateChanged(int);
|
||||
}
|
||||
|
||||
public final class PinResult implements android.os.Parcelable {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.CallbackExecutor;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.RequiresPermission;
|
||||
@@ -24,6 +25,9 @@ import android.compat.annotation.EnabledAfter;
|
||||
import android.content.Context;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.telephony.Annotation.CallState;
|
||||
@@ -37,6 +41,7 @@ import android.telephony.Annotation.SimActivationState;
|
||||
import android.telephony.Annotation.SrvccState;
|
||||
import android.telephony.emergency.EmergencyNumber;
|
||||
import android.telephony.ims.ImsReasonInfo;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.telephony.IOnSubscriptionsChangedListener;
|
||||
@@ -45,6 +50,7 @@ import com.android.internal.telephony.ITelephonyRegistry;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
@@ -206,7 +212,7 @@ public class TelephonyRegistryManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* To check the SDK version for {@link #listenForSubscriber}.
|
||||
* To check the SDK version for {@link #listenWithEventList}.
|
||||
*/
|
||||
@ChangeId
|
||||
@EnabledAfter(targetSdkVersion = Build.VERSION_CODES.P)
|
||||
@@ -218,23 +224,23 @@ public class TelephonyRegistryManager {
|
||||
* @param pkg Package name
|
||||
* @param featureId Feature ID
|
||||
* @param listener Listener providing callback
|
||||
* @param events Events
|
||||
* @param events List events
|
||||
* @param notifyNow Whether to notify instantly
|
||||
*/
|
||||
public void listenForSubscriber(int subId, @NonNull String pkg, @NonNull String featureId,
|
||||
@NonNull PhoneStateListener listener, int events, boolean notifyNow) {
|
||||
public void listenWithEventList(int subId, @NonNull String pkg, @NonNull String featureId,
|
||||
@NonNull PhoneStateListener listener, @NonNull int[] events, boolean notifyNow) {
|
||||
try {
|
||||
// subId from PhoneStateListener is deprecated Q on forward, use the subId from
|
||||
// TelephonyManager instance. Keep using subId from PhoneStateListener for pre-Q.
|
||||
if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) {
|
||||
// Since mSubId in PhoneStateListener is deprecated from Q on forward, this is
|
||||
// the only place to set mSubId and its for "informational" only.
|
||||
listener.mSubId = (events == PhoneStateListener.LISTEN_NONE)
|
||||
listener.mSubId = (events.length == 0)
|
||||
? SubscriptionManager.INVALID_SUBSCRIPTION_ID : subId;
|
||||
} else if (listener.mSubId != null) {
|
||||
subId = listener.mSubId;
|
||||
}
|
||||
sRegistry.listenForSubscriber(
|
||||
sRegistry.listenWithEventList(
|
||||
subId, pkg, featureId, listener.callback, events, notifyNow);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
@@ -765,4 +771,366 @@ public class TelephonyRegistryManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify {@link PhysicalChannelConfig} has changed for a specific subscription.
|
||||
*
|
||||
* @param subId the subId
|
||||
* @param configs a list of {@link PhysicalChannelConfig}, the configs of physical channel.
|
||||
*/
|
||||
public void notifyPhysicalChannelConfigForSubscriber(
|
||||
int subId, List<PhysicalChannelConfig> configs) {
|
||||
try {
|
||||
sRegistry.notifyPhysicalChannelConfigForSubscriber(subId, configs);
|
||||
} catch (RemoteException ex) {
|
||||
// system server crash
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify that the data enabled has changed.
|
||||
*
|
||||
* @param enabled True if data is enabled, otherwise disabled.
|
||||
* @param reason Reason for data enabled/disabled. See {@code REASON_*} in
|
||||
* {@link TelephonyManager}.
|
||||
*/
|
||||
public void notifyDataEnabled(boolean enabled, @TelephonyManager.DataEnabledReason int reason) {
|
||||
try {
|
||||
sRegistry.notifyDataEnabled(enabled, reason);
|
||||
} catch (RemoteException ex) {
|
||||
// system server crash
|
||||
}
|
||||
}
|
||||
|
||||
public @NonNull Set<Integer> getEventsFromListener(@NonNull PhoneStateListener listener) {
|
||||
|
||||
Set<Integer> eventList = new ArraySet<>();
|
||||
|
||||
if (listener instanceof PhoneStateListener.ServiceStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_SERVICE_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.MessageWaitingIndicatorChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_MESSAGE_WAITING_INDICATOR_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.CallForwardingIndicatorChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_CALL_FORWARDING_INDICATOR_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.CellLocationChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_CELL_LOCATION_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.CallStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_CALL_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.DataConnectionStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_DATA_CONNECTION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.DataActivityListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_DATA_ACTIVITY_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.SignalStrengthsChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_SIGNAL_STRENGTHS_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.AlwaysReportedSignalStrengthChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_ALWAYS_REPORTED_SIGNAL_STRENGTH_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.CellInfoChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_CELL_INFO_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.PreciseCallStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_PRECISE_CALL_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.CallDisconnectCauseChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_CALL_DISCONNECT_CAUSE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.ImsCallDisconnectCauseChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_IMS_CALL_DISCONNECT_CAUSE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.PreciseDataConnectionStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_PRECISE_DATA_CONNECTION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.SrvccStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_SRVCC_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.VoiceActivationStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_VOICE_ACTIVATION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.DataActivationStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_DATA_ACTIVATION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.UserMobileDataStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_USER_MOBILE_DATA_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.DisplayInfoChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_DISPLAY_INFO_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.EmergencyNumberListChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_EMERGENCY_NUMBER_LIST_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.OutgoingEmergencyCallListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_OUTGOING_EMERGENCY_CALL);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.OutgoingEmergencySmsListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_OUTGOING_EMERGENCY_SMS);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.PhoneCapabilityChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_PHONE_CAPABILITY_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.ActiveDataSubscriptionIdChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.RadioPowerStateChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_RADIO_POWER_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.CarrierNetworkChangeListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_CARRIER_NETWORK_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.RegistrationFailedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_REGISTRATION_FAILURE);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.CallAttributesChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_CALL_ATTRIBUTES_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.BarringInfoChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_BARRING_INFO_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.PhysicalChannelConfigChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED);
|
||||
}
|
||||
|
||||
if (listener instanceof PhoneStateListener.DataEnabledChangedListener) {
|
||||
eventList.add(PhoneStateListener.EVENT_DATA_ENABLED_CHANGED);
|
||||
}
|
||||
|
||||
return eventList;
|
||||
}
|
||||
|
||||
private @NonNull Set<Integer> getEventsFromBitmask(int eventMask) {
|
||||
|
||||
Set<Integer> eventList = new ArraySet<>();
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_SERVICE_STATE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_SERVICE_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_SIGNAL_STRENGTH) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_SIGNAL_STRENGTH_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_MESSAGE_WAITING_INDICATOR_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_CALL_FORWARDING_INDICATOR_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_CELL_LOCATION) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_CELL_LOCATION_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_CALL_STATE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_CALL_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_DATA_CONNECTION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_DATA_ACTIVITY) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_DATA_ACTIVITY_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_SIGNAL_STRENGTHS_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_ALWAYS_REPORTED_SIGNAL_STRENGTH_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_CELL_INFO) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_CELL_INFO_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_PRECISE_CALL_STATE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_PRECISE_CALL_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_PRECISE_DATA_CONNECTION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_DATA_CONNECTION_REAL_TIME_INFO_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_OEM_HOOK_RAW_EVENT) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_OEM_HOOK_RAW);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_SRVCC_STATE_CHANGED) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_SRVCC_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_CARRIER_NETWORK_CHANGE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_CARRIER_NETWORK_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_VOICE_ACTIVATION_STATE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_VOICE_ACTIVATION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_DATA_ACTIVATION_STATE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_DATA_ACTIVATION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_USER_MOBILE_DATA_STATE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_USER_MOBILE_DATA_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_DISPLAY_INFO_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_PHONE_CAPABILITY_CHANGE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_PHONE_CAPABILITY_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_RADIO_POWER_STATE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_EMERGENCY_NUMBER_LIST_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_CALL_DISCONNECT_CAUSE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_CALL_ATTRIBUTES_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_IMS_CALL_DISCONNECT_CAUSES) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_IMS_CALL_DISCONNECT_CAUSE_CHANGED);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_OUTGOING_EMERGENCY_CALL) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_OUTGOING_EMERGENCY_CALL);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_OUTGOING_EMERGENCY_SMS) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_OUTGOING_EMERGENCY_SMS);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_REGISTRATION_FAILURE) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_REGISTRATION_FAILURE);
|
||||
}
|
||||
|
||||
if ((eventMask & PhoneStateListener.LISTEN_BARRING_INFO) != 0) {
|
||||
eventList.add(PhoneStateListener.EVENT_BARRING_INFO_CHANGED);
|
||||
}
|
||||
return eventList;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener object to receive notification of changes
|
||||
* in specified telephony states.
|
||||
* <p>
|
||||
* To register a listener, pass a {@link PhoneStateListener} which implements
|
||||
* interfaces of events. For example,
|
||||
* FakeServiceStateChangedListener extends {@link PhoneStateListener} implements
|
||||
* {@link PhoneStateListener.ServiceStateChangedListener}.
|
||||
*
|
||||
* At registration, and when a specified telephony state changes, the telephony manager invokes
|
||||
* the appropriate callback method on the listener object and passes the current (updated)
|
||||
* values.
|
||||
* <p>
|
||||
*
|
||||
* If this TelephonyManager object has been created with
|
||||
* {@link TelephonyManager#createForSubscriptionId}, applies to the given subId.
|
||||
* Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}.
|
||||
* To listen events for multiple subIds, pass a separate listener object to
|
||||
* each TelephonyManager object created with {@link TelephonyManager#createForSubscriptionId}.
|
||||
*
|
||||
* Note: if you call this method while in the middle of a binder transaction, you <b>must</b>
|
||||
* call {@link android.os.Binder#clearCallingIdentity()} before calling this method. A
|
||||
* {@link SecurityException} will be thrown otherwise.
|
||||
*
|
||||
* This API should be used sparingly -- large numbers of listeners will cause system
|
||||
* instability. If a process has registered too many listeners without unregistering them, it
|
||||
* may encounter an {@link IllegalStateException} when trying to register more listeners.
|
||||
*
|
||||
* @param listener The {@link PhoneStateListener} object to register.
|
||||
*/
|
||||
public void registerPhoneStateListener(@NonNull @CallbackExecutor Executor executor, int subId,
|
||||
String pkgName, String attributionTag, @NonNull PhoneStateListener listener,
|
||||
boolean notifyNow) {
|
||||
listener.setExecutor(executor);
|
||||
registerPhoneStateListener(subId, pkgName, attributionTag, listener,
|
||||
getEventsFromListener(listener), notifyNow);
|
||||
}
|
||||
|
||||
public void registerPhoneStateListenerWithEvents(int subId, String pkgName,
|
||||
String attributionTag, @NonNull PhoneStateListener listener, int events,
|
||||
boolean notifyNow) {
|
||||
registerPhoneStateListener(
|
||||
subId, pkgName, attributionTag, listener, getEventsFromBitmask(events), notifyNow);
|
||||
}
|
||||
|
||||
private void registerPhoneStateListener(int subId,
|
||||
String pkgName, String attributionTag, @NonNull PhoneStateListener listener,
|
||||
@NonNull Set<Integer> events, boolean notifyNow) {
|
||||
if (listener == null) {
|
||||
throw new IllegalStateException("telephony service is null.");
|
||||
}
|
||||
|
||||
listenWithEventList(subId, pkgName, attributionTag, listener,
|
||||
events.stream().mapToInt(i -> i).toArray(), notifyNow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister an existing {@link PhoneStateListener}.
|
||||
*
|
||||
* @param listener The {@link PhoneStateListener} object to unregister.
|
||||
*/
|
||||
public void unregisterPhoneStateListener(int subId, String pkgName, String attributionTag,
|
||||
@NonNull PhoneStateListener listener,
|
||||
boolean notifyNow) {
|
||||
listenWithEventList(subId, pkgName, attributionTag, listener, new int[0], notifyNow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.telephony.CellInfo;
|
||||
import android.telephony.DataConnectionRealTimeInfo;
|
||||
import android.telephony.TelephonyDisplayInfo;
|
||||
import android.telephony.PhoneCapability;
|
||||
import android.telephony.PhysicalChannelConfig;
|
||||
import android.telephony.PreciseCallState;
|
||||
import android.telephony.PreciseDataConnectionState;
|
||||
import android.telephony.ServiceState;
|
||||
@@ -68,4 +69,6 @@ oneway interface IPhoneStateListener {
|
||||
void onRegistrationFailed(in CellIdentity cellIdentity,
|
||||
String chosenPlmn, int domain, int causeCode, int additionalCauseCode);
|
||||
void onBarringInfoChanged(in BarringInfo barringInfo);
|
||||
void onPhysicalChannelConfigChanged(in List<PhysicalChannelConfig> configs);
|
||||
void onDataEnabledChanged(boolean enabled, int reason);
|
||||
}
|
||||
|
||||
@@ -41,16 +41,8 @@ interface ITelephonyRegistry {
|
||||
IOnSubscriptionsChangedListener callback);
|
||||
void removeOnSubscriptionsChangedListener(String pkg,
|
||||
IOnSubscriptionsChangedListener callback);
|
||||
/**
|
||||
* @deprecated Use {@link #listenWithFeature(String, String, IPhoneStateListener, int,
|
||||
* boolean) instead
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
void listen(String pkg, IPhoneStateListener callback, int events, boolean notifyNow);
|
||||
void listenWithFeature(String pkg, String featureId, IPhoneStateListener callback, int events,
|
||||
boolean notifyNow);
|
||||
void listenForSubscriber(in int subId, String pkg, String featureId,
|
||||
IPhoneStateListener callback, int events, boolean notifyNow);
|
||||
void listenWithEventList(in int subId, String pkg, String featureId,
|
||||
IPhoneStateListener callback, in int[] events, boolean notifyNow);
|
||||
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
||||
void notifyCallStateForAllSubs(int state, String incomingNumber);
|
||||
void notifyCallState(in int phoneId, in int subId, int state, String incomingNumber);
|
||||
@@ -99,4 +91,7 @@ interface ITelephonyRegistry {
|
||||
void notifyRegistrationFailed(int slotIndex, int subId, in CellIdentity cellIdentity,
|
||||
String chosenPlmn, int domain, int causeCode, int additionalCauseCode);
|
||||
void notifyBarringInfoChanged(int slotIndex, int subId, in BarringInfo barringInfo);
|
||||
void notifyPhysicalChannelConfigForSubscriber(in int subId,
|
||||
in List<PhysicalChannelConfig> configs);
|
||||
void notifyDataEnabled(boolean enabled, int reason);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,6 @@ import java.util.Objects;
|
||||
/**
|
||||
* Define capability of a modem group. That is, the capabilities
|
||||
* are shared between those modems defined by list of modem IDs.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class PhoneCapability implements Parcelable {
|
||||
// Hardcoded default DSDS capability.
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.IntRange;
|
||||
import android.annotation.NonNull;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.Annotation.NetworkType;
|
||||
@@ -26,12 +28,10 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public final class PhysicalChannelConfig implements Parcelable {
|
||||
|
||||
// TODO(b/72993578) consolidate these enums in a central location.
|
||||
/** @hide */
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({CONNECTION_PRIMARY_SERVING, CONNECTION_SECONDARY_SERVING, CONNECTION_UNKNOWN})
|
||||
public @interface ConnectionStatus {}
|
||||
@@ -47,7 +47,13 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
public static final int CONNECTION_SECONDARY_SERVING = 2;
|
||||
|
||||
/** Connection status is unknown. */
|
||||
public static final int CONNECTION_UNKNOWN = Integer.MAX_VALUE;
|
||||
public static final int CONNECTION_UNKNOWN = -1;
|
||||
|
||||
/** Channel number is unknown. */
|
||||
public static final int CHANNEL_NUMBER_UNKNOWN = -1;
|
||||
|
||||
/** Physical Cell Id is unknown. */
|
||||
public static final int PHYSICAL_CELL_ID_UNKNOWN = -1;
|
||||
|
||||
/**
|
||||
* Connection status of the cell.
|
||||
@@ -75,7 +81,7 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
private int mFrequencyRange;
|
||||
|
||||
/**
|
||||
* The absolute radio frequency channel number, {@link Integer#MAX_VALUE} if unknown.
|
||||
* The absolute radio frequency channel number, {@link #CHANNEL_NUMBER_UNKNOWN} if unknown.
|
||||
*/
|
||||
private int mChannelNumber;
|
||||
|
||||
@@ -86,7 +92,7 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
private int[] mContextIds;
|
||||
|
||||
/**
|
||||
* The physical cell identifier for this cell - PCI, PSC, {@link Integer#MAX_VALUE} if known.
|
||||
* The physical cell identifier for this cell - PCI, PSC, {@link #PHYSICAL_CELL_ID_UNKNOWN}
|
||||
*/
|
||||
private int mPhysicalCellId;
|
||||
|
||||
@@ -96,7 +102,7 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeInt(mCellConnectionStatus);
|
||||
dest.writeInt(mCellBandwidthDownlinkKhz);
|
||||
dest.writeInt(mRat);
|
||||
@@ -120,6 +126,7 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
* physical channel has no data call mapped to it.
|
||||
*
|
||||
* @return an integer list indicates the data call ids.
|
||||
* @hide
|
||||
*/
|
||||
public int[] getContextIds() {
|
||||
return mContextIds;
|
||||
@@ -131,6 +138,7 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
* @see {@link ServiceState#FREQUENCY_RANGE_MID}
|
||||
* @see {@link ServiceState#FREQUENCY_RANGE_HIGH}
|
||||
* @see {@link ServiceState#FREQUENCY_RANGE_MMWAVE}
|
||||
* @hide
|
||||
*/
|
||||
@ServiceState.FrequencyRange
|
||||
public int getFrequencyRange() {
|
||||
@@ -139,7 +147,7 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
|
||||
/**
|
||||
* @return the absolute radio frequency channel number for this physical channel,
|
||||
* {@link Integer#MAX_VALUE} if unknown.
|
||||
* {@link #CHANNEL_NUMBER_UNKNOWN} if unknown.
|
||||
*/
|
||||
public int getChannelNumber() {
|
||||
return mChannelNumber;
|
||||
@@ -152,18 +160,20 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
* In EUTRAN, this value is physical layer cell identity. The range is [0, 503].
|
||||
* Reference: 3GPP TS 36.211 section 6.11.
|
||||
*
|
||||
* In 5G RAN, this value is physical layer cell identity. The range is [0, 1008].
|
||||
* In 5G RAN, this value is physical layer cell identity. The range is [0, 1007].
|
||||
* Reference: 3GPP TS 38.211 section 7.4.2.1.
|
||||
*
|
||||
* @return the physical cell identifier for this cell, {@link Integer#MAX_VALUE} if unknown.
|
||||
* @return the physical cell identifier for this cell, {@link #PHYSICAL_CELL_ID_UNKNOWN}
|
||||
* if {@link android.telephony.CellInfo#UNAVAILABLE}.
|
||||
*/
|
||||
@IntRange(from = 0, to = 1007)
|
||||
public int getPhysicalCellId() {
|
||||
return mPhysicalCellId;
|
||||
}
|
||||
|
||||
/**The radio technology for this physical channel. */
|
||||
@NetworkType
|
||||
public int getRat() {
|
||||
public int getNetworkType() {
|
||||
return mRat;
|
||||
}
|
||||
|
||||
@@ -181,7 +191,10 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
return mCellConnectionStatus;
|
||||
}
|
||||
|
||||
/** @return String representation of the connection status */
|
||||
/**
|
||||
* @return String representation of the connection status
|
||||
* @hide
|
||||
*/
|
||||
private String getConnectionStatusString() {
|
||||
switch(mCellConnectionStatus) {
|
||||
case CONNECTION_PRIMARY_SERVING:
|
||||
@@ -274,7 +287,10 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
mPhysicalCellId = builder.mPhysicalCellId;
|
||||
}
|
||||
|
||||
/** The builder of {@code PhysicalChannelConfig}. */
|
||||
/**
|
||||
* The builder of {@code PhysicalChannelConfig}.
|
||||
* @hide
|
||||
*/
|
||||
public static final class Builder {
|
||||
private int mRat;
|
||||
private int mFrequencyRange;
|
||||
@@ -284,60 +300,51 @@ public final class PhysicalChannelConfig implements Parcelable {
|
||||
private int[] mContextIds;
|
||||
private int mPhysicalCellId;
|
||||
|
||||
/** @hide */
|
||||
public Builder() {
|
||||
mRat = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
|
||||
mFrequencyRange = ServiceState.FREQUENCY_RANGE_UNKNOWN;
|
||||
mChannelNumber = Integer.MAX_VALUE;
|
||||
mChannelNumber = CHANNEL_NUMBER_UNKNOWN;
|
||||
mCellBandwidthDownlinkKhz = 0;
|
||||
mCellConnectionStatus = CONNECTION_UNKNOWN;
|
||||
mContextIds = new int[0];
|
||||
mPhysicalCellId = Integer.MAX_VALUE;
|
||||
mPhysicalCellId = PHYSICAL_CELL_ID_UNKNOWN;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public PhysicalChannelConfig build() {
|
||||
return new PhysicalChannelConfig(this);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Builder setRat(int rat) {
|
||||
this.mRat = rat;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Builder setFrequencyRange(int frequencyRange) {
|
||||
this.mFrequencyRange = frequencyRange;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Builder setChannelNumber(int channelNumber) {
|
||||
this.mChannelNumber = channelNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Builder setCellBandwidthDownlinkKhz(int cellBandwidthDownlinkKhz) {
|
||||
this.mCellBandwidthDownlinkKhz = cellBandwidthDownlinkKhz;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Builder setCellConnectionStatus(int connectionStatus) {
|
||||
this.mCellConnectionStatus = connectionStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Builder setContextIds(int[] contextIds) {
|
||||
if (contextIds != null) Arrays.sort(contextIds);
|
||||
this.mContextIds = contextIds;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Builder setPhysicalCellId(int physicalCellId) {
|
||||
this.mPhysicalCellId = physicalCellId;
|
||||
return this;
|
||||
|
||||
@@ -124,6 +124,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Consumer;
|
||||
@@ -155,6 +156,7 @@ import java.util.function.Consumer;
|
||||
public class TelephonyManager {
|
||||
private static final String TAG = "TelephonyManager";
|
||||
|
||||
private TelephonyRegistryManager mTelephonyRegistryMgr;
|
||||
/**
|
||||
* To expand the error codes for {@link TelephonyManager#updateAvailableNetworks} and
|
||||
* {@link TelephonyManager#setPreferredOpportunisticDataSubscription}.
|
||||
@@ -5569,8 +5571,7 @@ public class TelephonyManager {
|
||||
//
|
||||
|
||||
/**
|
||||
* Registers a listener object to receive notification of changes
|
||||
* in specified telephony states.
|
||||
* Registers a listener object to receive notification of changes in specified telephony states.
|
||||
* <p>
|
||||
* To register a listener, pass a {@link PhoneStateListener} and specify at least one telephony
|
||||
* state of interest in the events argument.
|
||||
@@ -5580,13 +5581,15 @@ public class TelephonyManager {
|
||||
* values.
|
||||
* <p>
|
||||
* To un-register a listener, pass the listener object and set the events argument to
|
||||
* {@link PhoneStateListener#LISTEN_NONE LISTEN_NONE} (0).
|
||||
* {@link PhoneStateListener#LISTEN_NONE} (0).
|
||||
*
|
||||
* If this TelephonyManager object has been created with {@link #createForSubscriptionId},
|
||||
* applies to the given subId. Otherwise, applies to
|
||||
* {@link SubscriptionManager#getDefaultSubscriptionId()}. To listen events for multiple subIds,
|
||||
* {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}. To listen events for multiple subIds,
|
||||
* pass a separate listener object to each TelephonyManager object created with
|
||||
* {@link #createForSubscriptionId}.
|
||||
* {@link #createForSubscriptionId}. Only {@link PhoneStateListener#LISTEN_CALL_STATE} event can
|
||||
* be used to receive changes for all subIds through
|
||||
* {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}.
|
||||
*
|
||||
* Note: if you call this method while in the middle of a binder transaction, you <b>must</b>
|
||||
* call {@link android.os.Binder#clearCallingIdentity()} before calling this method. A
|
||||
@@ -5596,23 +5599,28 @@ public class TelephonyManager {
|
||||
* instability. If a process has registered too many listeners without unregistering them, it
|
||||
* may encounter an {@link IllegalStateException} when trying to register more listeners.
|
||||
*
|
||||
* @param listener The {@link PhoneStateListener} object to register
|
||||
* (or unregister)
|
||||
* @param events The telephony state(s) of interest to the listener,
|
||||
* as a bitwise-OR combination of {@link PhoneStateListener}
|
||||
* LISTEN_ flags.
|
||||
* @param listener The {@link PhoneStateListener} object to register (or unregister)
|
||||
* @param events The telephony state(s) of interest to the listener, as a bitwise-OR combination
|
||||
* of {@link PhoneStateListener} LISTEN_ flags.
|
||||
* @deprecated Use {@link #registerPhoneStateListener(Executor, PhoneStateListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void listen(PhoneStateListener listener, int events) {
|
||||
if (mContext == null) return;
|
||||
boolean notifyNow = (getITelephony() != null);
|
||||
TelephonyRegistryManager telephonyRegistry =
|
||||
(TelephonyRegistryManager)
|
||||
mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE);
|
||||
if (telephonyRegistry != null) {
|
||||
telephonyRegistry.listenForSubscriber(mSubId, getOpPackageName(), getAttributionTag(),
|
||||
listener, events, notifyNow);
|
||||
if (!listener.isExecutorSet()) {
|
||||
throw new IllegalStateException("PhoneStateListener should be created on a thread "
|
||||
+ "with Looper.myLooper() != null");
|
||||
}
|
||||
boolean notifyNow = getITelephony() != null;
|
||||
mTelephonyRegistryMgr = mContext.getSystemService(TelephonyRegistryManager.class);
|
||||
if (mTelephonyRegistryMgr != null) {
|
||||
if (events != PhoneStateListener.LISTEN_NONE) {
|
||||
mTelephonyRegistryMgr.registerPhoneStateListenerWithEvents(mSubId,
|
||||
getOpPackageName(), getAttributionTag(), listener, events, notifyNow);
|
||||
} else {
|
||||
unregisterPhoneStateListener(listener);
|
||||
}
|
||||
} else {
|
||||
Rlog.w(TAG, "telephony registry not ready.");
|
||||
throw new IllegalStateException("telephony service is null.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14593,4 +14601,71 @@ public class TelephonyManager {
|
||||
e.execute(() -> callback.onAuthenticationFailure(GBA_FAILURE_REASON_FEATURE_NOT_READY));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener object to receive notification of changes in specified telephony states.
|
||||
* <p>
|
||||
* To register a listener, pass a {@link PhoneStateListener} which implements
|
||||
* interfaces of events. For example,
|
||||
* FakeServiceStateChangedListener extends {@link PhoneStateListener} implements
|
||||
* {@link PhoneStateListener.ServiceStateChangedListener}.
|
||||
*
|
||||
* At registration, and when a specified telephony state changes, the telephony manager invokes
|
||||
* the appropriate callback method on the listener object and passes the current (updated)
|
||||
* values.
|
||||
* <p>
|
||||
*
|
||||
* If this TelephonyManager object has been created with {@link #createForSubscriptionId},
|
||||
* applies to the given subId. Otherwise, applies to
|
||||
* {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}. To listen events for multiple subIds,
|
||||
* pass a separate listener object to each TelephonyManager object created with
|
||||
* {@link #createForSubscriptionId}. Only {@link PhoneStateListener.CallStateChangedListener}
|
||||
* can be used to receive changes for all subIds through
|
||||
* {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}.
|
||||
*
|
||||
* Note: if you call this method while in the middle of a binder transaction, you <b>must</b>
|
||||
* call {@link android.os.Binder#clearCallingIdentity()} before calling this method. A
|
||||
* {@link SecurityException} will be thrown otherwise.
|
||||
*
|
||||
* This API should be used sparingly -- large numbers of listeners will cause system
|
||||
* instability. If a process has registered too many listeners without unregistering them, it
|
||||
* may encounter an {@link IllegalStateException} when trying to register more listeners.
|
||||
*
|
||||
* @param executor The executor of where the callback will execute.
|
||||
* @param listener The {@link PhoneStateListener} object to register.
|
||||
*/
|
||||
public void registerPhoneStateListener(@NonNull @CallbackExecutor Executor executor,
|
||||
@NonNull PhoneStateListener listener) {
|
||||
if (executor == null || listener == null) {
|
||||
throw new IllegalArgumentException("PhoneStateListener and executor must be non-null");
|
||||
}
|
||||
mTelephonyRegistryMgr = (TelephonyRegistryManager)
|
||||
mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE);
|
||||
if (mTelephonyRegistryMgr != null) {
|
||||
mTelephonyRegistryMgr.registerPhoneStateListener(executor, mSubId,
|
||||
getOpPackageName(), getAttributionTag(), listener, getITelephony() != null);
|
||||
} else {
|
||||
throw new IllegalStateException("telephony service is null.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister an existing {@link PhoneStateListener}.
|
||||
*
|
||||
* @param listener The {@link PhoneStateListener} object to unregister.
|
||||
*/
|
||||
public void unregisterPhoneStateListener(@NonNull PhoneStateListener listener) {
|
||||
|
||||
if (mContext == null) {
|
||||
throw new IllegalStateException("telephony service is null.");
|
||||
}
|
||||
|
||||
mTelephonyRegistryMgr = mContext.getSystemService(TelephonyRegistryManager.class);
|
||||
if (mTelephonyRegistryMgr != null) {
|
||||
mTelephonyRegistryMgr.unregisterPhoneStateListener(mSubId, getOpPackageName(),
|
||||
getAttributionTag(), listener, getITelephony() != null);
|
||||
} else {
|
||||
throw new IllegalStateException("telephony service is null.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user