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

Commit 71c471f0 authored by yongnamcha's avatar yongnamcha
Browse files

API review : Updates the API for CallbackMode for call and SMS

This commit updates the API for CallbackMode for Call and SMS according
to the API council review.
API review comment:
1. subId should be spelled out in full as subscriptionId in method
   calls.
2. The EmergencyCallbackModeListener methods shouldn’t require
   permissions, it’s expected that only the registration method has
   the permission. The extra annotations can confuse the API.

Bug: 376118639
Test: atest CtsTelephonyTestCases:TelephonyCallbackTest,
      atest CtsTelephonyTestCases:TelephonyRegistryManagerTest
Test: atest TelephonyRegistryTest, atest DefaultPhoneNotifierTest
Flag: com.android.internal.telephony.flags.emergency_callback_mode_notification

Change-Id: I51d62c6c8a555c8c8fb05d9186e1324bfd0a3bb2
parent cd4bc44f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -15585,9 +15585,9 @@ package android.telephony {
  }
  @FlaggedApi("com.android.internal.telephony.flags.emergency_callback_mode_notification") public static interface TelephonyCallback.EmergencyCallbackModeListener {
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void onCallbackModeRestarted(int, @NonNull java.time.Duration, int);
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void onCallbackModeStarted(int, @NonNull java.time.Duration, int);
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void onCallbackModeStopped(int, int, int);
    method public void onCallbackModeRestarted(int, @NonNull java.time.Duration, int);
    method public void onCallbackModeStarted(int, @NonNull java.time.Duration, int);
    method public void onCallbackModeStopped(int, int, int);
  }
  public static interface TelephonyCallback.LinkCapacityEstimateChangedListener {
+12 −15
Original line number Diff line number Diff line
@@ -1715,11 +1715,10 @@ public class TelephonyCallback {
         * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_SMS
         *
         * @param timerDuration is the time remaining in the emergency callback mode.
         * @param subId The subscription ID used to start the emergency callback mode.
         * @param subscriptionId The subscription ID used to start the emergency callback mode.
         */
        @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
        void onCallbackModeStarted(@TelephonyManager.EmergencyCallbackModeType int type,
                @NonNull Duration timerDuration, int subId);
                @NonNull Duration timerDuration, int subscriptionId);

        /**
         * Indicates that emergency callback mode has been re-started.
@@ -1734,11 +1733,10 @@ public class TelephonyCallback {
         * @see TelephonyManager#EMERGENCY_CALLBACK_MODE_SMS
         *
         * @param timerDuration is the time remaining in the emergency callback mode.
         * @param subId The subscription ID used to restart the emergency callback mode.
         * @param subscriptionId The subscription ID used to restart the emergency callback mode.
         */
        @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
        void onCallbackModeRestarted(@TelephonyManager.EmergencyCallbackModeType int type,
                @NonNull Duration timerDuration, int subId);
                @NonNull Duration timerDuration, int subscriptionId);

        /**
         * Indicates that emergency callback mode has been stopped.
@@ -1759,11 +1757,10 @@ public class TelephonyCallback {
         * @see TelephonyManager#STOP_REASON_TIMER_EXPIRED
         * @see TelephonyManager#STOP_REASON_USER_ACTION
         *
         * @param subId is the current subscription used the emergency callback mode.
         * @param subscriptionId is the current subscription used the emergency callback mode.
         */
        @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
        void onCallbackModeStopped(@TelephonyManager.EmergencyCallbackModeType int type,
                @TelephonyManager.EmergencyCallbackModeStopReason int reason, int subId);
                @TelephonyManager.EmergencyCallbackModeStopReason int reason, int subscriptionId);
    }

    /**
@@ -2192,7 +2189,7 @@ public class TelephonyCallback {

        @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
        public void onCallbackModeStarted(@TelephonyManager.EmergencyCallbackModeType int type,
                long durationMillis, int subId) {
                long durationMillis, int subscriptionId) {
            if (!Flags.emergencyCallbackModeNotification()) return;

            EmergencyCallbackModeListener listener =
@@ -2203,12 +2200,12 @@ public class TelephonyCallback {
            final Duration timerDuration = Duration.ofMillis(durationMillis);
            Binder.withCleanCallingIdentity(
                    () -> mExecutor.execute(() -> listener.onCallbackModeStarted(type,
                            timerDuration, subId)));
                            timerDuration, subscriptionId)));
        }

        @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
        public void onCallbackModeRestarted(@TelephonyManager.EmergencyCallbackModeType int type,
                long durationMillis, int subId) {
                long durationMillis, int subscriptionId) {
            if (!Flags.emergencyCallbackModeNotification()) return;

            EmergencyCallbackModeListener listener =
@@ -2219,12 +2216,12 @@ public class TelephonyCallback {
            final Duration timerDuration = Duration.ofMillis(durationMillis);
            Binder.withCleanCallingIdentity(
                    () -> mExecutor.execute(() -> listener.onCallbackModeRestarted(type,
                            timerDuration, subId)));
                            timerDuration, subscriptionId)));
        }

        @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
        public void onCallbackModeStopped(@TelephonyManager.EmergencyCallbackModeType int type,
                @TelephonyManager.EmergencyCallbackModeStopReason int reason, int subId) {
                @TelephonyManager.EmergencyCallbackModeStopReason int reason, int subscriptionId) {
            if (!Flags.emergencyCallbackModeNotification()) return;

            EmergencyCallbackModeListener listener =
@@ -2235,7 +2232,7 @@ public class TelephonyCallback {

            Binder.withCleanCallingIdentity(
                    () -> mExecutor.execute(() -> listener.onCallbackModeStopped(type, reason,
                            subId)));
                            subscriptionId)));
        }

        public void onCarrierRoamingNtnModeChanged(boolean active) {