Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cebecc64 authored by Hall Liu's avatar Hall Liu
Browse files

Expose onEmergencyNumberListChanged, semantics change

Expose the onEmergencyNumberListChanged method, which seems to have been
left hidden inadvertently when introduced.

Add a new version of onOutgoingEmergencyCall that supplies a
subscription ID and deprecate the old one. Along with this, send
emergency call events from any subscription to all listeners regardless
of which subscription the listener specified.

Test: atest CtsTelecomTestCases:OutgoingCallTest
Bug: 162647577
bug: 165660452
Change-Id: Ia0e10bfb3376ff82d03a6dbc4bf71c22b0ace366
parent 1633cc69
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47836,6 +47836,7 @@ package android.telephony {
    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 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 public void onMessageWaitingIndicatorChanged(boolean);
    method @RequiresPermission("android.permission.MODIFY_PHONE_STATE") public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
+2 −1
Original line number Diff line number Diff line
@@ -10816,7 +10816,8 @@ package android.telephony {
  public class PhoneStateListener {
    method public void onCallAttributesChanged(@NonNull android.telephony.CallAttributes);
    method public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber);
    method @Deprecated public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber);
    method public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber, int);
    method public void onOutgoingEmergencySms(@NonNull android.telephony.emergency.EmergencyNumber);
    method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onPreciseCallStateChanged(@NonNull android.telephony.PreciseCallState);
    method public void onRadioPowerStateChanged(int);
+2 −1
Original line number Diff line number Diff line
@@ -4071,7 +4071,8 @@ package android.telephony {
  }

  public class PhoneStateListener {
    method public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber);
    method @Deprecated public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber);
    method public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber, int);
    method public void onOutgoingEmergencySms(@NonNull android.telephony.emergency.EmergencyNumber);
    field @RequiresPermission("android.permission.READ_ACTIVE_EMERGENCY_SESSION") public static final int LISTEN_OUTGOING_EMERGENCY_CALL = 268435456; // 0x10000000
    field @RequiresPermission("android.permission.READ_ACTIVE_EMERGENCY_SESSION") public static final int LISTEN_OUTGOING_EMERGENCY_SMS = 536870912; // 0x20000000
+42 −4
Original line number Diff line number Diff line
@@ -938,7 +938,6 @@ public class PhoneStateListener {
     *                           {@link SubscriptionManager#getDefaultSubscriptionId})
     *                           and the value as the list of {@link EmergencyNumber};
     *                           null if this information is not available.
     * @hide
     */
    public void onEmergencyNumberListChanged(
            @NonNull Map<Integer, List<EmergencyNumber>> emergencyNumberList) {
@@ -948,16 +947,49 @@ public class PhoneStateListener {
    /**
     * Callback invoked when an outgoing call is placed to an emergency number.
     *
     * @param placedEmergencyNumber the emergency number {@link EmergencyNumber} the call is placed
     *                              to.
     * This method will be called when an emergency call is placed on any subscription (including
     * the no-SIM case), regardless of which subscription this listener was registered on.
     *
     * This method is deprecated. Both this method and the new
     * {@link #onOutgoingEmergencyCall(EmergencyNumber, int)} will be called when an outgoing
     * emergency call is placed.
     *
     * @param placedEmergencyNumber The {@link EmergencyNumber} the emergency call was placed to.
     *
     * @deprecated Use {@link #onOutgoingEmergencyCall(EmergencyNumber, int)}.
     * @hide
     */
    @SystemApi
    @TestApi
    @Deprecated
    public void onOutgoingEmergencyCall(@NonNull EmergencyNumber placedEmergencyNumber) {
        // default implementation empty
    }

    /**
     * Callback invoked when an outgoing call is placed to an emergency number.
     *
     * This method will be called when an emergency call is placed on any subscription (including
     * the no-SIM case), regardless of which subscription this listener was registered on.
     *
     * Both this method and the deprecated {@link #onOutgoingEmergencyCall(EmergencyNumber)} will be
     * called when an outgoing emergency call is placed. You should only implement one of these
     * methods.
     *
     * @param placedEmergencyNumber The {@link EmergencyNumber} the emergency call was placed to.
     * @param subscriptionId The subscription ID used to place the emergency call. If the
     *                       emergency call was placed without a valid subscription (e.g. when there
     *                       are no SIM cards in the device), this will be equal to
     *                       {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}.
     *
     * @hide
     */
    @SystemApi
    @TestApi
    public void onOutgoingEmergencyCall(@NonNull EmergencyNumber placedEmergencyNumber,
            int subscriptionId) {
    }

    /**
     * Callback invoked when an outgoing SMS is placed to an emergency number.
     *
@@ -1336,13 +1368,19 @@ public class PhoneStateListener {
                            () -> psl.onEmergencyNumberListChanged(emergencyNumberList)));
        }

        public void onOutgoingEmergencyCall(@NonNull EmergencyNumber placedEmergencyNumber) {
        public void onOutgoingEmergencyCall(@NonNull EmergencyNumber placedEmergencyNumber,
                int subscriptionId) {
            PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
            if (psl == null) return;

            Binder.withCleanCallingIdentity(
                    () -> mExecutor.execute(
                            () -> psl.onOutgoingEmergencyCall(placedEmergencyNumber)));

            Binder.withCleanCallingIdentity(
                    () -> mExecutor.execute(
                            () -> psl.onOutgoingEmergencyCall(placedEmergencyNumber,
                                    subscriptionId)));
        }

        public void onOutgoingEmergencySms(@NonNull EmergencyNumber sentEmergencyNumber) {
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ oneway interface IPhoneStateListener {
    void onRadioPowerStateChanged(in int state);
    void onCallAttributesChanged(in CallAttributes callAttributes);
    void onEmergencyNumberListChanged(in Map emergencyNumberList);
    void onOutgoingEmergencyCall(in EmergencyNumber placedEmergencyNumber);
    void onOutgoingEmergencyCall(in EmergencyNumber placedEmergencyNumber, int subscriptionId);
    void onOutgoingEmergencySms(in EmergencyNumber sentEmergencyNumber);
    void onCallDisconnectCauseChanged(in int disconnectCause, in int preciseDisconnectCause);
    void onImsCallDisconnectCauseChanged(in ImsReasonInfo imsReasonInfo);
Loading