Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
604d7fe7
Commit
604d7fe7
authored
13 years ago
by
Martijn Coenen
Committed by
Android (Google) Code Review
13 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Added support for rediscovering a Tag (API)."
parents
8fdb1e60
2dcae567
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/java/android/nfc/INfcTag.aidl
+2
-0
2 additions, 0 deletions
core/java/android/nfc/INfcTag.aidl
core/java/android/nfc/Tag.java
+46
-0
46 additions, 0 deletions
core/java/android/nfc/Tag.java
with
48 additions
and
0 deletions
core/java/android/nfc/INfcTag.aidl
+
2
−
0
View file @
604d7fe7
...
...
@@ -17,6 +17,7 @@
package android.nfc;
import android.nfc.NdefMessage;
import android.nfc.Tag;
import android.nfc.TransceiveResult;
/**
...
...
@@ -40,6 +41,7 @@ interface INfcTag
int ndefMakeReadOnly(int nativeHandle);
boolean ndefIsWritable(int nativeHandle);
int formatNdef(int nativeHandle, in byte[] key);
Tag rediscover(int nativehandle);
void setIsoDepTimeout(int timeout);
void setFelicaTimeout(int timeout);
...
...
This diff is collapsed.
Click to expand it.
core/java/android/nfc/Tag.java
+
46
−
0
View file @
604d7fe7
...
...
@@ -30,7 +30,9 @@ import android.nfc.tech.TagTechnology;
import
android.os.Bundle
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
android.os.RemoteException
;
import
java.io.IOException
;
import
java.util.Arrays
;
/**
...
...
@@ -233,6 +235,50 @@ public final class Tag implements Parcelable {
return
mTechStringList
;
}
/**
* Rediscover the technologies available on this tag.
* <p>
* The technologies that are available on a tag may change due to
* operations being performed on a tag. For example, formatting a
* tag as NDEF adds the {@link Ndef} technology. The {@link rediscover}
* method reenumerates the available technologies on the tag
* and returns a new {@link Tag} object containing these technologies.
* <p>
* You may not be connected to any of this {@link Tag}'s technologies
* when calling this method.
* This method guarantees that you will be returned the same Tag
* if it is still in the field.
* <p>May cause RF activity and may block. Must not be called
* from the main application thread. A blocked call will be canceled with
* {@link IOException} by calling {@link #close} from another thread.
* <p>Does not remove power from the RF field, so a tag having a random
* ID should not change its ID.
* @return the rediscovered tag object.
* @throws IOException if the tag cannot be rediscovered
* @hide
*/
// TODO See if we need TagLostException
// TODO Unhide for ICS
// TODO Update documentation to make sure it matches with the final
// implementation.
public
Tag
rediscover
()
throws
IOException
{
if
(
getConnectedTechnology
()
!=
-
1
)
{
throw
new
IllegalStateException
(
"Close connection to the technology first!"
);
}
try
{
Tag
newTag
=
mTagService
.
rediscover
(
getServiceHandle
());
if
(
newTag
!=
null
)
{
return
newTag
;
}
else
{
throw
new
IOException
(
"Failed to rediscover tag"
);
}
}
catch
(
RemoteException
e
)
{
throw
new
IOException
(
"NFC service dead"
);
}
}
/** @hide */
public
boolean
hasTech
(
int
techType
)
{
for
(
int
tech
:
mTechList
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment