Merge tag 'android-security-10.0.0_r53' into int/10/fp2
Android security 10.0.0 release 53
* tag 'android-security-10.0.0_r53':
Change-Id: I1360bf53c08c8187b4928d321f66a769f3d4387c
diff --git a/src/com/android/se/SecureElementService.java b/src/com/android/se/SecureElementService.java
index 480141a..6f72377 100644
--- a/src/com/android/se/SecureElementService.java
+++ b/src/com/android/se/SecureElementService.java
@@ -158,7 +158,9 @@
do {
name = terminalName + Integer.toString(index);
Terminal terminal = new Terminal(name, this);
- terminal.initialize();
+
+ // Only retry on fail for the first terminal of each type.
+ terminal.initialize(index == 1);
mTerminals.put(name, terminal);
} while (++index > 0);
} catch (NoSuchElementException e) {
diff --git a/src/com/android/se/Terminal.java b/src/com/android/se/Terminal.java
index e17ac88..521d696 100644
--- a/src/com/android/se/Terminal.java
+++ b/src/com/android/se/Terminal.java
@@ -160,7 +160,7 @@
switch (message.what) {
case EVENT_GET_HAL:
try {
- initialize();
+ initialize(true);
} catch (Exception e) {
Log.e(mTag, mName + " could not be initialized again");
sendMessageDelayed(obtainMessage(EVENT_GET_HAL, 0),
@@ -185,18 +185,19 @@
* @throws NoSuchElementException if there is no HAL implementation for the specified SE name
* @throws RemoteException if there is a failure communicating with the remote
*/
- public void initialize() throws NoSuchElementException, RemoteException {
+ public void initialize(boolean retryOnFail) throws NoSuchElementException, RemoteException {
synchronized (mLock) {
android.hardware.secure_element.V1_1.ISecureElement seHal11 = null;
try {
seHal11 =
- android.hardware.secure_element.V1_1.ISecureElement.getService(mName, true);
+ android.hardware.secure_element.V1_1.ISecureElement.getService(mName,
+ retryOnFail);
} catch (Exception e) {
Log.d(mTag, "SE Hal V1.1 is not supported");
}
if (seHal11 == null) {
- mSEHal = ISecureElement.getService(mName, true);
+ mSEHal = ISecureElement.getService(mName, retryOnFail);
if (mSEHal == null) {
throw new NoSuchElementException("No HAL is provided for " + mName);
}
@@ -246,22 +247,22 @@
if (channel == null) {
return;
}
- if (mIsConnected) {
- try {
- byte status = mSEHal.closeChannel((byte) channel.getChannelNumber());
- /* For Basic Channels, errors are expected.
- * Underlying implementations use this call as an indication when there
- * aren't any users actively using the channel, and the chip can go
- * into low power state.
- */
- if (!channel.isBasicChannel() && status != SecureElementStatus.SUCCESS) {
- Log.e(mTag, "Error closing channel " + channel.getChannelNumber());
- }
- } catch (RemoteException e) {
- Log.e(mTag, "Exception in closeChannel() " + e);
- }
- }
synchronized (mLock) {
+ if (mIsConnected) {
+ try {
+ byte status = mSEHal.closeChannel((byte) channel.getChannelNumber());
+ /* For Basic Channels, errors are expected.
+ * Underlying implementations use this call as an indication when there
+ * aren't any users actively using the channel, and the chip can go
+ * into low power state.
+ */
+ if (!channel.isBasicChannel() && status != SecureElementStatus.SUCCESS) {
+ Log.e(mTag, "Error closing channel " + channel.getChannelNumber());
+ }
+ } catch (RemoteException e) {
+ Log.e(mTag, "Exception in closeChannel() " + e);
+ }
+ }
mChannels.remove(channel.getChannelNumber(), channel);
if (mChannels.get(channel.getChannelNumber()) != null) {
Log.e(mTag, "Removing channel failed");
diff --git a/src/com/android/se/security/AccessControlEnforcer.java b/src/com/android/se/security/AccessControlEnforcer.java
index 22b82f0..79252bd 100644
--- a/src/com/android/se/security/AccessControlEnforcer.java
+++ b/src/com/android/se/security/AccessControlEnforcer.java
@@ -488,9 +488,8 @@
}
}
if (!mTerminal.getName().startsWith(SecureElementService.UICC_TERMINAL)) {
- // It shall be allowed to grant full access if no rule can be retrieved
- // from the secure element except for UICC.
- mFullAccess = true;
+ // Deny full access for eSE if no rule can be retrieved because of security concern
+ mFullAccess = false;
// ARF is supported only on UICC.
mUseArf = false;
}