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

Commit a2d39751 authored by Hunsuk Choi's avatar Hunsuk Choi Committed by Android (Google) Code Review
Browse files

Merge "Update APIs for DomainSelectionService" into main

parents 163ee65a 912a5ca0
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -14188,12 +14188,12 @@ package android.telephony {
    method @NonNull public android.telephony.DataThrottlingRequest.Builder setDataThrottlingAction(int);
  }
  @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public class DomainSelectionService extends android.app.Service {
  @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public abstract class DomainSelectionService extends android.app.Service {
    ctor public DomainSelectionService();
    method public void onBarringInfoUpdated(int, int, @NonNull android.telephony.BarringInfo);
    method @Nullable public android.os.IBinder onBind(@Nullable android.content.Intent);
    method @Nullable public final android.os.IBinder onBind(@Nullable android.content.Intent);
    method @NonNull public java.util.concurrent.Executor onCreateExecutor();
    method public void onDomainSelection(@NonNull android.telephony.DomainSelectionService.SelectionAttributes, @NonNull android.telephony.TransportSelectorCallback);
    method public abstract void onDomainSelection(@NonNull android.telephony.DomainSelectionService.SelectionAttributes, @NonNull android.telephony.TransportSelectorCallback);
    method public void onServiceStateUpdated(int, int, @NonNull android.telephony.ServiceState);
    field public static final int SCAN_TYPE_FULL_SERVICE = 2; // 0x2
    field public static final int SCAN_TYPE_LIMITED_SERVICE = 1; // 0x1
@@ -14207,7 +14207,7 @@ package android.telephony {
    method @Nullable public android.net.Uri getAddress();
    method @Nullable public String getCallId();
    method public int getCsDisconnectCause();
    method @Nullable public android.telephony.EmergencyRegResult getEmergencyRegResult();
    method @Nullable public android.telephony.EmergencyRegistrationResult getEmergencyRegistrationResult();
    method @Nullable public android.telephony.ims.ImsReasonInfo getPsDisconnectCause();
    method public int getSelectorType();
    method public int getSlotIndex();
@@ -14223,13 +14223,13 @@ package android.telephony {
  @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final class DomainSelectionService.SelectionAttributes.Builder {
    ctor public DomainSelectionService.SelectionAttributes.Builder(int, int, int);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes build();
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setAddress(@NonNull android.net.Uri);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setCallId(@NonNull String);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setAddress(@Nullable android.net.Uri);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setCallId(@Nullable String);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setCsDisconnectCause(int);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setEmergency(boolean);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setEmergencyRegResult(@NonNull android.telephony.EmergencyRegResult);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setEmergencyRegistrationResult(@Nullable android.telephony.EmergencyRegistrationResult);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setExitedFromAirplaneMode(boolean);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setPsDisconnectCause(@NonNull android.telephony.ims.ImsReasonInfo);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setPsDisconnectCause(@Nullable android.telephony.ims.ImsReasonInfo);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setTestEmergencyNumber(boolean);
    method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setVideoCall(boolean);
  }
@@ -14239,7 +14239,7 @@ package android.telephony {
    method public void reselectDomain(@NonNull android.telephony.DomainSelectionService.SelectionAttributes);
  }
  @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public final class EmergencyRegResult implements android.os.Parcelable {
  @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public final class EmergencyRegistrationResult implements android.os.Parcelable {
    method public int describeContents();
    method public int getAccessNetwork();
    method @NonNull public String getCountryIso();
@@ -14252,7 +14252,7 @@ package android.telephony {
    method public boolean isEmcBearerSupported();
    method public boolean isVopsSupported();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.EmergencyRegResult> CREATOR;
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.EmergencyRegistrationResult> CREATOR;
  }
  public final class ImsiEncryptionInfo implements android.os.Parcelable {
@@ -15324,7 +15324,7 @@ package android.telephony {
  @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public interface WwanSelectorCallback {
    method public void onDomainSelected(int, boolean);
    method public void onRequestEmergencyNetworkScan(@NonNull java.util.List<java.lang.Integer>, int, boolean, @NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<android.telephony.EmergencyRegResult>);
    method public void onRequestEmergencyNetworkScan(@NonNull java.util.List<java.lang.Integer>, int, boolean, @NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<android.telephony.EmergencyRegistrationResult>);
  }
}
+32 −29
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ import java.util.function.Consumer;
 */
@SystemApi
@FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE)
public class DomainSelectionService extends Service {
public abstract class DomainSelectionService extends Service {

    private static final String LOG_TAG = "DomainSelectionService";

@@ -152,7 +152,7 @@ public class DomainSelectionService extends Service {
        private boolean mIsExitedFromAirplaneMode;
        private @Nullable ImsReasonInfo mImsReasonInfo;
        private @PreciseDisconnectCauses int mCause;
        private @Nullable EmergencyRegResult mEmergencyRegResult;
        private @Nullable EmergencyRegistrationResult mEmergencyRegistrationResult;

        /**
         * @param slotIndex The logical slot index.
@@ -172,7 +172,7 @@ public class DomainSelectionService extends Service {
                @Nullable Uri address, @SelectorType int selectorType,
                boolean video, boolean emergency, boolean isTest, boolean exited,
                @Nullable ImsReasonInfo imsReasonInfo, @PreciseDisconnectCauses int cause,
                @Nullable EmergencyRegResult regResult) {
                @Nullable EmergencyRegistrationResult regResult) {
            mSlotIndex = slotIndex;
            mSubId = subscriptionId;
            mCallId = callId;
@@ -184,7 +184,7 @@ public class DomainSelectionService extends Service {
            mIsExitedFromAirplaneMode = exited;
            mImsReasonInfo = imsReasonInfo;
            mCause = cause;
            mEmergencyRegResult = regResult;
            mEmergencyRegistrationResult = regResult;
        }

        /**
@@ -204,7 +204,7 @@ public class DomainSelectionService extends Service {
            mIsExitedFromAirplaneMode = s.mIsExitedFromAirplaneMode;
            mImsReasonInfo = s.mImsReasonInfo;
            mCause = s.mCause;
            mEmergencyRegResult = s.mEmergencyRegResult;
            mEmergencyRegistrationResult = s.mEmergencyRegistrationResult;
        }

        /**
@@ -296,8 +296,8 @@ public class DomainSelectionService extends Service {
        /**
         * @return The current registration state of cellular network.
         */
        public @Nullable EmergencyRegResult getEmergencyRegResult() {
            return mEmergencyRegResult;
        public @Nullable EmergencyRegistrationResult getEmergencyRegistrationResult() {
            return mEmergencyRegistrationResult;
        }

        @Override
@@ -313,7 +313,7 @@ public class DomainSelectionService extends Service {
                    + ", airplaneMode=" + mIsExitedFromAirplaneMode
                    + ", reasonInfo=" + mImsReasonInfo
                    + ", cause=" + mCause
                    + ", regResult=" + mEmergencyRegResult
                    + ", regResult=" + mEmergencyRegistrationResult
                    + " }";
        }

@@ -331,14 +331,15 @@ public class DomainSelectionService extends Service {
                    && mIsExitedFromAirplaneMode == that.mIsExitedFromAirplaneMode
                    && equalsHandlesNulls(mImsReasonInfo, that.mImsReasonInfo)
                    && mCause == that.mCause
                    && equalsHandlesNulls(mEmergencyRegResult, that.mEmergencyRegResult);
                    && equalsHandlesNulls(mEmergencyRegistrationResult,
                            that.mEmergencyRegistrationResult);
        }

        @Override
        public int hashCode() {
            return Objects.hash(mCallId, mAddress, mImsReasonInfo,
                    mIsVideoCall, mIsEmergency, mIsTestEmergencyNumber, mIsExitedFromAirplaneMode,
                    mEmergencyRegResult, mSlotIndex, mSubId, mSelectorType, mCause);
                    mEmergencyRegistrationResult, mSlotIndex, mSubId, mSelectorType, mCause);
        }

        @Override
@@ -359,7 +360,7 @@ public class DomainSelectionService extends Service {
            out.writeBoolean(mIsExitedFromAirplaneMode);
            out.writeParcelable(mImsReasonInfo, 0);
            out.writeInt(mCause);
            out.writeParcelable(mEmergencyRegResult, 0);
            out.writeParcelable(mEmergencyRegistrationResult, 0);
        }

        private void readFromParcel(@NonNull Parcel in) {
@@ -376,8 +377,9 @@ public class DomainSelectionService extends Service {
            mImsReasonInfo = in.readParcelable(ImsReasonInfo.class.getClassLoader(),
                    android.telephony.ims.ImsReasonInfo.class);
            mCause = in.readInt();
            mEmergencyRegResult = in.readParcelable(EmergencyRegResult.class.getClassLoader(),
                    EmergencyRegResult.class);
            mEmergencyRegistrationResult = in.readParcelable(
                    EmergencyRegistrationResult.class.getClassLoader(),
                    EmergencyRegistrationResult.class);
        }

        public static final @NonNull Creator<SelectionAttributes> CREATOR =
@@ -413,7 +415,7 @@ public class DomainSelectionService extends Service {
            private boolean mIsExitedFromAirplaneMode;
            private @Nullable ImsReasonInfo mImsReasonInfo;
            private @PreciseDisconnectCauses int mCause;
            private @Nullable EmergencyRegResult mEmergencyRegResult;
            private @Nullable EmergencyRegistrationResult mEmergencyRegistrationResult;

            /**
             * Default constructor for Builder.
@@ -430,7 +432,7 @@ public class DomainSelectionService extends Service {
             * @param callId The call identifier.
             * @return The same instance of the builder.
             */
            public @NonNull Builder setCallId(@NonNull String callId) {
            public @NonNull Builder setCallId(@Nullable String callId) {
                mCallId = callId;
                return this;
            }
@@ -441,7 +443,7 @@ public class DomainSelectionService extends Service {
             * @param address The dialed address.
             * @return The same instance of the builder.
             */
            public @NonNull Builder setAddress(@NonNull Uri address) {
            public @NonNull Builder setAddress(@Nullable Uri address) {
                mAddress = address;
                return this;
            }
@@ -497,7 +499,7 @@ public class DomainSelectionService extends Service {
             * @param info The reason why the last PS attempt failed.
             * @return The same instance of the builder.
             */
            public @NonNull Builder setPsDisconnectCause(@NonNull ImsReasonInfo info) {
            public @NonNull Builder setPsDisconnectCause(@Nullable ImsReasonInfo info) {
                mImsReasonInfo = info;
                return this;
            }
@@ -519,8 +521,9 @@ public class DomainSelectionService extends Service {
             * @param regResult The current registration result for emergency services.
             * @return The same instance of the builder.
             */
            public @NonNull Builder setEmergencyRegResult(@NonNull EmergencyRegResult regResult) {
                mEmergencyRegResult = regResult;
            public @NonNull Builder setEmergencyRegistrationResult(
                    @Nullable EmergencyRegistrationResult regResult) {
                mEmergencyRegistrationResult = regResult;
                return this;
            }

@@ -532,7 +535,7 @@ public class DomainSelectionService extends Service {
                return new SelectionAttributes(mSlotIndex, mSubId, mCallId, mAddress,
                        mSelectorType, mIsVideoCall, mIsEmergency, mIsTestEmergencyNumber,
                        mIsExitedFromAirplaneMode, mImsReasonInfo,
                        mCause, mEmergencyRegResult);
                        mCause, mEmergencyRegistrationResult);
            }
        }
    }
@@ -697,7 +700,7 @@ public class DomainSelectionService extends Service {
        public void onRequestEmergencyNetworkScan(@NonNull List<Integer> preferredNetworks,
                @EmergencyScanType int scanType, boolean resetScan,
                @NonNull CancellationSignal signal,
                @NonNull Consumer<EmergencyRegResult> consumer) {
                @NonNull Consumer<EmergencyRegistrationResult> consumer) {
            try {
                if (signal != null) signal.setOnCancelListener(this);
                mResultCallback = new IWwanSelectorResultCallbackAdapter(consumer, mExecutor);
@@ -721,17 +724,18 @@ public class DomainSelectionService extends Service {

        private class IWwanSelectorResultCallbackAdapter
                extends IWwanSelectorResultCallback.Stub {
            private final @NonNull Consumer<EmergencyRegResult> mConsumer;
            private final @NonNull Consumer<EmergencyRegistrationResult> mConsumer;
            private final @NonNull Executor mExecutor;

            IWwanSelectorResultCallbackAdapter(@NonNull Consumer<EmergencyRegResult> consumer,
            IWwanSelectorResultCallbackAdapter(
                    @NonNull Consumer<EmergencyRegistrationResult> consumer,
                    @NonNull Executor executor) {
                mConsumer = consumer;
                mExecutor = executor;
            }

            @Override
            public void onComplete(@NonNull EmergencyRegResult result) {
            public void onComplete(@NonNull EmergencyRegistrationResult result) {
                if (mConsumer == null) return;

                executeMethodAsyncNoException(mExecutor,
@@ -759,9 +763,8 @@ public class DomainSelectionService extends Service {
     * @param attr Required to determine the domain.
     * @param callback The callback instance being registered.
     */
    public void onDomainSelection(@NonNull SelectionAttributes attr,
            @NonNull TransportSelectorCallback callback) {
    }
    public abstract void onDomainSelection(@NonNull SelectionAttributes attr,
            @NonNull TransportSelectorCallback callback);

    /**
     * Notifies the change in {@link ServiceState} for a specific logical slot index.
@@ -836,7 +839,7 @@ public class DomainSelectionService extends Service {

    /** @hide */
    @Override
    public @Nullable IBinder onBind(@Nullable Intent intent) {
    public final @Nullable IBinder onBind(@Nullable Intent intent) {
        if (intent == null) return null;
        if (SERVICE_INTERFACE.equals(intent.getAction())) {
            Log.i(LOG_TAG, "DomainSelectionService Bound.");
@@ -863,7 +866,7 @@ public class DomainSelectionService extends Service {
     * @return {@link Executor} instance.
     * @hide
     */
    public @NonNull Executor getCachedExecutor() {
    public final @NonNull Executor getCachedExecutor() {
        synchronized (mExecutorLock) {
            if (mExecutor == null) {
                Executor e = onCreateExecutor();
+1 −1
Original line number Diff line number Diff line
@@ -16,4 +16,4 @@

package android.telephony;

parcelable EmergencyRegResult;
parcelable EmergencyRegistrationResult;
+18 −18
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ import java.util.Objects;
 */
@SystemApi
@FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE)
public final class EmergencyRegResult implements Parcelable {
public final class EmergencyRegistrationResult implements Parcelable {

    /**
     * Indicates the cellular network type of the acquired system.
@@ -101,7 +101,7 @@ public final class EmergencyRegResult implements Parcelable {
     * @param iso The ISO-3166-1 alpha-2 country code equivalent, empty string if unknown.
     * @hide
     */
    public EmergencyRegResult(
    public EmergencyRegistrationResult(
            @AccessNetworkConstants.RadioAccessNetworkType int accessNetwork,
            @NetworkRegistrationInfo.RegistrationState int regState,
            @NetworkRegistrationInfo.Domain int domain,
@@ -125,7 +125,7 @@ public final class EmergencyRegResult implements Parcelable {
     * @param s Source emergency scan result
     * @hide
     */
    public EmergencyRegResult(@NonNull EmergencyRegResult s) {
    public EmergencyRegistrationResult(@NonNull EmergencyRegistrationResult s) {
        mAccessNetworkType = s.mAccessNetworkType;
        mRegState = s.mRegState;
        mDomain = s.mDomain;
@@ -139,9 +139,9 @@ public final class EmergencyRegResult implements Parcelable {
    }

    /**
     * Construct a EmergencyRegResult object from the given parcel.
     * Construct a EmergencyRegistrationResult object from the given parcel.
     */
    private EmergencyRegResult(@NonNull Parcel in) {
    private EmergencyRegistrationResult(@NonNull Parcel in) {
        readFromParcel(in);
    }

@@ -258,7 +258,7 @@ public final class EmergencyRegResult implements Parcelable {
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        EmergencyRegResult that = (EmergencyRegResult) o;
        EmergencyRegistrationResult that = (EmergencyRegistrationResult) o;
        return mAccessNetworkType == that.mAccessNetworkType
                && mRegState == that.mRegState
                && mDomain == that.mDomain
@@ -311,16 +311,16 @@ public final class EmergencyRegResult implements Parcelable {
        mCountryIso = in.readString8();
    }

    public static final @NonNull Creator<EmergencyRegResult> CREATOR =
            new Creator<EmergencyRegResult>() {
    public static final @NonNull Creator<EmergencyRegistrationResult> CREATOR =
            new Creator<EmergencyRegistrationResult>() {
                @Override
        public EmergencyRegResult createFromParcel(@NonNull Parcel in) {
            return new EmergencyRegResult(in);
                public EmergencyRegistrationResult createFromParcel(@NonNull Parcel in) {
                    return new EmergencyRegistrationResult(in);
                }

                @Override
        public EmergencyRegResult[] newArray(int size) {
            return new EmergencyRegResult[size];
                public EmergencyRegistrationResult[] newArray(int size) {
                    return new EmergencyRegistrationResult[size];
                }
            };
}
+2 −1
Original line number Diff line number Diff line
@@ -48,7 +48,8 @@ public interface WwanSelectorCallback {
     */
    void onRequestEmergencyNetworkScan(@NonNull List<Integer> preferredNetworks,
            @EmergencyScanType int scanType, boolean resetScan,
            @NonNull CancellationSignal signal, @NonNull Consumer<EmergencyRegResult> consumer);
            @NonNull CancellationSignal signal,
            @NonNull Consumer<EmergencyRegistrationResult> consumer);

    /**
     * Notifies the FW that the domain has been selected. After this method is called,
Loading