8800 Commits

Author SHA1 Message Date
Craig Mautner
1e1edaa60d Merge "Check WindowState when looking for animation." 2012-04-11 17:18:44 -07:00
Craig Mautner
f20588fdc6 Check WindowState when looking for animation.
The method setTokenVisibilityLocked returns true when animations are
delaying the exit of an app. Previously this only checked AppToken
animations but that caused exiting WindowState animations to be
ignored.

In particular if an application both hid an AppToken and then
dismissed the AppToken, the AppToken was being removed from
mClosingTokens before the animation finished. This caused
rebuildAppWindowListLocked to lose a WindowState. Furthermore
Surfaces were not being removed when a WindowState was lost and
we were leaking Surfaces.

Fixes bug 6297563.

Change-Id: Ie75c71064518199237ec4a17d3f65e2a2dd29674
2012-04-11 17:15:09 -07:00
Dianne Hackborn
f882efadd3 Fix issue #6266651: Low storage warning takes long time to sort apps by usage
On a device with emulated external storage, the low storage notification
should go to the main storage settings UI.  This shows the user all of
the things that could be causing their storage to be low.

Change-Id: I9c345b6cb7abbabc24a67c7e104d077ecbbfb86d
2012-04-11 16:04:12 -07:00
Craig Mautner
b414812549 Merge "Check for existing dimming before stop dimming." 2012-04-11 09:35:05 -07:00
Craig Mautner
f8d4fbb9c8 Check for existing dimming before stop dimming.
Add a test to make sure that we are dimming before we send the message
to stop it. This prevents a CPU consuming loop when dimming is already on.

Fixes bug 6320003.

Change-Id: If26dc5b0800300d8e38c166824651223eded4cfa
2012-04-11 09:25:53 -07:00
Daniel Sandler
3bf928d51e Merge "Fix PowerMgr NPE on emulator." 2012-04-11 07:03:00 -07:00
satok
8d33d39d68 Merge "Show physical keyboard control button on the input method switch dialog" 2012-04-11 00:12:59 -07:00
satok
01038492ff Show physical keyboard control button on the input method switch dialog
Bug: 5240095
Change-Id: Ica768083f95c33dc1e494a28ba7d8b6eb989b0ef
2012-04-11 15:49:35 +09:00
Jeff Brown
9f25b7fdf2 Request key maps from input manager service.
Instead of each application loading the KeyCharacterMap from
the file system, get them from the input manager service as
part of the InputDevice object.

Refactored InputManager to be a proper singleton instead of
having a bunch of static methods.

InputManager now maintains a cache of all InputDevice objects
that it has loaded.  Currently we never invalidate the cache
which can cause InputDevice to return stale motion ranges if
the device is reconfigured.  This will be fixed in a future change.

Added a fake InputDevice with ID -1 to represent the virtual keyboard.

Change-Id: If7a695839ad0972317a5aab89e9d1e42ace28eb7
2012-04-10 18:23:58 -07:00
Dianne Hackborn
2a854c13f8 Merge "Some small tweaks to improve memory management." 2012-04-10 15:25:43 -07:00
Dianne Hackborn
162bc0ea0d Some small tweaks to improve memory management.
We now allow processes that currently have stopping activities to
be managed as if they were done stopping, so that memory trimming
can be done before the process goes to the background.  Hopefully
this will reduce cases where the processes goes to the background
and immediately gets killed, but wouldn't have had to be killed if
it had a chance to trim its memory.

Also change window memory trimming to always do the aggressive
trimming when memory is critical, even if not on a low-end device.

And tweak web view trimming to not trim for foreground UI events.

Change-Id: I241b3152b52d09757bd14a202477cf69c9b78786
2012-04-10 14:43:58 -07:00
Craig Mautner
f0cabba38b Merge "Fix NPE in setTransparentRegion." 2012-04-10 14:33:07 -07:00
Jeff Brown
cd2a3ea5c8 Merge "Don't reuse StringBuilder outside of lock when dumping ANR." 2012-04-10 14:30:20 -07:00
Jeff Brown
deb6ed8c2e Don't reuse StringBuilder outside of lock when dumping ANR.
The ANR dumping code was reusing the shared StringBuilder while
not holding the ActivityManagerService lock.  As a result, other
threads could sweep in and clobber the ANR information.
We don't want to hold the lock here, so just create a new StringBuilder.

Change-Id: I0d91af55f5c123102cfab2cd97035491efed59c0
2012-04-10 14:26:26 -07:00
Craig Mautner
1f4e0ccba0 Fix NPE in setTransparentRegion.
Check for null Surface before using it.

Fixes bug 6312835.

Change-Id: Iaaac2a5d88e81b88e369815e09818c268085e4b7
2012-04-10 14:24:38 -07:00
Craig Mautner
8330e40b98 Merge "Reduce load on CPU when animating rotation." 2012-04-10 13:01:12 -07:00
Craig Mautner
73850cb699 Reduce load on CPU when animating rotation.
This change keeps requestTraversalLocked from being called on virtually
every call to animate while rotating.

Change-Id: I6d2db37db3bb82f4f9ecc84b17dbf121819a6c1b
2012-04-10 12:56:27 -07:00
Daniel Sandler
0af489568d Fix PowerMgr NPE on emulator.
Bug: 6313695
Change-Id: Ib12b9102df01603df135cef03fd2a2f6e3634dd1
2012-04-10 15:15:32 -04:00
Daniel Sandler
c38cf4c7db Merge "New Android Dreams architecture, disabled for now." 2012-04-10 05:33:07 -07:00
John Grossman
8100960892 am e1d6c080: Make common_time more deferential when coming out of networkless mode.
* commit 'e1d6c080f0b1769637d742e51cc22167c7af12bb':
  Make common_time more deferential when coming out of networkless mode.
2012-04-09 17:00:24 -07:00
John Grossman
e1d6c080f0 Make common_time more deferential when coming out of networkless mode.
Addresses issues seen in bug 6260139.

This is a really tough bug to repro, but there is no doubt that it is
happening occasionally on our super huge A@H subnet.  I have collected
data all weekend; the failure did not occur, but I got enough to have
a theoretical sequence of events which could trigger this behavior.
The sequence goes like this.

1) A network is running and happy with a timeline master M,
   maintaining timeline X.
2) Device B boots, but its network is taking a long time to come up.
   After 60 seconds of waiting for the network to come up, device B
   goes into networkless master mode and creates timeline Y.
3) Device B's network comes up.  It immediately sends a master
   announcement saying that it is the current low-priority master of
   timeline Y (its low priority because it has never had any real
   clients)
4) Master M ignores B because B is low priority.
5) Device C boots and sends out a who is master request.  It is a race
   between M and A to see who will respond first.  In this case, A
   responds first.
6) C sends B a request which B receives.  B now has its first client
   and is now high priority.  In this scenario, B matches M in all
   aspects of the priority ranking function, including winning the tie
   breaker (larger MAC address when interpreted as a 48 bit integer)
7) M sends its master announcement; it is ignored by B since B
   now wins in the ranking function vs M.
8) Finally, B sends its next master announcement.  M sees it, realizes
   that there is a higher priority master out there (looks like a
   bridged network scenario to M).  M gives up master status along
   with timeline X.  The clients of M become clients of B and move
   from timeline X to timeline Y (something which should only be
   needed during an actual network bridging event)

This change has a few different things meant to severely minimize the
chance that this can happen.

First, and the most important change, is that networkless masters do
not immediately announce themselves as masters on the network they are
joining.  Instead, they transition into Ronin to discover any
pre-existing masters on the network.  If there are no masters out
there, the device will simply transition back to master and continue
to maintain the timeline it had in networkless mode.  In the scenario
above, however, B should discover M and become its client, preserving
the established timeline X.

Second, any time a device experienced an interface reconfiguration
(including coming out of networkless mode), it clears its high
priority bit.  This is a good thing.  The bit used to get set again
any time...

1) The device is master and receives a client request.
2) The device becomes a client of another master on the network.
3) The device becomes a master.

Number 3 in this list is a mistake.  The high priority bit should only
be set for devices during master election which have been
participating in a timeline which has been used by multiple devices.
We know that this is the case when we are master and receive a
request.  We also know that this is the case when we hear from a
master and decide to become its client.  Simply becoming a master
should not make us high priority.  This behavior has been removed.

Third, timeouts have been adjusted just for some extra "stickyness"
when it comes to master status.  Clients now say in the Ronin state
for up to 10 seconds looking for a master sending up to 20 discovery
requests, instead of only 3 seconds (sending 6 requests).  The
wait-for-election timeout has been adjusted up from 5 seconds to 12.5
seconds to track the longer election cycle as well.  Also, while in
steady-state, clients will now wait until 10 packets (10 seconds)
have not been answered by its master before giving up and dropping
into Ronin.

Change-Id: I438b39f31265e34d6719d4adfa9e8b95a2afc188
Signed-off-by: John Grossman <johngro@google.com>
2012-04-09 15:33:53 -07:00
Daniel Sandler
7d276c377c New Android Dreams architecture, disabled for now.
Rather than normal Activities (which have a host of problems
when used for this purpose), screen savers are now a
special kind of Service that can add views to its own
special window (TYPE_DREAM, in the SCREENSAVER layer).

Dreams are now launched by the power manager; whenever it is
about to turn the screen off, it asks the window manager if
it wants to run a screen saver instead. (http://b/5677408)

Also, the new config_enableDreams bool allows the entire
feature to be switched on or off in one place. It is
currently switched off (and the APIs are all @hidden).

Change-Id: Idfe9d430568471d15f4b463cb70586a899a331f7
2012-04-09 15:33:26 -04:00
Jeff Sharkey
eaeee6a55c Merge "Migrate to @Override to remove warnings." 2012-04-09 11:26:34 -07:00
Jeff Brown
fd6ebee93c Merge "Fix lid switch interpretation." 2012-04-09 11:25:02 -07:00
Jeff Brown
3b0ea8dbb6 Merge "Use new EVIOCSCLOCKID ioctl if supported." 2012-04-09 11:24:16 -07:00
Jeff Brown
27fd3420ac Fix lid switch interpretation.
Also remove unnecessary permission check for method that is
only called internally.

Change-Id: I32f63fc3e96b06709d18b046ee2d3c8f310de70d
2012-04-09 11:22:12 -07:00
Jeff Brown
eca3cf58c0 Use new EVIOCSCLOCKID ioctl if supported.
Bug: 6292993
Change-Id: I718f167c2cd41298ed54847dbc5de872cd4c7e4a
2012-04-09 11:00:37 -07:00
Jeff Sharkey
bfdd680ab4 Migrate to @Override to remove warnings.
Bug: 6303344
Change-Id: I0d33b2ed448467379d576ccd71fb5ae20c878852
2012-04-09 10:57:21 -07:00
Jeff Sharkey
4b3c523210 Merge "Splice operations before collapsing ifaces." 2012-04-09 10:31:20 -07:00
Jeff Sharkey
21a547823d Splice operations before collapsing ifaces.
Bug: 6241038
Change-Id: Ide9058703f7305df8fb070af149ddce0653a0abf
2012-04-09 10:27:55 -07:00
Eric Laurent
079f09c6ca Merge "Added support for USB audio devices" 2012-04-09 08:39:05 -07:00
Jeff Brown
12578bde99 Merge "Ensure that apps crash if they throw exceptions." 2012-04-06 18:26:48 -07:00
Jeff Brown
603b445896 Ensure that apps crash if they throw exceptions.
Previously, if an app threw an uncaught exception in an input,
vsync or native activity callback, it would log the exception then
continue limping merrily along.  In the case of input, it
could result in an ANR occurring because we had not drained
all of the pending input events and marked them as finished
(we only marked the most recent one finished).

Bug: 6304124
Change-Id: I87d76f7fd605e1a8af1237c66d8d62973080277e
2012-04-06 18:25:09 -07:00
Eric Laurent
59f482764e Added support for USB audio devices
Two types of USB audio devices are defined:
- USB audio device: the audio device in USB device mode while
the Android device is in USB host mode.
- USB audio accessory: the audio device in USB host mode while
the Android device is in USB device mode.

Renamed intents for analog and digital docks to avoid confusion:
 - ACTION_USB_ANLG_HEADSET_PLUG to ACTION_ANALOG_AUDIO_DOCK_PLUG
 - ACTION_USB_DGTL_HEADSET_PLUG to ACTION_DIGITAL_AUDIO_DOCK_PLUG

Factorized code in AudioService broadcast receiver.

Change-Id: I1b6d0257a9d68ecb9495c78c98bac8c67fec7891
2012-04-06 18:24:48 -07:00
Craig Mautner
cd837070f6 Merge "Fix endless looping in layout." 2012-04-06 18:14:15 -07:00
Craig Mautner
3de422fe4f Fix endless looping in layout.
An odd alignment of the stars can end up with all of mAppToken.allDrawn
animating and mAppToken.startingDisplayed all false, and animation not
null. In such a case we can continue returning false but still pass
the test in WindowAnimator.updateWindowsAndRotation setting
wasAnimating to true. The combination continually sets the
FINISH_LAYOUT_REDO_WALLPAPER bit in mPendingLayoutChanges.

Fixes bug 6304838.

Change-Id: Ie7a7b39ea218213f51dc3df3eefe4ff03f1d885d
2012-04-06 18:04:13 -07:00
Dianne Hackborn
b7943811a2 Merge "Fix issue #6242583: ResolverActivity is considered as home activity" 2012-04-06 17:53:59 -07:00
Dianne Hackborn
2d69d49d30 Fix issue #6242583: ResolverActivity is considered as home activity
Change-Id: Ib29908cdfcbbff769d12df1770264ad13ec5337b
2012-04-06 16:24:14 -07:00
Jeff Brown
69bba1dfb7 Merge "Add a unique input device descriptor." 2012-04-06 15:04:53 -07:00
Jeff Brown
e38fdfae91 Add a unique input device descriptor.
The purpose of the input device descriptor is to make it possible
to associate persistent settings for each input device, such as the
keyboard layout.

The descriptor is a hash of the information we have about the
device, such as its vendor id, product id, unique id, name,
or location.

Bug: 6110399
Change-Id: Idb80f946819b3f0dbf4e661bb0a753dbc2b60981
2012-04-06 14:57:19 -07:00
Christopher Tate
bf64e70f9b Merge "Attribute alarm broadcast wakelocks to the sender" 2012-04-06 14:35:16 -07:00
Christopher Tate
c4a07d1caa Attribute alarm broadcast wakelocks to the sender
Wakelock usage for the purpose of sending an alarm broadcast is now
attributed to the application which posted the alarm, not to the OS.

Bug 5911317

Change-Id: I8cb79c3bd5db467388716ab68285f4ab0bfe468b
2012-04-06 14:23:12 -07:00
Craig Mautner
1ade5ae9c8 Merge "Animate from local list of WindowStateAnimators." 2012-04-06 14:12:46 -07:00
Craig Mautner
bec53f7066 Animate from local list of WindowStateAnimators.
Stop animate() from using the mWindows maintained by
WindowManagerService. Animating WindowStateAnimators are now drawn from
a HashSet maintained by WindowAnimator and containing just those
WindowStateAnimators that have Surfaces.

When starting a move animation do not place parameters directly into
the WindowStateAnimator, instead pass them through the Handler.

Also removed synchronization points from mWindows/mAppTokens
add/remove.
2012-04-06 14:03:25 -07:00
Jeff Sharkey
b52e3e5509 INetworkStatsSession with lifecycle for caching.
Users outside system_server now explicitly communicate their
lifecycle, which keeps a strong-reference chain to any fully loaded
NetworkStatsCollection histories.

Bug: 6236498
Change-Id: I8e22739b6e89a626b676967a736d7117fd000778
2012-04-06 13:38:29 -07:00
Mike Lockwood
9d5a4be05b Add Intents to notify when USB audio devices or accessories are attached
In this change, only the USB audio accessory support is implemented.

Change-Id: Id9b411319b07a96dc56649ca74cc5f3f89a55a7c
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-04-06 11:00:27 -07:00
Craig Mautner
7a3bc87468 Merge "Fix so that windows again animate when moving." 2012-04-06 08:00:47 -07:00
Jeff Brown
ac14351e16 Move some APIs from window manager to input manager.
Simplified input injection API down to just one call.

Removed all input state reading API.  It was only used by the
window manager policy and required a permission that applications
could not obtain.  READ_INPUT_STATE is now unused and deprecated.

Change-Id: I41278141586ddee9468cae0fb59ff0dced6cbc00
2012-04-05 19:33:11 -07:00
Craig Mautner
6af9b92b75 Fix looping to turn off dimming.
Dimming was constantly being turned off if it wasn't time to turn it
on. This caused endless reentry into the Window Manager and consumed
lots of CPU.

Fixes bug 6293953.

Change-Id: Id87e60c7c70e96e66ce0b6297442f5ac0d2ff477
2012-04-05 19:25:51 -07:00
Dianne Hackborn
42c45856f5 Fix so that windows again animate when moving.
Change-Id: I2441d0c892687b8cda239815caf77837cd21093e
2012-04-05 18:29:35 -07:00