Commit Graph

892 Commits

Author SHA1 Message Date
Mathias Agopian
59119e658a turn off the electron beam
Change-Id: I335fb6719f1d5a3f1c6f37a046fd1c2c4ed2bbc6
2010-10-12 14:16:11 -07:00
Jeff Brown
a8ed856a8a Improve the input policy handling a bit.
Fixed some issues with Monkeys turning off their own screens.  Ook ook!
Added some more comments to explain what's going on.

Change-Id: Id2bc0466161a642a73ef7ef97725d1c81e984b12
2010-10-12 00:16:14 -07:00
Jeff Brown
316237d554 Fix a bug synthesizing cancelation events for motions.
Change-Id: I881c0fa16c1d22c4b1b6cca24deb0105405ff5b0
2010-10-11 18:22:53 -07:00
Jeff Brown
1fe6dec097 Fix an event injection bug when the policy is bypassed.
Added the concept of a "trusted" event to distinguish between events from
attached input devices or trusted injectors vs. other applications.
This change enables us to move certain policy decisions out of the
dispatcher and into the policy itself where they can be handled more
systematically.

Change-Id: I4d56fdcdd31aaa675d452088af39a70c4e039970
2010-10-11 16:26:13 -07:00
Jeff Brown
90f0cee685 Added more robust tracking and cancelation of events.
This change fixes several issues where events would be dropped in the
input dispatch pipeline in such a way that the dispatcher could not
accurately track the state of the input device.

Given more robust tracking, we can now also provide robust cancelation
of input events in cases where an application might otherwise become
out of sync with the event stream due to ANR, app switch, policy decisions,
or forced focus transitions.

Pruned some of the input dispatcher log output.

Moved the responsibility for calling intercept*BeforeQueueing into
the input dispatcher instead of the input reader and added support for
early interception of injected events for events coming from trusted
sources.  This enables behaviors like injection of media keys while
the screen is off, haptic feedback of injected virtual keys, so injected
events become more "first class" in a way.

Change-Id: Iec6ff1dd21e5f3c7feb80ea4feb5382bd090dbd9
2010-10-10 14:45:51 -07:00
Jeff Brown
77e26fce8e Minor fix for InputReader support for non-touchscreen devices.
Change-Id: I2256e37dd1c6f3836f82786aae14ee5d0c98f4c6
2010-10-07 13:44:51 -07:00
Jeff Brown
54e1cdacd2 Switch Looper back to using poll() instead of epoll().
Added a couple of micro-optimizations to avoid calling wake() unnecessarily
and reduce JNI overhead slightly.

Fixed a minor issue where we were not clearing the "next" field of Messages
returned by the MessageQueue so the Message would hold on to its successor
and potentially prevent the GC from collecting it if the message were leaked
somehow.

Change-Id: I488d29417ce0cdd7d0e447cda76ec978ef7f811c
2010-10-07 13:26:39 -07:00
Jeff Brown
35cf0e9854 Make secure views tolerate IME overlays.
Change-Id: I3cf09b9d91045f4d9c558b4aace482a7b0bbd3d8
2010-10-05 12:26:23 -07:00
Mathias Agopian
19957553cb fix [2835280] Add support for cancelling buffers to ANativeWindow
There is a new ANativeWindow::cancelBuffer() API that can be used to
cancel any dequeued buffer, BEFORE it's been enqueued. The buffer is
returned to the list of availlable buffers. dequeue and cancel are not
mutually thread safe, they must be called from the same thread or
external synchronization must be used.

Change-Id: I86cc7985bace8b6a93ad2c75d2bef5c3c2cb4d61
2010-10-04 20:10:11 -07:00
Mathias Agopian
566b728c93 Merge "refactored screenshot code" into gingerbread 2010-10-04 20:04:42 -07:00
Mathias Agopian
df85c455c3 refactored screenshot code
the core screenshot function now can capture the screen at any lower resolution
performing bilinear filtering.

we also now have some client code to interface with the screenshot service.

it's now possible to request a screenshot at a lower resolution.

Change-Id: I33689bba98507ab928d0898b21596d0d2fe4b953
2010-10-04 17:36:17 -07:00
Kenny Root
61ef747e0e Use pread() in ZipFileRO for Linux
AssetManager instances are created by zygote and passed to all its
children so that they don't have to individually open
frameworks-res.apk. This creates a problem for determining the current
file offset when using lseek() on those files, because you can't
guarantee the cross-process locking of a mutex. Luckily, Linux
implements pread() to get around this suckiness.

The problem is that only Linux implements this, so we have to keep the
old locking for use on host builds with aapt and friends. aapt doesn't
have this same problem of sharing file descriptors across forked
processes, so we can keep the local AutoMutex to protect accesses of
those files.

Change-Id: Ibe9f11499a53fe345f50fbaea438815ec0fd363e
2010-10-04 15:17:19 -07:00
Kenny Root
a2b0e61228 Merge "ZipFileRO: moar logging and wrap close" into gingerbread 2010-10-04 07:28:20 -07:00
Jeff Brown
1ad00e96fe Wait for initial device scan to finish before updating config.
This change narrows the opportunity for a race condition setting the
resource Configuration while devices are being updated.

Change-Id: I58efa563f4129ab0fce7108511d16a99dff7e451
2010-10-01 18:55:43 -07:00
Kenny Root
dbf6f272a2 ZipFileRO: moar logging and wrap close
There is apparently still a race upon reading the entry Local File
Header that can't be tracked down, so move the LFH check inside the
mutex-protected block so we can call lseek again to see where we are
when we log an error.

Also, close() can fail so use TEMP_FAILURE_RETRY on it so we don't
unwittingly leak file descriptors when Mean Mr. EINTR comes a-knocking.

Change-Id: I753abad0bd882fe28f7281c406fa76f64393ef4c
2010-10-01 18:30:59 -07:00
Jeff Brown
2806e381cf Minor logging changes to input dispatcher to help with debugging.
Added dumpsys reporting to EventHub.
Made the formatting a bit clearer.
Added 'Locked' suffix to some internal methods of EventHub.

Change-Id: Ic449560bcce378f6361895d27c66854e9724abb0
2010-10-01 18:05:13 -07:00
Jeff Brown
956c0fb238 Support haptic feedback for virtual keys defined in key layout.
Change-Id: I83e4108a87332692e03791dc066206becbc7941f
2010-10-01 15:08:56 -07:00
Jeff Brown
26c94ff615 Move verbose logging of device capabilities to dumpsys.
Change-Id: I5d55eaebfdf049bd1ac1e7bab2758886cfefc9d7
2010-09-30 15:34:48 -07:00
Jeff Brown
1c32258443 Fix bug in split touches.
Change-Id: I808c2201a06938f82817058059f4ddcc9b1a9ae2
2010-09-28 13:26:42 -07:00
Jeff Brown
ffb16d601b Fix pointer index when splitting secondary pointers.
Change-Id: Ib01e810ea5b64501b1303000bbef0f0a1db2114e
2010-09-27 20:54:28 -07:00
Jeff Brown
6949f5da66 Merge "Add suuport for splitting touch events across windows." into gingerbread 2010-09-27 12:33:14 -07:00
Jeff Brown
d1b0a2bfe5 Add suuport for splitting touch events across windows.
This feature is currently used to enable dragging the start and end
selection handles of a TextView at the same time.  Could be used for
other things later.

Deleted some dead code in ArrowKeyMovementMethod and CursorControllers.

Change-Id: I930accd97ca1ca1917aab8a807db2c950fc7b409
2010-09-26 22:20:12 -07:00
Mathias Agopian
8405dff685 Merge changes I1f7c4535,I741c68a2 into gingerbread
* changes:
  simple test app for screen capture API
  add support for [1974164] Be able to take a screen shot on the device
2010-09-24 18:02:10 -07:00
Dianne Hackborn
03ba4aeda9 Merge "Some debugging support." into gingerbread 2010-09-24 15:28:34 -07:00
Mathias Agopian
1b0b30d043 add support for [1974164] Be able to take a screen shot on the device
screenshots are taken using ISurfaceComposer::captureScreen() which returns
the size of the screenshot and an IMemoryHeap containing the data.
screenshots have limitations:
- they will always fail if a secure window is up on screen
- require GL_OES_framebuffer_object extension
- in some situation, video planes won't been captured

Change-Id: I741c68a2d2984fb139039301c3349e6780e2cd58
2010-09-24 14:56:39 -07:00
Dianne Hackborn
67f78c4fe8 Some debugging support.
- New feature to "am monitor" to have it automatically launch
  gdbserv for you when a crash/ANR happens, and tell you how to
  run the client.

- Update dumpstate to match new location of binder debug logs

- Various commented out logs that are being used to track down
  issues.

Change-Id: Ia5dd0cd2df983a1fc6be697642a4590aa02a26a5
2010-09-24 13:11:55 -07:00
Kenny Root
b47eafac1d Revert "Revert "Free created FileMap when uncompressing files""
This revert reverts commit a19ef306bd0a257c67b50f5e0e669e9fe52b0889.
2010-09-24 09:11:28 -07:00
Kenny Root
fa98920b71 Add locking around ZIP seeking
Since we switched to seeking to the LFH to verify its existence instead
of a huge mmap of the file, we have to guarantee that another seek
doesn't happen before we finish our read on the LFH.

Change-Id: If8135d9cb6f2f5cc4db734eafa4f6b5f6269c62a
2010-09-24 08:05:51 -07:00
Jeff Brown
61a25b2490 Looper: use pthread_once for TLS key initialization.
Also fix a Valgrind complaint by zeroing out the entire epoll event
struct since otherwise the data field union would be partly
uninitialized (but not in a harmful way).

Change-Id: I2091ce517e87fcad7c9caf90e2c5e4854a7ca465
2010-09-21 15:26:51 -07:00
Jeff Brown
ed242de3f5 Reduce lock thrashing in native Looper.
In the common case, there is nothing interesting happening on the native
Looper besides occasional wake ups.  There is no point grabbing the
semaphore then.

Change-Id: Ib5c426d0e158dfa37891b7ff5537b6f833592fad
2010-09-17 17:01:23 -07:00
Brian Carlstrom
ce802e33d4 Merge "Fix sim-eng build on Hardy" into gingerbread 2010-09-16 23:48:53 -07:00
Mathias Agopian
2ffb24799e Fix typo which causes sensors to fail miserably
Change-Id: Ieca18fc089e2bdf7d049f213836971b54d11cd76
2010-09-16 21:41:13 -07:00
Mathias Agopian
9e110d532f Merge "part of fix for [3004226] Cannot end the call - Proximity sensor doesn't work" into gingerbread 2010-09-16 17:54:50 -07:00
Mathias Agopian
aeda9afdba part of fix for [3004226] Cannot end the call - Proximity sensor doesn't work
- In SensorEventQueue, only bail on errors from Looper::loopOnce
- Improve sensor error logging

Change-Id: Ib3cf8d5d9fdac8513a3d753155827e0feeda1662
2010-09-16 17:33:48 -07:00
Jeff Brown
3b6dda9e19 Merge "Ensure input dispatcher and native looper handles EINTR." into gingerbread 2010-09-16 17:12:31 -07:00
Jeff Brown
f67f299036 Ensure input dispatcher and native looper handles EINTR.
Change-Id: I0a42db5f273b9bfe4ab174e4ee65d5d852f9f6bc
2010-09-16 17:04:52 -07:00
Jeff Brown
d8816c3c4c Fix app switch latency optimization.
This optimization was broken due to recent changes in how ANRs are handled.

Change-Id: Ic99248a12755fadac8d4893e7d305b773e038d3d
2010-09-16 16:41:46 -07:00
Brian Carlstrom
17563f9fb3 Fix sim-eng build on Hardy
Older glibc version do not include BSD htole32 and htole64 which are
present in bionic. This worksaround a sim-eng build issue by only
using htole32/htole64 if the host is not little endian.

Change-Id: Ia8d0d36285f3c34c51a331790458e52a21c2925f
2010-09-16 16:28:13 -07:00
Jeff Brown
128e33421b Merge "Input API review." into gingerbread 2010-09-16 12:57:56 -07:00
Jeff Brown
405a1d32e9 Fix input dispatcher regression on launcher drag&drop.
Change-Id: I40e937bd712cd2ed6cceac95dfd1b8c8e070724f
2010-09-16 12:31:46 -07:00
Jeff Brown
40ad470643 Fix NPE when handling certain kinds of ANRs.
Change-Id: Iccef1852e52c84f6f49d30c491431460a10b33d3
2010-09-16 11:02:16 -07:00
Jeff Brown
53a415e6d1 Make input dispatcher only ANR for foreground windows.
Redesigned the input dispatcher's ANR timeout mechanism so it is much
closer to Froyo's policy.  ANR is only ever signalled if the dispatcher
is waiting on a window to finish processing its previous event(s) and
there is new pending input.

In the old code, we tracked the dispatch timeout separately for each
input channel.  This was somewhat complicated and also resulted in the
situation where applications could ANR long after the user had pushed
them into the background.

Change-Id: I666ecada0952d4b95f1d67b9f733842b745c7f4b
2010-09-15 18:52:08 -07:00
Jeff Brown
b5764e066c Input API review.
Drop currently unsupported input features.
Add documentation comments.

Change-Id: I407d2e1dd90c5ee82983a3ccf177430d35ee7592
2010-09-14 20:46:14 -07:00
Jeff Brown
b06cca6228 Merge "Replace epoll() with poll() and rename PollLoop to Looper." into gingerbread 2010-09-14 15:27:33 -07:00
Jeff Brown
59abe7e090 Replace epoll() with poll() and rename PollLoop to Looper.
As part of this change, consolidated and cleaned up the Looper API so
that there are fewer distinctions between the NDK and non-NDK declarations
(no need for two callback types, etc.).

Removed the dependence on specific constants from sys/poll.h such as
POLLIN.  Instead looper.h defines events like LOOPER_EVENT_INPUT for
the events that it supports.  That should help make any future
under-the-hood implementation changes easier.

Fixed a couple of compiler warnings along the way.

Change-Id: I449a7ec780bf061bdd325452f823673e2b39b6ae
2010-09-14 01:59:45 -07:00
Mathias Agopian
35b48d10bc Add logging of various important graphics events
There are 16 events logged in the event log:
SF_APP_DEQUEUE_BEFORE
SF_APP_DEQUEUE_AFTER
SF_APP_LOCK_BEFORE
SF_APP_LOCK_AFTER
SF_APP_QUEUE

SF_REPAINT
SF_COMPOSITION_COMPLETE
SF_UNLOCK_CLIENTS
SF_SWAP_BUFFERS
SF_REPAINT_DONE

SF_FB_POST_BEFORE
SF_FB_POST_AFTER
SF_FB_DEQUEUE_BEFORE
SF_FB_DEQUEUE_AFTER
SF_FB_LOCK_BEFORE
SF_FB_LOCK_AFTER

all events log the buffer conserned and a timestamp in microseconds.

by default the logging is not enabled, to turn it on:
adb shell service call SurfaceFlinger 1006 i31 1
adb shell setprop debug.graphic_log 1

The effect is immediate in SurfaceFlinger, but applications need to be
restarted.

Change-Id: Ifc2e31f7aed072d9a7dede20ff2ce59231edbec1
2010-09-13 23:16:58 -07:00
Jeff Brown
a665ca805c Input dispatcher ANR handling enhancements.
This change is essentially a rewrite of the main input dispatcher loop
with the target identification folded in.  Since the input dispatcher now
has all of the window state, it can make better decisions about
when to ANR.

Added a .5 second deadline for processing app switch keys.  This behavior
predates Gingerbread but had not previously been ported.

Fixed some timing inaccuracies in the ANR accounting that could cause
applications to ANR sooner than they should have.

Added a mechanism for tracking key and motion events that have been
dispatched to a window so that appropriate cancelation events can be
synthesized when recovering from ANR.  This change helps to keep
applications in sync so they don't end up with stuck buttons upon
recovery from ANRs.

Added more comments to describe the tricky parts of PollLoop.

Change-Id: I13dffca27acb436fc383980db536abc4d8b9e6f1
2010-09-12 16:52:03 -07:00
Dianne Hackborn
9c82c48d52 Always set the scheduling group when starting a new thread.
Change-Id: Ia33acf13fc3752707f3819928c36315e223fa1bd
2010-09-09 22:12:25 -07:00
Jeff Brown
61ce3982e1 Fix key repeat delay.
Change-Id: I6216e082324ee29bf50e37acc673350ca5417c4d
2010-09-08 12:28:43 -07:00
Jeff Brown
af30ff6020 Add support for secure views.
Added the MotionEvent.FLAG_WINDOW_IS_OBSCURED flag which is set by the
input manager whenever another visible window is partly or wholly obscured
the target of a touch event so that applications can filter touches
accordingly.

Added a "filterTouchesWhenObscured" attribute to View which can be used to
enable filtering of touches when the view's window is obscured.

Change-Id: I936d9c85013fd2d77fb296a600528d30a29027d2
2010-09-08 11:50:55 -07:00