Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -17033,6 +17033,7 @@ package android.provider { field public static final deprecated java.lang.String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; field public static final java.lang.String RADIO_BLUETOOTH = "bluetooth"; field public static final java.lang.String RADIO_CELL = "cell"; field public static final java.lang.String RADIO_NFC = "nfc"; field public static final java.lang.String RADIO_WIFI = "wifi"; field public static final java.lang.String RINGTONE = "ringtone"; field public static final java.lang.String SCREEN_BRIGHTNESS = "screen_brightness"; core/java/android/nfc/INfcAdapter.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ interface INfcAdapter INfcAdapterExtras getNfcAdapterExtrasInterface(); // NfcAdapter-class related methods boolean isEnabled(); int getState(); void enableForegroundDispatch(in ComponentName activity, in PendingIntent intent, in IntentFilter[] filters, in TechListParcel techLists); void disableForegroundDispatch(in ComponentName activity); Loading @@ -48,5 +48,5 @@ interface INfcAdapter boolean enable(); boolean enableZeroClick(); boolean disableZeroClick(); boolean zeroClickEnabled(); boolean isZeroClickEnabled(); } core/java/android/nfc/NfcAdapter.java +78 −22 Original line number Diff line number Diff line Loading @@ -157,23 +157,35 @@ public final class NfcAdapter { public static final String EXTRA_ID = "android.nfc.extra.ID"; /** * Broadcast Action: an adapter's state changed between enabled and disabled. * * The new value is stored in the extra EXTRA_NEW_BOOLEAN_STATE and just contains * whether it's enabled or disabled, not including any information about whether it's * actively enabling or disabling. * * Broadcast Action: The state of the local NFC adapter has been * changed. * <p>For example, NFC has been turned on or off. * <p>Always contains the extra field {@link #EXTRA_STATE} * @hide */ public static final String ACTION_ADAPTER_STATE_CHANGE = "android.nfc.action.ADAPTER_STATE_CHANGE"; @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED"; /** * The Intent extra for ACTION_ADAPTER_STATE_CHANGE, saying what the new state is. * * Used as an int extra field in {@link #ACTION_STATE_CHANGED} * intents to request the current power state. Possible values are: * {@link #STATE_OFF}, * {@link #STATE_TURNING_ON}, * {@link #STATE_ON}, * {@link #STATE_TURNING_OFF}, * @hide */ public static final String EXTRA_NEW_BOOLEAN_STATE = "android.nfc.isEnabled"; public static final String EXTRA_ADAPTER_STATE = "android.nfc.extra.ADAPTER_STATE"; /** @hide */ public static final int STATE_OFF = 1; /** @hide */ public static final int STATE_TURNING_ON = 2; /** @hide */ public static final int STATE_ON = 3; /** @hide */ public static final int STATE_TURNING_OFF = 4; /** * LLCP link status: The LLCP link is activated. Loading Loading @@ -430,18 +442,48 @@ public final class NfcAdapter { */ public boolean isEnabled() { try { return sService.isEnabled(); return sService.getState() == STATE_ON; } catch (RemoteException e) { attemptDeadServiceRecovery(e); return false; } } /** * Return the state of this NFC Adapter. * * <p>Returns one of {@link #STATE_ON}, {@link #STATE_TURNING_ON}, * {@link #STATE_OFF}, {@link #STATE_TURNING_OFF}. * * <p>{@link #isEnabled()} is equivalent to * <code>{@link #getAdapterState()} == {@link #STATE_ON}</code> * * @return the current state of this NFC adapter * * @hide */ public int getAdapterState() { try { return sService.getState(); } catch (RemoteException e) { attemptDeadServiceRecovery(e); return NfcAdapter.STATE_OFF; } } /** * Enable NFC hardware. * <p> * NOTE: may block for ~second or more. Poor API. Avoid * calling from the UI thread. * * <p>This call is asynchronous. Listen for * {@link #ACTION_ADAPTER_STATE_CHANGED} broadcasts to find out when the * operation is complete. * * <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 * there is some problem that prevents an attempt to turn * NFC on (for example we are in airplane mode and NFC is not * toggleable in airplane mode on this platform). * * @hide */ Loading @@ -456,11 +498,19 @@ public final class NfcAdapter { /** * Disable NFC hardware. * No NFC features will work after this call, and the hardware * * <p>No NFC features will work after this call, and the hardware * will not perform or respond to any NFC communication. * <p> * NOTE: may block for ~second or more. Poor API. Avoid * calling from the UI thread. * * <p>This call is asynchronous. Listen for * {@link #ACTION_ADAPTER_STATE_CHANGED} broadcasts to find out when the * operation is complete. * * <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 */ Loading Loading @@ -712,14 +762,20 @@ public final class NfcAdapter { } /** * Return true if zero-click sharing is enabled. * Return true if zero-click sharing feature is enabled. * <p>This function can return true even if NFC is currently turned-off. * This indicates that zero-click is not currently active, but it has * been requested by the user and will be active as soon as NFC is turned * on. * <p>If you want to check if zero-click sharing is currently active, use * <code>{@link #isEnabled()} && {@link #isZeroClickEnabled()}</code> * * @return true if zero-click sharing is enabled * @hide */ public boolean zeroClickEnabled() { public boolean isZeroClickEnabled() { try { return sService.zeroClickEnabled(); return sService.isZeroClickEnabled(); } catch (RemoteException e) { attemptDeadServiceRecovery(e); return false; Loading core/java/android/provider/Settings.java +5 −0 Original line number Diff line number Diff line Loading @@ -1168,6 +1168,11 @@ public final class Settings { */ public static final String RADIO_CELL = "cell"; /** * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. */ public static final String RADIO_NFC = "nfc"; /** * A comma separated list of radios that need to be disabled when airplane mode * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are Loading packages/SettingsProvider/res/values/defaults.xml +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ <integer name="def_screen_off_timeout">60000</integer> <bool name="def_airplane_mode_on">false</bool> <!-- Comma-separated list of bluetooth, wifi, and cell. --> <string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi</string> <string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi</string> <string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc</string> <string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string> <bool name="def_auto_time">true</bool> <bool name="def_auto_time_zone">true</bool> <bool name="def_accelerometer_rotation">true</bool> Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -17033,6 +17033,7 @@ package android.provider { field public static final deprecated java.lang.String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; field public static final java.lang.String RADIO_BLUETOOTH = "bluetooth"; field public static final java.lang.String RADIO_CELL = "cell"; field public static final java.lang.String RADIO_NFC = "nfc"; field public static final java.lang.String RADIO_WIFI = "wifi"; field public static final java.lang.String RINGTONE = "ringtone"; field public static final java.lang.String SCREEN_BRIGHTNESS = "screen_brightness";
core/java/android/nfc/INfcAdapter.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ interface INfcAdapter INfcAdapterExtras getNfcAdapterExtrasInterface(); // NfcAdapter-class related methods boolean isEnabled(); int getState(); void enableForegroundDispatch(in ComponentName activity, in PendingIntent intent, in IntentFilter[] filters, in TechListParcel techLists); void disableForegroundDispatch(in ComponentName activity); Loading @@ -48,5 +48,5 @@ interface INfcAdapter boolean enable(); boolean enableZeroClick(); boolean disableZeroClick(); boolean zeroClickEnabled(); boolean isZeroClickEnabled(); }
core/java/android/nfc/NfcAdapter.java +78 −22 Original line number Diff line number Diff line Loading @@ -157,23 +157,35 @@ public final class NfcAdapter { public static final String EXTRA_ID = "android.nfc.extra.ID"; /** * Broadcast Action: an adapter's state changed between enabled and disabled. * * The new value is stored in the extra EXTRA_NEW_BOOLEAN_STATE and just contains * whether it's enabled or disabled, not including any information about whether it's * actively enabling or disabling. * * Broadcast Action: The state of the local NFC adapter has been * changed. * <p>For example, NFC has been turned on or off. * <p>Always contains the extra field {@link #EXTRA_STATE} * @hide */ public static final String ACTION_ADAPTER_STATE_CHANGE = "android.nfc.action.ADAPTER_STATE_CHANGE"; @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED"; /** * The Intent extra for ACTION_ADAPTER_STATE_CHANGE, saying what the new state is. * * Used as an int extra field in {@link #ACTION_STATE_CHANGED} * intents to request the current power state. Possible values are: * {@link #STATE_OFF}, * {@link #STATE_TURNING_ON}, * {@link #STATE_ON}, * {@link #STATE_TURNING_OFF}, * @hide */ public static final String EXTRA_NEW_BOOLEAN_STATE = "android.nfc.isEnabled"; public static final String EXTRA_ADAPTER_STATE = "android.nfc.extra.ADAPTER_STATE"; /** @hide */ public static final int STATE_OFF = 1; /** @hide */ public static final int STATE_TURNING_ON = 2; /** @hide */ public static final int STATE_ON = 3; /** @hide */ public static final int STATE_TURNING_OFF = 4; /** * LLCP link status: The LLCP link is activated. Loading Loading @@ -430,18 +442,48 @@ public final class NfcAdapter { */ public boolean isEnabled() { try { return sService.isEnabled(); return sService.getState() == STATE_ON; } catch (RemoteException e) { attemptDeadServiceRecovery(e); return false; } } /** * Return the state of this NFC Adapter. * * <p>Returns one of {@link #STATE_ON}, {@link #STATE_TURNING_ON}, * {@link #STATE_OFF}, {@link #STATE_TURNING_OFF}. * * <p>{@link #isEnabled()} is equivalent to * <code>{@link #getAdapterState()} == {@link #STATE_ON}</code> * * @return the current state of this NFC adapter * * @hide */ public int getAdapterState() { try { return sService.getState(); } catch (RemoteException e) { attemptDeadServiceRecovery(e); return NfcAdapter.STATE_OFF; } } /** * Enable NFC hardware. * <p> * NOTE: may block for ~second or more. Poor API. Avoid * calling from the UI thread. * * <p>This call is asynchronous. Listen for * {@link #ACTION_ADAPTER_STATE_CHANGED} broadcasts to find out when the * operation is complete. * * <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 * there is some problem that prevents an attempt to turn * NFC on (for example we are in airplane mode and NFC is not * toggleable in airplane mode on this platform). * * @hide */ Loading @@ -456,11 +498,19 @@ public final class NfcAdapter { /** * Disable NFC hardware. * No NFC features will work after this call, and the hardware * * <p>No NFC features will work after this call, and the hardware * will not perform or respond to any NFC communication. * <p> * NOTE: may block for ~second or more. Poor API. Avoid * calling from the UI thread. * * <p>This call is asynchronous. Listen for * {@link #ACTION_ADAPTER_STATE_CHANGED} broadcasts to find out when the * operation is complete. * * <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 */ Loading Loading @@ -712,14 +762,20 @@ public final class NfcAdapter { } /** * Return true if zero-click sharing is enabled. * Return true if zero-click sharing feature is enabled. * <p>This function can return true even if NFC is currently turned-off. * This indicates that zero-click is not currently active, but it has * been requested by the user and will be active as soon as NFC is turned * on. * <p>If you want to check if zero-click sharing is currently active, use * <code>{@link #isEnabled()} && {@link #isZeroClickEnabled()}</code> * * @return true if zero-click sharing is enabled * @hide */ public boolean zeroClickEnabled() { public boolean isZeroClickEnabled() { try { return sService.zeroClickEnabled(); return sService.isZeroClickEnabled(); } catch (RemoteException e) { attemptDeadServiceRecovery(e); return false; Loading
core/java/android/provider/Settings.java +5 −0 Original line number Diff line number Diff line Loading @@ -1168,6 +1168,11 @@ public final class Settings { */ public static final String RADIO_CELL = "cell"; /** * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio. */ public static final String RADIO_NFC = "nfc"; /** * A comma separated list of radios that need to be disabled when airplane mode * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are Loading
packages/SettingsProvider/res/values/defaults.xml +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ <integer name="def_screen_off_timeout">60000</integer> <bool name="def_airplane_mode_on">false</bool> <!-- Comma-separated list of bluetooth, wifi, and cell. --> <string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi</string> <string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi</string> <string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc</string> <string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string> <bool name="def_auto_time">true</bool> <bool name="def_auto_time_zone">true</bool> <bool name="def_accelerometer_rotation">true</bool> Loading