Commit Graph

17867 Commits

Author SHA1 Message Date
Joseph Jang
44a753f548 Merge "Revert "SurfaceControlViewHost: Restrict disclosure of input token"" 2022-01-26 09:23:36 +00:00
Joseph Jang
b061b38945 Revert "SurfaceControlViewHost: Restrict disclosure of input token"
This reverts commit 131444d500.

Reason for revert: <Test break by b/216355943>

Change-Id: I172db29e4eebea9214d05fc1309abbc0c4487804
2022-01-26 09:22:43 +00:00
Rob Carr
2b6cc61257 Merge "WM: Call Transaction#sanitize" 2022-01-25 22:08:34 +00:00
Rob Carr
0233e8a178 Merge "SurfaceControlViewHost: Restrict disclosure of input token" 2022-01-25 20:07:48 +00:00
Rob Carr
677d040e4f Merge "AttachedSurfaceControl: Add setTouchableRegion API" 2022-01-25 18:28:08 +00:00
Evan Rosky
4ab2c3c602 Merge "Move rotate utility to DisplayCutout" 2022-01-25 17:11:37 +00:00
Taran Singh
1797e0c8b8 Merge "Scribe in IMF: Automatically sub to CAI w/ Stylus 4/N" 2022-01-25 16:01:35 +00:00
Tiger Huang
dc94a72272 Merge "Remove the frame number from WindowManagerService" 2022-01-25 14:11:20 +00:00
Tiger Huang
3932df1165 Merge "Let the client compute the surface size on its own" 2022-01-25 14:09:25 +00:00
Taran Singh
71aa1a31d1 Scribe in IMF: Automatically sub to CAI w/ Stylus 4/N
When Stylus handwriting mode is about to be used, automatically
subscribe IME to CursorAnchroInfo updates. This helps speed-up
stylus tasks in IME

Bug: 203086136
Bug: 210039666
Bug: 215533103
Test: atest CtsInputMethodTestCases
Change-Id: I3d6b1728d62139785593af14c24cb52bf2c91e31
2022-01-25 07:02:17 +00:00
Robert Carr
234c2592c4 AttachedSurfaceControl: Add setTouchableRegion API
Add an API for setting touchable regions. This API allows
a view hierarchy to allow touches to pass through its
surface in certain regions. Touch pass through of course
follows the regular rules about UID/PID origins and
touchable region does not effect the calculation of the
TOUCH_OBSCURED flag. Such an API has existed as @hide
since the beginning of time, via
ViewTreeObserver.ComputeInternalInsetsListener. The API has already been
wrapped in the IME system, and in VoiceInteractionSession.
Desire to make the API public is motivated by 3 use cases:
	1. GameOverlayService UI code moving out of framework
	required for their UX (multiple small buttons in a large
	transparent overlay)
	2. SurfaceControlViewHost: A common point request among
	people who ask me about SurfaceControlViewHost is to be able
	to embed the SurfaceControlViewHost in a SurfaceView which is
	"setZOrderOnTop(false)" (hole punching) so that the host
	hierarchy can draw on top of the embedded hierarchy in some
	regions. This is possible today, but there will be no way
	to receive input without input hole punching.
	3. There may be cases where apps are using multiple Popup type
	windows which could be combined in to one. In general reducing
	HWC layer count this way will be a good trade off.

It was considered to ViewTreeObserver.ComputeInternalInsetsListener
directly but ultimately decided against it for a few reasons:
	1. Obscure naming
	2. Other fields not useful for our use cases.
	   Because insets/touchable region linkage not a useful API concept for
	   us
	3. Forces dispatch model via callbacks which may or may not be
           useful for a given app.

It was also considered to create a gatherTouchableRegion API mirroring
gatherTransparentRegion. Such a concept (as setting root surface
touchable regions) is not really composable though. For example
maybe a parent view requires touch regions, then a child view
one day starts removing them. The fact that input order is not
simply reverse drawing order (since parents come before children
in both) means there is no way to ensure this always cleanly composes
as expected. Given this, it's better to expose a "global" API
and require the app developer to understand how their components
are fitting together, rather than invite a View implementer
to subclass gatherTouchableRegion and allow someone to break them.

Bug: 213603716
Bug: 214239892
Test: SetTouchableRegionTest, SurfaceControlViewHostTests
Change-Id: Ie49caec964455b7129daa2aaa6990a368309f8e9
2022-01-24 21:17:25 +00:00
Robert Carr
131444d500 SurfaceControlViewHost: Restrict disclosure of input token
Currently we send the input (channel) token from the embedded
view hierarchy to the remote embedding process via SurfacePackage.
This is used to call grantEmbeddedWindowFocus. However this could also
allow the host process to invoke updateInputChannel, which is not
desirable. To fix this we rework updateInputChannel to work in terms
of a focusGrantToken, which only carries this 1 capability.
SurfacePackage is modified to not include the input token, but rather
include this focus grant token.

Bug: 215912712
Test: Existing tests pass
Change-Id: Ia9153c54e3e36e73c2b56763b96afab9e9f20d40
2022-01-24 19:44:12 +00:00
Philip Junker
83704e06b3 Merge changes from topic "keyLayoutAPI"
* changes:
  Add TestAPIs to test InputDevice#getKeyCodeForKeyLocation().
  Add API to get KeyCode produced by physical key location.
2022-01-24 18:39:18 +00:00
Nataniel Borges
2a7fc664a0 Merge "Add API for writing WM trace to file" 2022-01-24 17:41:59 +00:00
Nadav Bar
7d3df7b69f Merge "CaptioningManager: handle a case where caption calls enabled resource is not defined" 2022-01-24 13:45:11 +00:00
Tiger Huang
96c3e87e9e Remove the frame number from WindowManagerService
The frame number at the server side is not used anymore since BLAST.

Bug: 161810301
Test: presubmit
Change-Id: I01c6fb0750799aa94766f2582ce6ac031c9426cf
2022-01-24 21:43:28 +08:00
Tiger Huang
0456e9d5cb Let the client compute the surface size on its own
This is a step to move the layout logic to the client side. We won't
obtain the surface size from the server then.

This CL also moves the logic about adjusting the LayoutParams of
wallpaper to the client side.

Bug: 161810301
Test: presubmit
Change-Id: I3a81e174035c67a285cab449c0701ee2fe6f6a24
2022-01-24 21:40:45 +08:00
Tiger Huang
e99c5306cd Merge "Remove forwarded insets" 2022-01-24 08:03:20 +00:00
Shan Huang
7f10e2981c Merge "Implement OnBackInvokedDispatcher" 2022-01-24 05:14:29 +00:00
Tiger Huang
e45f1e5fac Remove forwarded insets
It was only used by ActivityView to forward IME insets, but ActivityView
is gone now. We should clean it up.

Bug: 161810301
Test: presubmit
Change-Id: Ib173112f2d668b0bb93ee2b5e639d236686846c1
2022-01-24 12:24:59 +08:00
Shan Huang
54b9c9d66e Implement OnBackInvokedDispatcher
Bug:209867448
Test: mp core services sysuig. atest FrameworksCoreTests:WindowOnBackInvokedDispatcherTest

Change-Id: Ib74250e93926854f07ebba6b9f680040aa98f9a4
2022-01-23 23:30:37 +00:00
Tiger Huang
697660ac69 Merge "Let the client set transform hint on its own" 2022-01-23 18:02:11 +00:00
Robert Carr
cdf1398415 WM: Call Transaction#sanitize
Various elements of the Transaction interface require
a permission in order to apply. In particular the setTrustedOverlay
and setInputWindowInfo fields. These permission checks are
implemented by checking the PID and the UID of the process which
sent the transaction. Unfortunately widespread use of transaction
merging makes this inadequate. At the moment
IWindowSession#finishDrawing seems to be the only boundary on which
transactions move from client to system processes, and so we expose
a sanitize method and use it from there to resolve the situation
in an easily backportable way.

Moving forward it likely make sense to move security sensitive
interfaces off of Transaction. Most of the things behind permissions
currently are not truly security sensitive, more of just a request
not to use them.

It was also considered to sanitize transactions at all process
boundaries through writeToParcel, however this could be disruptive
as previously permissioned processes (WM and SysUI) could freely
exchange transactions. As the change needs to be backportable the
lowest risk option was chosen.

Bug: 213644870
Test: Existing tests pass
Change-Id: I8d4a0ebe0cdfaed7ff1ad862724d49a14ed04478
2022-01-22 16:59:19 -08:00
Haoyu Zhang
8860e4044f Merge "Scribe in View: enable Handwriting" 2022-01-22 19:57:23 +00:00
Galia Peycheva
5c57f3bebf Merge changes from topic "keep_clear_areas"
* changes:
  Add keep clear rects API
  Add WMS support for keep-clear areas
2022-01-22 17:25:09 +00:00
Tiger Huang
5242af609e Let the client set transform hint on its own
This is a step to move the layout logic to the client side. We won't
invoke IWindowSession#relayout then.

Bug: 161810301
Test: atest WmTests
Change-Id: Ib5ac048a573907af0a81f3e228575d9458862cfd
2022-01-22 19:22:23 +08:00
Tiger Huang
c5ee8aa405 Merge "Pipe display install orientation 2/2" 2022-01-22 08:01:00 +00:00
Galia Peycheva
4e2adbd3c4 Add keep clear rects API
This allows the app to set views as keep-clear areas, which the system
will avoid laying out floating windows over, like Pip or Bubbles.

Bug: 209577354
Bug: 209578131
Test: atest CtsWindowManagerDeviceTestCases:KeepClearRectTests
Change-Id: I02f72376b709c0534bd678b7ce66cd95cab41832
2022-01-22 08:50:42 +01:00
Galia Peycheva
92edc518ff Add WMS support for keep-clear areas
Test: atest DisplayContentTests#testKeepClearAreasMultipleWindows
Test: atest WindowStateTests#testKeepClearAreas
Bug: 183746978
Change-Id: I974bf4254003467c8aa9a4f7aa618ab96985dd38
2022-01-22 08:50:02 +01:00
Peiyong Lin
4f8f656dca Merge "Raise SurfaceControlFpsListener to System API." 2022-01-21 20:30:59 +00:00
Nadav Bar
6785133405 CaptioningManager: handle a case where caption calls enabled resource is not defined
Change-Id: I9a54aef7f3cdbf7fa8e0d894b9c4c0223ff85605
Bug: 215444065.
Test: CaptioningManagerTest#testIsCallCaptioningEnabled
2022-01-21 21:58:31 +02:00
Evan Rosky
3c12e168a3 Move rotate utility to DisplayCutout
This was only in WMDisplayCutout, but it really is generic and we
plan to support rotating cutouts in the client.

Bug: 202201326
Test: DisplayContentTests DisplayCutoutTest
Change-Id: I75dc5e2296d096680e7660c98faf88b5cb1726e8
2022-01-21 10:30:04 -08:00
Philip Junker
704afe2077 Add TestAPIs to test InputDevice#getKeyCodeForKeyLocation().
Mention @RequiredPermission(..) where applicable / move it from javadocs.

Bug: 179812917
Test: atest KeyboardLayoutChangeTest
Test: atest android.hardware.input.cts.tests -m
Change-Id: I183734d3bb80a6f0c69f27629bfaaa577e4fab59
2022-01-21 17:59:08 +01:00
Philip Junker
71355cd52a Add API to get KeyCode produced by physical key location.
The physical key location is provided as a location keyCode pointing to a location on a US keyboard layout.

Bug: 179812917
Test: atest KeyboardLayoutChangeTest
Test: atest android.hardware.input.cts.tests -m
Change-Id: Ie1b424a0e0bfea2bc15b0b3a644f2f718f16094e
2022-01-21 17:56:10 +01:00
Vishnu Nair
80d665bbbc Pipe display install orientation 2/2
This is a step to move the layout logic to the client side. We won't
invoke IWindowSession#relayout then, and the client should be able to
set the transform hint on its own.

Bug: 161810301
Test: presubmit
Change-Id: Ib12a76fcc9906b3d9c487fb89bbe4520c682379a
2022-01-22 00:16:32 +08:00
Nataniel Borges
d9edbe7a50 Add API for writing WM trace to file
Currently the API supports only starting or stopping the trace, and writes to file when the trace is stopped. However, in some scenarios we would like to maintain the trace active, and just dump the trace.

Bug: 205138504
Test: all API, check if files are created under /data/misc/wmtrace
Change-Id: Ia1d38ebcfd5a9d45e25bc7a29146aca54d4bdaf3
2022-01-21 12:06:12 +01:00
Peiyong Lin
399e06d648 Raise SurfaceControlFpsListener to System API.
Previously the SurfaceControlFpsListener is a hidden API which only
allows platform code access. This patch renames it to follow the
callback convention and raises it to be a system API in order to allow
system applications to access the FPS count of a task and its children.
The FPS count access is guarded by a permission ACCESS_FPS_COUNTER.

To follow the API convention and properly check the permission, the
register/unregister callback APIs are moved to WindowManager and
permission check is done in the System Server.

Minor: Rename to SurfaceControlFpsCallback to TaskFpsCallback in order
to follow the API naming convention.

Bug: b/199920468
CTS-Coverage-Bug: b/199920468
Test: atest TaskFpsCallbackTest
Change-Id: I6b0a0ad6500278b3da09059e9c2ede28d9a743aa
2022-01-21 09:18:08 +00:00
Ady Abraham
5b299e3914 Merge "Fix negative frame time nanos." 2022-01-21 04:19:05 +00:00
Haoyu Zhang
57620822d3 Scribe in View: enable Handwriting
Bug: 209854913
Test: atest FrameworksCoreTests:HandwritingInitiatorTest
Change-Id: I8449b3d9e713e226a2cd2b772103e79bf65b88c9
2022-01-20 16:31:04 -08:00
TreeHugger Robot
ce65b04d56 Merge "Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""" 2022-01-20 11:33:39 +00:00
Shan Huang
5b44dd8b79 Merge changes from topic "shanh-back-api"
* changes:
  Provide OnBackInvokedDispatcher from Activity, View and Dialog
  Introduce IOnBackInvokedCallback and OnBackInvokedDispatcher
2022-01-20 07:20:51 +00:00
Shan Huang
c0999600ee Provide OnBackInvokedDispatcher from Activity, View and Dialog
Test: mp core sysuig services
Bug: 195946584

Change-Id: Ia882ec621154ea1daa780c8976b900e4c8f44a7d
2022-01-20 01:33:56 +00:00
Shan Huang
14b38d5a00 Introduce IOnBackInvokedCallback and OnBackInvokedDispatcher
Test: mp core, m -j update-api
Bug:195946584

Change-Id: I7997c69fca69cc8875410d8240caf48feef34378
2022-01-20 01:06:53 +00:00
Rachel Lee
cc9c644106 Fix negative frame time nanos.
On scheduling delays, frame time nanos changes.

Bug: 215299245
Bug: 198191703
Test: atest ChoreographerTest
Change-Id: Ia813971380276a93e0feabc3705dbe7515cc24ae
2022-01-19 15:33:47 -08:00
Lais Andrade
41fd16dfb7 Merge "Deprecate boolean settings for haptic feedback and vibrate when ringing" 2022-01-19 17:24:40 +00:00
Prabir Pradhan
08d0c47646 Merge "Introduce SimpleBatchedInputEventReceiver" 2022-01-19 11:24:21 +00:00
Bernardo Rufino
1a5cb387d6 Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""
This reverts commit 331be9a643.

Reintroducing ag/16366278 since it seems unrelated to b/214053959 (more details on b/214053959#comment55).

Original commit message:

Migrate unsafe parcel APIs in framework-minus-apex

Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()

This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).

A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.

Bug: 195622897
Change-Id: I272432e6e082a973f7a50492ec35d79c2b577c93
Test: TH passes
2022-01-19 11:13:18 +00:00
Jacky Kao
1700cab5f8 Merge "Adds APIs to let live caption can access the data in the DB (2/n)" 2022-01-18 23:26:52 +00:00
Rachel Lee
34f56bf78a Merge "Implement Java Choreographer multi frame timeline." 2022-01-18 20:30:18 +00:00
Lais Andrade
a01a1f6993 Deprecate boolean settings for haptic feedback and vibrate when ringing
Deprecate HAPTIC_FEEDBACK_ENABLED in favor or HAPTIC_FEEDBACK_INTENSITY,
and VIBRATE_WHEN_RINGING in favor or RING_VIBRATION_INTENSITY.

Introduce hidden flag
VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF
to represent HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING in the
vibrator service. This is applied by:

- PhoneWindowManager, that converts HapticFeedbackConstants into
(VibrationEffect, VibrationAttributes).

- CellBroadcastAlertAudio, that triggers alerts using AudioAttributes
with flags FLAG_BYPASS_INTERRUPTION_POLICY (that translates to same flag
in VibratorManager, to bypass DnD) and FLAG_BYPASS_MUTE (that translates
to this new flag, to bypass the new alarm intensity settings).

The new flag is erased from request that are not from privileged apps,
similar to the other bypass flag. The public
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING has also been
deprecated in T with a documentation explaining the removal of platform
support.

Remove SysUI dependencies on the deprecated settings, it should use the
USAGE_TOUCH attribute and rely on the vibrator service to apply the user
settings.

Keep other SysUI dependencies that needs to run in older Android
versions (like Launcher3).

Bug: 185351540
Test: VibrationSettingsTest + manual
Change-Id: I0372e4db19e09523795d7e79b9f7a15ae48a8cd9
2022-01-18 18:57:10 +00:00