Commit Graph

535 Commits

Author SHA1 Message Date
Romain Guy
3b996c96e4 Always create OpenGL accelerated windows in RGBA 8888.
Bug #3081600

The OpenGL renderer in libhwui uses a single EGL context per process and
thus create it with an RGBA 8888 EGL configuration. To ensure that all
windows are compatible with this configuration, this change modifies
the window manager and SurfaceFlinger.

The window manager now checks the window's flags and if the window is
hardware accelerated, it forces the window's pixel format to be
translucent when creating the surface. The window itself is still
marked as opaque if we know that the window will be opaque on screen.
This keeps existing optimizations in place.

Similarly in SurfaceFlinger, a translucent Surface can now be created
with the Surface.OPAQUE flag, indicating SurfaceFlinger that the surface
does not require blending, despite its RGBA 8888 configuration.

Change-Id: Ic747b6b12564ba064412d842117880fcc199eb7c
2010-10-12 11:00:18 -07:00
Jeff Brown
b6702e5972 Track input state when transferring touch focus.
Copies the input state to the destination window and sends synthesic
cancelation events to the source window.

Change-Id: Ia75820b0d756ed5d6cd22dce7830251ac85141ed
2010-10-11 18:32:20 -07:00
Jeff Brown
33d54ce97d 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.

Cherry pick of b931a1b4 from gingerbread into master.

Change-Id: I700a5f07b8b227878cea9437a289a45a245c0424
2010-10-11 17:54:12 -07:00
Jeff Brown
d129348647 am 41aabeb5: am 1e6a3a53: Merge "Added more robust tracking and cancelation of events." into gingerbread
Merge commit '41aabeb51305d19747687f246080f44fc2a74435'

* commit '41aabeb51305d19747687f246080f44fc2a74435':
  Added more robust tracking and cancelation of events.
2010-10-11 17:42:30 -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
Jamie Gennis
fe2987d865 Merge "Move binder magic from the Surface class to GraphicBuffer." 2010-10-10 13:36:13 -07:00
Jamie Gennis
309d3bb2f9 Move binder magic from the Surface class to GraphicBuffer.
- Register buffers with Gralloc when unflattening a GraphicBuffer (rather than
doing it in the Surface class).
- Add support for a GraphicBuffer that wraps an android_native_window_t*.

Change-Id: I029ac086111bbac800e5ca37eb505f558b718cd8
2010-10-10 13:09:46 -07:00
Jeff Brown
2eb1995a5d am 22cb4ef8: am d577cfd7: Merge "Switch Looper back to using poll() instead of epoll()." into gingerbread
Merge commit '22cb4ef8ce9c4d5536ac5cee5c40b82bfa56ccc5'

* commit '22cb4ef8ce9c4d5536ac5cee5c40b82bfa56ccc5':
  Switch Looper back to using poll() instead of epoll().
2010-10-10 12:52:40 -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
6d462b1221 am 56364bcd: am 78d15acf: Merge "Make secure views tolerate IME overlays." into gingerbread
Merge commit '56364bcd0d1a1b064db3e83fdb64f948ce5c2ad7'

* commit '56364bcd0d1a1b064db3e83fdb64f948ce5c2ad7':
  Make secure views tolerate IME overlays.
2010-10-07 12:20:45 -07:00
Mathias Agopian
e1c290b97d am ff04e97f: am f4619308: Merge "fix [2835280] Add support for cancelling buffers to ANativeWindow" into gingerbread
Merge commit 'ff04e97faf75c435e453d4c1caf7eeac8b9c1ceb'

* commit 'ff04e97faf75c435e453d4c1caf7eeac8b9c1ceb':
  fix [2835280] Add support for cancelling buffers to ANativeWindow
2010-10-06 17:07:39 -07:00
Kenny Root
8c4edc02d5 am bfa33b94: am f84a5918: Merge "Use pread() in ZipFileRO for Linux" into gingerbread
Merge commit 'bfa33b9484e2c0a019ab81f30261b9696df23a9b'

* commit 'bfa33b9484e2c0a019ab81f30261b9696df23a9b':
  Use pread() in ZipFileRO for Linux
2010-10-05 17:02:42 -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
3d20bc9ff6 am ac754073: am b58b2714: Merge "ZipFileRO: moar logging and wrap close" into gingerbread
Merge commit 'ac7540733cafcca5bdb1842e1ebcb396ba064583'

* commit 'ac7540733cafcca5bdb1842e1ebcb396ba064583':
  ZipFileRO: moar logging and wrap close
2010-10-04 07:54:06 -07:00
Kenny Root
a2b0e61228 Merge "ZipFileRO: moar logging and wrap close" into gingerbread 2010-10-04 07:28:20 -07:00
Jeff Brown
c0242197ea am ea58d1ba: am e951ef07: Merge "Wait for initial device scan to finish before updating config." into gingerbread
Merge commit 'ea58d1bac2960c1794f048bfa5d1a60b1a3d23a1'

* commit 'ea58d1bac2960c1794f048bfa5d1a60b1a3d23a1':
  Wait for initial device scan to finish before updating config.
2010-10-01 21:49:39 -07:00
Jeff Brown
76025e44e4 am e11b76d3: am f6295b35: Merge "Minor logging changes to input dispatcher to help with debugging." into gingerbread
Merge commit 'e11b76d3efb056edea301d53a354d0730adf3520'

* commit 'e11b76d3efb056edea301d53a354d0730adf3520':
  Minor logging changes to input dispatcher to help with debugging.
2010-10-01 21:49:29 -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
4adce423e4 am 57fa3e8b: am 9e32a438: Merge "Support haptic feedback for virtual keys defined in key layout." into gingerbread
Merge commit '57fa3e8b4c94125ddb5be015dd7fbde4a458894f'

* commit '57fa3e8b4c94125ddb5be015dd7fbde4a458894f':
  Support haptic feedback for virtual keys defined in key layout.
2010-10-01 17:08:34 -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
Mathias Agopian
84ac949b0e Merge "refactored screenshot code" 2010-10-01 12:15:12 -07:00
Jeff Brown
3f0fd1897c am 5d3cef8a: am e0c12c88: Merge "Move verbose logging of device capabilities to dumpsys." into gingerbread
Merge commit '5d3cef8a6d1baec29512764b9e0ba240ccd7fcfe'

* commit '5d3cef8a6d1baec29512764b9e0ba240ccd7fcfe':
  Move verbose logging of device capabilities to dumpsys.
2010-09-30 18:12:28 -07:00
Jeff Brown
26c94ff615 Move verbose logging of device capabilities to dumpsys.
Change-Id: I5d55eaebfdf049bd1ac1e7bab2758886cfefc9d7
2010-09-30 15:34:48 -07:00
Mathias Agopian
74c40c0a27 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: I5a3b0e431421800e3aad601d9af8f94adffbc71f
2010-09-29 16:55:15 -07:00
Jeff Brown
744c559ac7 Add support for transferring touch focus.
Prerequisite for drag and drop.

Change-Id: Iedbe93ed0f3e1c4083130fe66b4ba06d416afce0
2010-09-27 16:10:17 -07:00
Jeff Brown
e457038905 am 9785bf0f: am 14a288da: Merge "Add suuport for splitting touch events across windows." into gingerbread
Merge commit '9785bf0f2b6b8758aed7ded3b996a2ef0be89919'

* commit '9785bf0f2b6b8758aed7ded3b996a2ef0be89919':
  Add suuport for splitting touch events across windows.
2010-09-27 14:40:38 -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
a3aefeb1c3 am 495ad4f2: am beabe75a: Merge changes I1f7c4535,I741c68a2 into gingerbread
Merge commit '495ad4f22096aa172d025c16c25497e7dad8f2bd'

* commit '495ad4f22096aa172d025c16c25497e7dad8f2bd':
  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:13:22 -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
Kenny Root
d6d93dbb86 am 3e07c000: am 74865ef6: Merge "Add locking around ZIP seeking" into gingerbread
Merge commit '3e07c0007b10fbda945516acaf6b2a8787a6ca06'

* commit '3e07c0007b10fbda945516acaf6b2a8787a6ca06':
  Add locking around ZIP seeking
2010-09-24 15:22:38 -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
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
6bea174983 am 4ec134cd: am cce0cd13: Merge "Looper: use pthread_once for TLS key initialization." into gingerbread
Merge commit '4ec134cdba52b663506562c6406b07915820b007'

* commit '4ec134cdba52b663506562c6406b07915820b007':
  Looper: use pthread_once for TLS key initialization.
2010-09-21 15:57:13 -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
067ed1db03 am bc9599d4: am 838e93ed: Merge "Looper: Drop default parameters in favor of a safer overload." into gingerbread
Merge commit 'bc9599d48c79c18d306a13f51af9ef2aac92cdca'

* commit 'bc9599d48c79c18d306a13f51af9ef2aac92cdca':
  Looper: Drop default parameters in favor of a safer overload.
2010-09-17 16:10:01 -07:00
Jeff Brown
b0619e8ad8 Looper: Drop default parameters in favor of a safer overload.
The idea is that if you're writing code that wants fd/events/data on
return from pollOnce() / pollAll() you should really pass in all of those
arguments.  When I changed the Looper API earlier, it was difficult
to ensure that all callers were passing the right parameters since they
were relying on default parameters to some degree so usage mistakes
would not have been caught by the compiler.

Change-Id: I1f2812894270aaf1515017ac1616b6b312d9b565
2010-09-16 18:51:15 -07:00
Jeff Brown
54e9a7ec0b am 6f0ff46c: am 9c258710: Merge "Fix app switch latency optimization." into gingerbread
Merge commit '6f0ff46c6f1fd1b61325b545ab9e93c5ebf37d25'

* commit '6f0ff46c6f1fd1b61325b545ab9e93c5ebf37d25':
  Fix app switch latency optimization.
2010-09-16 17:29:46 -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
Jeff Brown
87fab277fd am 61cf67a2: am 24326f72: Merge "Input API review." into gingerbread
Merge commit '61cf67a220ba3205737c646c1c836a92074220de'

* commit '61cf67a220ba3205737c646c1c836a92074220de':
  Input API review.
2010-09-16 13:05:50 -07:00
Jeff Brown
128e33421b Merge "Input API review." into gingerbread 2010-09-16 12:57:56 -07:00
Jeff Brown
02a71f7ab4 am 7642c82c: am f4d788c9: Merge "Make input dispatcher only ANR for foreground windows." into gingerbread
Merge commit '7642c82c291051919aad87c797e2dc1d77ed55e1'

* commit '7642c82c291051919aad87c797e2dc1d77ed55e1':
  Make input dispatcher only ANR for foreground windows.
2010-09-15 21:42:28 -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
Mathias Agopian
3fd1ed5938 am 310da64d: am f182e8a8: fix a typo where the eventtags code were wrong
Merge commit '310da64d78750cdba4349d7cc0a268c07155569d'

* commit '310da64d78750cdba4349d7cc0a268c07155569d':
  fix a typo where the eventtags code were wrong
2010-09-15 17:53:43 -07:00