737 Commits

Author SHA1 Message Date
Jeff Sharkey
88de70f3c5 Merge "Deprecate ACTION_BACKGROUND_DATA_SETTING_CHANGED." 2012-02-01 16:54:53 -08:00
Jeff Brown
9dbfc331b4 Merge "Support automatic cancellation of Loaders." 2012-02-01 16:31:48 -08:00
Jeff Brown
b19a71a20a Support automatic cancellation of Loaders.
Change-Id: I18d3f49e413f48fcdd519d15e99c238ad54d35b9
2012-02-01 16:30:14 -08:00
Christopher Tate
f46723b41f Implement background vs foreground broadcasts
Before now, receiving a broadcast would cause a process to be hoisted
to foreground priority / cgroup.  This is no longer the case: broadcasts
by default are handled in the background, with a suitably increased
timeout interval.  When a given broadcast needs to be dealt with in a
more timely manner, the issuer can set the new FLAG_BROADCAST_FOREGROUND
flag on the Intent, which will produce the old foreground-priority
behavior.

To avoid priority inversions, foreground broadcasts are tracked on a
separate outgoing queue and can be in flight simultaneously with a
background-priority broadcast.  If there is already a background-level
broadcast in flight to a given app and then a foreground-level one is
dispatched to that app, the app [and its handling of both broadcasts]
will be properly hoisted to foreground priority.

This change is also essentially the first step towards refactoring the
broadcast-handling portions of the Activity Manager into a more
independent existence.  Making BroadcastQueue a top-level class and
regularizing its operation viz the primary Activity Manager operation
is the next step.

Change-Id: If1be33156dc22dcce318edbb5846b08df8e7bed5
2012-02-01 14:36:34 -08:00
Xavier Ducrohet
d2726ba47e Add tools specific annotations to the API.
Those annotations are not runtime retention and have zero impact
on the device builds.

Change-Id: I18d905fccfe18eb621e1411d7ae7ba97910cc727
2012-01-31 15:56:40 -08:00
Romain Guy
a403a2e0f0 Merge "Add GradientDrawable.setColors(int[])" 2012-01-31 12:12:38 -08:00
Romain Guy
8bd9698b66 Add GradientDrawable.setColors(int[])
This change also updates the documentation to warn the user about which properties
require a call to mutate().

Change-Id: I84717068bf026669e3eef1ae92db665a964fe08a
2012-01-31 12:11:02 -08:00
Chet Haase
c1ca665827 Add new ViewPropertyAnimator utility methods
Users have requested the ability to sequence ViewPropertyAnimator
animations. it is not possible with AnimatorSet, which only takes objects
of type Animator (which VPA does not extend). But the AnimatorSet model
is not appropriate for VPA anyway, since it is not possible to set up
a VPA ahead of time to start later; it's just not the way that VPA is
intended to work.

Instead, there are now two new methods on VPA, onStart() and onEnd(). These
methods take a Runnable which is executed when the animation starts or ends.
These methods should allow other VPAs or other arbitrary code to execute at the
start or finish of any particular VPA animation, allowing simple sequencing
without the overhead of creating listeners and monitoring the cancelation status
of the VPA.

Additionally, this change adds a new method withLayer() which sets a hardware
layer on the VPA's target view for the duration of the animation. This
was already possible, but required writing boilerplate code to create a listener
and override the start/end methods to add and remove the layer. This utility method
makes this common use case much simpler and less error-prone.

Change-Id: I819978517e17c647ffb7028063cd0adde68ff691
2012-01-31 10:50:14 -08:00
Jeff Sharkey
54ee2adf17 Deprecate ACTION_BACKGROUND_DATA_SETTING_CHANGED.
Broadcast is no longer sent, except during first boot after platform
upgrade.

Change-Id: I7a9c105b5783ca9f9c3aca2efff6fe5c13a4c1fd
2012-01-30 16:32:54 -08:00
Chet Haase
0d29936ec3 Fix bug in LayoutTransition for INVISIBLE views
When a view is becoming VISIBLE or INVISIBLE in a container with a
LayoutTransition, animations run to fade the view in and out and also
to run 'changing' animations on the view's other siblings. This logic
also cancels any running 'changin' animations to account for new ones
running.

However, in the specific case of INVISIBLE changes, there will be no
layout changes in the container - layout has already accounted for that
view (unlike in the case of GONE views); the visibility is just a matter of
drawing the view (or not). Therefore, we're canceling 'changing' animations
that should continue running and not replacing them with any other animations,
since new animations would only be started on layout chnages which are not
forthcoming.

One artifact seen from this bug is that the navigation bar buttons sometimes
disappear when changing orientation. This is because the menu button may
toggle between VISIBLE and INVISIBLE, causing animations on the other
buttons to get canceled, which leaves those views in a completely wrong
state.

The right thing to do is to avoid canceling in-process 'changing' animations
and to skip the logic of setting up new 'changing' animations which won't fire
anyway.

There is some minor API work in here because we did not previously have the
necessary information in LayoutTransition to know whether a view was being
hidden or shown to/from the INVISIBLE state.

Issue #5911213: LayoutTransitions ending in an odd state

Change-Id: I5c60c8583c8ea08965727b4ef17b550c40a3882c
2012-01-30 07:53:59 -08:00
Jeff Brown
2d2d7d6f42 Merge "Implement a cancelation mechanism for queries." 2012-01-27 17:37:24 -08:00
Jeff Brown
75ea64fc54 Implement a cancelation mechanism for queries.
Added new API to enable cancelation of SQLite and content provider
queries by means of a CancelationSignal object.  The application
creates a CancelationSignal object and passes it as an argument
to the query.  The cancelation signal can then be used to cancel
the query while it is executing.

If the cancelation signal is raised before the query is executed,
then it is immediately terminated.

Change-Id: If2c76e9a7e56ea5e98768b6d4f225f0a1ca61c61
2012-01-27 17:33:21 -08:00
Nick Pelly
fbc659e259 Merge "Fix build: update current.txt" 2012-01-27 10:35:12 -08:00
Nick Pelly
21c136a4ec Fix build: update current.txt
Change-Id: Ic28314e98784ebe513bd2191d3fa6c9bd5674422
2012-01-27 10:34:18 -08:00
Nick Pelly
ef78d96b90 Merge "Add NdefMessage.getByteLength(), and more minor fixes:" 2012-01-27 09:59:10 -08:00
Nick Pelly
1f5badc1cb Add NdefMessage.getByteLength(), and more minor fixes:
Remove NdefMessage from dispatch(). It's already in the Tag.
/*package*/ cleanup
Fix sitemap after removal of NFCDemo

Change-Id: Ie1f6d9ea98144aa97f56bb709a33f5d0ef916e8b
2012-01-26 14:21:19 -08:00
Gilles Debunne
259c109046 Remove @deprecate in View's fadingEdge
The comment of this field is also aggregated in the android.R.styleable#View
description. As a result, the @deprecated in the comment of this field also
applies to android.R.styleable#View which incorrectly appears deprecated.

This fixes the problem, although fadingEdge will no longer be marked as
deprecated in IDEs. I believe it is less important that to make View
deprecated.

Change-Id: I96d8e868001c4c853eb1536f8401275b9b1e689b
2012-01-26 13:46:25 -08:00
Dianne Hackborn
52da22f273 Merge "Add xxhdpi; fix ActivityManager.getLauncherLargeIconSize() etc." 2012-01-25 16:15:43 -08:00
Dianne Hackborn
d96e3dfa02 Add xxhdpi; fix ActivityManager.getLauncherLargeIconSize() etc.
Change-Id: I519d6cdc527a402d93b98df17a64fc1da52ad598
2012-01-25 15:14:50 -08:00
Nick Pelly
c97a552023 Improve NDEF API's
o Add NdefRecord.toMimeType()
  Maps the record to a MIME type
o Add NdefRecord.toUri()
  Maps the record to a URI
o Add hidden NfcAdapter.dispatch()
  Helps test the dispatch path.
o Modify createMime(), createUri() and createExternal():
  Do not try and strictly follow RFC requirements for URI or MIME content
  types. This just leads to heartbreak - the RFC requirements are too strict.
  For example RFC1341 forbids the use of '.' in a MIME type, however this is in
  common use in types such as "application/vnd.companyname". I think the best
  approach is to only remove 'obvious' whitespace issues, and to convert
  uppercase to lowercase as per Android guidelines.

Change-Id: Id686f5f3b05b2dceafad48e1cfcbdb2b3890b854
2012-01-25 13:17:19 -08:00
Nick Pelly
dc828acd5f Merge "Add API's for normalizing MIME's and URI's." 2012-01-25 12:55:58 -08:00
Dianne Hackborn
43ea4e10dc Merge "Added JELLY_BEAN version name; update some targetSdkVersion docs." 2012-01-25 12:29:17 -08:00
Dianne Hackborn
81e9276a47 Added JELLY_BEAN version name; update some targetSdkVersion docs.
Change-Id: Ia38ff5b9ad2b63c2cf667260881222d9ff168052
2012-01-25 11:16:57 -08:00
Nick Pelly
ccae412ded Add API's for normalizing MIME's and URI's.
Helps developers create well-behaved intents:
- lower case MIME data type
- strip parameters from MIME content types
- lowercase URI scheme

The new API's are
normalizeAndSetType()
normalizeAndSetData()
normalizeAndSetDataAndType()
Uri.normalize()
normalizeMimeType()

Change-Id: Ib5c907897f39b1f705bcc4c9103ba1e6f316380b
2012-01-24 20:04:13 -08:00
Svetoslav Ganov
3f9c9eab7b NumberPicker should not throw an exception if no enough values for wrapping.
1. The selector wheel was throwing an exception if a client requires that it
   wraps its selector wheel if the number of values is less that the number
   of values shown in the wheel.  While wrapping makes no sense if the all
   possible values are already shown, we should not throw an exception,
   rather to ignore the request.

bug:5911190

Change-Id: Icd90cd39f66d9f39939801752bf1eb1eef8fe757
2012-01-24 12:09:11 -08:00
Jeff Brown
d4e34d61d0 Merge "Inform ContentObservers about the changed content Uri." 2012-01-23 17:36:06 -08:00
Jeff Brown
b934a82139 Merge "Clean up content observer code." 2012-01-23 17:35:50 -08:00
Jeff Brown
655e66bceb Inform ContentObservers about the changed content Uri.
Added a new method ContentObserver.onChange(boolean, Uri) that
receives the changed content Uri.  This can help applications make
better decisions about how to interpret a change notification.

Change-Id: I8e35378b6485fe22c5bc240ba07557d269af0836
2012-01-23 17:28:29 -08:00
Romain Guy
e575005f7c Merge "Update hardware acceleration doc" 2012-01-23 16:27:50 -08:00
Romain Guy
36d7549181 Update hardware acceleration doc
Change-Id: I3bed77b3c4e1eff96fa462e4849f25f38784c415
2012-01-23 16:26:46 -08:00
Romain Guy
d215ddf3d9 Merge "Fix API typo" 2012-01-23 15:35:24 -08:00
Romain Guy
1e878d2ff5 Fix API typo
Change-Id: Iac6de947b0d550cc8dd4a3b5d88baa322c21bbb8
2012-01-23 15:34:25 -08:00
Jeff Brown
86de0590b9 Clean up content observer code.
Improved the documentation a little bit.

Fixed a bug in ContentService wherein if a ContentObserver was
passed as an argument and its deliverSelfNotifications() method
returned true, then notifyChange would tell all observers that
the change was a self-change even though it was only a self-change
from the perspective of the provided observer.

Deprecated ContentObservable.notifyChange since it is never
used and in general it shouldn't be because we want the notification
to be posted to the handler.

Change-Id: Idde49eb40777e011a068f2adae8a32f779dfb923
2012-01-23 13:01:18 -08:00
Dianne Hackborn
d9ea468d6a New brightness setting to adjust auto-brightness mode.
Change-Id: Icfec22be99d8c79e9ff5720b80fb9dacbba36134
2012-01-23 12:01:00 -08:00
Romain Guy
22d418437e Fix the build, for real
Change-Id: I6263f7e5e3ae2f7efe045f8b464c0ed1b87fc793
2012-01-19 18:33:25 -08:00
Romain Guy
bad1216619 Merge "Deprecate unused APIs" 2012-01-19 17:34:26 -08:00
Romain Guy
f9d9c065ed Deprecate unused APIs
Change-Id: I0107e246b632dda96b8b025217936954f1f46283
2012-01-19 17:16:38 -08:00
Jean Chalard
96c804af0b Add methods to support shortcuts in user dict.
Adds the new interface to the user dictionary, which includes
a clean way of inserting words in any locale and support for
shortcuts.

Change Ib318c047 implements the provider part of this.

Bug: 4646172
Change-Id: Id3ca792f2555fac46728f9d404ab0199971f6503
2012-01-18 18:54:34 +09:00
Ken Wakasa
5a5b84c3e1 Merge "Bring LatinIME's privateImeOptions "forceAscii" to a formal public API" 2012-01-12 18:15:42 -08:00
Ken Wakasa
c8f4183669 Bring LatinIME's privateImeOptions "forceAscii" to a formal public API
bug: 5850605
Change-Id: I6ab6076909c735a3e0729b457de68d0b5301184d
2012-01-13 09:45:41 +09:00
Svetoslav Ganov
bd2ff3666b Merge "AccessibilityService description not internationalized." 2012-01-12 15:36:58 -08:00
Jeff Brown
986f00faf4 Merge "Rewrite SQLite database wrappers." 2012-01-12 15:03:26 -08:00
Jeff Brown
e5360fbf3e Rewrite SQLite database wrappers.
The main theme of this change is encapsulation.  This change
preserves all existing functionality but the implementation
is now much cleaner.

Instead of a "database lock", access to the database is treated
as a resource acquisition problem.  If a thread's owns a database
connection, then it can access the database; otherwise, it must
acquire a database connection first, and potentially wait for other
threads to give up theirs.  The SQLiteConnectionPool encapsulates
the details of how connections are created, configured, acquired,
released and disposed.

One new feature is that SQLiteConnectionPool can make scheduling
decisions about which thread should next acquire a database
connection when there is contention among threads.  The factors
considered include wait queue ordering (fairness among peers),
whether the connection is needed for an interactive operation
(unfairness on behalf of the UI), and whether the primary connection
is needed or if any old connection will do.  Thus one goal of the
new SQLiteConnectionPool is to improve the utilization of
database connections.

To emulate some quirks of the old "database lock," we introduce
the concept of the primary database connection.  The primary
database connection is the one that is typically used to perform
write operations to the database.  When a thread holds the primary
database connection, it effectively prevents other threads from
modifying the database (although they can still read).  What's
more, those threads will block when they try to acquire the primary
connection, which provides the same kind of mutual exclusion
features that the old "database lock" had.  (In truth, we
probably don't need to be requiring use of the primary database
connection in as many places as we do now, but we can seek to refine
that behavior in future patches.)

Another significant change is that native sqlite3_stmt objects
(prepared statements) are fully encapsulated by the SQLiteConnection
object that owns them.  This ensures that the connection can
finalize (destroy) all extant statements that belong to a database
connection when the connection is closed.  (In the original code,
this was very complicated because the sqlite3_stmt objects were
managed by SQLiteCompiledSql objects which had different lifetime
from the original SQLiteDatabase that created them.  Worse, the
SQLiteCompiledSql finalizer method couldn't actually destroy the
sqlite3_stmt objects because it ran on the finalizer thread and
therefore could not guarantee that it could acquire the database
lock in order to do the work.  This resulted in some rather
tortured logic involving a list of pending finalizable statements
and a high change of deadlocks or leaks.)

Because sqlite3_stmt objects never escape the confines of the
SQLiteConnection that owns them, we can also greatly simplify
the design of the SQLiteProgram, SQLiteQuery and SQLiteStatement
objects.  They no longer have to wrangle a native sqlite3_stmt
object pointer and manage its lifecycle.  So now all they do
is hold bind arguments and provide a fancy API.

All of the JNI glue related to managing database connections
and performing transactions is now bound to SQLiteConnection
(rather than being scattered everywhere).  This makes sense because
SQLiteConnection owns the native sqlite3 object, so it is the
only class in the system that can interact with the native
SQLite database directly.  Encapsulation for the win.

One particularly tricky part of this change is managing the
ownership of SQLiteConnection objects.  At any given time,
a SQLiteConnection is either owned by a SQLiteConnectionPool
or by a SQLiteSession.  SQLiteConnections should never be leaked,
but we handle that case too (and yell about it with CloseGuard).

A SQLiteSession object is responsible for acquiring and releasing
a SQLiteConnection object on behalf of a single thread as needed.
For example, the session acquires a connection when a transaction
begins and releases it when finished.  If the session cannot
acquire a connection immediately, then the requested operation
blocks until a connection becomes available.

SQLiteSessions are thread-local.  A SQLiteDatabase assigns a
distinct session to each thread that performs database operations.
This is very very important.  First, it prevents two threads
from trying to use the same SQLiteConnection at the same time
(because two threads can't share the same session).
Second, it prevents a single thread from trying to acquire two
SQLiteConnections simultaneously from the same database (because
a single thread can't have two sessions for the same database which,
in addition to being greedy, could result in a deadlock).

There is strict layering between the various database objects,
objects at lower layers are not aware of objects at higher layers.
Moreover, objects at higher layers generally own objects at lower
layers and are responsible for ensuring they are properly disposed
when no longer needed (good for the environment).

API layer: SQLiteDatabase, SQLiteProgram, SQLiteQuery, SQLiteStatement.
Session layer: SQLiteSession.
Connection layer: SQLiteConnectionPool, SQLiteConnection.
Native layer: JNI glue.

By avoiding cyclic dependencies between layers, we make the
architecture much more intelligible, maintainable and robust.

Finally, this change adds a great deal of new debugging information.
It is now possible to view a list of the most recent database
operations including how long they took to run using
"adb shell dumpsys dbinfo".  (Because most of the interesting
work happens in SQLiteConnection, it is easy to add debugging
instrumentation to track all database operations in one place.)

Change-Id: Iffb4ce72d8bcf20b4e087d911da6aa84d2f15297
2012-01-12 14:56:18 -08:00
satok
11299b1b8c Make public SpellChecker utilities
Bug: 5639238
Change-Id: Id7dd2263a6305cc6ba0cf8f4d8ad8fb0d39a48ff
2012-01-12 13:54:53 +09:00
Dianne Hackborn
32313b161f am d476c8b8: am d3be0a76: Merge "Unhide Resources APIs for getting resources at specific densities." into ics-mr1
* commit 'd476c8b8a8a6fadea7e72426d3e93c4e6b00e543':
  Unhide Resources APIs for getting resources at specific densities.
2012-01-09 16:51:52 -08:00
Dianne Hackborn
613989772f Unhide Resources APIs for getting resources at specific densities.
This adds Resources.getDrawableForDensity() and
Resources.getValueForDensity().  These are needed for applications
to correctly retrieve larger icons such as in launcher when
running on a tablet.  We had already exposed the APIs to tell the
application which density to use for app icons on the current
device, but didn't unhide these APIs that allowed you to
actually retrieve them.

This is safe to do without introducing a new API level (as long
as we do it soon) because we know these APIs already exist in
Android 4.0, and there is no reason for anyone to be removing
them when building a device.

Change-Id: I5138e5dc908197b66a98d20af73c5374cb5d41d3
2012-01-09 12:00:30 -08:00
Svetoslav Ganov
3d0edd31d8 AccessibilityService description not internationalized.
1. AccessibilityServiceInfo loading the description string on
   creation and using this value. Hence, changing the locale
   results in reporting incorrectly localized string. Added a
   new loadDescription method to return the localized version.

2. Deprecated the old method.

bug:5807616

Change-Id: Id82bda3c6a90fa6681b035d20da0b8688ed68da3
2012-01-03 17:05:38 -08:00
Jonathan Dixon
19644b613e Make WebView.HitTestResult static
- we can do this, because HitTestResult never had a published constructor
  so the only code that can create it has always lived in this package.
- doing this makes the class design cleaner, and smooths the way for allowing
  the new WebView implementation to deal in these results in contexts where
  the appropriate WebView instance is not readily available.

Change-Id: I9e1f1c0faeb16436b1861aab3c2871a5851dfb54
2011-12-21 14:21:36 +00:00
Nick Pelly
eca6d909f7 Merge "Rewrite NDEF parsing in Java, clean-up API." 2011-12-19 15:53:10 -08:00
Nick Pelly
a356bf1cd8 Rewrite NDEF parsing in Java, clean-up API.
o Lots of documentation fixes.
o Add NdefMessage(NdefRecord ... records) ctor
o Add NdefRecord.createMime()
o Add NdefRecord.createExternal()
o Add toString(), equals() and hashCode() implementations
o Deprecate NdefRecord(byte[]) and NdefRecord.toByteArray()
o Remove framework dependency on libnfc_ndef.so
o Remove NfcAdapter.getDefaultAdapter(), its been deprecated a while

next step:
o Attempt to move NdefMessage -> Intent conversion into NDEF, and
  make it CTS tested. This will ensure consistent NDEF -> Intent
  mapping across all Android devices.

Change-Id: Ifed4910caa9a1d6bad32dbf0a507ab22bca35e22
2011-12-19 15:48:35 -08:00