diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 1102a0d666971..7e5a62110161d 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -6735,16 +6735,16 @@ package android.nfc { method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableSecureNfc(boolean); 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.NFC_SET_CONTROLLER_ALWAYS_ON) public void registerControllerAlwaysOnStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.nfc.NfcAdapter.ControllerAlwaysOnStateCallback); + method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public void registerControllerAlwaysOnListener(@NonNull java.util.concurrent.Executor, @NonNull android.nfc.NfcAdapter.ControllerAlwaysOnListener); method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean removeNfcUnlockHandler(android.nfc.NfcAdapter.NfcUnlockHandler); 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 @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public void unregisterControllerAlwaysOnStateCallback(@NonNull android.nfc.NfcAdapter.ControllerAlwaysOnStateCallback); + method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public void unregisterControllerAlwaysOnListener(@NonNull android.nfc.NfcAdapter.ControllerAlwaysOnListener); field public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 1; // 0x1 } - public static interface NfcAdapter.ControllerAlwaysOnStateCallback { - method public void onStateChanged(boolean); + public static interface NfcAdapter.ControllerAlwaysOnListener { + method public void onControllerAlwaysOnChanged(boolean); } public static interface NfcAdapter.NfcUnlockHandler { diff --git a/core/java/android/nfc/INfcAdapter.aidl b/core/java/android/nfc/INfcAdapter.aidl index d5cc01aac0cc7..cb9a3e43db817 100644 --- a/core/java/android/nfc/INfcAdapter.aidl +++ b/core/java/android/nfc/INfcAdapter.aidl @@ -24,7 +24,7 @@ import android.nfc.Tag; import android.nfc.TechListParcel; import android.nfc.IAppCallback; import android.nfc.INfcAdapterExtras; -import android.nfc.INfcControllerAlwaysOnStateCallback; +import android.nfc.INfcControllerAlwaysOnListener; import android.nfc.INfcTag; import android.nfc.INfcCardEmulation; import android.nfc.INfcFCardEmulation; @@ -76,6 +76,6 @@ interface INfcAdapter boolean setControllerAlwaysOn(boolean value); boolean isControllerAlwaysOn(); boolean isControllerAlwaysOnSupported(); - void registerControllerAlwaysOnStateCallback(in INfcControllerAlwaysOnStateCallback callback); - void unregisterControllerAlwaysOnStateCallback(in INfcControllerAlwaysOnStateCallback callback); + void registerControllerAlwaysOnListener(in INfcControllerAlwaysOnListener listener); + void unregisterControllerAlwaysOnListener(in INfcControllerAlwaysOnListener listener); } diff --git a/core/java/android/nfc/INfcControllerAlwaysOnStateCallback.aidl b/core/java/android/nfc/INfcControllerAlwaysOnListener.aidl similarity index 87% rename from core/java/android/nfc/INfcControllerAlwaysOnStateCallback.aidl rename to core/java/android/nfc/INfcControllerAlwaysOnListener.aidl index 1e4fdd79e8314..1bb7680d2fed7 100644 --- a/core/java/android/nfc/INfcControllerAlwaysOnStateCallback.aidl +++ b/core/java/android/nfc/INfcControllerAlwaysOnListener.aidl @@ -19,11 +19,11 @@ package android.nfc; /** * @hide */ -oneway interface INfcControllerAlwaysOnStateCallback { +oneway interface INfcControllerAlwaysOnListener { /** * Called whenever the controller always on state changes * * @param isEnabled true if the state is enabled, false otherwise */ - void onControllerAlwaysOnStateChanged(boolean isEnabled); + void onControllerAlwaysOnChanged(boolean isEnabled); } diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java index bbf802ca58d8a..64c1211949321 100644 --- a/core/java/android/nfc/NfcAdapter.java +++ b/core/java/android/nfc/NfcAdapter.java @@ -67,7 +67,7 @@ import java.util.concurrent.Executor; public final class NfcAdapter { static final String TAG = "NFC"; - private final NfcControllerAlwaysOnStateListener mControllerAlwaysOnStateListener; + private final NfcControllerAlwaysOnListener mControllerAlwaysOnListener; /** * Intent to start an activity when a tag with NDEF payload is discovered. @@ -418,19 +418,19 @@ public final class NfcAdapter { } /** - * A callback to be invoked when NFC controller always on state changes. - *
Register your {@code ControllerAlwaysOnStateCallback} implementation with {@link - * NfcAdapter#registerControllerAlwaysOnStateCallback} and disable it with {@link - * NfcAdapter#unregisterControllerAlwaysOnStateCallback}. - * @see #registerControllerAlwaysOnStateCallback + * A listener to be invoked when NFC controller always on state changes. + *
Register your {@code ControllerAlwaysOnListener} implementation with {@link
+ * NfcAdapter#registerControllerAlwaysOnListener} and disable it with {@link
+ * NfcAdapter#unregisterControllerAlwaysOnListener}.
+ * @see #registerControllerAlwaysOnListener
* @hide
*/
@SystemApi
- public interface ControllerAlwaysOnStateCallback {
+ public interface ControllerAlwaysOnListener {
/**
* Called on NFC controller always on state changes
*/
- void onStateChanged(boolean isEnabled);
+ void onControllerAlwaysOnChanged(boolean isEnabled);
}
/**
@@ -748,7 +748,7 @@ public final class NfcAdapter {
mNfcUnlockHandlers = new HashMap This API is for the NFCC internal state management. It allows to discriminate
* the controller function from the NFC function by keeping the NFC controller on without
* any NFC RF enabled if necessary.
- * This call is asynchronous. Register a callback {@link #ControllerAlwaysOnStateCallback}
- * by {@link #registerControllerAlwaysOnStateCallback} to find out when the operation is
+ * This call is asynchronous. Register a listener {@link #ControllerAlwaysOnListener}
+ * by {@link #registerControllerAlwaysOnListener} to find out when the operation is
* complete.
* If this returns true, then either NFCC always on state has been set based on the value,
- * or a {@link ControllerAlwaysOnStateCallback#onStateChanged(boolean)} will be invoked to
- * indicate the state change.
+ * or a {@link ControllerAlwaysOnListener#onControllerAlwaysOnChanged(boolean)} will be invoked
+ * to indicate the state change.
* If this returns false, then there is some problem that prevents an attempt to turn NFCC
* always on.
* @param value if true the NFCC will be kept on (with no RF enabled if NFC adapter is
@@ -2344,37 +2344,37 @@ public final class NfcAdapter {
}
/**
- * Register a {@link ControllerAlwaysOnStateCallback} to listen for NFC controller always on
+ * Register a {@link ControllerAlwaysOnListener} to listen for NFC controller always on
* state changes
- * The provided callback will be invoked by the given {@link Executor}.
+ * The provided listener will be invoked by the given {@link Executor}.
*
- * @param executor an {@link Executor} to execute given callback
- * @param callback user implementation of the {@link ControllerAlwaysOnStateCallback}
+ * @param executor an {@link Executor} to execute given listener
+ * @param listener user implementation of the {@link ControllerAlwaysOnListener}
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
- public void registerControllerAlwaysOnStateCallback(
+ public void registerControllerAlwaysOnListener(
@NonNull @CallbackExecutor Executor executor,
- @NonNull ControllerAlwaysOnStateCallback callback) {
- mControllerAlwaysOnStateListener.register(executor, callback);
+ @NonNull ControllerAlwaysOnListener listener) {
+ mControllerAlwaysOnListener.register(executor, listener);
}
/**
- * Unregister the specified {@link ControllerAlwaysOnStateCallback}
- * The same {@link ControllerAlwaysOnStateCallback} object used when calling
- * {@link #registerControllerAlwaysOnStateCallback(Executor, ControllerAlwaysOnStateCallback)}
+ * Unregister the specified {@link ControllerAlwaysOnListener}
+ * The same {@link ControllerAlwaysOnListener} object used when calling
+ * {@link #registerControllerAlwaysOnListener(Executor, ControllerAlwaysOnListener)}
* must be used.
*
- * Callbacks are automatically unregistered when application process goes away
+ * Listeners are automatically unregistered when application process goes away
*
- * @param callback user implementation of the {@link ControllerAlwaysOnStateCallback}
+ * @param listener user implementation of the {@link ControllerAlwaysOnListener}
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON)
- public void unregisterControllerAlwaysOnStateCallback(
- @NonNull ControllerAlwaysOnStateCallback callback) {
- mControllerAlwaysOnStateListener.unregister(callback);
+ public void unregisterControllerAlwaysOnListener(
+ @NonNull ControllerAlwaysOnListener listener) {
+ mControllerAlwaysOnListener.unregister(listener);
}
}
diff --git a/core/java/android/nfc/NfcControllerAlwaysOnStateListener.java b/core/java/android/nfc/NfcControllerAlwaysOnListener.java
similarity index 51%
rename from core/java/android/nfc/NfcControllerAlwaysOnStateListener.java
rename to core/java/android/nfc/NfcControllerAlwaysOnListener.java
index 69a9ec79edb29..96707bb432db7 100644
--- a/core/java/android/nfc/NfcControllerAlwaysOnStateListener.java
+++ b/core/java/android/nfc/NfcControllerAlwaysOnListener.java
@@ -17,7 +17,7 @@
package android.nfc;
import android.annotation.NonNull;
-import android.nfc.NfcAdapter.ControllerAlwaysOnStateCallback;
+import android.nfc.NfcAdapter.ControllerAlwaysOnListener;
import android.os.Binder;
import android.os.RemoteException;
import android.util.Log;
@@ -29,77 +29,77 @@ import java.util.concurrent.Executor;
/**
* @hide
*/
-public class NfcControllerAlwaysOnStateListener extends INfcControllerAlwaysOnStateCallback.Stub {
- private static final String TAG = "NfcControllerAlwaysOnStateListener";
+public class NfcControllerAlwaysOnListener extends INfcControllerAlwaysOnListener.Stub {
+ private static final String TAG = NfcControllerAlwaysOnListener.class.getSimpleName();
private final INfcAdapter mAdapter;
- private final Map