Loading core/java/android/nfc/INfcTag.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,7 @@ interface INfcTag boolean canMakeReadOnly(int ndefType); int getMaxTransceiveLength(int technology); boolean getExtendedLengthApdusSupported(); void setTagUpToDate(long cookie); boolean isTagUpToDate(long cookie); } core/java/android/nfc/Tag.java +21 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.os.SystemClock; import java.io.IOException; import java.util.Arrays; Loading Loading @@ -121,6 +122,7 @@ public final class Tag implements Parcelable { final INfcTag mTagService; // interface to NFC service, will be null if mock tag int mConnectedTechnology; long mCookie; /** * Hidden constructor to be used by NFC service and internal classes. Loading @@ -140,6 +142,13 @@ public final class Tag implements Parcelable { mTagService = tagService; mConnectedTechnology = -1; try { mCookie = SystemClock.elapsedRealtime(); tagService.setTagUpToDate(mCookie); } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } } /** Loading Loading @@ -361,6 +370,18 @@ public final class Tag implements Parcelable { /** @hide */ @UnsupportedAppUsage public INfcTag getTagService() { try { if (!mTagService.isTagUpToDate(mCookie)) { String id_str = ""; for (int i = 0; i < mId.length; i++) { id_str = id_str + String.format("%02X ", mId[i]); } String msg = "Permission Denial: Tag ( ID: " + id_str + ") is out of date"; throw new SecurityException(msg); } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } return mTagService; } Loading Loading
core/java/android/nfc/INfcTag.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,7 @@ interface INfcTag boolean canMakeReadOnly(int ndefType); int getMaxTransceiveLength(int technology); boolean getExtendedLengthApdusSupported(); void setTagUpToDate(long cookie); boolean isTagUpToDate(long cookie); }
core/java/android/nfc/Tag.java +21 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.os.SystemClock; import java.io.IOException; import java.util.Arrays; Loading Loading @@ -121,6 +122,7 @@ public final class Tag implements Parcelable { final INfcTag mTagService; // interface to NFC service, will be null if mock tag int mConnectedTechnology; long mCookie; /** * Hidden constructor to be used by NFC service and internal classes. Loading @@ -140,6 +142,13 @@ public final class Tag implements Parcelable { mTagService = tagService; mConnectedTechnology = -1; try { mCookie = SystemClock.elapsedRealtime(); tagService.setTagUpToDate(mCookie); } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } } /** Loading Loading @@ -361,6 +370,18 @@ public final class Tag implements Parcelable { /** @hide */ @UnsupportedAppUsage public INfcTag getTagService() { try { if (!mTagService.isTagUpToDate(mCookie)) { String id_str = ""; for (int i = 0; i < mId.length; i++) { id_str = id_str + String.format("%02X ", mId[i]); } String msg = "Permission Denial: Tag ( ID: " + id_str + ") is out of date"; throw new SecurityException(msg); } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } return mTagService; } Loading