History log of /frameworks/base/core/java/android/os/Looper.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cb01563d7efa5689abb98fe4e5d8cc86bfc2b6fc 15-Jun-2017 Dianne Hackborn <hackbod@google.com> Work on issue #36891897: Need to ensure foreground services...

...can't hide themselves

Tune the policies for when we tell about apps running in the
background after their services have stopped.

- If it ran while the screen was on, the time we require for it
to be running is much shorter (a couple seconds) as well as the
time we tell about it having run (with another tunable for the
minimum time we tell about this).

- If it has only run while the screen is off and stops a sufficient
amount of time before the screen goes on (currently a second) then
we will not show anything when the screen goes on.

- If it stops when the screen turns on, we will make sure the user
sees about it for a short period of time (currently 5 seconds).

Also includes some improved debug output about handler message
queues.

Test: manual

Change-Id: Iab438410d7182b2dfe4f9c1cce7069b26b34834c
/frameworks/base/core/java/android/os/Looper.java
9957151661b8ae65da45a1fb72df5b66176302cb 28-Mar-2017 Makoto Onuki <omakoto@google.com> Log a warning if a dispatch on UiThread takes more than

a certain amount of time.

Bug: 34961340
Test: Boot and launch several apps.
Change-Id: I38bd85a1dd9c572242d04f550df4a979f5f3bea5
/frameworks/base/core/java/android/os/Looper.java
958d0a503699840f8f4b85cafa62f3793c89ac73 07-Feb-2017 Netta P <nettap@google.com> Protobufferize PowerManager dumpsys

Bug: 34230125
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCase -t com.android.server.cts.PowerIncidentTest
Change-Id: Ib71563cfc9ca95c297111430d8bbe2ce88d7a41d
/frameworks/base/core/java/android/os/Looper.java
407c0be727bb77360494f8cbc5aa879515e15484 01-Aug-2016 Jorim Jaggi <jjaggi@google.com> Only get trace name if tracing is enabled

String formatting creates new objects, so only do it if needed.

Bug: 30549756
Change-Id: I8035357c2b9c3066ef7663b938654f698a2321bc
/frameworks/base/core/java/android/os/Looper.java
74cd3de6f4889d54a3da930de5e7ad00b97f03e9 07-Apr-2016 Jeff Sharkey <jsharkey@android.com> Automatically trace messages on shared loopers.

There are a handful of looper threads in the system_process that
are shared by dozens of different internal services. To help track
down what these operations are, tag the processing of each message
with a string that tries describing where it originated from: the
class name of the Handler, and the message number or class name of the
Runnable.

Bug: 28046299
Change-Id: I409ec43fea8daaae4fd70df05d4fed929a7249ae
/frameworks/base/core/java/android/os/Looper.java
dc3eb4bf91d37ce6b8b000a59625a496b64b36fb 06-Mar-2015 Jeff Brown <jeffbrown@google.com> Add support for non-blocking I/O with Looper.

Bug: 10349083
Change-Id: I4a94b1eac53df57c05103913bd593d92b1e062d7
/frameworks/base/core/java/android/os/Looper.java
803c2affcbe0a0e0fbb561967e0306bfc97ee197 05-Mar-2015 Jeff Brown <jeffbrown@google.com> Expose some useful methods on Looper and clean up docs.

Change-Id: I40796c3ba07d3c50043da56e835f11fbf9852d30
/frameworks/base/core/java/android/os/Looper.java
3d4e7efe37a4b0dfc5807444e8c3b98a28953377 27-Feb-2015 Jeff Brown <jeffbrown@google.com> Move sync barrier methods into MessageQueue.

The methods were previously defined on Looper but on reflection
they actually make more sense on the MessageQueue instead since
the Looper class is primarily concerned with thread lifecycle
rather than the actual messages themselves.

Change-Id: Iff356b94754fc9960774fa17e3eec9604229cba6
/frameworks/base/core/java/android/os/Looper.java
6c7b41adf9e937a66880b8906389760f3fc82a08 26-Feb-2015 Jeff Brown <jeffbrown@google.com> Rename Looper::isIdling() to isPolling() to resolve confusion.

The loop isn't technically idle at this time, it's just checking
whether any file descriptors have pending events. However it's
still a good signal as to whether the loop is alive.

Added a real isIdle() function.

Bug: 19532373
Change-Id: Idd273e8774f469ccafb00d560818cf279dfd6ba6
/frameworks/base/core/java/android/os/Looper.java
9867ed7aa98f5a719db4b50c39a290bc0ef38123 28-Feb-2014 Jeff Brown <jeffbrown@google.com> Detect invalid uses of Message.

Throw an exception when an application attempts to recycle or
resend messages that are still in-use.

Change-Id: I7096e8b7bd5bec41b7b8ef0c798c55ce3db6827e
/frameworks/base/core/java/android/os/Looper.java
6090995951c6e2e4dcf38102f01793f8a94166e1 19-Nov-2013 John Spurlock <jspurlock@google.com> Remove unused imports from frameworks/base.

Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
/frameworks/base/core/java/android/os/Looper.java
5182c780a8b42acd46a06d693ab63a0dd78c6d70 16-Oct-2013 Jeff Brown <jeffbrown@google.com> Log view root, input and looper state in bug reports.

Bug: 10948648
Change-Id: I956cce2a0fb516c02f9bbbc021f6238bcb226891
/frameworks/base/core/java/android/os/Looper.java
efa92b2182ab581873aa8e75d596e2e363bd5e6d 03-May-2013 Dianne Hackborn <hackbod@google.com> Cleanup some of the thread merging.

Adds an optimization for checking whether a looper is stuck,
with a new Looper method to see if its thread is currently
idle. This will allow us to put a large number of loopers
in the monitor efficiently, since we generally won't have to
do a context switch on each of them (since most looper threads
spend most of their time idle waiting for work).

Also change things so the system process's main thread
is actually running on the main thread. Because Jeff
asked for this, and who am I to argue? :)

Change-Id: I12999e6f9c4b056c22dd652cb78c2453c391061f
/frameworks/base/core/java/android/os/Looper.java
8b60e4514702edd1eb4b6f2bfc027e04a94369c0 19-Apr-2013 Jeff Brown <jeffbrown@google.com> Fix change of behavior in Looper.quit().

It seems some applications rely on Looper.quit() terminating the
loop immediately without processing all messages. Rather than
risk breaking them, make the safer behavior optional.

Also take care to properly drain the message queue before quitting
so that all of the Message instances are recycled. This may
help release storage sooner in case the Looper doesn't get GC'd
promptly and its remaining queue of undelivered messages sticks
around.

Improve docs on runWithScissors.

Bug: 8596303
Change-Id: I8cbeb6f7a5f6b8e618b5109f87a03defc1486b9f
/frameworks/base/core/java/android/os/Looper.java
024136f57e5f8b4c11a4fe0fd83061eb6d372d26 12-Apr-2013 Jeff Brown <jeffbrown@google.com> Ensure looper quits after all other messages are handled.

Bug: 8596303
Change-Id: Ie8bfbbe810f5ade2afd870c8e675ce1353a80e5d
/frameworks/base/core/java/android/os/Looper.java
f9e989d5f09e72f5c9a59d713521f37d3fdd93dd 05-Apr-2013 Jeff Brown <jeffbrown@google.com> Queues, queues, queues and input.

Redesigned how ViewRootImpl delivers input events to views,
the IME and to native activities to fix several issues.

The prior change to make IME input event delegation use
InputChannels failed to take into account that InputMethodManager
is a singleton attached to the main looper whereas UI may be
attached to any looper. Consequently interactions with the
InputChannel might occur on the wrong thread. Fixed this
problem by checking the current thread and posting input
events or callbacks to the correct looper when necessary.

NativeActivity has also been broken for a while because the
default event handling logic for joysticks and touch navigation
was unable to dispatch events back into the native activity.
In particular, this meant that DPad synthesis from touch navigation
would not work in any native activity. The plan is to fix
this problem by passing all events through ViewRootImpl as usual
then forwarding them to native activity as needed. This should
greatly simplify IME pre-dispatch and system key handling
and make everything more robust overall.

Fixed issues related to when input events are synthesized.
In particular, added a more robust mechanism to ensure that
synthetic events are canceled appropriately when we discover
that events are no longer being resynthesized (because the
application or IME is handling or dropping them).

The new design is structured as a pipeline with a chain of
responsibility consisting of InputStage objects. Each InputStage
is responsible for some part of handling each input event
such as dispatching to the view hierarchy or to the IME.
As a stage processes an input event, it has the option of
finishing the event, forwarding the event to the next stage
or handling the event asynchronously. Some queueing logic
takes care to ensure that events are forwarded downstream in
the correct order even if they are handled out of order
by a given stage.

Cleaned up the InputMethodManager singleton initialization logic
to make it clearer that it must be attached to the main looper.
We don't actually need to pass this looper around.

Deleted the LatencyTimer class since no one uses it and we have
better ways of measuring latency these days using systrace.

Added a hidden helper to Looper to determine whether the current
thread is the indicated Looper thread.

Note: NativeActivity's IME dispatch is broken by this patch.
This will be fixed later in another patch.

Bug: 8473020
Change-Id: Iac2a1277545195a7a0137bbbdf04514c29165c60
/frameworks/base/core/java/android/os/Looper.java
67fc67cf3e1dba17b0eae4f3923f3e93a78c7575 01-Apr-2013 Jeff Brown <jeffbrown@google.com> Make MessageQueue and Looper final.

Applications already cannot subclass these classes because
their constructors are not visible.

Change-Id: Id979d86dd05f7bcc888fe4ea499ab9b95d3d5dde
/frameworks/base/core/java/android/os/Looper.java
13b907353f18215b52b5ceda24bbf520d91d72a1 21-May-2012 Romain Guy <romainguy@google.com> Remove unused, obsolete debug code

All these features have either been abandonned and left un-maintained
for years or can be replaced by systrace.

Change-Id: I42e4579a8078744047e5fe08a7a15254970b09bc
/frameworks/base/core/java/android/os/Looper.java
0f85ce3837633a03460a61405087a5d28a4bf955 16-Feb-2012 Jeff Brown <jeffbrown@google.com> Improve MessageQueue sync barrier implementation.

Instead of acquiring and releasing a barrier using an up/down
counter, we post a message to the queue that represents the
barrier. This is a more natural representation of the barrier
and better matches what we want to do with it: stall messages
behind the barrier in the queue while allowing messages earlier
in the queue to run as usual.

Refactored the MessageQueue a little bit to simplify the quit
logic and to better encapsulate the invariant that all
messages within the queue must have a valid target. Messages
without targets are used to represent barriers.

Bug: 5721047
Change-Id: Id297d9995474b5e3f17d24e302c58168e0a00394
/frameworks/base/core/java/android/os/Looper.java
7f9f99ea11051614a7727dfb9f9578b518e76e3c 11-Aug-2011 Xavier Ducrohet <xav@android.com> Make some methods/fields package private so that layoutlib can access them.

Change-Id: I4aeadfbaf8a4f6a459fa19937c21ac23d9e5fb64
/frameworks/base/core/java/android/os/Looper.java
648bee18a1ccd362445d562729250ff5910f16a0 21-Jul-2011 Romain Guy <romainguy@google.com> Convert looper traces to traceview traces

Change-Id: If9238e8b00744118c1c4d2182727569f94deb638
/frameworks/base/core/java/android/os/Looper.java
f9284695e8c10dad4daf3d2c84f607483bcb56ca 14-Jul-2011 Romain Guy <romainguy@google.com> Add new ViewDebug APIs to profile the event queue.

Change-Id: I225bf288780b0244f459316e2765cfa29cd22c89
/frameworks/base/core/java/android/os/Looper.java
10e89712863f5b91a2982dc1783fbdfe39c1485d 09-Jul-2011 Jeff Brown <jeffbrown@google.com> Eliminate single-process mode.
Bug: 5010576

Change-Id: Id450dc83efed4897d1e4ff451530fed14457aace
/frameworks/base/core/java/android/os/Looper.java
43a17654cf4bfe7f1ec22bd8b7b32daccdf27c09 07-Apr-2011 Joe Onorato <joeo@google.com> Remove the deprecated things from Config.java. These haven't been working since before 1.0.

Change-Id: Ic2e8fa68797ea9d486f4117f3d82c98233cdab1e
/frameworks/base/core/java/android/os/Looper.java
9b7c1274ddba8db2842431649d46c4cef510131f 15-Mar-2011 Dianne Hackborn <hackbod@google.com> am e2e8da7c: am 7c2e76f0: Merge "Improve error reporting for issue #3183612" into gingerbread

* commit 'e2e8da7c734b71c4b6b81e51e16ce3f4061f0f07':
Improve error reporting for issue #3183612
1ab43775d8134d652a7d27f2d79c569653e47f1a 15-Mar-2011 Dianne Hackborn <hackbod@google.com> Improve error reporting for issue #3183612

java.lang.SecurityException: Neither user 1209 nor current process
has android.permission.WAKE_LOCK.

Change-Id: I465972ab91b007e04b2ac62550f78583956a4048
/frameworks/base/core/java/android/os/Looper.java
df58a1bbf8d7f6608848eae4d5d48dcff137dc8c 03-Mar-2011 Simon Wilson <simonwilson@google.com> am 3d79f1ce: am edc68a00: Merge "Attempt to reduce problems from issue #3183612" into gingerbread

* commit '3d79f1ce84ee60dbb26468b9e5f75f4ccb5ed8aa':
Attempt to reduce problems from issue #3183612
e5dea7537cadbf79614730f96d9e92cc2b12ad5a 09-Feb-2011 Dianne Hackborn <hackbod@google.com> Attempt to reduce problems from issue #3183612

java.lang.SecurityException: Neither user 1209 nor current...
...process has android.permission.WAKE_LOCK.

It looks like, somehow, the calling uid/pid of the SyncHandler
thread is getting corrupted. This change has Looper check for
these values changing from their original defaults and, if there
is a problem, resetting them and logging a WTF. Hopefully this
will avoid crashing the process, while also giving us more
helpful error reports about what is going on.

Change-Id: Iff06d575951fb8c06e2a3c31141f2907a715eb81
/frameworks/base/core/java/android/os/Looper.java
1b29825cca9edda7ae4b3a3f27420c42fd13eef8 24-Nov-2010 Brad Fitzpatrick <bradfitz@android.com> Misc Looper cleanups; add android.util.PrefixPrinter

Change-Id: I0b9adce46cb785b4dd4e6296e1f97c8bcf0dbfbf
/frameworks/base/core/java/android/os/Looper.java
1ebccf531d1049853b3b0630035434619682c016 15-Aug-2010 Dianne Hackborn <hackbod@google.com> Fix problems with determining when to kill apps for wake usage.

Also improve debug printing of various times.

Change-Id: Ifcc288fd1bcbf44c069875ba97925b9e7ffe9a48
/frameworks/base/core/java/android/os/Looper.java
a41ca77fabe1c7ad12ebb9b69b9e786c07d49fa0 11-Aug-2010 Jeff Brown <jeffbrown@google.com> 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
/frameworks/base/core/java/android/os/Looper.java
935ae463d495d41155e27feb849768ad2b8b16db 14-Apr-2009 Dianne Hackborn <> AI 145994: Integrate #145778 from Donut.

Automated import of CL 145994
/frameworks/base/core/java/android/os/Looper.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/Looper.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/Looper.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/java/android/os/Looper.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/os/Looper.java