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

Commit d8c59270 authored by Ruchi Kandoi's avatar Ruchi Kandoi Committed by android-build-merger
Browse files

Merge "Add Secure NFC functionality" am: 3ffdb26a am: c538141c

am: 32b84ede

Change-Id: I67f436d48dfd5578d04d284e7669685760b0716f
parents be77fdac 32b84ede
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -30595,6 +30595,7 @@ package android.nfc {
  }
  public final class NfcAdapter {
    method public boolean deviceSupportsNfcSecure();
    method public void disableForegroundDispatch(android.app.Activity);
    method @Deprecated public void disableForegroundNdefPush(android.app.Activity);
    method public void disableReaderMode(android.app.Activity);
@@ -30607,6 +30608,7 @@ package android.nfc {
    method @Deprecated public boolean invokeBeam(android.app.Activity);
    method public boolean isEnabled();
    method @Deprecated public boolean isNdefPushEnabled();
    method public boolean isNfcSecureEnabled();
    method @Deprecated public void setBeamPushUris(android.net.Uri[], android.app.Activity);
    method @Deprecated public void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity);
    method @Deprecated public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...);
+1 −0
Original line number Diff line number Diff line
@@ -5078,6 +5078,7 @@ package android.nfc {
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableNdefPush();
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean removeNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler);
    method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, int);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setNfcSecure(boolean);
    field public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 1; // 0x1
  }
+4 −0
Original line number Diff line number Diff line
@@ -68,4 +68,8 @@ interface INfcAdapter
    void removeNfcUnlockHandler(INfcUnlockHandler unlockHandler);

    void verifyNfcPermission();
    boolean isNfcSecureEnabled();
    boolean deviceSupportsNfcSecure();
    boolean setNfcSecure(boolean enable);

}
+57 −0
Original line number Diff line number Diff line
@@ -1701,6 +1701,63 @@ public final class NfcAdapter {
        mNfcActivityManager.setOnNdefPushCompleteCallback(activity, null);
    }

    /**
     * Sets Secure NFC feature.
     * <p>This API is for the Settings application.
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
    public boolean setNfcSecure(boolean enable) {
        if (!sHasNfcFeature) {
            throw new UnsupportedOperationException();
        }
        try {
            return sService.setNfcSecure(enable);
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
            return false;
        }
    }

    /**
     * Checks if the device supports Secure NFC functionality.
     *
     * @return True if device supports Secure NFC, false otherwise
     * @throws UnsupportedOperationException if FEATURE_NFC is unavailable.
     */
    public boolean deviceSupportsNfcSecure() {
        if (!sHasNfcFeature) {
            throw new UnsupportedOperationException();
        }
        try {
            return sService.deviceSupportsNfcSecure();
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
            return false;
        }
    }

    /**
     * Checks Secure NFC feature is enabled.
     *
     * @return True if device supports Secure NFC is enabled, false otherwise
     * @throws UnsupportedOperationException if FEATURE_NFC is unavailable.
     * @throws UnsupportedOperationException if device doesn't support
     *         Secure NFC functionality. {@link #deviceSupportsNfcSecure}
     */
    public boolean isNfcSecureEnabled() {
        if (!sHasNfcFeature) {
            throw new UnsupportedOperationException();
        }
        try {
            return sService.isNfcSecureEnabled();
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
            return false;
        }
    }

    /**
     * Enable NDEF Push feature.
     * <p>This API is for the Settings application.