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

Commit cfa8c4b3 authored by Sarah Chin's avatar Sarah Chin Committed by Automerger Merge Worker
Browse files

Merge "Update unthrottleApn calls to take in DataProfile" am: fa2dc0b7

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1934667

Change-Id: Ib72ac511f9919fc212d7e6958328c55d3760f24f
parents cadcd9c2 fa2dc0b7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12520,6 +12520,7 @@ package android.telephony.data {
    method public final int getSlotIndex();
    method public final void notifyApnUnthrottled(@NonNull String);
    method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
    method public final void notifyDataProfileUnthrottled(@NonNull android.telephony.data.DataProfile);
    method public void requestDataCallList(@NonNull android.telephony.data.DataServiceCallback);
    method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @NonNull android.telephony.data.DataServiceCallback);
    method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @NonNull android.telephony.data.DataServiceCallback);
@@ -12530,6 +12531,7 @@ package android.telephony.data {
  public class DataServiceCallback {
    method public void onApnUnthrottled(@NonNull String);
    method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>);
    method public void onDataProfileUnthrottled(@NonNull android.telephony.data.DataProfile);
    method public void onDeactivateDataCallComplete(int);
    method public void onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>);
    method public void onSetDataProfileComplete(int);
+29 −2
Original line number Diff line number Diff line
@@ -401,6 +401,21 @@ public abstract class DataService extends Service {
            }
        }

        /**
         * Notify the system that a given DataProfile was unthrottled.
         *
         * @param dataProfile DataProfile associated with an APN returned from the modem
         */
        public final void notifyDataProfileUnthrottled(@NonNull DataProfile dataProfile) {
            synchronized (mApnUnthrottledCallbacks) {
                for (IDataServiceCallback callback : mApnUnthrottledCallbacks) {
                    mHandler.obtainMessage(DATA_SERVICE_INDICATION_APN_UNTHROTTLED,
                            mSlotIndex, 0, new ApnUnthrottledIndication(dataProfile,
                                    callback)).sendToTarget();
                }
            }
        }

        /**
         * Called when the instance of data service is destroyed (e.g. got unbind or binder died)
         * or when the data service provider is removed. The extended class should implement this
@@ -496,13 +511,20 @@ public abstract class DataService extends Service {
    }

    private static final class ApnUnthrottledIndication {
        public final DataProfile dataProfile;
        public final String apn;
        public final IDataServiceCallback callback;
        ApnUnthrottledIndication(String apn,
                IDataServiceCallback callback) {
            this.dataProfile = null;
            this.apn = apn;
            this.callback = callback;
        }
        ApnUnthrottledIndication(DataProfile dataProfile, IDataServiceCallback callback) {
            this.dataProfile = dataProfile;
            this.apn = null;
            this.callback = callback;
        }
    }

    private class DataServiceHandler extends Handler {
@@ -636,8 +658,13 @@ public abstract class DataService extends Service {
                    ApnUnthrottledIndication apnUnthrottledIndication =
                            (ApnUnthrottledIndication) message.obj;
                    try {
                        if (apnUnthrottledIndication.dataProfile != null) {
                            apnUnthrottledIndication.callback
                                    .onDataProfileUnthrottled(apnUnthrottledIndication.dataProfile);
                        } else {
                            apnUnthrottledIndication.callback
                                    .onApnUnthrottled(apnUnthrottledIndication.apn);
                        }
                    } catch (RemoteException e) {
                        loge("Failed to call onApnUnthrottled. " + e);
                    }
+25 −2
Original line number Diff line number Diff line
@@ -260,8 +260,8 @@ public class DataServiceCallback {

    /**
     * Unthrottles the APN on the current transport.  There is no matching "APN throttle" method.
     * Instead, the APN is throttled for the time specified in
     * {@link DataCallResponse#getRetryDurationMillis}.
     * Instead, the APN is throttled when {@link IDataService#setupDataCall} fails within
     * the time specified by {@link DataCallResponse#getRetryDurationMillis}.
     * <p/>
     * see: {@link DataCallResponse#getRetryDurationMillis}
     *
@@ -279,4 +279,27 @@ public class DataServiceCallback {
            Rlog.e(TAG, "onApnUnthrottled: callback is null!");
        }
    }

    /**
     * Unthrottles the DataProfile on the current transport.
     * There is no matching "DataProfile throttle" method.
     * Instead, the DataProfile is throttled when {@link IDataService#setupDataCall} fails within
     * the time specified by {@link DataCallResponse#getRetryDurationMillis}.
     * <p/>
     * see: {@link DataCallResponse#getRetryDurationMillis}
     *
     * @param dataProfile DataProfile containing the APN to be throttled
     */
    public void onDataProfileUnthrottled(final @NonNull DataProfile dataProfile) {
        if (mCallback != null) {
            try {
                if (DBG) Rlog.d(TAG, "onDataProfileUnthrottled");
                mCallback.onDataProfileUnthrottled(dataProfile);
            } catch (RemoteException e) {
                Rlog.e(TAG, "onDataProfileUnthrottled: remote exception", e);
            }
        } else {
            Rlog.e(TAG, "onDataProfileUnthrottled: callback is null!");
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telephony.data;

import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;

/**
 * The call back interface
@@ -33,4 +34,5 @@ oneway interface IDataServiceCallback
    void onHandoverStarted(int result);
    void onHandoverCancelled(int result);
    void onApnUnthrottled(in String apn);
    void onDataProfileUnthrottled(in DataProfile dp);
}