Loading core/java/android/telephony/PhoneStateListener.java +14 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; import android.telephony.Annotation.SrvccState; import android.telephony.TelephonyManager.DataEnabledReason; import android.telephony.TelephonyManager.EmergencyCallbackModeStopReason; import android.telephony.TelephonyManager.EmergencyCallbackModeType; import android.telephony.emergency.EmergencyNumber; import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.MediaQualityStatus; Loading Loading @@ -1304,8 +1306,6 @@ public class PhoneStateListener { // default implementation empty } /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. Loading Loading @@ -1669,6 +1669,18 @@ public class PhoneStateListener { public final void onMediaQualityStatusChanged(MediaQualityStatus mediaQualityStatus) { // not support. Can't override. Use TelephonyCallback. } /** @hide */ public final void onCallBackModeStarted( @TelephonyManager.EmergencyCallbackModeType int type) { // not support. Can't override. Use TelephonyCallback. } /** @hide */ public final void onCallBackModeStopped(@EmergencyCallbackModeType int type, @EmergencyCallbackModeStopReason int reason) { // not support. Can't override. Use TelephonyCallback. } } private void log(String s) { Loading core/java/android/telephony/TelephonyCallback.java +85 −1 Original line number Diff line number Diff line Loading @@ -612,6 +612,20 @@ public class TelephonyCallback { @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_MEDIA_QUALITY_STATUS_CHANGED = 39; /** * Event for changes to the Emergency callback mode * * <p>Requires permission {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} * * @see EmergencyCallbackModeListener#onCallbackModeStarted(int) * @see EmergencyCallbackModeListener#onCallbackModeStopped(int, int) * * @hide */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int EVENT_EMERGENCY_CALLBACK_MODE_CHANGED = 40; /** * @hide */ Loading Loading @@ -654,7 +668,8 @@ public class TelephonyCallback { EVENT_LEGACY_CALL_STATE_CHANGED, EVENT_LINK_CAPACITY_ESTIMATE_CHANGED, EVENT_TRIGGER_NOTIFY_ANBR, EVENT_MEDIA_QUALITY_STATUS_CHANGED EVENT_MEDIA_QUALITY_STATUS_CHANGED, EVENT_EMERGENCY_CALLBACK_MODE_CHANGED }) @Retention(RetentionPolicy.SOURCE) public @interface TelephonyEvent { Loading Loading @@ -1567,6 +1582,53 @@ public class TelephonyCallback { void onMediaQualityStatusChanged(@NonNull MediaQualityStatus mediaQualityStatus); } /** * Interface for emergency callback mode listener. * * @hide */ public interface EmergencyCallbackModeListener { /** * Indicates that Callback Mode has been started. * <p> * This method will be called when an emergency sms/emergency call is sent * and the callback mode is supported by the carrier. * If an emergency SMS is transmitted during callback mode for SMS, this API will be called * once again with TelephonyManager#EMERGENCY_CALLBACK_MODE_SMS. * * @param type for callback mode entry * See {@link TelephonyManager.EmergencyCallbackModeType}. * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_CALL * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_SMS */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) void onCallBackModeStarted(@TelephonyManager.EmergencyCallbackModeType int type); /** * Indicates that Callback Mode has been stopped. * <p> * This method will be called when the callback mode timer expires or when * a normal call/SMS is sent * * @param type for callback mode entry * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_CALL * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_SMS * * @param reason for changing callback mode * * @see TelephonyManager#STOP_REASON_UNKNOWN * @see TelephonyManager#STOP_REASON_OUTGOING_NORMAL_CALL_INITIATED * @see TelephonyManager#STOP_REASON_NORMAL_SMS_SENT * @see TelephonyManager#STOP_REASON_OUTGOING_EMERGENCY_CALL_INITIATED * @see TelephonyManager#STOP_REASON_EMERGENCY_SMS_SENT * @see TelephonyManager#STOP_REASON_TIMER_EXPIRED * @see TelephonyManager#STOP_REASON_USER_ACTION */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) void onCallBackModeStopped(@TelephonyManager.EmergencyCallbackModeType int type, @TelephonyManager.EmergencyCallbackModeStopReason int reason); } /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. Loading Loading @@ -1935,5 +1997,27 @@ public class TelephonyCallback { () -> mExecutor.execute(() -> listener.onMediaQualityStatusChanged( mediaQualityStatus))); } public void onCallBackModeStarted(@TelephonyManager.EmergencyCallbackModeType int type) { EmergencyCallbackModeListener listener = (EmergencyCallbackModeListener) mTelephonyCallbackWeakRef.get(); Log.d(LOG_TAG, "onCallBackModeStarted:type=" + type + ", listener=" + listener); if (listener == null) return; Binder.withCleanCallingIdentity( () -> mExecutor.execute(() -> listener.onCallBackModeStarted(type))); } public void onCallBackModeStopped(@TelephonyManager.EmergencyCallbackModeType int type, @TelephonyManager.EmergencyCallbackModeStopReason int reason) { EmergencyCallbackModeListener listener = (EmergencyCallbackModeListener) mTelephonyCallbackWeakRef.get(); Log.d(LOG_TAG, "onCallBackModeStopped:type=" + type + ", reason=" + reason + ", listener=" + listener); if (listener == null) return; Binder.withCleanCallingIdentity( () -> mExecutor.execute(() -> listener.onCallBackModeStopped(type, reason))); } } } core/java/android/telephony/TelephonyRegistryManager.java +44 −0 Original line number Diff line number Diff line Loading @@ -1113,6 +1113,11 @@ public class TelephonyRegistryManager { eventList.add(TelephonyCallback.EVENT_MEDIA_QUALITY_STATUS_CHANGED); } if (telephonyCallback instanceof TelephonyCallback.EmergencyCallbackModeListener) { eventList.add(TelephonyCallback.EVENT_EMERGENCY_CALLBACK_MODE_CHANGED); } return eventList; } Loading Loading @@ -1539,4 +1544,43 @@ public class TelephonyRegistryManager { throw re.rethrowFromSystemServer(); } } /** * Notify Callback Mode has been started. * @param phoneId Sender phone ID. * @param subId Sender subscription ID. * @param type for callback mode entry. * See {@link TelephonyManager.EmergencyCallbackModeType}. */ public void notifyCallBackModeStarted(int phoneId, int subId, @TelephonyManager.EmergencyCallbackModeType int type) { try { Log.d(TAG, "notifyCallBackModeStarted:type=" + type); sRegistry.notifyCallbackModeStarted(phoneId, subId, type); } catch (RemoteException ex) { // system process is dead throw ex.rethrowFromSystemServer(); } } /** * Notify Callback Mode has been stopped. * @param phoneId Sender phone ID. * @param subId Sender subscription ID. * @param type for callback mode entry. * See {@link TelephonyManager.EmergencyCallbackModeType}. * @param reason for changing callback mode. * See {@link TelephonyManager.EmergencyCallbackModeStopReason}. */ public void notifyCallbackModeStopped(int phoneId, int subId, @TelephonyManager.EmergencyCallbackModeType int type, @TelephonyManager.EmergencyCallbackModeStopReason int reason) { try { Log.d(TAG, "notifyCallbackModeStopped:type=" + type + ", reason=" + reason); sRegistry.notifyCallbackModeStopped(phoneId, subId, type, reason); } catch (RemoteException ex) { // system process is dead throw ex.rethrowFromSystemServer(); } } } core/java/com/android/internal/telephony/IPhoneStateListener.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -78,4 +78,6 @@ oneway interface IPhoneStateListener { void onAllowedNetworkTypesChanged(in int reason, in long allowedNetworkType); void onLinkCapacityEstimateChanged(in List<LinkCapacityEstimate> linkCapacityEstimateList); void onMediaQualityStatusChanged(in MediaQualityStatus mediaQualityStatus); void onCallBackModeStarted(int type); void onCallBackModeStopped(int type, int reason); } core/java/com/android/internal/telephony/ITelephonyRegistry.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -117,4 +117,7 @@ interface ITelephonyRegistry { String pkg, String featureId); void removeCarrierConfigChangeListener(ICarrierConfigChangeListener listener, String pkg); void notifyCarrierConfigChanged(int phoneId, int subId, int carrierId, int specificCarrierId); void notifyCallbackModeStarted(int phoneId, int subId, int type); void notifyCallbackModeStopped(int phoneId, int subId, int type, int reason); } Loading
core/java/android/telephony/PhoneStateListener.java +14 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; import android.telephony.Annotation.SrvccState; import android.telephony.TelephonyManager.DataEnabledReason; import android.telephony.TelephonyManager.EmergencyCallbackModeStopReason; import android.telephony.TelephonyManager.EmergencyCallbackModeType; import android.telephony.emergency.EmergencyNumber; import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.MediaQualityStatus; Loading Loading @@ -1304,8 +1306,6 @@ public class PhoneStateListener { // default implementation empty } /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. Loading Loading @@ -1669,6 +1669,18 @@ public class PhoneStateListener { public final void onMediaQualityStatusChanged(MediaQualityStatus mediaQualityStatus) { // not support. Can't override. Use TelephonyCallback. } /** @hide */ public final void onCallBackModeStarted( @TelephonyManager.EmergencyCallbackModeType int type) { // not support. Can't override. Use TelephonyCallback. } /** @hide */ public final void onCallBackModeStopped(@EmergencyCallbackModeType int type, @EmergencyCallbackModeStopReason int reason) { // not support. Can't override. Use TelephonyCallback. } } private void log(String s) { Loading
core/java/android/telephony/TelephonyCallback.java +85 −1 Original line number Diff line number Diff line Loading @@ -612,6 +612,20 @@ public class TelephonyCallback { @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int EVENT_MEDIA_QUALITY_STATUS_CHANGED = 39; /** * Event for changes to the Emergency callback mode * * <p>Requires permission {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} * * @see EmergencyCallbackModeListener#onCallbackModeStarted(int) * @see EmergencyCallbackModeListener#onCallbackModeStopped(int, int) * * @hide */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final int EVENT_EMERGENCY_CALLBACK_MODE_CHANGED = 40; /** * @hide */ Loading Loading @@ -654,7 +668,8 @@ public class TelephonyCallback { EVENT_LEGACY_CALL_STATE_CHANGED, EVENT_LINK_CAPACITY_ESTIMATE_CHANGED, EVENT_TRIGGER_NOTIFY_ANBR, EVENT_MEDIA_QUALITY_STATUS_CHANGED EVENT_MEDIA_QUALITY_STATUS_CHANGED, EVENT_EMERGENCY_CALLBACK_MODE_CHANGED }) @Retention(RetentionPolicy.SOURCE) public @interface TelephonyEvent { Loading Loading @@ -1567,6 +1582,53 @@ public class TelephonyCallback { void onMediaQualityStatusChanged(@NonNull MediaQualityStatus mediaQualityStatus); } /** * Interface for emergency callback mode listener. * * @hide */ public interface EmergencyCallbackModeListener { /** * Indicates that Callback Mode has been started. * <p> * This method will be called when an emergency sms/emergency call is sent * and the callback mode is supported by the carrier. * If an emergency SMS is transmitted during callback mode for SMS, this API will be called * once again with TelephonyManager#EMERGENCY_CALLBACK_MODE_SMS. * * @param type for callback mode entry * See {@link TelephonyManager.EmergencyCallbackModeType}. * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_CALL * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_SMS */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) void onCallBackModeStarted(@TelephonyManager.EmergencyCallbackModeType int type); /** * Indicates that Callback Mode has been stopped. * <p> * This method will be called when the callback mode timer expires or when * a normal call/SMS is sent * * @param type for callback mode entry * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_CALL * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_SMS * * @param reason for changing callback mode * * @see TelephonyManager#STOP_REASON_UNKNOWN * @see TelephonyManager#STOP_REASON_OUTGOING_NORMAL_CALL_INITIATED * @see TelephonyManager#STOP_REASON_NORMAL_SMS_SENT * @see TelephonyManager#STOP_REASON_OUTGOING_EMERGENCY_CALL_INITIATED * @see TelephonyManager#STOP_REASON_EMERGENCY_SMS_SENT * @see TelephonyManager#STOP_REASON_TIMER_EXPIRED * @see TelephonyManager#STOP_REASON_USER_ACTION */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) void onCallBackModeStopped(@TelephonyManager.EmergencyCallbackModeType int type, @TelephonyManager.EmergencyCallbackModeStopReason int reason); } /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. Loading Loading @@ -1935,5 +1997,27 @@ public class TelephonyCallback { () -> mExecutor.execute(() -> listener.onMediaQualityStatusChanged( mediaQualityStatus))); } public void onCallBackModeStarted(@TelephonyManager.EmergencyCallbackModeType int type) { EmergencyCallbackModeListener listener = (EmergencyCallbackModeListener) mTelephonyCallbackWeakRef.get(); Log.d(LOG_TAG, "onCallBackModeStarted:type=" + type + ", listener=" + listener); if (listener == null) return; Binder.withCleanCallingIdentity( () -> mExecutor.execute(() -> listener.onCallBackModeStarted(type))); } public void onCallBackModeStopped(@TelephonyManager.EmergencyCallbackModeType int type, @TelephonyManager.EmergencyCallbackModeStopReason int reason) { EmergencyCallbackModeListener listener = (EmergencyCallbackModeListener) mTelephonyCallbackWeakRef.get(); Log.d(LOG_TAG, "onCallBackModeStopped:type=" + type + ", reason=" + reason + ", listener=" + listener); if (listener == null) return; Binder.withCleanCallingIdentity( () -> mExecutor.execute(() -> listener.onCallBackModeStopped(type, reason))); } } }
core/java/android/telephony/TelephonyRegistryManager.java +44 −0 Original line number Diff line number Diff line Loading @@ -1113,6 +1113,11 @@ public class TelephonyRegistryManager { eventList.add(TelephonyCallback.EVENT_MEDIA_QUALITY_STATUS_CHANGED); } if (telephonyCallback instanceof TelephonyCallback.EmergencyCallbackModeListener) { eventList.add(TelephonyCallback.EVENT_EMERGENCY_CALLBACK_MODE_CHANGED); } return eventList; } Loading Loading @@ -1539,4 +1544,43 @@ public class TelephonyRegistryManager { throw re.rethrowFromSystemServer(); } } /** * Notify Callback Mode has been started. * @param phoneId Sender phone ID. * @param subId Sender subscription ID. * @param type for callback mode entry. * See {@link TelephonyManager.EmergencyCallbackModeType}. */ public void notifyCallBackModeStarted(int phoneId, int subId, @TelephonyManager.EmergencyCallbackModeType int type) { try { Log.d(TAG, "notifyCallBackModeStarted:type=" + type); sRegistry.notifyCallbackModeStarted(phoneId, subId, type); } catch (RemoteException ex) { // system process is dead throw ex.rethrowFromSystemServer(); } } /** * Notify Callback Mode has been stopped. * @param phoneId Sender phone ID. * @param subId Sender subscription ID. * @param type for callback mode entry. * See {@link TelephonyManager.EmergencyCallbackModeType}. * @param reason for changing callback mode. * See {@link TelephonyManager.EmergencyCallbackModeStopReason}. */ public void notifyCallbackModeStopped(int phoneId, int subId, @TelephonyManager.EmergencyCallbackModeType int type, @TelephonyManager.EmergencyCallbackModeStopReason int reason) { try { Log.d(TAG, "notifyCallbackModeStopped:type=" + type + ", reason=" + reason); sRegistry.notifyCallbackModeStopped(phoneId, subId, type, reason); } catch (RemoteException ex) { // system process is dead throw ex.rethrowFromSystemServer(); } } }
core/java/com/android/internal/telephony/IPhoneStateListener.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -78,4 +78,6 @@ oneway interface IPhoneStateListener { void onAllowedNetworkTypesChanged(in int reason, in long allowedNetworkType); void onLinkCapacityEstimateChanged(in List<LinkCapacityEstimate> linkCapacityEstimateList); void onMediaQualityStatusChanged(in MediaQualityStatus mediaQualityStatus); void onCallBackModeStarted(int type); void onCallBackModeStopped(int type, int reason); }
core/java/com/android/internal/telephony/ITelephonyRegistry.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -117,4 +117,7 @@ interface ITelephonyRegistry { String pkg, String featureId); void removeCarrierConfigChangeListener(ICarrierConfigChangeListener listener, String pkg); void notifyCarrierConfigChanged(int phoneId, int subId, int carrierId, int specificCarrierId); void notifyCallbackModeStarted(int phoneId, int subId, int type); void notifyCallbackModeStopped(int phoneId, int subId, int type, int reason); }