8929 Commits

Author SHA1 Message Date
Nick Pelly
ddbb2c997b Tweak Ndef.getType() API. Rename constants, expand javadoc.
Change-Id: I9d2c83411411fea4ef46bb7c30ebdbcd9ee3e7d8
2011-01-04 17:31:48 +11:00
Martijn Coenen
d27ebf1e69 Added getType() to NDEF technology class (API part).
Change-Id: Idfa391dd9d4a401e1daa3dc90ca57e4a3d9e0fa3
2011-01-04 15:57:39 +11:00
Martijn Coenen
912aa1cd70 Removed selectAid() from IsoDep.
It's a convenience method that can be implemented with transceive();
not really needed for now.

Change-Id: Idd855c85b15d97ae679d11d908834be3cb2741d8
2011-01-04 15:08:34 +11:00
Alon Albert
672ebb61a7 Merge "Improved ignore-backoff handling Allow a non-epidited ignore-backoff op to pass through an expidited backed off op." into gingerbread 2010-12-28 14:44:51 -08:00
Jeff Brown
c6f2b3b302 Merge "Fix policy issues when screen is off. (DO NOT MERGE)" into gingerbread 2010-12-23 12:41:59 -08:00
Dianne Hackborn
7becaeea7b Another stab at fixing issue #3149290 java.lang.RuntimeException:...
...Unable to pause activity
{com.android.settings/com.android.settings.applications.StorageUse}

Change-Id: Ibfa28a1c5af50dd150dfcafe71e905426d312643
2010-12-22 18:29:32 -08:00
Jeff Brown
eb9f7a01b0 Fix policy issues when screen is off. (DO NOT MERGE)
Rewrote interceptKeyBeforeQueueing to make the handling more systematic.
Behavior should be identical except:
- We never pass keys to applications when the screen is off and the keyguard
  is not showing (the proximity sensor turned off the screen).
  Previously we passed all non-wake keys through in this case which
  caused a bug on Crespo where the screen would come back on if a soft key
  was held at the time of power off because the resulting key up event
  would sneak in just before the keyguard was shown.  It would then be
  passed through to the dispatcher which would poke user activity and
  wake up the screen.
- We propagate the key flags when broadcasting media keys which
  ensures that recipients can tell when the key is canceled.
- We ignore endcall or power if canceled (shouldn't happen anyways).

Changed the input dispatcher to not poke user activity for canceled
events since they are synthetic and should not wake the device.

Changed the lock screen so that it does not poke the wake lock when the
grab handle is released.  This fixes a bug where the screen would come
back on immediately if the power went off while the user was holding
one of the grab handles because the sliding tab would receive an up
event after screen turned off and release the grab handles.

Bug: 3144874
Change-Id: Iebb91e10592b4ef2de4b1dd3a2e1e4254aacb697
2010-12-22 16:00:21 -08:00
Alon Albert
d41fe75f09 Improved ignore-backoff handling
Allow a non-epidited ignore-backoff op to pass through
an expidited backed off op.

To do this, I first refactored the complicated if statement:

            if (best == null
                    || ((bestSyncableIsUnknownAndNotARetry == syncableIsUnknownAndNotARetry)
                        ? (best.expedited == op.expedited
                           ? opRunTime < bestRunTime
                           : op.expedited)
                        : syncableIsUnknownAndNotARetry)) {
                best = op;
                bestSyncableIsUnknownAndNotARetry = syncableIsUnknownAndNotARetry;
                bestRunTime = opRunTime;
            }

Into a more readable:
            boolean setBest = false;
            if (best == null) {
                setBest = true;
            } else if (bestSyncableIsUnknownAndNotARetry == syncableIsUnknownAndNotARetry) {
                if (best.expedited == op.expedited) {
                    if (opRunTime < bestRunTime) {
                        //  if both have same level, earlier time wins
                        setBest = true;
                    }
                } else {
                    if (op.expedited) {
                        setBest = true;
                    }
                }
            } else {
                if (syncableIsUnknownAndNotARetry) {
                    setBest = true;
                }
            }
            if (setBest) {
                best = op;
                bestSyncableIsUnknownAndNotARetry = syncableIsUnknownAndNotARetry;
                bestRunTime = opRunTime;
            }

The refactoring was all done automatically with IntelliJ to avoid human error
in the conversion.

After verifying this code still behaved as expected including the error
condition in the bug, I added handling for the cases when a non-expidited op
may override an expedited op if certain conditions occur, specificaly, if the
expidited op is backed off and the non-expidited op is not.

Finally, refactored to make it testable and added tests and logging.

Bug: 3128963

Change-Id: I131cbcec6073ea5fe425f6b5aa88ca56c02b6598
2010-12-22 14:40:43 -08:00
Jeff Hamilton
3ce86481cb Remove canBeFormatted().
It's not easy to determine if this
is possible, so instead apps should
attempt a format and handle errors
in the format request.

Change-Id: I078a208b849e71ef3fb6b5970a9111ece4a2d201
2010-12-22 11:31:21 -06:00
Dianne Hackborn
5261cea2e0 Merge "Fix issue #3224616: TimeUtils.formatDuration() can drop 0s." into gingerbread 2010-12-21 13:27:15 -08:00
Bjorn Bringert
f5f7510486 Fix issue #3224616: TimeUtils.formatDuration() can drop 0s.
Integrated from master.

Change-Id: Ie12dd25cce03c06fafb7df1335266322df43b038
2010-12-20 15:23:02 -08:00
Mike LeBeau
52af3a4f9a Unhide RecognizerResultsIntent. This API was
reviewed for Froyo, but we didn't want to make it
public then because it wasn't until our first
Market release of Voice Search that the APIs would
be in use by our app.

http://b/3135351

Change-Id: I49053717cac08e3976c22e3a105139b6755aadb8
2010-12-20 10:50:31 -05:00
Martijn Coenen
ab82a5b9a8 Clean up and polish Mifare Classic tech.
- It's useful to have accessors at block level, so apps don't really have to know
  about the sector structure (and how many blocks there are in a sector).
- There's no way to tell whether a read/write/ didn't work because of auth
  failure. The documentation should be changed to make this point clear.
- Added increment/decrement commands, for atomic increment/decrement of value blocks.

Change-Id: I590feacbcd1443f1be7a86ab046a5b1f33e2e04c
2010-12-17 13:20:32 -08:00
Martijn Coenen
01d159aa2c Need to check ndef before writing ndef.
Regression due to all the (re)connect changes.

Change-Id: I637618f63518965e893a5a59db61002271666fa4
2010-12-16 16:34:56 -08:00
Martijn Coenen
c58c3f1ae2 Implement additional Mifare Ultralight convenience methods.
Change-Id: I8d9dfadb5911b2d11d1ba6dcf1381decbb8386ef
2010-12-15 16:41:38 -06:00
Martijn Coenen
0d27f999f4 Expose reconnect(), to allow applications to reset tag state.
Change-Id: Ib5432e7f6b6aaf6ec1cb06693592cb7c6440a6f8
2010-12-15 16:41:38 -06:00
Martijn Coenen
4049f9d00a Implement multi-tech connect, enfore tech exclusivity.
- The NfcService now allows for connecting to a specific technology;
- The "active" parts of technology classes may not be used at the same time.

Change-Id: Ibb569f51cc6da4f3e24df9d0850c6f49a022b0c2
2010-12-15 16:41:38 -06:00
Dianne Hackborn
99441c45e4 Fix issue #3149290: java.lang.RuntimeException: Unable to pause activity
{com.android.settings/com.android.settings.applications.StorageUse}

AbsListView could call mAdapter.getItemId() if a save state happened
after the data changed but before a layout occurred.

Change-Id: Ica020971dc458dff79b56dd810733e217f4f7da6
2010-12-15 11:02:55 -08:00
Costin Manolache
a848d34450 Merge "Fix bug in permission grant system." into gingerbread 2010-12-14 10:07:26 -08:00
Brad Fitzpatrick
0927c90265 Merge "Fix StrictMode javadoc copy/paste error." into gingerbread 2010-12-13 15:25:09 -08:00
Nick Kralevich
9dbef975f0 Merge "Avoid leaking sockets." into gingerbread 2010-12-13 15:03:28 -08:00
Nick Kralevich
2ed20f8768 Avoid leaking sockets.
When a DNS lookup fails, we end up creating a datagram socket
but never properly close it.  This wastes limited valuable file
descriptors and causes CTS test failures.  Generally, we should
ensure that sockets or files are opened in a try block, and closed
in a finally block.

Bug: 3276283
Change-Id: I3432f3bc061268c7367948230f6edbdfcec55892
2010-12-13 14:32:17 -08:00
Dianne Hackborn
e4a5951925 Fix issue #3154576: battery stats checkin should include UID -> packages+ map
Includes some other small fixes to battery collection and a few
other things.

Output of package info looks like this:

5,0,i,uid,1000,com.android.settings
5,0,i,uid,1000,com.android.providers.subscribedfeeds
5,0,i,uid,1000,com.android.providers.settings
5,0,i,uid,1000,com.android.server.vpn
5,0,i,uid,1000,android
5,0,i,uid,1000,com.android.systemui
5,0,i,uid,1000,com.google.android.backup
5,0,i,uid,1001,com.android.phone
5,0,i,uid,1001,com.android.providers.telephony
5,0,i,uid,1022,com.android.nfc
5,0,i,uid,10021,com.google.android.location
5,0,i,uid,10021,com.google.android.syncadapters.calendar
5,0,i,uid,10021,com.google.android.gsf
5,0,i,uid,10021,com.google.android.syncadapters.contacts
5,0,i,uid,10026,com.android.providers.downloads.ui
5,0,i,uid,10026,com.android.providers.media
5,0,i,uid,10026,com.android.providers.drm
5,0,i,uid,10026,com.android.providers.downloads
5,0,i,uid,10032,com.android.launcher
5,0,i,uid,10039,com.google.android.gm
5,0,i,uid,10041,com.google.android.gallery3d
5,0,i,uid,10049,com.android.providers.calendar

Change-Id: I9e38f254eef146339113ad270f5c6e8b60fb7a1d
2010-12-13 14:31:40 -08:00
Brad Fitzpatrick
320274c5f1 Fix StrictMode javadoc copy/paste error.
Change-Id: Idd49111f0a1af6f331cffa0972191b2d4e25a385
2010-12-13 14:07:39 -08:00
Martijn Coenen
e3f6336bcf Fixed API for active NDEF reading and NDEF formatting.
- Added getNdefCached() to return the message read at discovery time.
- Fixed format() to check ndef before doing the write:
  libnfc actually requires a checkNdef to be done before writing.

Change-Id: I9b3108299c05539bdef92dd74f62f911fb5a16bf
2010-12-13 09:58:58 -06:00
Jeff Hamilton
641dd62155 First pass at advanced NFC tag dispatching APIs and other cleanup.
Change-Id: I022fcd481274a2f68d93218026e77551cfae8cae
2010-12-10 22:48:16 -06:00
Martijn Coenen
b79173f660 Changed technology close() to reconnect to the tag instead of physical disconnect.
Change-Id: I8935e4aae452adeec472c0b3ff3c77f1400a264e
2010-12-10 22:07:46 -06:00
Martijn Coenen
fc5a3b6cfb Changed transceive on all technologies to "raw", except for Mifare classes.
Change-Id: I3d680e37fec0ab84cdbb70d9fb6fff9527dd76a2
2010-12-10 22:06:35 -06:00
Martijn Coenen
3300e4c3ea Implemented isWritable() to indicate NDEF capability container r/w state.
Change-Id: Ie8bdf490c955e620f5e5029346fbe2e188ea4748
2010-12-10 22:02:09 -06:00
Nick Pelly
50b4d8f643 Make getSystemService(NFC_SERVICE) the NFC entry point.
This gives NFC service a handle to the application context.

Deprecate NfcAdapter.getDefaultAdapter(), it does not provide a context.
Using this method will print a warning, and will later throw an exception
if a method that requires a context is called. No 2.3 API's will fail, but
new API's that do require a context might fail.

Also add helper NfcAdapter.getDefaultAdapter(Context).

Change-Id: I9a6378de4ef4b61ad922f8d53e64e2a1a1d5d60c
2010-12-10 17:12:33 -08:00
Costin Manolache
5d275bba42 Fix bug in permission grant system.
Change-Id: Ic7d712e5a672c3eded16fee83235db01ab3c74fa
2010-12-09 16:53:33 -08:00
Brad Fitzpatrick
36af79434f Fix malformed Javadoc.
Change-Id: I5cfbd49272117defce5226da0f40a8392457a2e2
2010-12-08 11:31:07 -08:00
Nick Pelly
40ddd4a649 Merge "Implemented getSize() to return max ndef size." into gingerbread 2010-12-07 22:55:21 -08:00
Martijn Coenen
6d9fc7e1ef Implemented getSize() to return max ndef size.
Change-Id: Ia584e8cfa51a4eaef5f03dc436c78a67296c2cae
2010-12-07 22:54:07 -08:00
Martijn Coenen
5289b91c88 Implement ndef formatting.
Change-Id: I6e3e3abdc304bc14d7c93a413e42bf957963e288
2010-12-07 22:30:39 -08:00
Mathias Agopian
05813b0eb9 Merge changes I244b5469,I32044e91 into gingerbread
* changes:
  [3253328, 3171580] Treat GONE and INVISIBLE views the same when calculating transparent regions
  [3171580] Fix two typos related to fixed-size buffers
2010-12-07 14:18:21 -08:00
Martijn Coenen
72df4ea830 Remove Type X Tags from the top-level API.
Also added an extra to carry the ndef message, so we can have it in multiple
Ndef instances without doing an active read.

Change-Id: I2ecabc24732990c5c9979ee3a001a7fb13da21d9
2010-12-07 13:51:47 -08:00
Nick Pelly
47e6ccb65a Merge "Corrected MIFARE default key set" into gingerbread 2010-12-07 09:29:21 -08:00
Jan Brands
65c3f9806e Corrected MIFARE default key set
The all-zero key is not a commonly used key.
Fixed naming

Change-Id: I2fb86079159195c6893ea758e8b0bbda266dc420
2010-12-07 09:27:06 -08:00
Dirk Dougherty
0871ee0c6f Doc change: fix href to axis_globe_inverted orientation diagram. 2010-12-06 19:40:21 -08:00
Martijn Coenen
9a9706a213 Added missing ndef technology to getTech.
Change-Id: I1f08e140c9bb43a8e894812adbc4d11801637f46
2010-12-06 18:44:12 -08:00
Nick Pelly
e58e8a715b Merge "Added NdefFormatable tag, initial class with supported methods." into gingerbread 2010-12-06 18:41:36 -08:00
Martijn Coenen
39f91ed529 Added NdefFormatable tag, initial class with supported methods.
Change-Id: Ifa358b5e980158d5e8accb9f42fdcfb29ad81e64
2010-12-06 18:38:49 -08:00
Jeff Hamilton
c1576ad627 Update the docs to clarify the ordering constraints.
Change-Id: Ib3932e637a675c875b9ed3482826a150b845a385
2010-12-05 21:50:29 -06:00
Mathias Agopian
e33811512e [3253328, 3171580] Treat GONE and INVISIBLE views the same when calculating transparent regions
We only used to check for INVISIBLE, which prevented some Surfaceview
optimization to take place.

Change-Id: I244b54696d861a022ca1c334ff61ab7efb899587
2010-12-03 17:35:06 -08:00
Jan Brands
2fe24e3e14 First implementation of MifareUltralight
Change-Id: I77818ddc89b529c17fc41d6c0850688365c6b770
2010-12-03 23:45:03 +01:00
Jeff Hamilton
609b3e429a Merge remote branch 'ohd/gingerbread' into merge 2010-12-02 09:41:16 -06:00
Kenny Root
938d097263 Merge "Grant ACCESS_ALL_DOWNLOADS to DefaultContainerService" into gingerbread 2010-12-01 14:18:23 -08:00
Kenny Root
1de2eac9d0 Grant ACCESS_ALL_DOWNLOADS to DefaultContainerService
Be compatible with the old DownloadProvider behavior of being able to
operate on content URIs returned from .insert()

Bug: 3242328
Change-Id: I7dad15ac0fefa867c3c8a33a579fc9899ac80262
2010-12-01 11:37:53 -08:00
Brad Fitzpatrick
981a72a150 Merge "[don't auto-merge] Don't re-read SharedPreferences unnecessarily." into gingerbread 2010-12-01 08:46:52 -08:00