From f04aa64e6d39d8d7a541b86c566ac4fcc10e98af Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Thu, 17 Dec 2020 16:46:43 +0800 Subject: [PATCH] Add intent to notify applications when the secure element state changed Bug: 175850569 Test: check broadcast intent is triggered when the secure element state changed Change-Id: Iaf9f6bd5e964e1e3ef559afa7adbefd2cbd8d596 --- core/api/current.txt | 3 +++ core/java/android/se/omapi/SEService.java | 25 +++++++++++++++++++++++ core/res/AndroidManifest.xml | 3 +++ 3 files changed, 31 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index d1906c6eac1ad..60fe4882d51aa 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -35868,6 +35868,9 @@ package android.se.omapi { method @NonNull public String getVersion(); method public boolean isConnected(); method public void shutdown(); + field public static final String ACTION_SECURE_ELEMENT_STATE_CHANGED = "android.se.omapi.action.SECURE_ELEMENT_STATE_CHANGED"; + field public static final String EXTRA_READER_NAME = "android.se.omapi.extra.READER_NAME"; + field public static final String EXTRA_READER_STATE = "android.se.omapi.extra.READER_STATE"; } public static interface SEService.OnConnectedListener { diff --git a/core/java/android/se/omapi/SEService.java b/core/java/android/se/omapi/SEService.java index a5c5c613e1f2a..333af91ac8729 100644 --- a/core/java/android/se/omapi/SEService.java +++ b/core/java/android/se/omapi/SEService.java @@ -22,7 +22,10 @@ package android.se.omapi; +import android.annotation.BroadcastBehavior; import android.annotation.NonNull; +import android.annotation.SdkConstant; +import android.annotation.SdkConstant.SdkConstantType; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -70,6 +73,28 @@ public final class SEService { void onConnected(); } + /** + * Broadcast Action: Intent to notify if the secure element state is changed. + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + @BroadcastBehavior(registeredOnly = true, protectedBroadcast = true) + public static final String ACTION_SECURE_ELEMENT_STATE_CHANGED = + "android.se.omapi.action.SECURE_ELEMENT_STATE_CHANGED"; + + /** + * Mandatory extra containing the reader name of the state changed secure element. + * + * @see Reader#getName() + */ + public static final String EXTRA_READER_NAME = "android.se.omapi.extra.READER_NAME"; + + /** + * Mandatory extra containing the connected state of the state changed secure element. + * + * True if the secure element is connected correctly, false otherwise. + */ + public static final String EXTRA_READER_STATE = "android.se.omapi.extra.READER_STATE"; + /** * Listener object that allows the notification of the caller if this * SEService could be bound to the backend. diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 714a09d022648..60b3839a57efd 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -309,6 +309,9 @@ + + +