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

Commit 8314fa72 authored by Qingxi Li's avatar Qingxi Li
Browse files

Add API EuiccController#startOtaUpdatingIfNecessary

This function requests calling app has WRITE_EMBEDDED_SUBSCRIPTIONS
permission. It will check whether the OTA update needed to be done
first. If current eUICC OS isn't latest one and OTA needed to be
performed, it will update eUICC OS. When the OS update is started or
finished, a broadcast will be sent.

Bug: 37279356
Test: E2E
Merged-In: Iea86add4bdc01c79a8714af4b3a89735ba78ee74
Change-Id: Iea86add4bdc01c79a8714af4b3a89735ba78ee74
parent 8098078e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@ java_library {
        "core/java/android/service/euicc/IGetEuiccInfoCallback.aidl",
        "core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl",
        "core/java/android/service/euicc/IGetOtaStatusCallback.aidl",
        "core/java/android/service/euicc/IOtaStatusChangedCallback.aidl",
        "core/java/android/service/euicc/IRetainSubscriptionsForFactoryResetCallback.aidl",
        "core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl",
        "core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl",
+42 −0
Original line number Diff line number Diff line
@@ -192,6 +192,18 @@ public abstract class EuiccService extends Service {
        return mStubWrapper;
    }

    /**
     * Callback class for {@link #onStartOtaIfNecessary(int, OtaStatusChangedCallback)}
     *
     * The status of OTA which can be {@code android.telephony.euicc.EuiccManager#EUICC_OTA_}
     *
     * @see IEuiccService#startOtaIfNecessary
     */
    public interface OtaStatusChangedCallback {
        /** Called when OTA status is changed. */
        void onOtaStatusChanged(int status);
    }

    /**
     * Return the EID of the eUICC.
     *
@@ -213,6 +225,16 @@ public abstract class EuiccService extends Service {
     */
    public abstract @OtaStatus int onGetOtaStatus(int slotId);

    /**
     * Perform OTA if current OS is not the latest one.
     *
     * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
     *     but is here to future-proof the APIs.
     * @param statusChangedCallback Function called when OTA status changed.
     */
    public abstract void onStartOtaIfNecessary(
            int slotId, OtaStatusChangedCallback statusChangedCallback);

    /**
     * Populate {@link DownloadableSubscription} metadata for the given downloadable subscription.
     *
@@ -395,6 +417,26 @@ public abstract class EuiccService extends Service {
            });
        }

        @Override
        public void startOtaIfNecessary(
                int slotId, IOtaStatusChangedCallback statusChangedCallback) {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                    EuiccService.this.onStartOtaIfNecessary(slotId, new OtaStatusChangedCallback() {
                        @Override
                        public void onOtaStatusChanged(int status) {
                            try {
                                statusChangedCallback.onOtaStatusChanged(status);
                            } catch (RemoteException e) {
                                // Can't communicate with the phone process; ignore.
                            }
                        }
                    });
                }
            });
        }

        @Override
        public void getOtaStatus(int slotId, IGetOtaStatusCallback callback) {
            mExecutor.execute(new Runnable() {
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.service.euicc.IGetEidCallback;
import android.service.euicc.IGetEuiccInfoCallback;
import android.service.euicc.IGetEuiccProfileInfoListCallback;
import android.service.euicc.IGetOtaStatusCallback;
import android.service.euicc.IOtaStatusChangedCallback;
import android.service.euicc.IRetainSubscriptionsForFactoryResetCallback;
import android.service.euicc.ISwitchToSubscriptionCallback;
import android.service.euicc.IUpdateSubscriptionNicknameCallback;
@@ -39,6 +40,7 @@ oneway interface IEuiccService {
            boolean forceDeactivateSim, in IGetDownloadableSubscriptionMetadataCallback callback);
    void getEid(int slotId, in IGetEidCallback callback);
    void getOtaStatus(int slotId, in IGetOtaStatusCallback callback);
    void startOtaIfNecessary(int slotId, in IOtaStatusChangedCallback statusChangedCallback);
    void getEuiccProfileInfoList(int slotId, in IGetEuiccProfileInfoListCallback callback);
    void getDefaultDownloadableSubscriptionList(int slotId, boolean forceDeactivateSim,
            in IGetDefaultDownloadableSubscriptionListCallback callback);
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.service.euicc;

/** @hide */
oneway interface IOtaStatusChangedCallback {
    void onOtaStatusChanged(int status);
}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -563,6 +563,9 @@
    <protected-broadcast android:name="android.media.tv.action.CHANNEL_BROWSABLE_REQUESTED" />
    <protected-broadcast android:name="com.android.server.InputMethodManagerService.SHOW_INPUT_METHOD_PICKER" />

    <!-- Added in P -->
    <protected-broadcast android:name="android.telephony.euicc.action.OTA_STATUS_CHANGED" />

    <!-- ====================================================================== -->
    <!--                          RUNTIME PERMISSIONS                           -->
    <!-- ====================================================================== -->
Loading