Loading api/current.xml +29 −1 Original line number Diff line number Diff line Loading @@ -100802,6 +100802,19 @@ <parameter name="activity" type="android.app.Activity"> </parameter> </method> <method name="disableNdefPushDispatch" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="activity" type="android.app.Activity"> </parameter> </method> <method name="enableForegroundDispatch" return="void" abstract="false" Loading @@ -100819,6 +100832,21 @@ <parameter name="filters" type="android.content.IntentFilter..."> </parameter> </method> <method name="enableForegroundNdefPush" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="activity" type="android.app.Activity"> </parameter> <parameter name="msg" type="android.nfc.NdefMessage"> </parameter> </method> <method name="getDefaultAdapter" return="android.nfc.NfcAdapter" abstract="false" Loading Loading @@ -226756,7 +226784,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="t" type="T"> <parameter name="arg0" type="T"> </parameter> </method> </interface> core/java/android/nfc/INfcAdapter.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ interface INfcAdapter void enableForegroundDispatch(in ComponentName activity, in PendingIntent intent, in IntentFilter[] filters); void disableForegroundDispatch(in ComponentName activity); void enableForegroundNdefPush(in ComponentName activity, in NdefMessage msg); void disableForegroundNdefPush(in ComponentName activity); // Non-public methods // TODO: check and complete Loading core/java/android/nfc/NfcAdapter.java +64 −10 Original line number Diff line number Diff line Loading @@ -413,13 +413,6 @@ public final class NfcAdapter { } } class ForegroundDispatchPausedListener implements OnActivityPausedListener { @Override public void onPaused(Activity activity) { disableForegroundDispatchInternal(activity, true); } } /** * Enables foreground dispatching to the given Activity. This will force all NFC Intents that * match the given filters to be delivered to the activity bypassing the standard dispatch Loading @@ -438,7 +431,7 @@ public final class NfcAdapter { throw new NullPointerException(); } if (!activity.isResumed()) { throw new IllegalStateException("Foregorund dispatching can onlly be enabled " + throw new IllegalStateException("Foregorund dispatching can only be enabled " + "when your activity is resumed"); } try { Loading @@ -452,15 +445,24 @@ public final class NfcAdapter { /** * Disables foreground activity dispatching setup with * {@link #enableForegroundDispatch}. This must be called before the Activity returns from * {@link #enableForegroundDispatch}. * * <p>This must be called before the Activity returns from * it's <code>onPause()</code> or this method will throw an IllegalStateException. * * This method must be called from the main thread. * <p>This method must be called from the main thread. */ public void disableForegroundDispatch(Activity activity) { disableForegroundDispatchInternal(activity, false); } class ForegroundDispatchPausedListener implements OnActivityPausedListener { @Override public void onPaused(Activity activity) { disableForegroundDispatchInternal(activity, true); } } void disableForegroundDispatchInternal(Activity activity, boolean force) { try { sService.disableForegroundDispatch(activity.getComponentName()); Loading @@ -473,6 +475,58 @@ public final class NfcAdapter { } } /** * Enable NDEF messages push while this Activity is in the foreground. */ public void enableForegroundNdefPush(Activity activity, NdefMessage msg) { if (activity == null || msg == null) { throw new NullPointerException(); } if (!activity.isResumed()) { throw new IllegalStateException("Foregorund NDEF push can only be enabled " + "when your activity is resumed"); } try { ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, new ForegroundDispatchPausedListener()); sService.enableForegroundNdefPush(activity.getComponentName(), msg); } catch (RemoteException e) { attemptDeadServiceRecovery(e); } } /** * Disables foreground NDEF push setup with * {@link #enableForegroundNdefPush}. * * <p>This must be called before the Activity returns from * it's <code>onPause()</code> or this method will throw an IllegalStateException. * * <p>This method must be called from the main thread. */ public void disableNdefPushDispatch(Activity activity) { disableForegroundDispatchInternal(activity, false); } class ForegroundNdefPushPausedListener implements OnActivityPausedListener { @Override public void onPaused(Activity activity) { disableNdefPushDispatchInternal(activity, true); } } void disableNdefPushDispatchInternal(Activity activity, boolean force) { try { sService.disableForegroundNdefPush(activity.getComponentName()); if (!force && !activity.isResumed()) { throw new IllegalStateException("You must disable forgeground NDEF push " + "while your activity is still resumed"); } } catch (RemoteException e) { attemptDeadServiceRecovery(e); } } /** * Retrieve a TagTechnology object used to interact with a Tag that is * in field. Loading Loading
api/current.xml +29 −1 Original line number Diff line number Diff line Loading @@ -100802,6 +100802,19 @@ <parameter name="activity" type="android.app.Activity"> </parameter> </method> <method name="disableNdefPushDispatch" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="activity" type="android.app.Activity"> </parameter> </method> <method name="enableForegroundDispatch" return="void" abstract="false" Loading @@ -100819,6 +100832,21 @@ <parameter name="filters" type="android.content.IntentFilter..."> </parameter> </method> <method name="enableForegroundNdefPush" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="activity" type="android.app.Activity"> </parameter> <parameter name="msg" type="android.nfc.NdefMessage"> </parameter> </method> <method name="getDefaultAdapter" return="android.nfc.NfcAdapter" abstract="false" Loading Loading @@ -226756,7 +226784,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="t" type="T"> <parameter name="arg0" type="T"> </parameter> </method> </interface>
core/java/android/nfc/INfcAdapter.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ interface INfcAdapter void enableForegroundDispatch(in ComponentName activity, in PendingIntent intent, in IntentFilter[] filters); void disableForegroundDispatch(in ComponentName activity); void enableForegroundNdefPush(in ComponentName activity, in NdefMessage msg); void disableForegroundNdefPush(in ComponentName activity); // Non-public methods // TODO: check and complete Loading
core/java/android/nfc/NfcAdapter.java +64 −10 Original line number Diff line number Diff line Loading @@ -413,13 +413,6 @@ public final class NfcAdapter { } } class ForegroundDispatchPausedListener implements OnActivityPausedListener { @Override public void onPaused(Activity activity) { disableForegroundDispatchInternal(activity, true); } } /** * Enables foreground dispatching to the given Activity. This will force all NFC Intents that * match the given filters to be delivered to the activity bypassing the standard dispatch Loading @@ -438,7 +431,7 @@ public final class NfcAdapter { throw new NullPointerException(); } if (!activity.isResumed()) { throw new IllegalStateException("Foregorund dispatching can onlly be enabled " + throw new IllegalStateException("Foregorund dispatching can only be enabled " + "when your activity is resumed"); } try { Loading @@ -452,15 +445,24 @@ public final class NfcAdapter { /** * Disables foreground activity dispatching setup with * {@link #enableForegroundDispatch}. This must be called before the Activity returns from * {@link #enableForegroundDispatch}. * * <p>This must be called before the Activity returns from * it's <code>onPause()</code> or this method will throw an IllegalStateException. * * This method must be called from the main thread. * <p>This method must be called from the main thread. */ public void disableForegroundDispatch(Activity activity) { disableForegroundDispatchInternal(activity, false); } class ForegroundDispatchPausedListener implements OnActivityPausedListener { @Override public void onPaused(Activity activity) { disableForegroundDispatchInternal(activity, true); } } void disableForegroundDispatchInternal(Activity activity, boolean force) { try { sService.disableForegroundDispatch(activity.getComponentName()); Loading @@ -473,6 +475,58 @@ public final class NfcAdapter { } } /** * Enable NDEF messages push while this Activity is in the foreground. */ public void enableForegroundNdefPush(Activity activity, NdefMessage msg) { if (activity == null || msg == null) { throw new NullPointerException(); } if (!activity.isResumed()) { throw new IllegalStateException("Foregorund NDEF push can only be enabled " + "when your activity is resumed"); } try { ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity, new ForegroundDispatchPausedListener()); sService.enableForegroundNdefPush(activity.getComponentName(), msg); } catch (RemoteException e) { attemptDeadServiceRecovery(e); } } /** * Disables foreground NDEF push setup with * {@link #enableForegroundNdefPush}. * * <p>This must be called before the Activity returns from * it's <code>onPause()</code> or this method will throw an IllegalStateException. * * <p>This method must be called from the main thread. */ public void disableNdefPushDispatch(Activity activity) { disableForegroundDispatchInternal(activity, false); } class ForegroundNdefPushPausedListener implements OnActivityPausedListener { @Override public void onPaused(Activity activity) { disableNdefPushDispatchInternal(activity, true); } } void disableNdefPushDispatchInternal(Activity activity, boolean force) { try { sService.disableForegroundNdefPush(activity.getComponentName()); if (!force && !activity.isResumed()) { throw new IllegalStateException("You must disable forgeground NDEF push " + "while your activity is still resumed"); } } catch (RemoteException e) { attemptDeadServiceRecovery(e); } } /** * Retrieve a TagTechnology object used to interact with a Tag that is * in field. Loading