Commit Graph

15464 Commits

Author SHA1 Message Date
Rob Carr
ae00abf8ed Merge changes I0333ab33,I7ae7b27f,If20185ce
* changes:
  SurfaceView Cleanup (3/n): Extract RemoteAccessibilityController
  SurfaceView Cleanup (2/n): Cleanup visible = mVisible
  SurfaceView Cleanup (1/n): Breakup updateSurface()
2020-10-14 23:46:51 +00:00
Chavi Weingarten
c843f827df Merge "Removed separate SurfaceControl for Blast" 2020-10-14 23:42:46 +00:00
Mark Goldstein
dc6a578af9 Doc: Fix typo the right way. Supersedes cl/318172931 am: d5726423ca am: 6c0854d8a6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12828332

Change-Id: I736a936f1830e8a6b3044526c0b4939dc36edb91
2020-10-14 22:00:58 +00:00
Mark Goldstein
d5726423ca Doc: Fix typo the right way. Supersedes cl/318172931
Bug: 170764224

Change-Id: Iaef1aa4fd3143e6e9019d06834001b3bfa3d887d

Exempt-from-owner-approval: Docs-only typo fix
2020-10-14 20:38:09 +00:00
Robert Carr
60370aadc8 SurfaceView Cleanup (3/n): Extract RemoteAccessibilityController
We extract the SurfaceControlViewHost accessibility logic from
SurfaceView. This is serving both cleaning up the code in SurfaceView
a little, while also serving the goal of one day using this
accessibility code from other components.

Test: Existing tests pass
Change-Id: I0333ab339e54e3766fffab25df92f00bdb9723dc
2020-10-14 19:02:17 +00:00
Robert Carr
5a37207192 SurfaceView Cleanup (2/n): Cleanup visible = mVisible
Since visible=mVisible we don't really need this visible variable
we clean it up to avoid confusion.

Test: Existing tests pass
Change-Id: I7ae7b27f71744c90004f77467f6fd5e79d2f557c
2020-10-13 23:09:33 -07:00
Robert Carr
f45cfa2333 SurfaceView Cleanup (1/n): Breakup updateSurface()
This has become a mega function, the number of variables
and levels of indentation is increasingly difficult to read.
This is a simple abstraction of one large chunk.

Test: Existing tests pass
Change-Id: If20185ce640802173ccd53c84b1947b011f379ad
2020-10-13 23:09:28 -07:00
Robert Carr
b3bb920676 SurfaceControl: Remove setOverrideScalingMode
There are no callers.

Bug: 161937501
Test: Existing tests pass
Change-Id: Ib668e9092c60e3b5615cef2369b97ec1e4e6b87b
2020-10-13 18:44:27 -07:00
Robert Carr
7675809673 ScreenRotationAnimation: Use Surface#setScalingMode
We are the last user of SurfaceControl#setOverrideScalingMode
in ScreenRotationAnimation we have no need to call it since we
are the BufferProducer and we can just use Surface#setScalingMode

Bug: 161937501
Test: Existing tests pass
Change-Id: I049145a91fedbbca5f009648f1537b0380c5e771
2020-10-13 18:44:19 -07:00
chaviw
4a10b38ad4 Removed separate SurfaceControl for Blast
If Blast was enabled, WindowStateAnimator would create a container layer
and then a blast layer as a child. This caused some issues with
reparentChildren and relative Z, so instead of trying to continously fix
those issues, just use one layer. If blast is enabled, it will create a
single SurfaceControl with type blast. Otherwise, it will create a
BufferQueueLayer.

This means that we have to be careful with setting any properties on
the layer since the blast adapter could also be modifying the layer.
This is in the right direction since we will move all transactions for
the layer to the client, eventually.

Test: YT and Chrome with and without Blast
Change-Id: I43efc37663696ba8e54d341a03531f0048ee6a14
2020-10-13 17:48:57 -07:00
Kyunglyul Hyun
5045b3bb65 Merge "Add @JavaOnlyStableParcelable to KeyEvent" 2020-10-14 00:00:40 +00:00
Ady Abraham
439b20b2c7 Merge "pass frame deadline to Choreographer" 2020-10-13 23:03:55 +00:00
Kyunglyul Hyun
d4b338ba7d Add @JavaOnlyStableParcelable to KeyEvent
MediaSessionManager accepts KeyEvent in some system APIs,
which can be used from non-mainline modules.

Bug: 169046322
Test: build successful
Change-Id: Ibfa67c154af7ca189ea8cefa8c9cbb746365fb30
2020-10-13 02:25:52 +00:00
Nikita Dubrovsky
8438eec26a Merge "Add callbacks to notify View when an InputConnection is opened/closed" 2020-10-12 22:16:07 +00:00
Nikita Dubrovsky
92422b34a2 Add callbacks to notify View when an InputConnection is opened/closed
Added hidden callback methods on View to notify editors when the
system has initialized an InputConnection successfully and when
the InputConnection is closed.

This allows editable views (e.g. EditText) to have access to the
final EditorInfo and InputConnection that were created via
onCreateInputConnection(). This enables the editor platform code
to do things such as
* know what type of content can be inserted into the view (ie, the
MIME types in EditorInfo.contentMimeTypes)
* call APIs on InputConnection, e.g. commitContent() to pass
non-text content to the application

Bug: 163400105
Test: Manual and unit test
  atest FrameworksCoreTests:ViewInputConnectionTest
Change-Id: Iaafb0a03126c9292c24415f866dbdd72cadfa239
2020-10-12 11:03:31 -07:00
Ady Abraham
dfb13985af pass frame deadline to Choreographer
Pass the frame deadline calculated by SF to Choreographer so
hwui would be able to improve its stats by knowing if a frame is
likely to be late.

Bug: 169858174
Test: manual
Change-Id: Ib9fd93638b54f08d8dc72fa6b023e2dd7c276dc7
2020-10-09 11:17:32 -07:00
Jeff Sharkey
f76ffeaff1 Merge changes from topic "oct6"
* changes:
  Upgrade AndroidFrameworkBinderIdentity to fatal.
  Tighten up Binder.clearCallingIdentity() usage.
  Tighten up Binder.clearCallingIdentity() usage.
  Tighten up Binder.clearCallingIdentity() usage.
2020-10-08 18:50:22 +00:00
Ioana Stefan
823982d3f5 Merge "Add proto-based InputMethodService and server side dumping for IME" 2020-10-08 14:30:36 +00:00
Jeff Sharkey
b93712f623 Tighten up Binder.clearCallingIdentity() usage.
This is a third CL in a chain that adjusts existing malformed code
to follow AndroidFrameworkBinderIdentity best-practices.

Specifically, if a thread clears an identity they need to restore it
to avoid obscure security vulnerabilities.  In addition, the relevant
"try" block must start immediately after the identity is cleared to
ensure that its restored if/when any exceptions are thrown.

Bug: 155703208
Test: make
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I74cb958b68d55a647547aae21baff6ddc364859b
2020-10-07 21:24:05 -06:00
Rob Carr
3a67903462 Merge "WindowStateAnimator: Abstract global transaction usage (1/n)." 2020-10-07 23:18:31 +00:00
Anmol Gupta
5e68eeac86 Add proto-based InputMethodService and server side dumping for IME
This CL implements a mechanism to dump InputMethodService and IME
related server states into a proto file which can later be imported
to Winscope to allow easy debugging.

The Design Doc for the IME tracing project is: go/ime-tracing

Bug: 154348613
Test: start trace by calling "adb shell ime tracing start"
      end trace by calling "adb shell ime tracing stop"
      pull trace using "adb pull /data/misc/wmtrace/ime_trace.pb ime_trace.pb"
Change-Id: Icbfb8c11e882f29eb45dea9d4c23315c48e9d619
2020-10-07 20:27:32 +02:00
Kohsuke Yatoh
95733e3cb5 Merge "Add API to differentiate grammar suggestions." 2020-10-07 03:59:25 +00:00
Jeff Sharkey
2d2e07e2ff Tighten up Binder.clearCallingIdentity() usage.
The recently added AndroidFrameworkBinderIdentity Error Prone checker
examines code to ensure that any cleared identities are restored to
avoid obscure security vulnerabilities.

This change is a purely mechanical refactoring that adds the "final"
keyword to the cleared identity to ensure that it's not accidentally
modified before eventually being cleared.  Here's the exact command
used to generate this CL:

$ find . -name "*.java" -exec sed -Ei \
    's/    (long \w+ = .+?clearCallingIdentity)/    final \1/' \
    {} \;

Bug: 155703208
Test: make
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I832c9d70c3dfcd8d669cf71939d97837becc973a
2020-10-06 11:18:09 -06:00
Bernardo Rufino
0cbce5de93 Merge "Block untrusted touches opt-in" 2020-10-06 08:05:00 +00:00
Kohsuke Yatoh
291a0f9682 Add API to differentiate grammar suggestions.
The following attributes are added for grammar suggestions.
- SuggestionSpan#FLAG_GRAMMAR_ERROR
- SuggestionsInfo#RESULT_ATTR_LOOKS_LIKE_GRAMMAR_ERROR

Bug: 166304720
Test: atest CtsInputMethodTestCases:SpellCheckerTest
Change-Id: I0e5da3125d28bb881e513d0d69e0a2d336a9f286
2020-10-05 23:29:14 -07:00
Chavi Weingarten
b18d49ad00 Merge "Fix some blast issues with SurfaceViews" 2020-10-05 20:36:52 +00:00
TreeHugger Robot
31d12630bd Merge "Removing the UnsupportedAppUsage annotation from Choreographer" 2020-10-05 19:18:57 +00:00
Bernardo Rufino
64bbd4b1d9 Block untrusted touches opt-in
The feature is disabled by default and can be in one of 3 modes:
disabled, permissive and block. In permissive we only log but
don't block the touch. This knob is implemented in a global setting
block_untrusted_touches. It can also be disabled per occluding app using
app-compat infrastructure, so if you disable for a certain app, overlays
of that app won't have the chance of blocking touches. More details
on these on go/try-cross-uid-touches.

Each window has 3 modes related to touch occlusion: ALLOW, USE_OPACITY
or BLOCK_UNTRUSTRED. Check code comments for the meaning of each. If the
feature is turned off for the app, then the mode is ALLOW. Else if it's
a SAW, then it's USE_OPACITY. Else it's BLOCK_UNTRUSTED. These states
are passed to InputDispatcher, who then perform the proper checks and
blocks or not the touch.

If input dispatcher deems the touch unsafe, depending on the feature
mode, we filter out such touches and log a message to logcat.

I also introduce a global (secure) setting
MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH which represents the maximum
opacity allowed per UID that's obscuring the touch-consuming window
according to some rules, which are discussed in topic CL for
InputDispatcher code. This maximum is initially set to 0.8, but we'll
be conducting local experiments to determine the final value.

Test: atest WindowUntrustedTouchTest
Test: atest inputflinger_tests inputflinger_benchmarks libinput_tests
Test: go/try-cross-uid-touches for manual testing
Bug: 158002302
Change-Id: I462858ad5f0d11b1261748489385e6409e38e4b1
2020-10-05 11:44:37 +00:00
Pablo Gamito
c307591a1b Merge "Remove option to set barrier layer by surface" 2020-10-02 21:20:36 +00:00
Hongwei Wang
1735c59a61 Merge "Improve PIP enter transition w/ gesture nav (1/N)" 2020-10-01 20:18:15 +00:00
Ady Abraham
67199f7051 Merge "Add vsyncId to transactions" 2020-10-01 17:55:19 +00:00
Pablo Gamito
03112d7bf6 Remove option to set barrier layer by surface
This functionality is no longer used, so we can remove it to make it possible to dump all LayerState data exclusively on the client side without requiring access to Surface Flinger to get the layerId

Test: N/A

Change-Id: Ie8939a74e1c29ef767b8df2515fba308b2c7fa15
2020-10-01 17:34:19 +00:00
Vishnu Nair
c8b32797ea Merge "Add debug logs to BlastBufferQueue" 2020-10-01 01:59:07 +00:00
Hongwei Wang
8ea8dbe1a2 Improve PIP enter transition w/ gesture nav (1/N)
Add PictureInPictureParams to RemoteAnimationTarget, which would allow
Launcher to determine whether the current app can auto enter PiP.

Bug: 143965596
Test: N/A
Change-Id: I5bc8dd29e9e4e7f3acfe9b841e64344211f57758
2020-09-30 15:00:51 -07:00
Adam He
1dab7a7c1f Merge "Send ContentCapture events with mHandler to prevent threading issues causing mEvents to be null." 2020-09-30 20:54:47 +00:00
Ady Abraham
e998888046 Merge "Adding publicAlternatives to UnsupportedAppUsage on Choreographer" 2020-09-30 19:11:26 +00:00
Vishnu Nair
faa3969d77 Add debug logs to BlastBufferQueue
Bug: 168917217
Test: Enable logs and check logcat
Change-Id: Ie7aa4a9fb60924589f8efccc1a64a46f85d6dde3
2020-09-30 09:44:43 -07:00
chaviw
e0daa2e7ee Fix some blast issues with SurfaceViews
1. When calling reparentChildren, we want to move children from old view
root surface to new view root surface. If blast was enabled, the current
code would mvoe children from old view root surface to the layer above
the new view root surface. This would cause the SurfaceView to be
parented to the wrong layer

2. When the view root surface is changed, VRI is supposed to notify the
SurfaceViews so they can call setRelativeLayer to the new view root
surface. This wasn't getting called when blast was enabled because the
logic to check if it was a new surface is different when using a blast
layer. In addition the checking the sequence id that we do now, also
check the relayout flag RELAYOUT_RES_SURFACE_CHANGED since that should
indicate that the surface was changed.

Test: Split screen with Youtube.
Change-Id: I1012678b60cec87a702e4d0ffe3e197eda66cff6
2020-09-29 17:26:52 -07:00
Adam He
8b7eade4fa Send ContentCapture events with mHandler to prevent threading issues causing mEvents to be null.
Bug: 169267614
Test: atest CtsContentCaptureServiceTestCases
Change-Id: I1f0408611154cfdecc30a22f9c77582dd7001967
2020-09-29 16:35:02 -07:00
TreeHugger Robot
c747e87751 Merge "Expose spell checker settings for testing." 2020-09-29 23:08:01 +00:00
Rob Carr
c31ca6d90a Merge changes Icf1215c2,I3c8edef0,Icebd94f8
* changes:
  WindowState: Fix transaction usage in preserve surface
  WindowState/WindowStateAnimator: Remove cropping
  WindowStateAnimator/ViewRoot: Move surface resizing to client
2020-09-29 22:27:57 +00:00
Ady Abraham
504c828e21 Removing the UnsupportedAppUsage annotation from Choreographer
Removing the UnsupportedAppUsage annotation according to
https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/12517216/11/core/java/android/view/DisplayEventReceiver.java#158

Test: build
Bug: 162890382
Bug: 162888881
Bug: 162890407
Change-Id: I1bf8edceb52e9f4cf3f24bf9f6b9e3eb8d8ef01b
2020-09-29 19:23:34 +00:00
Ady Abraham
42193cbccf Adding publicAlternatives to UnsupportedAppUsage on Choreographer
Adding back the UnsupportedAppUsage annotation together with
publicAlternatives according to
https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/12517216/11/core/java/android/view/DisplayEventReceiver.java#158

Test: build
Bug: 162890382
Bug: 162888881
Bug: 162890407
Change-Id: I7b895978ec61290c5320ccb2472b0bf1addc914b
2020-09-29 19:22:09 +00:00
Ady Abraham
2afd66e968 Add vsyncId to transactions
This change is the first in a series of changes to add vsyncIds to
transactions so that SurfaceFlinger could identity jank related
to transactions. In this change we are sending the vsyncIds for
transactions originated by WindowAnimator.

Bug: 166302754
Test: manually see transactions in frame timeline
Change-Id: Ib0e9f4dcc873ab671c2bfded87868bfea2bf9366
2020-09-29 12:15:22 -07:00
Ioana Stefan
88cefeb2c9 Merge "Add proto-based client side dumping for IME tracing" 2020-09-29 15:27:30 +00:00
TreeHugger Robot
d20030e604 Merge "Implementing Lock contention API" 2020-09-29 14:04:32 +00:00
Anmol Gupta
cf9e5123ce Add proto-based client side dumping for IME tracing
This CL implements a mechanism to dump IME related client states into
a proto file which can later be imported to winscope to allow easy
debugging. A new abstract class ImeTracing.java declares the methods
related to scheduling, collecting and dumping logs. Two child class
implement these methods for server and client separately.

The Design Doc for the IME tracing project is: go/ime-tracing

Bug: 154348613
Test: start trace by calling "adb shell ime tracing start"
      end trace by calling "adb shell ime tracing stop"
      pull trace using "adb pull /data/misc/wmtrace/ime_trace.pb ime_trace.pb"
Change-Id: Ia89f11d5ef8a220ea7746191b18769cea5a8359d
2020-09-29 15:05:18 +02:00
Robert Carr
4659a118bf WindowStateAnimator: Abstract global transaction usage (1/n).
For the BLASTSyncEngine we will need all WSA GlobalTransaction
usage to be redirected to the pending transaction instead.

To prepare for this we first slimmed down WSA as much as possible
to make the remaining job easier. As a next step we start refactoring
code to use a passed in Transaction, but without chasing the global
Transaction all the way to the top. To do this we expose the global
transaction from SurfaceControl.java but with a special wrapper
that makes sure we don't accidentally call apply directly.

As we start cleaning up global transaction usage we can remove some
variants in WindowSurfaceController. In this CL we get setMatrix
and setPosition global variants removed.

Bug: 161937501
Test: Existing tests pass
Change-Id: Ibd8f710c8ca01e57f6f994f23dd7bf2dca3902fd
2020-09-28 12:23:27 -07:00
Robert Carr
55d882cf5f WindowStateAnimator/ViewRoot: Move surface resizing to client
The bounds on the client surface are controlled by higher levels of
the hierarchy and so the client can use whatever Surface size it wants
on its node. We move the SurfaceControl setSize call to the client,
following 3 sort of ideas:

1. Project to make relayout window async, but currently it is used as a
sync point for resizing, resizing on client, one problem solved!
2. WM Shouldn't do what it doesnt have to for clients
3. Totally move management of lowest level Surface to client
   clean up lots of WM code (see WindowStateAnimator slimming project)

In the future maybe we don't need to set the SurfaceControl size at all
and the client can just set its buffer size, but it may produce some
differences in geometry handling on the server so I want to maintain
the old semantics for this CL.

Bug: 161937501
Test: Existing tests pass
Change-Id: Icebd94f8443fdbe9f0e6968bc35bbb0504a1520c
2020-09-28 12:20:27 -07:00
Nikita Dubrovsky
210c931b21 Merge "Update RichContentReceiver API (now OnReceiveContentCallback)" 2020-09-28 14:48:42 +00:00