summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Qingxi Li <qingxi@google.com> 2017-12-14 15:36:06 -0800
committer Qingxi Li <qingxi@google.com> 2018-01-10 12:01:13 -0800
commit8314fa72f27d0358ab29681fee5dfa4a4276946c (patch)
tree7f9f63f79d277d8fb3734596f8ba29621cfbd5bf
parent8098078edf5c74b1a1513c45012aa036ce6d36ec (diff)
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
-rw-r--r--Android.bp1
-rw-r--r--core/java/android/service/euicc/EuiccService.java42
-rw-r--r--core/java/android/service/euicc/IEuiccService.aidl2
-rw-r--r--core/java/android/service/euicc/IOtaStatusChangedCallback.aidl22
-rw-r--r--core/res/AndroidManifest.xml3
-rw-r--r--telephony/java/android/telephony/euicc/EuiccManager.java14
6 files changed, 84 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
index d4b15caf3047..e6aa7cf0f61a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -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",
diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java
index fb530074d5b0..be8580074f73 100644
--- a/core/java/android/service/euicc/EuiccService.java
+++ b/core/java/android/service/euicc/EuiccService.java
@@ -193,6 +193,18 @@ public abstract class EuiccService extends Service {
}
/**
+ * 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.
*
* @param slotId ID of the SIM slot being queried. This is currently not populated but is here
@@ -214,6 +226,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.
*
* @param slotId ID of the SIM slot to use for the operation. This is currently not populated
@@ -396,6 +418,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() {
@Override
diff --git a/core/java/android/service/euicc/IEuiccService.aidl b/core/java/android/service/euicc/IEuiccService.aidl
index a24e5c35c1cb..45be52740f32 100644
--- a/core/java/android/service/euicc/IEuiccService.aidl
+++ b/core/java/android/service/euicc/IEuiccService.aidl
@@ -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);
diff --git a/core/java/android/service/euicc/IOtaStatusChangedCallback.aidl b/core/java/android/service/euicc/IOtaStatusChangedCallback.aidl
new file mode 100644
index 000000000000..caec75f13f61
--- /dev/null
+++ b/core/java/android/service/euicc/IOtaStatusChangedCallback.aidl
@@ -0,0 +1,22 @@
+/*
+ * 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
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 4b2ae06eff2f..fdda55bfa01b 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -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 -->
<!-- ====================================================================== -->
diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java
index f777649283e7..3dfadf585c28 100644
--- a/telephony/java/android/telephony/euicc/EuiccManager.java
+++ b/telephony/java/android/telephony/euicc/EuiccManager.java
@@ -60,6 +60,20 @@ public class EuiccManager {
public static final String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS =
"android.telephony.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS";
+
+ /**
+ * Broadcast Action: The eUICC OTA status is changed.
+ * <p class="note">
+ * Requires the {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
+ *
+ * <p class="note">This is a protected intent that can only be sent
+ * by the system.
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_OTA_STATUS_CHANGED
+ = "android.telephony.euicc.action.OTA_STATUS_CHANGED";
+
/**
* Intent action to provision an embedded subscription.
*