Commit Graph

18063 Commits

Author SHA1 Message Date
Chavi Weingarten
747b5bfad7 Merge "Add SurfaceSyncer class" into tm-dev 2022-02-28 18:11:41 +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
Sally Yuen
9178d29c98 Merge "Make pane logic consistent with documentation" into tm-dev 2022-02-25 17:47:14 +00:00
TYM Tsai
2a5769bc38 Merge "Make fill dialog feature controlled by device config" into tm-dev 2022-02-25 04:33:29 +00:00
Winson Chung
344764058d Merge "1/ Remove some unused code from the shared lib" into tm-dev 2022-02-24 23:45:39 +00:00
Vishnu Nair
7da5f02dc9 Merge changes from topics "cherrypick-sv-changes-8cq54jfvx9", "sv-changes-tm-dev" into tm-dev
* changes:
  SurfaceView: Synchronize all surface view changes with VRI draw
  SurfaceView: Avoid destination frame updates on multiple threads 1/2
2022-02-24 23:18:22 +00:00
Winson Chung
535740f798 1/ Remove some unused code from the shared lib
Bug: 219861883
Test: Builds/Presubmit
Change-Id: I884392d2fcbfac6fd27c01f0077d4fb426a24d4a
2022-02-24 18:04:02 +00:00
TreeHugger Robot
d0dfaa7c45 Merge "Remove the current input focused window when ANR" into tm-dev 2022-02-24 17:53:46 +00:00
Nikolas Havrikov
236e833e04 Replace LinkedList by a more performant collection
This is a semi-automatic change.
See https://errorprone.info/bugpattern/JdkObsolete for the rationale.

Test: make
Bug: 221046110
Change-Id: I15328005007ddc58f56604f6064c30fbed2c01a6
(cherry picked from commit 1c8715261d)
Merged-In:I15328005007ddc58f56604f6064c30fbed2c01a6
2022-02-24 10:10:17 +00:00
Jorim Jaggi
35efedc9a2 Merge "Get rid of double measure" into tm-dev 2022-02-23 22:00:20 +00:00
Jorim Jaggi
4234e6cea8 Get rid of double measure
We first need to dispatch insets, then we can measure so we don't
need to immediately measure again.

Fixes: 210881360
Bug: 190379081
Test: Presubmit, Boots
Change-Id: Id40a083dd2e122ca71a96213e94b5bbbb45d596d
2022-02-23 21:59:18 +00:00
TYM Tsai
261ac24929 Make fill dialog feature controlled by device config
Use device config to control whether autofill dialog feature is enabled.
To support this, the autofill namespace of DeviceConfig needs to be exposed
for AutofillManager to read in the app thread.
There are augmented_autofill_mode, smart_suggestion_supported_modes and
compat_mode_allowed_packages existed in autofill space. These can be made
app readable.

Bug: 210926084
Test: atest android.autofillservice.cts.dialog.LoginActivityTest
Change-Id: Idfb846656a0c26eba1db4f8ef6ec427ae4ca666d
2022-02-24 00:34:54 +08:00
TreeHugger Robot
de23e70472 Merge changes from topic "clear_show_forced_tm_dev" into tm-dev
* changes:
  Clear SHOW_FORCED flag when the app's targetSdk >= T
  Introduce ImePlatformCompatUtils
2022-02-23 15:05:49 +00:00
Ming-Shin Lu
df5fc6f727 Clear SHOW_FORCED flag when the app's targetSdk >= T
As the legacy flag SHOW_FORCED when calling showSoftInput keeps
remaining soft-keyboard visible, even though switching focus to another
application the situation still remains, unless someone calls
hideSoftInputFromWindow explicitly.

In case SHOW_FORCED flag affects the next client to keep IME visible and
hard to handle for the app developer, we introduce a platform
compatibility flag, when enabled, if the current client is leaving due
to the next focused client, in IMMS side will clear mShowForced flag when
the next client's targetSdkVersion is T or higher.

Also, deprecated SHOW_FORCED flag with updating the reason in
the documentation.

Fix: 214016041
Test: atest KeyboardVisibilityControlTest#\
    testShowSoftInputWithShowForcedFlagWhenAppIsLeaving
Change-Id: I47efe5cb02ba69cbe018619e5bdc8f3995a55b4b
2022-02-23 18:26:49 +08:00
Xiaowen Lei
8d50e04afc Merge "Add role guarded APIs for subscribing to keyguard locked state in KeyguardManager." into tm-dev 2022-02-23 06:43:49 +00:00
Rob Carr
bb4e0de2de Merge "SurfaceControlViewHost: Clone control for SurfacePackage" into tm-dev 2022-02-23 03:14:45 +00:00
TreeHugger Robot
913b220e22 Merge "Deprecate SurfaceControl.Transaction#setGeometry" into tm-dev 2022-02-22 19:38:31 +00:00
Sally Yuen
f85808ddf2 Merge "Use isAggregatedVisible for pane events" into tm-dev 2022-02-22 19:25:08 +00:00
Robert Carr
f9b5a13cd1 SurfaceControlViewHost: Clone control for SurfacePackage
Otherwise the results can be quite confusing, each time we call
getSurfacePackage it returns a new SurfacePackage but after releasing
the first one all the others become invalid. This normally isn't
noticed as SurfaceControlViewHost is frequently used only in
cross process scenarios so the additional step of parcelling
can prevent this issue from occuring.

Bug: 196926363
Test: SurfaceViewSurfacePackageValidatorTest#testSurfacePackageNoFlicker
Change-Id: Id77f6daab4bb80d4d23d40d24d74b39bd694f350
2022-02-22 18:18:27 +00:00
Philip Junker
e90d6b5e78 Merge "Add more detailed documentation to InputDevice#getKeyCodeForKeyLocation()." into tm-dev 2022-02-22 16:55:48 +00:00
Philip Junker
810e58044d Add more detailed documentation to InputDevice#getKeyCodeForKeyLocation().
Bug: 216640180
Bug: 179812917
Test: javadocs only
Change-Id: I7ebbd3ab2829667849576bf11a48689bb2714a2d
2022-02-22 13:21:40 +00:00
Nikolas Havrikov
87d1af1d80 Simplify getImmDelegate in ImeFocusController
This CL undoes part of [1] making removing a local variable.

[1]: Id4c85be1c0eab51f167ba00fc355386f852c424d

Test: make
Change-Id: I6b890e5536c17dd53722e2c3a781c85dd9d6bdf0
(cherry picked from commit d90033999f)
Merged-In:I6b890e5536c17dd53722e2c3a781c85dd9d6bdf0
2022-02-22 10:46:02 +00:00
HQ Liu
964305e1b2 Remove the current input focused window when ANR
When a freeform app launched and focused, but its window is not ready,
the input focus stays on the window of the previously focused freeform
app. The focus should be removed from the previously foccused app, so
ANR can be triggered correctly.

Bug: 216852742
Test: atest AnrTests#slowOnCreateWithKeyEventTriggersAnr
Change-Id: Id00c147ffab9b11fb2abdf0f3020bc017a31bea7
2022-02-21 20:42:21 +00:00
shawnlin
b76fdc5630 Update the sdk doc of Default & ShortEdge cutout mode
We now allow OEMs to extend the window to cutout area in below cutout
mode, only if the cutout overlaps at most 16dp with the app windows.
 - LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFUALT
 - LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES

Bug: 218603390
Test: make
Change-Id: I8c83cde40f321de2a301b5865445ff765c824d43
2022-02-21 01:43:31 +00:00
Xiaowen Lei
a650c2c4b7 Add role guarded APIs for subscribing to keyguard locked state in KeyguardManager.
Bug: 216630470
CTS-Coverage-Bug: 220371902
Test: manual
Test: atest CtsAppTestCases:KeyguardLockedStateApiTest
Ignore-AOSP-First: (for packages/Shell/AndroidManifest.xml) Permission
not yet publicly announced.

Change-Id: I1f44ec6799b0f74791613389ce28aadf84c9fe5c
2022-02-19 03:48:40 +00:00
TreeHugger Robot
92d4c63228 Merge "Fix NPE when IMM#invalidateInput() is called too early" into tm-dev 2022-02-19 00:26:47 +00:00
Vishnu Nair
6011059ed0 SurfaceView: Synchronize all surface view changes with VRI draw
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
Bug: 217973491
Change-Id: I0b5741b376e042537c37ec34644e0a048eb4bfe0
2022-02-19 00:12:43 +00:00
Vishnu Nair
cb7a16280a SurfaceView: Avoid destination frame updates on multiple threads 1/2
The caller such as SurfaceView can optionally apply destination
frame changes if they wish to synchronize buffer scale with other
scales in the hierarchy. This is hard to synchronize if the buffer
scale changes, since in fixed scaling mode we want the destination
frame to be applied when a buffer of the new size is queued.

This approach is brittle because SurfaceView does not have control
over the buffer production and the app can get into a scenario
where there is scaled incorrectly.

Fix this by configuring BBQ to always apply destination frame
changes or always defer to the caller. If the scaling mode is freeze,
then BBQ will set a flag to ignore the destination frame. This
allows us to synchronize destination frame changes with scale
applied by a parent and avoid unwanted scaling if the scaling
mode changes to freeze.

Test: atest SurfaceViewTest
Test: go/wm-smoke
Bug: 217973491
Change-Id: I5226c304bae9dde890306f8528dfeabf6b015a32
2022-02-19 00:08:04 +00:00
Sally
4e8545b0b5 Make pane logic consistent with documentation
APPEARED and DISAPPEARED events should be sent when a title is first
given and nulled respectively, following the Javadoc.

Test: Manual, atest AccessibilityPaneTest
Bug: 133131221
Change-Id: I41cd2548aa949c7ce320e228c2b07ef04ea0298b
2022-02-18 21:10:12 +00:00
Sally
33e714af1c Use isAggregatedVisible for pane events
When the pane title changes, the view may not be actually visible on screen.
Check parent visibility before sending a pane event.

Bug: 133131221
Test: manual check to ensure we don't receive title event, atest AccessibilityPaneTest
Change-Id: I8bad8f742cc3e8f4d906c2b6fe80a3516c900ef1
2022-02-18 21:07:25 +00:00
Yohei Yukawa
a4a6960b62 Fix NPE when IMM#invalidateInput() is called too early
This is a follow up CL to my previous CL [1], which introduced

  InputMethodManager#invalidateInput(View).

One thing I overlooked is that apps may call that API even before

  InputMethodManager#mCurrentInputMethodSession,

which results in a NullPointerException.

With this CL, such a case will be gracefully fallen back into

  InputMethodManager#restartInput(View)

like other cases when IMM#invalidateInput() is not available.

 [1]: I3161755779080f98bcef0e47dd0c5247d8a3a256
      daa6695c2e

Fix: 213350732
Test: atest CtsInputMethodTestCases:InputMethodStartInputLifecycleTest
Change-Id: I67458494b3069498a1395e3278f6a975e821e610
2022-02-18 12:05:15 -08:00
Vishnu Nair
ba74e4b0d2 Deprecate SurfaceControl.Transaction#setGeometry
The java API is not consistent with the now deprecated native ASurfaceTransaction_setGeometry API. The existing functionality can be
better composed with the available API to set position, scale, transform
and crop.

Bug: 220336806
Test: presubmit
Change-Id: Ib2bf75876e2ce5e700da3085fab66218723ff54e
2022-02-18 18:47:30 +00:00
Robert Horvath
b864abe37b Remove keep clear areas when a view detaches
If a View detaches, its keep clear areas should no longer be considered
when placing a PiP.

Bug: 209577354
Test: atest KeepClearRectsTests#testIgnoreKeepClearRectsFromDetachedViews
Change-Id: I0caa74d4bef2ee157fc3f48747788e30752d09ad
2022-02-18 13:48:30 +01:00
Gaurav Bhola
8d25bbe074 Merge "Add APIs to add/remove local InsetsSourceProviders in WindowContainer." 2022-02-17 20:18:14 +00:00
Gaurav Bhola
eeb1b258f4 Add APIs to add/remove local InsetsSourceProviders in WindowContainer.
- updateAboveInsetsState() now updates the entire hierarchy everytime
  it is called.
- updateAboveInsetsState() also takes care of passing the local Insets
  Sources to the insets-state of every children in the subtree of the
  WindowContainer for which the API was called.
- addLocalInsetsSourceProvider() adds a new local InsetsSourceProvider
  to the WindowContainer.
- removeLocalInsetsSourceProvider() removes a local InsetsSourceProvider
- Made InsetsSourceProvider abstract and added a
  WindowContainerInsetsSourceProvider to be used instead. Eventually
  all the window specific logic will be moved to WindowContainerInsets-
  -SourceProvider.

Bug: 199449177
Test: atest InsetsStateControllerTest WindowContainerTests WindowManagerServiceTests
Test: atest ActivityRecordTests
Change-Id: I8d93b739df6d5f18a0d2219d9b00d96a2829746c
2022-02-17 17:48:45 +00:00
Joanne Chung
9277ba500d Merge "Enable system selection toolbar" 2022-02-17 02:38:42 +00:00
Ady Abraham
171380fd37 Merge "Correct JankData.PREDICTION_ERROR meaning" 2022-02-17 02:12:43 +00:00
Galia Peycheva
d09e15e7b2 Merge "Add a note to preferKeepClear APIs documentation" 2022-02-16 07:57:40 +00:00
TreeHugger Robot
38e0ef45e2 Merge changes from topic "inline-touch"
* changes:
  Change when to create inline fill request
  Add new IME attr
2022-02-16 06:16:35 +00:00
Joanne Chung
5c1e5f7193 Merge "Update team OWNERS file." am: e96070ac89 am: 114d0c7773 am: 1bb2f28548
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1982066

Change-Id: Ic8c77290b4d8e2d6cf8353a793b75cf71990a7a1
2022-02-16 05:24:07 +00:00
Joanne Chung
1bb2f28548 Merge "Update team OWNERS file." am: e96070ac89 am: 114d0c7773
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1982066

Change-Id: I973028e9095644d0aa71d3b0664297d81ecffb55
2022-02-16 05:14:21 +00:00
Joanne Chung
114d0c7773 Merge "Update team OWNERS file." am: e96070ac89
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1982066

Change-Id: I50a93d3e190ba2a4988e0777be2c5e571f2a2760
2022-02-16 04:42:57 +00:00
Joanne Chung
e96070ac89 Merge "Update team OWNERS file." 2022-02-16 02:03:49 +00:00
Rachel Lee
44f80a031b Merge "Rename to VsyncCallback and Presentation time." 2022-02-15 23:12:34 +00:00
Ady Abraham
e4a9000b03 Correct JankData.PREDICTION_ERROR meaning
JankData.PREDICTION_ERROR is asserted when SF vsync calculation
is incorrect and should be attributed to SF missed frames.

Bug: 211763914
Test: SF unit tests
Change-Id: I332480ad1017c220501ed938319f8b2fbfe22826
2022-02-15 15:06:45 -08:00
skxu
06a8880edf Add new IME attr
This new attr will allow IME to specify whether they support inline suggestion with touch exploration

Fixes: 207007377
Test: atest android.view.inputmethod.InputMethodInfoTest
Change-Id: I1fa36d7fd57a9b25838d4dd48243c19630495648
2022-02-15 21:43:22 +00:00
Galia Peycheva
cd6bf71ced Add a note to preferKeepClear APIs documentation
Bug: 216590903
Test: m doc-comment-check-docs
Change-Id: Ic696694edfea4bd9c0bb88d6851b2932427b757d
2022-02-15 21:10:46 +00:00
Peiyong Lin
68e5d6b6d8 Merge "Address API review feedback." 2022-02-15 19:55:56 +00:00
Vadim Caen
a70bdd8739 Merge "Add enableOnBackInvokedCallaback manifest attribute" 2022-02-15 19:07:27 +00:00
John Reck
a49e26c27c Merge "Add setBuffer w/ SyncFence" 2022-02-15 17:55:51 +00:00