Commit Graph

18113 Commits

Author SHA1 Message Date
Tiger Huang
fa1ec597ca Refine PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT
- If a window has PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT, the final
  frame might be larger than the requested size, and we cannot use the
  requested lengths to compute the window frame. Because the window size
  will be the new requested size, we don't want to extend the window
  size again and again.

- When we are checking if a frame is overlapped with the display cutout,
  we only need to check if displayCutoutSafe contains the frame. We
  don't need to check individual bounding rectangles. This also fixes an
  issue that the gestural navigation bar is not extended by the
  waterfall cutout because it doesn't have bounding rectangles.

Bug: 203031262
Bug: 161810301
Test: Enable double cutout or waterfall cutout in developer options and
      see if the frame of navigation bar is correct when it is at the
      same side of the cutout.
Change-Id: Ic8c090198c556f2dc3b2c0b8498c42e9ca18c795
2022-03-17 00:58:29 +08:00
TreeHugger Robot
d7a879e665 Merge changes from topic "merge-input-config-feature-tm" into tm-dev
* changes:
  Use InputConfig flags in InputWindowHandle API
  WindowInfo: Merge InputConfig and Feature flags
2022-03-05 03:53:59 +00:00
yingleiw
a3a06ac231 Rename ACTION_SHOW_SUGGESTSIONS TO ACTION_SHOW_TEXT_SUGGESTIONS
Fix: 217730256

Bug: 222537368

Test: Added test in EditTextTest (will merge later when reviewed).

Merged-In: I78354a0f1d955c5b7c1ead044ea49086b3479841
Change-Id: I78354a0f1d955c5b7c1ead044ea49086b3479841
(cherry picked from commit e1f392d171)
2022-03-04 16:42:54 -08:00
TreeHugger Robot
5a8bea1a5d Revert 'Adding definitions for AccessibilityAction directional swipes.'
This reverts commit 0de71ca543.

Reason for revert: Don't yet have a use for the definitions,
and will likely reimplement them differently. This is an adjusted
revert to account for a resource finalization error

Test: Is a reversion.

Bug: 222537368

Merged-In: I99a71551069069d117039af4708030772b741cea
Change-Id: I99a71551069069d117039af4708030772b741cea
(cherry picked from commit 65e5bf07c2)
2022-03-04 15:45:46 -08:00
Xiaowen Lei
788fe7cdb6 Merge "Fix [AndroidFrameworkRequiresPermission] build warnings for add(remove)KeyguardLockedStateListener." into tm-dev 2022-03-04 22:04:52 +00:00
Taran Singh
e12374c01c Merge "Introduce Stylus handwriting developer option" into tm-dev 2022-03-04 18:21:20 +00:00
Xiaowen Lei
ac1a15b69a Fix [AndroidFrameworkRequiresPermission] build warnings for add(remove)KeyguardLockedStateListener.
These warnings triggered on ag/16873530. The warnings are like:

  [AndroidFrameworkRequiresPermission] Method addKeyguardLockedStateListener() annotated {allOf=[android.permission.SUBSCRIBE_TO_KEYGUARD_LOCKED_STATE]} but too wide; only invokes methods requiring [none]
      public void addKeyguardLockedStateListener(@NonNull @CallbackExecutor Executor executor,
                  ^
      If calling an AIDL interface, it can be annotated by adding:
      @JavaPassthrough(annotation="@android.annotation.RequiresPermission(...)")

Bug: 216630470
Test: n/a
Change-Id: I479063de6b591da44c474e4aa93e0466104d2a9a
2022-03-04 18:08:45 +00:00
Prabir Pradhan
bdf0cb7262 Use InputConfig flags in InputWindowHandle API
Use the android.os.InputConfig flags to control input window behavior in
InputWindowHandle. This consolidates the old boolean flags and
inputFeatures flags into one set of flags so that the InputConfigs are
the sole set of flags that change change how an input window behaves.

After this change, InputFeatures and LayoutParamsFlags are specific to
WM, which is responsible for converting them into InputConfig flags.
Trivial conversions between these flags are done in InputConfigAdapter.

The LayoutParams type and flags are still part of the this API to send
these attributes to native code. However, they are no longer used by
input.

Bug: 216806304
Test: manual: verify touch functionality
Test: atest WindowStateTests
Change-Id: I5b384770272c111680783ee8ab01ecd6e03f42be
2022-03-04 13:08:59 +00:00
TreeHugger Robot
bf41e89645 Merge "Disable system toolbar feature" into tm-dev 2022-03-04 12:29:52 +00:00
TreeHugger Robot
761938ea59 Merge "Restrict getInputMethodWindowVisibleHeight" into tm-dev 2022-03-04 10:08:20 +00:00
Joanne Chung
7f357d45d1 Disable system toolbar feature
The feature is punting to QPR1, disable feature by flag first. The
feature will strip from the build in the follow up change.

Bug: 190030331
Test: manual. Clear flag and make sure the feature is disable.
Change-Id: Id5e0efeff0465890a5d26ef10b6e54359f569317
2022-03-04 13:55:17 +08:00
Chavi Weingarten
53f62e57cf Merge "Changed setSyncTransaction to syncNextTransaction with callback logic." into tm-dev 2022-03-03 22:14:41 +00:00
Chavi Weingarten
5dcd46d356 Merge "SurfaceView: Synchronize all surface view changes with VRI draw" into tm-dev 2022-03-03 17:57:05 +00:00
Prabir Pradhan
ed142dcacb WindowInfo: Merge InputConfig and Feature flags
InputFeatureFlags are now a WM-only flag, but is temporarily used by
InputWindowHandle until the cleanup is completed.

Bug: 216806304
Test: atest libgui_test
Test: atest inputflinger_tests
Change-Id: I1260431e99d2c50261dc8b0356dc3e21ba76d39f
2022-03-03 17:00:33 +00:00
Vishnu Nair
797aa0066c SurfaceView: Synchronize all surface view changes with VRI draw
Re landing with the following changes:
We initially cloned the SurfaceControl handle to avoid locking when
accessing the SurfaceControl from the position listener callbacks
running from RT workers. But this meant the last reference to the
layer handle would only be released by GC. If SurfaceViews are
created and destroyed rapidly, we would be at the mercy of GC to
release buffers.

Original change:

There are three transaction queues that can submit SurfaceView
changes.

1. Buffer updates via BBQ apply token
2. SCC apply token
3. ViewRootImpl BBQ apply token

It makes sense for most SurfaceView changes to be synchronized with
ViewRootImpl draws since the caller can optionally synchronize the
change with main window content.

This change eliminates the tmp transaction that is applied directly
via the SCC apply token and instead applies them with the ViewRootImpl
draw transaction.

Also take the opportunity to scope down mSurfaceControlLock usage.

Test: atest SurfaceViewSyncTest
Test: go/wm-smoke
Test: run mem tests via forrest
Bug: b/217973491, b/221631942
Change-Id: Idba712d146e62d7346920dc4f060cba92d47fada
2022-03-03 16:07:15 +00:00
TreeHugger Robot
33a2b4bacd Merge "Incorporate API feedback: CAI requestCursorUpdates()" into tm-dev 2022-03-03 13:27:04 +00:00
Robert Horvath
1b0ffb5b13 Merge "Mark focused Views as keep clear areas" into tm-dev 2022-03-03 13:14:56 +00:00
Naomi Musgrave
3302797586 Merge "MediaProjection sets content recording details in WM directly." into tm-dev 2022-03-03 10:45:36 +00:00
Vadim Caen
8fa5667732 Merge "Move OnBackInvokedCallback to window package." into tm-dev 2022-03-03 10:03:41 +00:00
Robert Horvath
e867127174 Merge "Keep custom keep-clear Rects if preferKeepClear is set" into tm-dev 2022-03-03 08:37:14 +00:00
Rachel Lee
acd10a9a97 Merge "Cleanup Extended frame -> Vsync callback." into tm-dev 2022-03-03 01:05:52 +00:00
Rob Carr
c406f6afa7 Merge "ViewRootImpl: Don't pause HWUI so much" into tm-dev 2022-03-02 21:20:46 +00:00
Mark Punzalan
a88f5b74f2 Merge "Don't cache created Translators in TranslationManager." into tm-dev 2022-03-02 20:36:09 +00:00
Naomi Musgrave
27655e1fc3 MediaProjection sets content recording details in WM directly.
Content recording relies upon a class describing current state.
rather than passing around details from media > display > wm.
WMService keeps track of the session in ContentRecordingController.
ContentRecordingController manages hand-off between different
DisplayContent instances, as the session details are changed.

Manually tested that fold/unfold handling when screen recording
from QS tile still works, and that taking over a screen cast
with a screen recording works.

Refactoring logic from DisplayContent into new recording
delegate will come in a future change.

Bug: 216756854
Test: atest FrameworksCoreTests:ContentRecordingSessionTest
Test: atest WmTests:DisplayContentTests
Test: atest WmTests:ContentRecordingControllerTests
Change-Id: Ib4f125dd703d362ac13fcbe469d00b345827e706
2022-03-02 18:32:34 +00:00
Ameer Armaly
34f063c663 Merge "Fix speech state event javadocs per API review." into tm-dev 2022-03-02 17:45:17 +00:00
Tianhao Yao
5ecd6d37de Changed setSyncTransaction to syncNextTransaction with callback logic.
Modified SurfaceView and ViewRootImpl to provide callbacks when syncing
a transaction instead of sending transactions. This will ensure a clear
ownership of the transaction object since it will be provided in the
callback when BBQ adds a buffer into the transaction. Modified JNI to
add compatibility for native functions.

Test: Manual testing from go/wm-smoke.
Test: BLASTBufferQueueTest
Bug: 210714235.
Change-Id: I1f872d6b2846b0d64d5b33b8866d0b2ec7126c8c
2022-03-02 09:55:46 -06:00
Vadim Caen
72077726f5 Move OnBackInvokedCallback to window package.
Originally, View was implementing onBackInvokedDisptacherOwner, but now
only Activity and Dialog and since back event are related to the
window, it makes sense to move them into the android.window package

This follow up comment at:
ag/c/platform/frameworks/base/+/16764116/comments/e131f3ef_e3e1d2e0

Test: atest BackNavigationTests
Bug: 221401221
Change-Id: Ia2f26162beb6a41b6e162b31e599e882f8bf7320
2022-03-02 16:28:57 +01:00
Robert Horvath
52ba29fd8e Mark focused Views as keep clear areas
Mark/unmark Views as keep clear areas as they gain/lose focus
with a small delay.

Test: atest KeepClearRectsTests
Bug: 218494300
Change-Id: I33c89b5d2ed6707f95eca8ec4b5604c9193aec05
2022-03-02 11:21:27 +01:00
Robert Horvath
9a7444cec5 Keep custom keep-clear Rects if preferKeepClear is set
Since ViewParents can be set to not clip their children, custom
keep clear areas can extend beyond the bounds of its hosting View.
If preferKeepClear is set, add the View's bounds as a keep clear area,
but also keep the custom Rects.

Bug: 221073574
Test: atest KeepClearRectsTests
Change-Id: I85a4e4a223fbba787c5afebf2689a031243808d4
2022-03-02 11:20:33 +01:00
Mark Punzalan
e859f4655e Don't cache created Translators in TranslationManager.
Bug: 208599087
Test: atest CtsTranslationTestCases
Change-Id: I0c2f606ef8acc7001beafdd02b48e37e9734182e
2022-03-02 09:10:10 +00:00
Daniel Hsieh
6fbd9e7755 Merge changes from topics "presubmit-am-6d6a4b4f29394bb498818c2f4488d08d", "presubmit-am-b0e37416e8c743989854206f0e1f2acb" into tm-dev
* changes:
  Add a condition of ime should be visible on tracking typing focus.
  Disables tracking focus on move a11y actions.
2022-03-02 06:28:44 +00:00
Galia Peycheva
96c65d7c31 Merge "Add SystemApi to set unrestricted keep-clear rects" into tm-dev 2022-03-02 06:08:37 +00:00
Ameer Armaly
da8ef6e5a3 Fix speech state event javadocs per API review.
Fix: 219740393
Test: N/A
Change-Id: I1b3be67cdb3986426ef83726ebbc316654012996
(cherry picked from commit c025739eda)
2022-03-02 01:53:24 +00:00
TreeHugger Robot
6d990b1296 Merge "Close Transactions explicitly" into tm-dev 2022-03-02 01:40:39 +00:00
Daniel Hsieh
6f06d92d77 Merge changes from topics "presubmit-am-8e1f6f3832184ab4980013d926d31388", "presubmit-am-a0b2814b27254513b7a62e0a1e0044ff" into tm-dev
* changes:
  Enables following typing functionality when the window magnifier is on again.
  Adds moveWindowMagnifierToPosition method
2022-03-02 01:21:14 +00:00
TreeHugger Robot
1f014a4a51 Merge "Revert "SurfaceView: Synchronize all surface view changes with V..."" into tm-dev 2022-03-01 23:50:49 +00:00
Jared Duke
0a682bf137 Close Transactions explicitly
Ensure one-shot, scheduled Transactions are closed after application.
While individual Transaction instances aren't all that heavy, this
avoids unnecessary GC pressure and churn.

Bug: 216159702
Test: atest WmTests SystemUITests FrameworksCoreTests
Change-Id: Iec053dd8163fb9b300fd1e9eb9f1472a0d0dd782
2022-03-01 11:39:52 -08:00
Taran Singh
472e5c3825 Incorporate API feedback: CAI requestCursorUpdates()
1. Use intDef for CurosrUpdateFilter
2. overload requestCursorUpdates(mode, filter)
3. additional details in javadoc

Fix: 218314883
Bug: 210039666
Test: atest CtsInputMethodTestCases

Change-Id: I1dc5acac4f968b2a2d1780f2ee6c0145c7dcbbaa
2022-03-01 19:05:50 +00:00
Vishnu Nair
8dfd38ad76 Revert "SurfaceView: Synchronize all surface view changes with V..."
Revert "SurfaceView:  Avoid destination frame updates on multipl..."

Revert submission 16944940-sv-changes-tm-dev

Reason for revert: b/221631942
Reverted Changes:
I0d214e3f7:SurfaceView:  Avoid destination frame updates on m...
I0b5741b37:SurfaceView: Synchronize all surface view changes ...
I5226c304b:SurfaceView: Avoid destination frame updates on mu...

Change-Id: I35b7c1be7202ebe89a5309284a9401c8084e9d79
2022-03-01 18:55:13 +00:00
TreeHugger Robot
78840228ee Merge "Introduce a private flag to extend frame with cutout" into tm-dev 2022-03-01 17:00:29 +00:00
TreeHugger Robot
b419fc8e09 Merge "[ShellTransition]: add WMS#setRecentsAppBehindSystemBars for recents" into tm-dev 2022-03-01 08:53:12 +00:00
Daniel Hsieh
07229fd519 Disables tracking focus on move a11y actions.
After a user perform a11y action, namely moving up/down/left/right, we
have to disable tracking focus functionality.

We refactor #onDrag to a more general term #onMove to cover any move
action which has to disable tracking focus functionality.

Bug: 218935435
Test: atest WindowMagnificationTest
      atest WindowMagnificationControllerTest
      atest WindowMagnificationManagerTest
Change-Id: I578b301645a08c71e874fe2f4fcf2557202abefd
2022-03-01 08:45:31 +00:00
Daniel Hsieh
0dae9e4f47 Adds moveWindowMagnifierToPosition method
For following typing focus feature, we add a
moveWindowMagnifierToPosition method for a window magnifier to move it
to the center of onRectangleOnScreenRequested.

Apart from calling this method to fulfill movement functionality, we can
separate the movement from calling enableWindowMagnification which is a
temporary replacement for movement functionality. Therefore, we can
distinguish whether the it is enabled by the first time or the further
movement behavior. It would help us differentiate the condition whether
we should reset the following typing focus to on/off state. (b/216394179)

Bug: 219654280
Test: atest IWindowMagnificationConnectionTest
      atest WindowMagnificationTest
      atest WindowMagnificationAnimationControllerTest
      atest WindowMagnificationControllerTest
      atest WindowMagnificationConnectionWrapperTest
      atest WindowMagnificationManagerTest
Change-Id: Iaac3ca6868d948571c1aee54a5f122c9697059d8
2022-03-01 08:05:14 +00:00
Rachel Lee
71ba110d91 Cleanup Extended frame -> Vsync callback.
Non-api cleanups.

Bug: none
Test: atest ChoreographerTest
Change-Id: Ieaf40e60e0a98ae7b4ad7f9c79dc87190384a2b5
2022-02-28 15:09:02 -08:00
Chavi Weingarten
747b5bfad7 Merge "Add SurfaceSyncer class" into tm-dev 2022-02-28 18:11:41 +00:00
Taran Singh
ede3a97e6f Introduce Stylus handwriting developer option
Introduce stylus handwriting settings and check if its enabled before
calling IMM#startStylusHandwriting()

Bug: 219777744
Test: atest StylusHandwritingTest

Change-Id: Id58b2eb66a0a1178743d08921918f3d9d717546c
2022-02-28 17:15:53 +00:00
Yunfan Chen
a5dffa7762 Introduce a private flag to extend frame with cutout
This patch introduced a new private flag
PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_TO_CUTOUT to let the window extend
it's requested window frame to contain the display cutout frame. This
is useful for the case of navigation bar. Without it, the navigation
bar may not have enough space to layout it's content when it's on the
same side as the display cutout. With the flag set, the Navigation
bar will have the requested size plus the navigation bar size as its
frame.

Bug: 203031262
Bug: 161689946
Test: See reproduce steps in b/203031262
Test: atest WindowLayoutTests
Change-Id: Id1d6f09dc421b5f25e16e4aca6282b6deec2e8c4
2022-02-28 07:16:01 +00:00
Galia Peycheva
acaf385715 Add SystemApi to set unrestricted keep-clear rects
This CL allows applications to choose whether to set restricted or
unrestricted keep-clear areas by adding a dedicated SystemApi for
unrestricted keep-clear areas - View#setUnrestrictedKeepClearRects. The
SET_UNRESTRICTED_PREFER_KEEP_CLEAR_AREAS permission is now only checked
for keep-clear areas from that API

Bug: 221094507
Test: atest CtsWindowManagerDeviceTestCases:KeepClearRectsTests
Test: atest WindowStateTests#testUnrestrictedKeepClearAreas
Change-Id: I89ca3149117b4d457c5521d617880870706d7793
2022-02-28 05:14:35 +00:00
Ming-Shin Lu
e42507dda6 [ShellTransition]: add WMS#setRecentsAppBehindSystemBars for recents
For legacy recents animation, launcher side use
RecentsAnimationController#setAnimationTargetsBehindSystemBars to
callback if the animating recents task target is valid to affect
system bar apparence according the gesture threadshold.

if the animating recents task is behind system bar, means the
gesture threshod not yet passed and the task still can affect
system bar apparence, and vice-versa.

with shell-transition, since launcher triggers recents animation
by normal startActivity without initiating RecentsAnimationController
with startRecentsActivity, the launcher will be top-resumed
(but the surface hierarchy the recents task is still be top-most) when
starting gesture on navbar, in this case, launcher can affect the
system appearence even though launcher is behind systembar.

beside, previously we also rely on setAnimationTargetsBehindSystemBars
to hide soft-keyboard in multi-windowing mode when quick-swich tasks,
without this, soft-keyboard will keep visible when swiping up to
recents.

As the result, we needs to backport the most logic of
setAnimationTargetsBehindSystemBars for fixing the above cases,
the only difference is we renaming the method with
setRecentsAppBehindSystemBars(behindSystemBars) to only set recents app
can affect systembar apparence, and placing hide IME/IME icon logic into
handleLegacyRecentsStartBehavior when starting recents animation.

Fix: 215504556
Test: manual as below CUJs with enabling shell-transition:
 CUJ1:
  1) Launching a app with showing IME
  2) Quick-switching to the next task or swiping task to home
  3) Expect no navbar icon flickering

 CUJ2:
  1) With entering split-screen and showing IME on the split task
  2) Swipe up to recents
  3) Expect IME shound be hidden

 CUJ3:
  1) Launching a app
  2) Hammer tapping on the navigation bar
  3) Expect the staus bar icon won't blinking

Change-Id: I552eea738aed5566eb897bb9c68507e83ac43e1d
2022-02-26 06:18:26 +00:00
chaviw
d32068af7d Add SurfaceSyncer class
Add Syncer class that allows callers to add desired syncs into a set and
wait for them to all complete before getting a callback. The purpose of
the Syncer is to be an accounting mechanism so each sync implementation
doesn't need to handle it themselves. The Syncer class is used the
following way.

1. SurfaceSyncer#setupSync is called
2. addToSync is called for every SyncTarget object that wants to be
   included in the sync. If the addSync is called for a View or
   SurfaceView it needs to be called on the UI thread. When addToSync is
   called, it's guaranteed that any UI updates that were requested before
   addToSync but after the last frame drew, will be included in the sync.
3. SurfaceSyncer#markSyncReady should be called when all the SyncTargets
   have been added to the SyncSet. Now the SyncSet is closed and no more
   SyncTargets can be added to it.
4. When all SyncTargets are complete, the final merged Transaction will
   either be applied or sent back to the caller.

The following is what happens within the SyncSet
1. Each SyncableTarget will get an onReadyToSync callback that contains
   a SyncBufferCallback.
2. Each SyncableTarget needs to invoke SyncBufferCallback#onBufferReady.
   This makes sure the SyncSet knows when the SyncTarget is complete,
   allowing the SyncSet to get the Transaction that contains the buffer.
3. When the final FrameCallback finishes for the SyncSet, the
   syncRequestComplete Consumer will be invoked with the transaction
   that contains all information requested in the sync. This could include
   buffers and geometry changes. The buffer update will include the UI
   changes that were requested for the View.

Test: SurfaceSyncerTest
Test: SurfaceSyncerContinuousTest
Bug: 200284684
Change-Id: Iab87bff8a0483581e57803724eae88f0a3d96c8e
2022-02-25 13:44:46 -06:00