Merge "[Telephony] PhoneStateListener redesign for new event"

This commit is contained in:
Zoey Chen
2020-11-18 05:13:47 +00:00
committed by Android (Google) Code Review
10 changed files with 2462 additions and 570 deletions

View File

@@ -46188,6 +46188,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);
@@ -46256,10 +46262,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>);
@@ -46267,36 +46273,144 @@ 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.AlwaysReportedSignalStrengthsChangedListener {
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.PhysicalChannelConfigChangedListener {
method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onPhysicalChannelConfigChanged(@NonNull java.util.List<android.telephony.PhysicalChannelConfig>);
}
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 {
@@ -46805,7 +46919,8 @@ package android.telephony {
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
method public boolean isWorldPhone();
method @Deprecated public void listen(android.telephony.PhoneStateListener, int);
method public void listen(long, @NonNull android.telephony.PhoneStateListener);
method @Deprecated public void listen(long, @NonNull android.telephony.PhoneStateListener);
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);
@@ -46827,6 +46942,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";

View File

@@ -10340,35 +10340,83 @@ 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 public void onPhysicalChannelConfigurationChanged(@NonNull java.util.List<android.telephony.PhysicalChannelConfig>);
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.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final long LISTEN_PHYSICAL_CHANNEL_CONFIGURATION = 4294967296L; // 0x100000000L
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 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 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.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

View File

@@ -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, long 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();
@@ -771,13 +777,349 @@ public class TelephonyRegistryManager {
* @param subId the subId
* @param configs a list of {@link PhysicalChannelConfig}, the configs of physical channel.
*/
public void notifyPhysicalChannelConfigurationForSubscriber(
public void notifyPhysicalChannelConfigForSubscriber(
int subId, List<PhysicalChannelConfig> configs) {
try {
sRegistry.notifyPhysicalChannelConfigurationForSubscriber(subId, configs);
sRegistry.notifyPhysicalChannelConfigForSubscriber(subId, configs);
} 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.AlwaysReportedSignalStrengthsChangedListener) {
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) {
registerPhoneStateListener(executor, subId, pkgName, attributionTag, listener,
getEventsFromListener(listener), notifyNow);
}
public void registerPhoneStateListenerWithEvents(int subId, String pkgName,
String attributionTag, @NonNull PhoneStateListener listener, int events,
boolean notifyNow) {
if (Looper.myLooper() == null) {
Looper.prepare();
}
registerPhoneStateListener(new HandlerExecutor(new Handler(Looper.myLooper())),
subId, pkgName, attributionTag, listener, getEventsFromBitmask(events), notifyNow);
}
private void registerPhoneStateListener(@NonNull @CallbackExecutor Executor executor, 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.");
}
listener.setExecutor(executor);
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);
}
}

View File

@@ -69,6 +69,6 @@ oneway interface IPhoneStateListener {
void onRegistrationFailed(in CellIdentity cellIdentity,
String chosenPlmn, int domain, int causeCode, int additionalCauseCode);
void onBarringInfoChanged(in BarringInfo barringInfo);
void onPhysicalChannelConfigurationChanged(in List<PhysicalChannelConfig> configs);
void onPhysicalChannelConfigChanged(in List<PhysicalChannelConfig> configs);
void onDataEnabledChanged(boolean enabled, int reason);
}

View File

@@ -41,16 +41,10 @@ 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, long events,
boolean notifyNow);
void listenForSubscriber(in int subId, String pkg, String featureId,
IPhoneStateListener callback, long 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,6 +93,6 @@ 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 notifyPhysicalChannelConfigurationForSubscriber(in int subId,
void notifyPhysicalChannelConfigForSubscriber(in int subId,
in List<PhysicalChannelConfig> configs);
}

File diff suppressed because it is too large Load Diff

View File

@@ -29,7 +29,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.

View File

@@ -29,10 +29,6 @@ import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.Objects;
/**
* @hide
*/
@SystemApi
public final class PhysicalChannelConfig implements Parcelable {
// TODO(b/72993578) consolidate these enums in a central location.
@@ -86,7 +82,7 @@ public final class PhysicalChannelConfig implements Parcelable {
private int mFrequencyRange;
/**
* The absolute radio frequency channel number, {@link CHANNEL_NUMBER_UNKNOWN} if unknown.
* The absolute radio frequency channel number, {@link #CHANNEL_NUMBER_UNKNOWN} if unknown.
*/
private int mChannelNumber;
@@ -97,7 +93,7 @@ public final class PhysicalChannelConfig implements Parcelable {
private int[] mContextIds;
/**
* The physical cell identifier for this cell - PCI, PSC, {@link PHYSICAL_CELL_ID_UNKNOWN}
* The physical cell identifier for this cell - PCI, PSC, {@link #PHYSICAL_CELL_ID_UNKNOWN}
* if unknown.
*/
private int mPhysicalCellId;
@@ -153,7 +149,7 @@ public final class PhysicalChannelConfig implements Parcelable {
/**
* @return the absolute radio frequency channel number for this physical channel,
* {@link CHANNEL_NUMBER_UNKNOWN} if unknown.
* {@link #CHANNEL_NUMBER_UNKNOWN} if unknown.
*/
public int getChannelNumber() {
return mChannelNumber;
@@ -169,7 +165,7 @@ public final class PhysicalChannelConfig implements Parcelable {
* 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 PHYSICAL_CELL_ID_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)

View File

@@ -123,6 +123,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;
@@ -154,6 +155,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}.
@@ -5593,12 +5595,22 @@ public class TelephonyManager {
* @param events The telephony state(s) of interest to the listener,
* as a bitwise-OR combination of {@link PhoneStateListener}
* LISTEN_ flags.
* @deprecated use {@link #listen(long, PhoneStateListener) instead due to the event number
* limit increased to 64.
* @deprecated Use {@link #registerPhoneStateListener(Executor, PhoneStateListener)}.
*/
@Deprecated
public void listen(PhoneStateListener listener, int events) {
listen(events, listener);
boolean notifyNow = getITelephony() != null;
mTelephonyRegistryMgr = mContext.getSystemService(TelephonyRegistryManager.class);
if (mTelephonyRegistryMgr != null) {
if (events != PhoneStateListener.LISTEN_NONE) {
mTelephonyRegistryMgr.registerPhoneStateListenerWithEvents(getSubId(),
getOpPackageName(), getAttributionTag(), listener, events, notifyNow);
} else {
unregisterPhoneStateListener(listener);
}
} else {
throw new IllegalStateException("telephony service is null.");
}
}
/**
@@ -5634,18 +5646,21 @@ public class TelephonyManager {
* LISTEN_ flags.
* @param listener The {@link PhoneStateListener} object to register
* (or unregister)
* @deprecated Use {@link #registerPhoneStateListener(Executor, PhoneStateListener)}.
*/
@Deprecated
public void listen(long events, @NonNull PhoneStateListener listener) {
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);
mTelephonyRegistryMgr = mContext.getSystemService(TelephonyRegistryManager.class);
if (mTelephonyRegistryMgr != null) {
if (events != PhoneStateListener.LISTEN_NONE) {
mTelephonyRegistryMgr.registerPhoneStateListenerWithEvents(getSubId(),
getOpPackageName(), getAttributionTag(), listener,
Long.valueOf(events).intValue(), getITelephony() != null);
} else {
unregisterPhoneStateListener(listener);
}
} else {
Rlog.w(TAG, "telephony registry not ready.");
throw new IllegalStateException("telephony service is null.");
}
}
@@ -14178,4 +14193,70 @@ public class TelephonyManager {
return Collections.emptyList();
}
/**
* 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#getDefaultSubscriptionId()}. To listen events for multiple subIds,
* pass a separate listener object to each TelephonyManager object created with
* {@link #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 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 IllegalStateException("telephony service is null.");
}
mTelephonyRegistryMgr = (TelephonyRegistryManager)
mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE);
if (mTelephonyRegistryMgr != null) {
mTelephonyRegistryMgr.registerPhoneStateListener(executor, getSubId(),
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(getSubId(), getOpPackageName(),
getAttributionTag(), listener, getITelephony() != null);
} else {
throw new IllegalStateException("telephony service is null.");
}
}
}