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
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
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
- 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
- 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
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
this is already taken into consideration in computeVisibleRegion
and therefore not needed at draw time.
Change-Id: I3fc7336d22f1147dfcd3a20fd71bf79b946d971f
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
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
Fixed regression introduced by commit 2a6b80bc65c4782b5a7168b300e1dc5ec9f617ee:
master mute was not working if no effect chains were present on session 0.
Change-Id: I66d107e045d159cb94d29c7476fa1e12d92f2ae7
- 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
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>
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
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
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
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
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