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

Commit 6c946443 authored by Nagendra Prasad Nagarle Basavaraju's avatar Nagendra Prasad Nagarle Basavaraju
Browse files

Flagging requirement for notifyDataActivitychanged

Flagging requirement ref topic:
https://googleplex-android-review.git.corp.google.com/q/topic:%22clear_dataactivity_onsimremoval%22

Bug: 309896936
Test: atest FrameworksTelephonyTests & CtsTelephonyTestCases
Change-Id: I1900e2525452aafc754c759bac683dfd28de8fb2
parent 8de19adc
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -487,19 +487,35 @@ public class TelephonyRegistryManager {
        }
    }

    /**
     * Notify changes to activity state changes on certain subscription.
     *
     * @param subId for which data activity state changed.
     * @param dataActivityType indicates the latest data activity type e.g. {@link
     * TelephonyManager#DATA_ACTIVITY_IN}
     */
    public void notifyDataActivityChanged(int subId, @DataActivityType int dataActivityType) {
        try {
            sRegistry.notifyDataActivityForSubscriber(subId, dataActivityType);
        } catch (RemoteException ex) {
            // system process is dead
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * Notify changes to activity state changes on certain subscription.
     *
     * @param slotIndex for which data activity changed. Can be derived from subId except
     * when subId is invalid.
     * @param subId for which data activity state changed.
     * @param dataActivityType indicates the latest data activity type e.g, {@link
     * @param dataActivityType indicates the latest data activity type e.g. {@link
     * TelephonyManager#DATA_ACTIVITY_IN}
     */
    public void notifyDataActivityChanged(int slotIndex, int subId,
            @DataActivityType int dataActivityType) {
        try {
            sRegistry.notifyDataActivityForSubscriber(slotIndex, subId, dataActivityType);
            sRegistry.notifyDataActivityForSubscriberWithSlot(slotIndex, subId, dataActivityType);
        } catch (RemoteException ex) {
            // system process is dead
            throw ex.rethrowFromSystemServer();
+2 −1
Original line number Diff line number Diff line
@@ -60,7 +60,8 @@ interface ITelephonyRegistry {
    @UnsupportedAppUsage(maxTargetSdk = 28)
    void notifyCallForwardingChanged(boolean cfi);
    void notifyCallForwardingChangedForSubscriber(in int subId, boolean cfi);
    void notifyDataActivityForSubscriber(int phoneId, int subId, int state);
    void notifyDataActivityForSubscriber(int subId, int state);
    void notifyDataActivityForSubscriberWithSlot(int phoneId, int subId, int state);
    void notifyDataConnectionForSubscriber(
            int phoneId, int subId, in PreciseDataConnectionState preciseState);
    // Uses CellIdentity which is Parcelable here; will convert to CellLocation in client.
+36 −2
Original line number Diff line number Diff line
@@ -2096,16 +2096,50 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
    /**
     * Send a notification to registrants about the data activity state.
     *
     * @param phoneId the phoneId carrying the data connection
     * @param subId the subscriptionId for the data connection
     * @param state indicates the latest data activity type
     * e.g.,{@link TelephonyManager#DATA_ACTIVITY_IN}
     *
     */
    public void notifyDataActivityForSubscriber(int phoneId, int subId, int state) {

    public void notifyDataActivityForSubscriber(int subId, int state) {
        if (!checkNotifyPermission("notifyDataActivity()")) {
            return;
        }
        int phoneId = getPhoneIdFromSubId(subId);
        synchronized (mRecords) {
            if (validatePhoneId(phoneId)) {
                mDataActivity[phoneId] = state;
                for (Record r : mRecords) {
                    // Notify by correct subId.
                    if (r.matchTelephonyCallbackEvent(
                            TelephonyCallback.EVENT_DATA_ACTIVITY_CHANGED)
                            && idMatch(r, subId, phoneId)) {
                        try {
                            r.callback.onDataActivity(state);
                        } catch (RemoteException ex) {
                            mRemoveList.add(r.binder);
                        }
                    }
                }
            }
            handleRemoveListLocked();
        }
    }

    /**
     * Send a notification to registrants about the data activity state.
     *
     * @param phoneId the phoneId carrying the data connection
     * @param subId the subscriptionId for the data connection
     * @param state indicates the latest data activity type
     * e.g.,{@link TelephonyManager#DATA_ACTIVITY_IN}
     *
     */
    public void notifyDataActivityForSubscriberWithSlot(int phoneId, int subId, int state) {
        if (!checkNotifyPermission("notifyDataActivityWithSlot()")) {
            return;
        }

        synchronized (mRecords) {
            if (validatePhoneId(phoneId)) {