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

Commit be183912 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[framework] Expose enable()/disable() as public api." into main

parents c130a2ca 5acfc501
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -64,8 +64,10 @@ package android.nfc {
  }

  public final class NfcAdapter {
    method @FlaggedApi("android.nfc.nfc_state_change") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean disable();
    method public void disableForegroundDispatch(android.app.Activity);
    method public void disableReaderMode(android.app.Activity);
    method @FlaggedApi("android.nfc.nfc_state_change") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enable();
    method public void enableForegroundDispatch(android.app.Activity, android.app.PendingIntent, android.content.IntentFilter[], String[][]);
    method public void enableReaderMode(android.app.Activity, android.nfc.NfcAdapter.ReaderCallback, int, android.os.Bundle);
    method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context);
+0 −2
Original line number Diff line number Diff line
@@ -3,9 +3,7 @@ package android.nfc {

  public final class NfcAdapter {
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean addNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler, String[]);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean disable();
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean disable(boolean);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enable();
    method @FlaggedApi("android.nfc.enable_nfc_reader_option") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableReaderOption(boolean);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableSecureNfc(boolean);
    method @FlaggedApi("android.nfc.enable_nfc_mainline") public int getAdapterState();
+8 −4
Original line number Diff line number Diff line
@@ -1106,6 +1106,9 @@ public final class NfcAdapter {
     * {@link #ACTION_ADAPTER_STATE_CHANGED} broadcasts to find out when the
     * operation is complete.
     *
     * <p>This API is only allowed to be called by system apps
     * or apps which are Device Owner or Profile Owner.
     *
     * <p>If this returns true, then either NFC is already on, or
     * a {@link #ACTION_ADAPTER_STATE_CHANGED} broadcast will be sent
     * to indicate a state transition. If this returns false, then
@@ -1113,9 +1116,8 @@ public final class NfcAdapter {
     * NFC on (for example we are in airplane mode and NFC is not
     * toggleable in airplane mode on this platform).
     *
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_NFC_STATE_CHANGE)
    @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
    public boolean enable() {
        try {
@@ -1146,15 +1148,17 @@ public final class NfcAdapter {
     * {@link #ACTION_ADAPTER_STATE_CHANGED} broadcasts to find out when the
     * operation is complete.
     *
     * <p>This API is only allowed to be called by system apps
     * or apps which are Device Owner or Profile Owner.
     *
     * <p>If this returns true, then either NFC is already off, or
     * a {@link #ACTION_ADAPTER_STATE_CHANGED} broadcast will be sent
     * to indicate a state transition. If this returns false, then
     * there is some problem that prevents an attempt to turn
     * NFC off.
     *
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_NFC_STATE_CHANGE)
    @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
    public boolean disable() {
        try {
+8 −0
Original line number Diff line number Diff line
@@ -93,3 +93,11 @@ flag {
    description: "Enable NFC OEM extension support"
    bug: "331206243"
}

flag {
    name: "nfc_state_change"
    is_exported: true
    namespace: "nfc"
    description: "Enable nfc state change API"
    bug: "319934052"
}