Merge changes from topic "update_NFCC_Always_on" am: 7b7b809587

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1655107

Change-Id: I99ee357d8dd742404688ffb5ba49c945406e4ff6
This commit is contained in:
George Chang
2021-03-30 02:23:23 +00:00
committed by Automerger Merge Worker
6 changed files with 27 additions and 18 deletions

View File

@@ -155,6 +155,7 @@ package android {
field public static final String NETWORK_SIGNAL_STRENGTH_WAKEUP = "android.permission.NETWORK_SIGNAL_STRENGTH_WAKEUP"; field public static final String NETWORK_SIGNAL_STRENGTH_WAKEUP = "android.permission.NETWORK_SIGNAL_STRENGTH_WAKEUP";
field public static final String NETWORK_STACK = "android.permission.NETWORK_STACK"; field public static final String NETWORK_STACK = "android.permission.NETWORK_STACK";
field public static final String NETWORK_STATS_PROVIDER = "android.permission.NETWORK_STATS_PROVIDER"; field public static final String NETWORK_STATS_PROVIDER = "android.permission.NETWORK_STATS_PROVIDER";
field public static final String NFC_SET_CONTROLLER_ALWAYS_ON = "android.permission.NFC_SET_CONTROLLER_ALWAYS_ON";
field public static final String NOTIFICATION_DURING_SETUP = "android.permission.NOTIFICATION_DURING_SETUP"; field public static final String NOTIFICATION_DURING_SETUP = "android.permission.NOTIFICATION_DURING_SETUP";
field public static final String NOTIFY_TV_INPUTS = "android.permission.NOTIFY_TV_INPUTS"; field public static final String NOTIFY_TV_INPUTS = "android.permission.NOTIFY_TV_INPUTS";
field public static final String OBSERVE_APP_USAGE = "android.permission.OBSERVE_APP_USAGE"; field public static final String OBSERVE_APP_USAGE = "android.permission.OBSERVE_APP_USAGE";
@@ -6723,10 +6724,10 @@ package android.nfc {
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enable(); method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enable();
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableNdefPush(); method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableNdefPush();
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableSecureNfc(boolean); method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableSecureNfc(boolean);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean isAlwaysOnEnabled(); method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isControllerAlwaysOn();
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean isAlwaysOnSupported(); method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isControllerAlwaysOnSupported();
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean removeNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler); method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean removeNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setAlwaysOn(boolean); method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean setControllerAlwaysOn(boolean);
method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, int); method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, int);
field public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 1; // 0x1 field public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 1; // 0x1
} }

View File

@@ -1064,6 +1064,7 @@ package android.os {
field public static final int FIRST_ISOLATED_UID = 99000; // 0x182b8 field public static final int FIRST_ISOLATED_UID = 99000; // 0x182b8
field public static final int LAST_APP_ZYGOTE_ISOLATED_UID = 98999; // 0x182b7 field public static final int LAST_APP_ZYGOTE_ISOLATED_UID = 98999; // 0x182b7
field public static final int LAST_ISOLATED_UID = 99999; // 0x1869f field public static final int LAST_ISOLATED_UID = 99999; // 0x1869f
field public static final int NFC_UID = 1027; // 0x403
field public static final int NUM_UIDS_PER_APP_ZYGOTE = 100; // 0x64 field public static final int NUM_UIDS_PER_APP_ZYGOTE = 100; // 0x64
} }

View File

@@ -72,7 +72,7 @@ interface INfcAdapter
boolean deviceSupportsNfcSecure(); boolean deviceSupportsNfcSecure();
boolean setNfcSecure(boolean enable); boolean setNfcSecure(boolean enable);
boolean setAlwaysOn(boolean value); boolean setControllerAlwaysOn(boolean value);
boolean isAlwaysOnEnabled(); boolean isControllerAlwaysOn();
boolean isAlwaysOnSupported(); boolean isControllerAlwaysOnSupported();
} }

View File

@@ -2254,13 +2254,13 @@ public final class NfcAdapter {
* @hide * @hide
*/ */
@SystemApi @SystemApi
@RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
public boolean setAlwaysOn(boolean value) { public boolean setControllerAlwaysOn(boolean value) {
if (!sHasNfcFeature) { if (!sHasNfcFeature) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
try { try {
return sService.setAlwaysOn(value); return sService.setControllerAlwaysOn(value);
} catch (RemoteException e) { } catch (RemoteException e) {
attemptDeadServiceRecovery(e); attemptDeadServiceRecovery(e);
// Try one more time // Try one more time
@@ -2269,7 +2269,7 @@ public final class NfcAdapter {
return false; return false;
} }
try { try {
return sService.setAlwaysOn(value); return sService.setControllerAlwaysOn(value);
} catch (RemoteException ee) { } catch (RemoteException ee) {
Log.e(TAG, "Failed to recover NFC Service."); Log.e(TAG, "Failed to recover NFC Service.");
} }
@@ -2286,10 +2286,10 @@ public final class NfcAdapter {
*/ */
@SystemApi @SystemApi
@RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
public boolean isAlwaysOnEnabled() { public boolean isControllerAlwaysOn() {
try { try {
return sService.isAlwaysOnEnabled(); return sService.isControllerAlwaysOn();
} catch (RemoteException e) { } catch (RemoteException e) {
attemptDeadServiceRecovery(e); attemptDeadServiceRecovery(e);
// Try one more time // Try one more time
@@ -2298,7 +2298,7 @@ public final class NfcAdapter {
return false; return false;
} }
try { try {
return sService.isAlwaysOnEnabled(); return sService.isControllerAlwaysOn();
} catch (RemoteException ee) { } catch (RemoteException ee) {
Log.e(TAG, "Failed to recover NFC Service."); Log.e(TAG, "Failed to recover NFC Service.");
} }
@@ -2315,13 +2315,13 @@ public final class NfcAdapter {
*/ */
@SystemApi @SystemApi
@RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
public boolean isAlwaysOnSupported() { public boolean isControllerAlwaysOnSupported() {
if (!sHasNfcFeature) { if (!sHasNfcFeature) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
try { try {
return sService.isAlwaysOnSupported(); return sService.isControllerAlwaysOnSupported();
} catch (RemoteException e) { } catch (RemoteException e) {
attemptDeadServiceRecovery(e); attemptDeadServiceRecovery(e);
// Try one more time // Try one more time
@@ -2330,7 +2330,7 @@ public final class NfcAdapter {
return false; return false;
} }
try { try {
return sService.isAlwaysOnSupported(); return sService.isControllerAlwaysOnSupported();
} catch (RemoteException ee) { } catch (RemoteException ee) {
Log.e(TAG, "Failed to recover NFC Service."); Log.e(TAG, "Failed to recover NFC Service.");
} }

View File

@@ -127,6 +127,7 @@ public class Process {
* @hide * @hide
*/ */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@TestApi
public static final int NFC_UID = 1027; public static final int NFC_UID = 1027;
/** /**

View File

@@ -1882,6 +1882,12 @@
android:label="@string/permlab_preferredPaymentInfo" android:label="@string/permlab_preferredPaymentInfo"
android:protectionLevel="normal" /> android:protectionLevel="normal" />
<!-- @SystemApi Allows access to set NFC controller always on states.
<p>Protection level: signature|privileged
@hide -->
<permission android:name="android.permission.NFC_SET_CONTROLLER_ALWAYS_ON"
android:protectionLevel="signature|privileged" />
<!-- @SystemApi Allows an internal user to use privileged SecureElement APIs. <!-- @SystemApi Allows an internal user to use privileged SecureElement APIs.
Applications holding this permission can access OMAPI reset system API Applications holding this permission can access OMAPI reset system API
and bypass OMAPI AccessControlEnforcer. and bypass OMAPI AccessControlEnforcer.