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

Commit 8cf76249 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[satellite] Added onCarrierRoamingNtnAvailableServicesChanged callback" into main

parents 28d9721d 76fb5581
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1701,6 +1701,11 @@ public class PhoneStateListener {
        public final void onCarrierRoamingNtnEligibleStateChanged(boolean eligible) {
            // not supported on the deprecated interface - Use TelephonyCallback instead
        }

        public final void onCarrierRoamingNtnAvailableServicesChanged(
                @NetworkRegistrationInfo.ServiceType int[] availableServices) {
            // not supported on the deprecated interface - Use TelephonyCallback instead
        }
    }

    private void log(String s) {
+39 −1
Original line number Diff line number Diff line
@@ -680,6 +680,20 @@ public class TelephonyCallback {
     */
    public static final int EVENT_CARRIER_ROAMING_NTN_ELIGIBLE_STATE_CHANGED = 43;

    /**
     * Event for listening to changes in carrier roaming non-terrestrial network available services
     * via callback onCarrierRoamingNtnAvailableServicesChanged().
     * This callback is triggered when the available services provided by the carrier roaming
     * satellite changes. The carrier roaming satellite is defined by the following conditions.
     * <ul>
     * <li>Subscription supports attaching to satellite which is defined by
     * {@link CarrierConfigManager#KEY_SATELLITE_ATTACH_SUPPORTED_BOOL} </li>
     * </ul>
     *
     * @hide
     */
    public static final int EVENT_CARRIER_ROAMING_NTN_AVAILABLE_SERVICES_CHANGED = 44;

    /**
     * @hide
     */
@@ -726,7 +740,8 @@ public class TelephonyCallback {
            EVENT_EMERGENCY_CALLBACK_MODE_CHANGED,
            EVENT_SIMULTANEOUS_CELLULAR_CALLING_SUBSCRIPTIONS_CHANGED,
            EVENT_CARRIER_ROAMING_NTN_MODE_CHANGED,
            EVENT_CARRIER_ROAMING_NTN_ELIGIBLE_STATE_CHANGED
            EVENT_CARRIER_ROAMING_NTN_ELIGIBLE_STATE_CHANGED,
            EVENT_CARRIER_ROAMING_NTN_AVAILABLE_SERVICES_CHANGED
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface TelephonyEvent {
@@ -1784,6 +1799,15 @@ public class TelephonyCallback {
         * </ul>
         */
        default void onCarrierRoamingNtnEligibleStateChanged(boolean eligible) {}

        /**
         * Callback invoked when carrier roaming non-terrestrial network available
         * service changes.
         *
         * @param availableServices The list of the supported services.
         */
        default void onCarrierRoamingNtnAvailableServicesChanged(
                @NetworkRegistrationInfo.ServiceType List<Integer> availableServices) {}
    }

    /**
@@ -2235,5 +2259,19 @@ public class TelephonyCallback {
            Binder.withCleanCallingIdentity(() -> mExecutor.execute(
                    () -> listener.onCarrierRoamingNtnEligibleStateChanged(eligible)));
        }

        public void onCarrierRoamingNtnAvailableServicesChanged(
                @NetworkRegistrationInfo.ServiceType int[] availableServices) {
            if (!Flags.carrierRoamingNbIotNtn()) return;

            CarrierRoamingNtnModeListener listener =
                    (CarrierRoamingNtnModeListener) mTelephonyCallbackWeakRef.get();
            if (listener == null) return;

            List<Integer> ServiceList = Arrays.stream(availableServices).boxed()
                    .collect(Collectors.toList());
            Binder.withCleanCallingIdentity(() -> mExecutor.execute(
                    () -> listener.onCarrierRoamingNtnAvailableServicesChanged(ServiceList)));
        }
    }
}
+16 −4
Original line number Diff line number Diff line
@@ -1117,6 +1117,21 @@ public class TelephonyRegistryManager {
        }
    }

    /**
     * Notify external listeners that carrier roaming non-terrestrial available services changed.
     * @param availableServices The list of the supported services.
     * @hide
     */
    public void notifyCarrierRoamingNtnAvailableServicesChanged(
            int subId, @NetworkRegistrationInfo.ServiceType int[] availableServices) {
        try {
            sRegistry.notifyCarrierRoamingNtnAvailableServicesChanged(subId, availableServices);
        } catch (RemoteException ex) {
            // system server crash
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * Processes potential event changes from the provided {@link TelephonyCallback}.
     *
@@ -1272,12 +1287,9 @@ public class TelephonyRegistryManager {

        if (telephonyCallback instanceof TelephonyCallback.CarrierRoamingNtnModeListener) {
            eventList.add(TelephonyCallback.EVENT_CARRIER_ROAMING_NTN_MODE_CHANGED);
        }

        if (telephonyCallback instanceof TelephonyCallback.CarrierRoamingNtnModeListener) {
            eventList.add(TelephonyCallback.EVENT_CARRIER_ROAMING_NTN_ELIGIBLE_STATE_CHANGED);
            eventList.add(TelephonyCallback.EVENT_CARRIER_ROAMING_NTN_AVAILABLE_SERVICES_CHANGED);
        }

        return eventList;
    }

+1 −0
Original line number Diff line number Diff line
@@ -84,4 +84,5 @@ oneway interface IPhoneStateListener {
    void onSimultaneousCallingStateChanged(in int[] subIds);
    void onCarrierRoamingNtnModeChanged(in boolean active);
    void onCarrierRoamingNtnEligibleStateChanged(in boolean eligible);
    void onCarrierRoamingNtnAvailableServicesChanged(in int[] availableServices);
}
+1 −0
Original line number Diff line number Diff line
@@ -123,4 +123,5 @@ interface ITelephonyRegistry {
    void notifyCallbackModeStopped(int phoneId, int subId, int type, int reason);
    void notifyCarrierRoamingNtnModeChanged(int subId, in boolean active);
    void notifyCarrierRoamingNtnEligibleStateChanged(int subId, in boolean eligible);
    void notifyCarrierRoamingNtnAvailableServicesChanged(int subId, in int[] availableServices);
}
Loading