2851 Commits

Author SHA1 Message Date
Jeff Brown
2cbecea4c9 Fix possible race conditions during channel unregistration.
Previously, the input dispatcher assumed that the input channel's
receive pipe file descriptor was a sufficiently unique identifier for
looking up input channels in its various tables.  However, it can happen
that an input channel is disposed and then a new input channel is
immediately created that reuses the same file descriptor.  Ordinarily
this is not a problem, however there is a small opportunity for a race
to arise in InputQueue.

When InputQueue receives an input event from the dispatcher, it
generates a finishedToken that encodes the channel's receive pipe fd,
and a sequence number.  The finishedToken is used by the ViewRoot
as a handle for the event so that it can tell the InputQueue when
the event has finished being processed.

Here is the race:

1. InputQueue receives an input event, assigns a new finishedToken.
2. ViewRoot begins processing the input event.
3. During processing, ViewRoot unregisters the InputChannel.
4. A new InputChannel is created and is registered with the Input Queue.
   This InputChannel happens to have the same receive pipe fd as
   the one previously registered.
5. ViewRoot tells the InputQueue that it has finished processing the
   input event, passing along the original finishedToken.
6. InputQueue throws an exception because the finishedToken's receive
   pipe fd is registered but the sequence number is incorrect so it
   assumes that the client has called finish spuriously.

The fix is to include a unique connection id within the finishedToken so
that the InputQueue can accurately confirm that the token belongs to
the currently registered InputChannel rather than to an old one that
happened to have the same receive pipe fd.  When it notices this, it
ignores the spurious finish.

I've also made a couple of other small changes to avoid similar races
elsewhere.

This patch set also includes a fix to synthesize a finished signal
when the input channel is unregistered on the client side to
help keep the server and client in sync.

Bug: 2834068
Change-Id: I1de34a36249ab74c359c2c67a57e333543400f7b
2010-08-17 17:03:42 -07:00
Jeff Brown
90291577a0 Throttle userActivity calls from input dispatcher.
Results in an approximately 60% reduction in InputDispatcher thread CPU time.
(Went from 3% to 1% when measured with CPU frequency scaling disabled.)

Change-Id: Ia6e6087a719ee518fe37b428a871c7240bd4143f
2010-08-16 18:33:50 -07:00
Dianne Hackborn
567722eee1 Merge "Fix problems with determining when to kill apps for wake usage." into gingerbread 2010-08-15 17:33:02 -07:00
Dianne Hackborn
1ebccf531d Fix problems with determining when to kill apps for wake usage.
Also improve debug printing of various times.

Change-Id: Ifcc288fd1bcbf44c069875ba97925b9e7ffe9a48
2010-08-15 17:27:29 -07:00
Mathias Agopian
6a73368be4 Merge "fix a typo that prevented glTexImage2D codepath to work" into gingerbread 2010-08-13 16:29:48 -07:00
Mathias Agopian
10f5c99223 fix a typo that prevented glTexImage2D codepath to work
Change-Id: I36a3bf9d1d2eacd9b14e00b0a6c53bf88bba381c
2010-08-13 16:25:13 -07:00
Robert Greenwalt
e300b8c10c Merge "DO NOT MERGE Always set/remove default routes." into gingerbread 2010-08-13 15:59:53 -07:00
Robert Greenwalt
b738fb9938 DO NOT MERGE Always set/remove default routes.
Must clean up default route if a default 3g connection is replaced
by a non-default (ie, mms) connection on teh same interface.

Also stop mucking with all connections dns and routes - do it only
for the connection that has changed.

bug:2865974
Change-Id: Ifdf49080fa0413a4d826813706c809975a562dfa
2010-08-13 15:53:13 -07:00
Dianne Hackborn
9adb9c3b10 Various battery info things:
- Now track wake locks in battery history.
- Now track sensors in battery history.
- Some filtering of sensory data.
- Fixes to some data that wasn't cleared when resetting battery stats.
- Print amount discharged since last charge.

And the big part -- keep track of wake locks held per process,
and kill processes that hold wake locks too much while they are in
the background.  This includes information in the battery stats
about the process being killed, which will be available to the
developer if the app is reported.

Change-Id: I97202e94d00aafe0526ba2db74a03212e7539c54
2010-08-13 15:17:49 -07:00
Erik Gilling
94364b91a2 surfaceflinger: don't check HWComposer numLayers unless one exists
Change-Id: I4b83f7bf7ba1318c70054117f14e759fe0ad105c
2010-08-13 10:10:48 -07:00
Eric Laurent
c8d0d6307f Merge "Fix issue 2909189: System property ro.audio.silent no longer mutes system." into gingerbread 2010-08-13 08:00:14 -07:00
Mathias Agopian
b7d1be01ae Merge "Fix a couple issues with the new hwcomposer HAL" into gingerbread 2010-08-12 15:07:29 -07:00
Mathias Agopian
f8e705dea4 Fix a couple issues with the new hwcomposer HAL
- we now clear the framebuffer upon request from the HAL
- the HAL list size could get out of sync with reality
- there was also an issue where sometime we could run past the list

Change-Id: Ic3a34314aed24181f2d8cc787096af83c046ef27
2010-08-12 15:03:26 -07:00
Dianne Hackborn
fb86ce9307 Add watermark support.
Use these system properties:

ro.watermark.text
ro.watermark.height
ro.watermark.x
ro.watermark.y
ro.watermark.color
ro.watermark.shadow.radius
ro.watermark.shadow.dx
ro.watermark.shadow.dy
ro.watermark.shadow.color

If ro.watermark.text is not set, no watermark will be shown.  All others
have reasonable defaults if they are not set.

Change-Id: Ibe4a01e6f1c576494ae2462e2688cdfaa8c62cb8
2010-08-11 18:15:29 -07:00
Mathias Agopian
65f2490e1b Merge "should fix sim build, hopefully" into gingerbread 2010-08-11 17:32:25 -07:00
Mathias Agopian
b59beb5ca6 should fix sim build, hopefully
Change-Id: I5390bd34dcca36fef43b5169386fff1b04cc842b
2010-08-11 17:31:33 -07:00
Mathias Agopian
90dc48b17f Merge "call into hwcomposer HAL when present" into gingerbread 2010-08-11 16:24:46 -07:00
Mathias Agopian
24d7050ca6 Merge "don't handle the transparent region of a layer in draw()" into gingerbread 2010-08-11 16:21:01 -07:00
Mathias Agopian
8e7515d9c9 Merge "get rid of our LayerVector implementation" into gingerbread 2010-08-11 16:20:38 -07:00
Mathias Agopian
025822a03a Merge "keep a list of visible sorted surfaces" into gingerbread 2010-08-11 16:19:16 -07:00
Jeff Brown
95af0c14a6 Merge "Add support for the PointerLocation overlay." into gingerbread 2010-08-11 16:15:48 -07:00
Mathias Agopian
e0d5f5bcf5 call into hwcomposer HAL when present
Change-Id: I70f31c69a9436a43860e78977442863ecba6d27b
2010-08-11 16:08:45 -07:00
Mathias Agopian
8514b92bc4 don't handle the transparent region of a layer in draw()
this is already taken into consideration in computeVisibleRegion
and therefore not needed at draw time.

Change-Id: I3fc7336d22f1147dfcd3a20fd71bf79b946d971f
2010-08-11 16:05:06 -07:00
Mathias Agopian
1efba9a617 get rid of our LayerVector implementation
we now use SortedVector<> with a special compare implementation.

Change-Id: I910459cf3b3c8993b55ad0786a8c348369262de5
2010-08-11 16:05:05 -07:00
Mathias Agopian
ff1d410288 keep a list of visible sorted surfaces
Change-Id: Ib815eeff894f8a3b1e79fbbf8186d5d91bb60285
2010-08-11 16:04:51 -07:00
Dianne Hackborn
bd1c082cf9 Merge "New system property "sys.boot_completed" set to 1 when boot completed." into gingerbread 2010-08-11 15:16:01 -07:00
Jeff Brown
a41ca77fab Add support for the PointerLocation overlay.
This change involves adding a new method to IWindowManager,
monitorInput() that returns an InputChannel to receive a copy of all
input that is dispatched to applications.  The caller must have
the READ_INPUT_STATE permission to make this request (similar to
other window manager methods such as getKeycodeState).

Change-Id: Icd14d810174a5b2928671ef16de73af88302aea0
2010-08-11 14:46:32 -07:00
Dianne Hackborn
f4c454bac9 New system property "sys.boot_completed" set to 1 when boot completed.
Change-Id: Ie3fc0b1efdfb637b0c780064a71e8c1575e15ca3
2010-08-11 12:47:41 -07:00
Kenny Root
a02b8b05dd Move OBB file reading to DefaultContainerService
The system_server shouldn't touch files on the SD card. This change
moves the things that touch the SD card out to the
DefaultContainerService so that it will get killed if the SD card goes
away instead of the system_server.

Change-Id: I0aefa085be4b194768527195532ee6dddc801cfc
2010-08-11 11:20:53 -07:00
Eric Laurent
8cc93b9b21 Fix issue 2909189: System property ro.audio.silent no longer mutes system.
Fixed regression introduced by commit 2a6b80bc65c4782b5a7168b300e1dc5ec9f617ee:
master mute was not working if no effect chains were present on session 0.

Change-Id: I66d107e045d159cb94d29c7476fa1e12d92f2ae7
2010-08-11 05:20:11 -07:00
Konstantin Lopyrev
6c6d57c6a0 Merge "Fix focus notification" into gingerbread 2010-08-09 17:03:10 -07:00
Konstantin Lopyrev
5e7833a571 Fix focus notification
Change-Id: I51d73100695ceb70620754a1897ace681a26d839
2010-08-09 17:01:11 -07:00
Eric Laurent
2a6b80bc65 Fixed several audio effects problems.
- Fixed constant inversions in AudioEffect.java
- Do not return error when enabling an already enabled effect
- Update cached effect state in native AudioEffect class when effect is enabled/disabled by command() method
- Remove click when restarting effect during disable sequence
- Fixed problem in master mute management when volume control is delegated to effect.

Change-Id: I6df4ce9fcc54fdc7345df858f639d20d802d6712
2010-08-09 05:48:20 -07:00
Konstantin Lopyrev
f962476471 Adding a way for Hierarchy Viewer to get the focused window.
Change-Id: I01e6ab4aa24d632fba586cb9e112d8d9df1a681a
2010-08-06 13:27:31 -07:00
Mike Lockwood
5723dfe8c8 GPS: Don't set XTRA download pending flag at boot time.
XTRA data downloads are now strictly on demand from the GPS engine.
Also fix typo in handleDownloadXtraData()

Change-Id: Ied1a6e2e62134add4d965326aae909c86f834682
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-08-06 10:15:15 -04:00
Chung-yih Wang
1d62c7737c Fix the build
Change-Id: I410e2fd057b68e1b5b5b33ee10178a01d3c9b2fa
2010-08-06 11:52:38 +08:00
Chung-yih Wang
2d94231ef9 Add SIP service into system server.
Change-Id: Icc39e4e54768cfdcc1b20a3efe6206009b9a8d10
2010-08-06 08:40:50 +08:00
Daniel Sandler
9b87770f53 Merge "Fix crash when startForeground posts a broken Notification." into gingerbread 2010-08-04 20:33:32 -07:00
Kenny Root
e2f7417529 Failure to move .dex in eng builds is not fatal
When moving between program locations or application names, the .dex
file is moved by installd. However, in engineering builds, the
applications are run through dexopt on-demand. If the .dex file fails to
move, we can ignore it because it's most likely because the .dex file
does not exist yet.

Change-Id: Id5c4dbfa33f19c976acd9f184ccd637752326629
2010-08-04 13:35:33 -07:00
Kenny Root
deb112674e Only allow one movePackage operation in-flight
When a movePackage operation is requested, don't allow multiple requests
to pile up for one package. Once a move is completed, an observer will
receive the message and be allowed to call movePackage again.

Change-Id: Ie3842b6d96446febc0037bf9b8f1ca250735edc2
2010-08-04 08:44:31 -07:00
Daniel Sandler
d0a2f86f35 Fix crash when startForeground posts a broken Notification.
The NotificationManager tries to crash the calling app, but
in the case of a service calling startForeground, the caller
is the ActivityManager, so system_server goes down.

NotificationManagerService#enqueueNotificationInternal is a
new internal-only method that accepts a UID/PID to use when
punishing bogus notifications (such as the one in
http://b/2869787).

Change-Id: I84a9854bae630bc90288cebb94f174809d5dac8c
2010-08-04 10:52:51 -04:00
Brad Fitzpatrick
389a916769 Usage Stats: don't block writing stats to disk.
I was seeing lots of stack traces of people hung for noticeable
amounts of time when switching between activities.

e.g. On of the common gmail stacks showing this pause was:

android.os.StrictMode$StrictModeDiskWriteViolation: policy=391 violation=1
  at android.os.StrictMode$AndroidBlockGuardPolicy.startHandlingViolationException(StrictMode.java:272)
  at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:243)
  at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:238)
  at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
  at java.io.FileOutputStream.<init>(FileOutputStream.java:69)
  at com.android.server.am.UsageStatsService.writeStatsFLOCK(UsageStatsService.java:424)
  at com.android.server.am.UsageStatsService.writeStatsToFile(UsageStatsService.java:398)
  at com.android.server.am.UsageStatsService.notePauseComponent(UsageStatsService.java:539)
  at com.android.server.am.ActivityManagerService.updateUsageStats(ActivityManagerService.java:1856)
  at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:667)
  at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2925)
  at com.android.server.am.ActivityStack.requestFinishActivityLocked(ActivityStack.java:2836)
  at com.android.server.am.ActivityManagerService.finishActivity(ActivityManagerService.java:2276)
  at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:237)
  at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1415)
  at android.os.Binder.execTransact(Binder.java:320)
  at dalvik.system.NativeStart.run(Native Method)

  at android.app.ActivityManagerProxy.finishActivity(ActivityManagerNative.java:1454)
  at android.app.Activity.finish(Activity.java:3260)
  at android.app.Activity.onBackPressed(Activity.java:1929)
  at android.app.Activity.onKeyUp(Activity.java:1907)
  at android.view.KeyEvent.dispatch(KeyEvent.java:1088)
  at android.app.Activity.dispatchKeyEvent(Activity.java:2087)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1661)
  at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2543)
  at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2516)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1866)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:3609)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  at dalvik.system.NativeStart.main(Native Method)

Change-Id: Id49157bc635017292eaefddc5e22d73f5f4ab05e
2010-08-03 15:41:05 -07:00
Konstantin Lopyrev
321f7fad5c Making sure that there is no notification when focus changes from something to nothing.
Change-Id: Ib8b3bdd7f5dd999c933a017fe1b34263afe38e4a
2010-08-03 11:21:55 -07:00
Christopher Tate
09e85dc027 Mute a common-case progress log about input injection
Change-Id: I37c9f5cb239ab93fde3a42f71f2782d8734c53ce
2010-08-02 11:59:11 -07:00
Kenny Root
8b61b68b64 Merge "Only install after MCS success" into gingerbread 2010-07-30 16:55:37 -07:00
Kenny Root
6f89fa07b4 Only install after MCS success
If MCS dies in the middle of a call during install, only proceed if the
call was successful. Otherwise wait for the max retries to be reached
and run the failure handling code there.

Change-Id: I00a27ea91046ea6521a3cff5e5ffe2c71b2b5bb4
2010-07-30 16:35:04 -07:00
Brad Fitzpatrick
d2165cfce7 Merge "StrictMode: time violations in Binder calls" into gingerbread 2010-07-30 15:20:28 -07:00
Brad Fitzpatrick
cb9ceb1029 StrictMode: time violations in Binder calls
Change-Id: I5796993dce98be722cf679b78acaf0c9de0ba461
2010-07-30 14:28:55 -07:00
Jean-Baptiste Queru
154a320069 resolved conflicts for merge of 27eecb70 to gingerbread
Change-Id: If064f2f4950fc1a4ff38e6927fe2120af76b26f1
2010-07-30 12:08:31 -07:00
The Android Open Source Project
392edec116 Merge from open-source froyo
Change-Id: Ifa75fce9bd362b06ecb622219ef501e61e89fd76
2010-07-29 15:38:49 -07:00