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

Commit 7b7b8095 authored by George Chang's avatar George Chang Committed by Gerrit Code Review
Browse files

Merge changes from topic "update_NFCC_Always_on"

* changes:
  Make NFC_UID TestApi
  Update SetAlwaysOn to SetControllerAlwaysOn
  Add new permission to set NFC always on states
parents 47dc4008 ba34121e
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 isControllerAlwaysOn();
    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 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);
    field public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 1; // 0x1
  }
+1 −0
Original line number Diff line number Diff line
@@ -1064,6 +1064,7 @@ package android.os {
    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_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
  }

+3 −3
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ interface INfcAdapter
    boolean deviceSupportsNfcSecure();
    boolean setNfcSecure(boolean enable);

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

    @SystemApi
    @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
    public boolean isAlwaysOnEnabled() {
    @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
    public boolean isControllerAlwaysOn() {
        try {
            return sService.isAlwaysOnEnabled();
            return sService.isControllerAlwaysOn();
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
            // Try one more time
@@ -2298,7 +2298,7 @@ public final class NfcAdapter {
                return false;
            }
            try {
                return sService.isAlwaysOnEnabled();
                return sService.isControllerAlwaysOn();
            } catch (RemoteException ee) {
                Log.e(TAG, "Failed to recover NFC Service.");
            }
@@ -2315,13 +2315,13 @@ public final class NfcAdapter {
     */

    @SystemApi
    @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
    public boolean isAlwaysOnSupported() {
    @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
    public boolean isControllerAlwaysOnSupported() {
        if (!sHasNfcFeature) {
            throw new UnsupportedOperationException();
        }
        try {
            return sService.isAlwaysOnSupported();
            return sService.isControllerAlwaysOnSupported();
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
            // Try one more time
@@ -2330,7 +2330,7 @@ public final class NfcAdapter {
                return false;
            }
            try {
                return sService.isAlwaysOnSupported();
                return sService.isControllerAlwaysOnSupported();
            } catch (RemoteException ee) {
                Log.e(TAG, "Failed to recover NFC Service.");
            }
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ public class Process {
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @TestApi
    public static final int NFC_UID = 1027;

    /**
Loading