Loading api/current.txt +11 −10 Original line number Diff line number Diff line Loading @@ -11315,6 +11315,7 @@ package android.content.pm { field public static final java.lang.String FEATURE_MICROPHONE = "android.hardware.microphone"; field public static final java.lang.String FEATURE_MIDI = "android.software.midi"; field public static final java.lang.String FEATURE_NFC = "android.hardware.nfc"; field public static final java.lang.String FEATURE_NFC_BEAM = "android.sofware.nfc.beam"; field public static final java.lang.String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; field public static final java.lang.String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef"; field public static final java.lang.String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese"; Loading Loading @@ -29169,14 +29170,14 @@ package android.nfc { method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context); method public java.util.List<java.lang.String> getSupportedOffHostSecureElements(); method public boolean ignore(android.nfc.Tag, int, android.nfc.NfcAdapter.OnTagRemovedListener, android.os.Handler); method public boolean invokeBeam(android.app.Activity); method public deprecated boolean invokeBeam(android.app.Activity); method public boolean isEnabled(); method public boolean isNdefPushEnabled(); method public void setBeamPushUris(android.net.Uri[], android.app.Activity); method public void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity); method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...); method public void setNdefPushMessageCallback(android.nfc.NfcAdapter.CreateNdefMessageCallback, android.app.Activity, android.app.Activity...); method public void setOnNdefPushCompleteCallback(android.nfc.NfcAdapter.OnNdefPushCompleteCallback, android.app.Activity, android.app.Activity...); method public deprecated boolean isNdefPushEnabled(); method public deprecated void setBeamPushUris(android.net.Uri[], android.app.Activity); method public deprecated void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity); method public deprecated void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...); method public deprecated void setNdefPushMessageCallback(android.nfc.NfcAdapter.CreateNdefMessageCallback, android.app.Activity, android.app.Activity...); method public deprecated void setOnNdefPushCompleteCallback(android.nfc.NfcAdapter.OnNdefPushCompleteCallback, android.app.Activity, android.app.Activity...); field public static final java.lang.String ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED"; field public static final java.lang.String ACTION_NDEF_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED"; field public static final java.lang.String ACTION_TAG_DISCOVERED = "android.nfc.action.TAG_DISCOVERED"; Loading @@ -29203,15 +29204,15 @@ package android.nfc { field public static final int STATE_TURNING_ON = 2; // 0x2 } public static abstract interface NfcAdapter.CreateBeamUrisCallback { public static abstract deprecated interface NfcAdapter.CreateBeamUrisCallback { method public abstract android.net.Uri[] createBeamUris(android.nfc.NfcEvent); } public static abstract interface NfcAdapter.CreateNdefMessageCallback { public static abstract deprecated interface NfcAdapter.CreateNdefMessageCallback { method public abstract android.nfc.NdefMessage createNdefMessage(android.nfc.NfcEvent); } public static abstract interface NfcAdapter.OnNdefPushCompleteCallback { public static abstract deprecated interface NfcAdapter.OnNdefPushCompleteCallback { method public abstract void onNdefPushComplete(android.nfc.NfcEvent); } core/java/android/content/pm/PackageManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -1929,6 +1929,13 @@ public abstract class PackageManager { @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The Beam API is enabled on the device. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_NFC_BEAM = "android.sofware.nfc.beam"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports any Loading core/java/android/nfc/NfcAdapter.java +71 −1 Original line number Diff line number Diff line Loading @@ -325,6 +325,7 @@ public final class NfcAdapter { // Guarded by NfcAdapter.class static boolean sIsInitialized = false; static boolean sHasNfcFeature; static boolean sHasBeamFeature; // Final after first constructor, except for // attemptDeadServiceRecovery() when NFC crashes - we accept a best effort Loading Loading @@ -372,7 +373,9 @@ public final class NfcAdapter { * A callback to be invoked when the system successfully delivers your {@link NdefMessage} * to another device. * @see #setOnNdefPushCompleteCallback * @deprecated this feature is deprecated. */ @java.lang.Deprecated public interface OnNdefPushCompleteCallback { /** * Called on successful NDEF push. Loading @@ -395,7 +398,9 @@ public final class NfcAdapter { * content currently visible to the user. Alternatively, you can call {@link * #setNdefPushMessage setNdefPushMessage()} if the {@link NdefMessage} always contains the * same data. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public interface CreateNdefMessageCallback { /** * Called to provide a {@link NdefMessage} to push. Loading @@ -421,7 +426,10 @@ public final class NfcAdapter { } // TODO javadoc /** * @deprecated this feature is deprecated. */ @java.lang.Deprecated public interface CreateBeamUrisCallback { public Uri[] createBeamUris(NfcEvent event); } Loading Loading @@ -449,6 +457,25 @@ public final class NfcAdapter { public boolean onUnlockAttempted(Tag tag); } /** * Helper to check if this device has FEATURE_NFC_BEAM, but without using * a context. * Equivalent to * context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC_BEAM) */ private static boolean hasBeamFeature() { IPackageManager pm = ActivityThread.getPackageManager(); if (pm == null) { Log.e(TAG, "Cannot get package manager, assuming no Android Beam feature"); return false; } try { return pm.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM, 0); } catch (RemoteException e) { Log.e(TAG, "Package manager query failed, assuming no Android Beam feature", e); return false; } } /** * Helper to check if this device has FEATURE_NFC, but without using Loading Loading @@ -528,6 +555,7 @@ public final class NfcAdapter { public static synchronized NfcAdapter getNfcAdapter(Context context) { if (!sIsInitialized) { sHasNfcFeature = hasNfcFeature(); sHasBeamFeature = hasBeamFeature(); boolean hasHceFeature = hasNfcHceFeature(); /* is this device meant to have NFC */ if (!sHasNfcFeature && !hasHceFeature) { Loading Loading @@ -953,12 +981,17 @@ public final class NfcAdapter { * @param uris an array of Uri(s) to push over Android Beam * @param activity activity for which the Uri(s) will be pushed * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setBeamPushUris(Uri[] uris, Activity activity) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } if (activity == null) { throw new NullPointerException("activity cannot be null"); Loading Loading @@ -1035,12 +1068,17 @@ public final class NfcAdapter { * @param callback callback, or null to disable * @param activity activity for which the Uri(s) will be pushed * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setBeamPushUrisCallback(CreateBeamUrisCallback callback, Activity activity) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } if (activity == null) { throw new NullPointerException("activity cannot be null"); Loading Loading @@ -1119,13 +1157,18 @@ public final class NfcAdapter { * to only register one at a time, and to do so in that activity's * {@link Activity#onCreate} * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setNdefPushMessage(NdefMessage message, Activity activity, Activity ... activities) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } int targetSdkVersion = getSdkVersion(); try { Loading Loading @@ -1232,13 +1275,18 @@ public final class NfcAdapter { * to only register one at a time, and to do so in that activity's * {@link Activity#onCreate} * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setNdefPushMessageCallback(CreateNdefMessageCallback callback, Activity activity, Activity ... activities) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } int targetSdkVersion = getSdkVersion(); try { Loading Loading @@ -1313,13 +1361,18 @@ public final class NfcAdapter { * to only register one at a time, and to do so in that activity's * {@link Activity#onCreate} * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setOnNdefPushCompleteCallback(OnNdefPushCompleteCallback callback, Activity activity, Activity ... activities) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } int targetSdkVersion = getSdkVersion(); try { Loading Loading @@ -1524,12 +1577,17 @@ public final class NfcAdapter { * @param activity the current foreground Activity that has registered data to share * @return whether the Beam animation was successfully invoked * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public boolean invokeBeam(Activity activity) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return false; } } if (activity == null) { throw new NullPointerException("activity may not be null."); Loading Loading @@ -1593,6 +1651,9 @@ public final class NfcAdapter { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } if (activity == null || message == null) { throw new NullPointerException(); Loading Loading @@ -1627,6 +1688,9 @@ public final class NfcAdapter { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } if (activity == null) { throw new NullPointerException(); Loading Loading @@ -1700,12 +1764,18 @@ public final class NfcAdapter { * @see android.provider.Settings#ACTION_NFCSHARING_SETTINGS * @return true if NDEF Push feature is enabled * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public boolean isNdefPushEnabled() { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return false; } } try { return sService.isNdefPushEnabled(); Loading Loading
api/current.txt +11 −10 Original line number Diff line number Diff line Loading @@ -11315,6 +11315,7 @@ package android.content.pm { field public static final java.lang.String FEATURE_MICROPHONE = "android.hardware.microphone"; field public static final java.lang.String FEATURE_MIDI = "android.software.midi"; field public static final java.lang.String FEATURE_NFC = "android.hardware.nfc"; field public static final java.lang.String FEATURE_NFC_BEAM = "android.sofware.nfc.beam"; field public static final java.lang.String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; field public static final java.lang.String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef"; field public static final java.lang.String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese"; Loading Loading @@ -29169,14 +29170,14 @@ package android.nfc { method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context); method public java.util.List<java.lang.String> getSupportedOffHostSecureElements(); method public boolean ignore(android.nfc.Tag, int, android.nfc.NfcAdapter.OnTagRemovedListener, android.os.Handler); method public boolean invokeBeam(android.app.Activity); method public deprecated boolean invokeBeam(android.app.Activity); method public boolean isEnabled(); method public boolean isNdefPushEnabled(); method public void setBeamPushUris(android.net.Uri[], android.app.Activity); method public void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity); method public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...); method public void setNdefPushMessageCallback(android.nfc.NfcAdapter.CreateNdefMessageCallback, android.app.Activity, android.app.Activity...); method public void setOnNdefPushCompleteCallback(android.nfc.NfcAdapter.OnNdefPushCompleteCallback, android.app.Activity, android.app.Activity...); method public deprecated boolean isNdefPushEnabled(); method public deprecated void setBeamPushUris(android.net.Uri[], android.app.Activity); method public deprecated void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity); method public deprecated void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...); method public deprecated void setNdefPushMessageCallback(android.nfc.NfcAdapter.CreateNdefMessageCallback, android.app.Activity, android.app.Activity...); method public deprecated void setOnNdefPushCompleteCallback(android.nfc.NfcAdapter.OnNdefPushCompleteCallback, android.app.Activity, android.app.Activity...); field public static final java.lang.String ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED"; field public static final java.lang.String ACTION_NDEF_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED"; field public static final java.lang.String ACTION_TAG_DISCOVERED = "android.nfc.action.TAG_DISCOVERED"; Loading @@ -29203,15 +29204,15 @@ package android.nfc { field public static final int STATE_TURNING_ON = 2; // 0x2 } public static abstract interface NfcAdapter.CreateBeamUrisCallback { public static abstract deprecated interface NfcAdapter.CreateBeamUrisCallback { method public abstract android.net.Uri[] createBeamUris(android.nfc.NfcEvent); } public static abstract interface NfcAdapter.CreateNdefMessageCallback { public static abstract deprecated interface NfcAdapter.CreateNdefMessageCallback { method public abstract android.nfc.NdefMessage createNdefMessage(android.nfc.NfcEvent); } public static abstract interface NfcAdapter.OnNdefPushCompleteCallback { public static abstract deprecated interface NfcAdapter.OnNdefPushCompleteCallback { method public abstract void onNdefPushComplete(android.nfc.NfcEvent); }
core/java/android/content/pm/PackageManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -1929,6 +1929,13 @@ public abstract class PackageManager { @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The Beam API is enabled on the device. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_NFC_BEAM = "android.sofware.nfc.beam"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports any Loading
core/java/android/nfc/NfcAdapter.java +71 −1 Original line number Diff line number Diff line Loading @@ -325,6 +325,7 @@ public final class NfcAdapter { // Guarded by NfcAdapter.class static boolean sIsInitialized = false; static boolean sHasNfcFeature; static boolean sHasBeamFeature; // Final after first constructor, except for // attemptDeadServiceRecovery() when NFC crashes - we accept a best effort Loading Loading @@ -372,7 +373,9 @@ public final class NfcAdapter { * A callback to be invoked when the system successfully delivers your {@link NdefMessage} * to another device. * @see #setOnNdefPushCompleteCallback * @deprecated this feature is deprecated. */ @java.lang.Deprecated public interface OnNdefPushCompleteCallback { /** * Called on successful NDEF push. Loading @@ -395,7 +398,9 @@ public final class NfcAdapter { * content currently visible to the user. Alternatively, you can call {@link * #setNdefPushMessage setNdefPushMessage()} if the {@link NdefMessage} always contains the * same data. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public interface CreateNdefMessageCallback { /** * Called to provide a {@link NdefMessage} to push. Loading @@ -421,7 +426,10 @@ public final class NfcAdapter { } // TODO javadoc /** * @deprecated this feature is deprecated. */ @java.lang.Deprecated public interface CreateBeamUrisCallback { public Uri[] createBeamUris(NfcEvent event); } Loading Loading @@ -449,6 +457,25 @@ public final class NfcAdapter { public boolean onUnlockAttempted(Tag tag); } /** * Helper to check if this device has FEATURE_NFC_BEAM, but without using * a context. * Equivalent to * context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC_BEAM) */ private static boolean hasBeamFeature() { IPackageManager pm = ActivityThread.getPackageManager(); if (pm == null) { Log.e(TAG, "Cannot get package manager, assuming no Android Beam feature"); return false; } try { return pm.hasSystemFeature(PackageManager.FEATURE_NFC_BEAM, 0); } catch (RemoteException e) { Log.e(TAG, "Package manager query failed, assuming no Android Beam feature", e); return false; } } /** * Helper to check if this device has FEATURE_NFC, but without using Loading Loading @@ -528,6 +555,7 @@ public final class NfcAdapter { public static synchronized NfcAdapter getNfcAdapter(Context context) { if (!sIsInitialized) { sHasNfcFeature = hasNfcFeature(); sHasBeamFeature = hasBeamFeature(); boolean hasHceFeature = hasNfcHceFeature(); /* is this device meant to have NFC */ if (!sHasNfcFeature && !hasHceFeature) { Loading Loading @@ -953,12 +981,17 @@ public final class NfcAdapter { * @param uris an array of Uri(s) to push over Android Beam * @param activity activity for which the Uri(s) will be pushed * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setBeamPushUris(Uri[] uris, Activity activity) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } if (activity == null) { throw new NullPointerException("activity cannot be null"); Loading Loading @@ -1035,12 +1068,17 @@ public final class NfcAdapter { * @param callback callback, or null to disable * @param activity activity for which the Uri(s) will be pushed * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setBeamPushUrisCallback(CreateBeamUrisCallback callback, Activity activity) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } if (activity == null) { throw new NullPointerException("activity cannot be null"); Loading Loading @@ -1119,13 +1157,18 @@ public final class NfcAdapter { * to only register one at a time, and to do so in that activity's * {@link Activity#onCreate} * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setNdefPushMessage(NdefMessage message, Activity activity, Activity ... activities) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } int targetSdkVersion = getSdkVersion(); try { Loading Loading @@ -1232,13 +1275,18 @@ public final class NfcAdapter { * to only register one at a time, and to do so in that activity's * {@link Activity#onCreate} * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setNdefPushMessageCallback(CreateNdefMessageCallback callback, Activity activity, Activity ... activities) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } int targetSdkVersion = getSdkVersion(); try { Loading Loading @@ -1313,13 +1361,18 @@ public final class NfcAdapter { * to only register one at a time, and to do so in that activity's * {@link Activity#onCreate} * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public void setOnNdefPushCompleteCallback(OnNdefPushCompleteCallback callback, Activity activity, Activity ... activities) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } int targetSdkVersion = getSdkVersion(); try { Loading Loading @@ -1524,12 +1577,17 @@ public final class NfcAdapter { * @param activity the current foreground Activity that has registered data to share * @return whether the Beam animation was successfully invoked * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public boolean invokeBeam(Activity activity) { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return false; } } if (activity == null) { throw new NullPointerException("activity may not be null."); Loading Loading @@ -1593,6 +1651,9 @@ public final class NfcAdapter { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } if (activity == null || message == null) { throw new NullPointerException(); Loading Loading @@ -1627,6 +1688,9 @@ public final class NfcAdapter { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return; } } if (activity == null) { throw new NullPointerException(); Loading Loading @@ -1700,12 +1764,18 @@ public final class NfcAdapter { * @see android.provider.Settings#ACTION_NFCSHARING_SETTINGS * @return true if NDEF Push feature is enabled * @throws UnsupportedOperationException if FEATURE_NFC is unavailable. * @deprecated this feature is deprecated. */ @java.lang.Deprecated public boolean isNdefPushEnabled() { synchronized (NfcAdapter.class) { if (!sHasNfcFeature) { throw new UnsupportedOperationException(); } if (!sHasBeamFeature) { return false; } } try { return sService.isNdefPushEnabled(); Loading