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

Commit abd045e9 authored by George Chang's avatar George Chang
Browse files

Add new permission to set NFC always on states

Bug: 182979907
Test: atest NfcNciInstrumentationTests
Change-Id: I9a82c37f0b6716e68dc4c2d7e0f171d892f09112
parent 35f70208
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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_STACK = "android.permission.NETWORK_STACK";
    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 NOTIFY_TV_INPUTS = "android.permission.NOTIFY_TV_INPUTS";
    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 enableNdefPush();
    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.WRITE_SECURE_SETTINGS) public boolean isAlwaysOnSupported();
    method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isAlwaysOnEnabled();
    method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isAlwaysOnSupported();
    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 setAlwaysOn(boolean);
    method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, int);
    field public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 1; // 0x1
  }
+3 −3
Original line number Diff line number Diff line
@@ -2254,7 +2254,7 @@ public final class NfcAdapter {
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
    @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
    public boolean setAlwaysOn(boolean value) {
        if (!sHasNfcFeature) {
            throw new UnsupportedOperationException();
@@ -2286,7 +2286,7 @@ public final class NfcAdapter {
     */

    @SystemApi
    @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
    @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
    public boolean isAlwaysOnEnabled() {
        try {
            return sService.isAlwaysOnEnabled();
@@ -2315,7 +2315,7 @@ public final class NfcAdapter {
     */

    @SystemApi
    @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
    @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
    public boolean isAlwaysOnSupported() {
        if (!sHasNfcFeature) {
            throw new UnsupportedOperationException();
+6 −0
Original line number Diff line number Diff line
@@ -1882,6 +1882,12 @@
        android:label="@string/permlab_preferredPaymentInfo"
        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.
         Applications holding this permission can access OMAPI reset system API
         and bypass OMAPI AccessControlEnforcer.