Commit Graph

14049 Commits

Author SHA1 Message Date
Taran Singh
73b1d16d28 Merge "Pipe windowToken for hideSoftInput" into rvc-dev 2020-02-27 07:14:04 +00:00
Tarandeep Singh
4fe5b654a1 Pipe windowToken for hideSoftInput
Pipe the windowToken of the window requesting hideSoftInput just like we
did it for showSoftInput [1].
This calls hideInsets on the correct display when control target is
different from IME target e.g. ActivityView.
Also hideInsets should be called on InsetsControlTarget instead which was
originally attempted in [2]

[1]: Ia49e23dd077d264a58d28a7b8acffde54b7db187
[2]: I7133e151a1037c42b275b97857936437a7a6725f

Bug: 149870112
Bug: 133381284
Test: Manually using steps mentioned in bug.

Change-Id: Ia596a392eb73ae46debd097151c8c9a7edd59833
2020-02-27 04:13:25 +00:00
TreeHugger Robot
658fc6d6d6 Merge "A few inline autofill API tweaks." into rvc-dev 2020-02-27 03:16:38 +00:00
Taran Singh
05b07c2657 Merge "Remove IME surface when hidden" into rvc-dev 2020-02-27 00:53:09 +00:00
Feng Cao
4b0ef392c2 A few inline autofill API tweaks.
* add isPinned() to InlineSuggestionInfo so IME can choose to pin the suggestion
* allow augmented autofill service to set inline actions in the response
* non-api change: pull the autofill hints from the Slice in the InlinePresentation

Test: m -j; atest InlinePresentationTest, atest CtsInputMethodTestCases:InlineSuggestionInfoTest CtsInputMethodTestCases:InlineSuggestionTest
Bug: 137800469

Change-Id: I63b6b843ef056df18c317299e617b8fe21907374
2020-02-26 13:49:54 -08:00
Evan Rosky
149bbf89bc Merge "Clean-up old docked-stack implementation from WM" into rvc-dev 2020-02-26 21:47:57 +00:00
TreeHugger Robot
31c94a2f0e Merge "Removing possible user defined strings from bugreport view-dump" into rvc-dev 2020-02-26 20:12:10 +00:00
Tarandeep Singh
94c9a8328e Remove IME surface when hidden
When IME is no longer shown, notify IMS to hide the window surface.
This reclaims the memory allocated to IME window surface.

Fix: 150163310
Test: atest CtsInputMethodTests
      Manually:
      1. Open any app that has editor  and run
         adb shell  dumpsys SurfaceFlinger | grep Total
      2. Note down total memory
      3. Tap on editor and IME shows. Note down memory
         using command in #1. It should go up by ~27MB
      4. Hide IME and note down memory again.
         It should revert to original value in #1.

Change-Id: I6c2a13dd40b22d3fd62b4763ba369992e5ff1138
2020-02-26 18:58:33 +00:00
Evan Rosky
73a7fe9479 Clean-up old docked-stack implementation from WM
Bug: 133381284
Test: Existing tests pass. Manually use sysui
Change-Id: I44155d74df1489fa391c60a05d1f8098986cefb7
2020-02-25 21:13:16 +00:00
TreeHugger Robot
0253cc8f2f Merge changes from topics "input_events_id", "wire_input_event_id" into rvc-dev
* changes:
  Send input event ID in InputEventSender.
  Add ID to InputEvent.
2020-02-25 19:20:17 +00:00
Sunny Goyal
c444b514bf Removing possible user defined strings from bugreport view-dump
Bug: 64101886
Test: Verified build
Change-Id: Ifad98a268fc17a2e1572ca3e0962a89447083294
2020-02-25 10:00:37 -08:00
Shawn Lin
faff9bd887 Merge "Fixed not updating waterfall insets in DisplayCutout.inset()" into rvc-dev 2020-02-25 06:15:37 +00:00
TreeHugger Robot
0cbb2687ed Merge "Move PiP animation to SysUI package" into rvc-dev 2020-02-25 03:10:24 +00:00
TreeHugger Robot
ba58fd615f Merge "Add Option To Prevent Wake On Back Key Press" into rvc-dev 2020-02-25 02:10:32 +00:00
Feng Cao
85cbe43d48 Merge "Use context for correct display in the renderer service" into rvc-dev 2020-02-24 22:10:06 +00:00
Hongwei Wang
85cf41fcc3 Move PiP animation to SysUI package
The bounds animation is cleaned up within window manager and it's now
the SysUI component listening on callbacks from TaskOrganizer for
entering to and exiting from PiP mode.

Additionally, the expand and move of the PiP window is now part of SysUI
as well.

Known issues:
- Black background when in transition from PiP to fullscreen. The
wallpaper gets into hidden state too early
- App gets into PiP mode too early when entering PiP, need to defer the
configuration change sent to app in this case

Bug: 146594635
Bug: 148198539
Bug: 138144750
Bug: 149569903
Test: atest PinnedStackTests
Test: atest PipAnimationControllerTest
Test: atest RecentsAnimationTest
Test: atest RecentTasksTest
Test: atest com.android.server.wm.ActivityStarterTests
Merged-In: Id0c8ce03fa26952daf5e3687b18b2eb2375b7d20
Change-Id: Id0c8ce03fa26952daf5e3687b18b2eb2375b7d20
2020-02-24 21:16:20 +00:00
Garfield Tan
c8362b24f6 Add ID to InputEvent.
The interaction between Java and native code for KeyEvent and
MotionEvent is different, so I used different arrangement to pass
sequence number across JNI that keeps the consistency with other
metadata.

Unfortunately this new ID doesn't have absolute uniqueness guarantee so
it can't replace InputEvent#getSequenceNumber() which is used with a
strict in-process uniqueness assumption. Therefore only convert systrace
related use to ID.

Also expose ID generator through a static function in InputEvent so that
everyone can use it. InputReader and InputDispatcher will use different
instances.

Bug: 144889238
Test: Build and run.
Test: atest FrameworksCoreTests:KeyEventTest
Test: atest FrameworksCoreTests:MotionEventTest
Change-Id: Icbdcaee1d98948c05484865a4e15e55161ecfa69
Merged-In: Icbdcaee1d98948c05484865a4e15e55161ecfa69
(cherry picked from 29d21d4062)
2020-02-24 12:45:27 -08:00
Robert Carr
6d16c8c340 RESTRICT AUTOMERGE - Explicitly disable BLAST for SurfaceControlViewHost surfaces
Right now it crashes because the ViewRoot expects to receive a
BLAST surface but the WindowlessWindowManager doesn't support it.
Adding support should be relatively trivial (coming in a follow-up)
but we haven't tested it yet so suggesting merging this patch for
today.

Bug: 150000636
Test: Existing tests pass
Change-Id: I4b36d190c8f4f022dada656e02452034113a4000
(cherry picked from commit b4727e0f55)
2020-02-24 15:56:07 +00:00
shawnlin
16ba068293 Fixed not updating waterfall insets in DisplayCutout.inset()
Bug: 149975807
Test: atest DisplayCutoutTest
Change-Id: Ic672e0688bbafabdd67790936568f40f6c4a3dff
2020-02-24 18:00:22 +08:00
Charles Chen
23c81a156e Merge "Revert "Revert "Always get window insets from server""" into rvc-dev 2020-02-24 09:14:56 +00:00
Patrick Rohr
2faf788151 Add Option To Prevent Wake On Back Key Press
KEYCODE_BACK was previously hardcoded as a wake key in KeyEvent.java.
For TV remotes, we want to make this behavior configurable.

Test: Tested on Android TV Device.
Bug: 144979700
Change-Id: I496c9c283525d5e04325e4bb3d6ab19a571db0c7
2020-02-24 08:17:24 +00:00
Charles Chen
65da12a421 Update document of WindowMetrics#getSize
Update document to notify that reported size is different between
WindowMetrics#getSize and Display#getSize and provide a sample
code to transform between usages.

Test: build & run
Bug: 128338354
Change-Id: I06aee9aaf903c3864fbb0fe89ea1d3e15506fe1c
(cherry picked from commit 2de0f42d50)
2020-02-24 07:08:09 +00:00
Charles Chen
1ac295ec08 Revert "Revert "Always get window insets from server""
This reverts commit 288e1bd045.

The previous implementation of computeWindowInsets is to
use last view from WM#addView, which may be invalid because
the last added view is removed and throws NPE when getting
property from the invalid view.
In this CL, we change the approach to always obtain window
insets from server.

fixes: 148789183
fixes: 149480577
Test: atest FrameworksCoreTests:WindowMetricsTest
Test: atest WindowMetricsTests

Change-Id: I6db5970d14ac9eebe0ab0df65cb1300515ad1754
(cherry picked from commit 6bb2d4f68c)
2020-02-24 03:46:51 +00:00
Jackal Guo
a67e14a6e1 Correct the bound if it's from outside of screen
Use getBoundsOnScreen without clipToParent instead since the bounds
may be out of screen.

Bug: 149539748
Test: a11y CTS & unit tests
Change-Id: Ie2107f58a7cc5f0b76e4a468cfb295c410dbb559
Merged-In: Ie2107f58a7cc5f0b76e4a468cfb295c410dbb559
(cherry picked from commit 9a341abdb4)
2020-02-24 01:28:21 +00:00
Svet Ganov
02fdd34057 Use context for correct display in the renderer service
bug:149958394

Test: atest android.autofillservice.cts.inline.InlineLoginActivityTest

Change-Id: I4bcdca8188b9b97076c4146f0f9eddffe3e1b3b1
(cherry picked from commit 2aa4f10996)
2020-02-22 19:54:59 +00:00
Andrii Kulian
02c0e4d2ac Handle config/display changes for WindowContext
Introduce IWindowToken to report config/display changes from
server side. When config change callback is received,
it will update the resources associated with the window token.

Test: WindowContextTests
Bug: 128338354
Bug: 146820733

Change-Id: I871bd78a21dbde1286786e65c340b6259b873660
2020-02-21 16:07:32 +08:00
Shawn Lin
46af143476 Merge "Allow passing cutout to the hierarchy in shortEdge mode" 2020-02-21 07:20:30 +00:00
Tiger Huang
4fd8cb5089 Merge "Adjust LayoutParams after handling soft input mode" 2020-02-21 06:35:22 +00:00
Charles Chen
c56ce6fd08 Merge "Exempt-From-Owner-Approval: Report non-visual Context misuse" 2020-02-20 12:30:06 +00:00
Tiger Huang
07b0733bde Adjust LayoutParams after handling soft input mode
For compatibility reasons, we would adjust layout params before it is
sent to window manager. We need to adjust it after soft input mode is
set.

This CL also makes sure that only match-parent-non-attached-app window
can use FLAG_FULL_SCREEN to hide status bar. This aligns the logic in
the legacy insets mode which only allows mTopFullscreenOpaqueWindowState
using FLAG_FULL_SCREEN to hide status bar.

Fix: 149816539
Fix: 149822806
Test: Go to Developer options > Click on Smallets width, and see if the
      layout of the dialog is correct.
Test: Long press power button and see if the dialog hides status bar.

Change-Id: I46daa0906bac981ccadb5f98aeb8b0479d23820e
2020-02-20 18:27:42 +08:00
Hongwei Wang
c21c7e836e Merge "WindowContainerTransaction: Provide non-BLAST bounds change sync" 2020-02-20 07:30:38 +00:00
Automerger Merge Worker
33b8bf685a Merge "Make me an owner of accessibility frameworks" am: 269d57b7da am: 6374aaf5c5 am: 865c89c5a3
Change-Id: I88fd0443d59c45ad625af9d72f05d8de8e4cb783
2020-02-20 04:29:31 +00:00
Yohei Yukawa
62612562d0 Merge "Offload user-switching task from startInputOrWindowGainedFocus()" 2020-02-20 03:27:26 +00:00
shawnlin
d647897fc9 Allow passing cutout to the hierarchy in shortEdge mode
Bug: 149806697
Test: make
Change-Id: I7fea5d0c05155a850fc7536bd0548c844ce6783d
2020-02-20 11:23:48 +08:00
Robert Carr
711e7051ce WindowContainerTransaction: Provide non-BLAST bounds change sync
This is to enable landing the SysUI driven PiP animation without BLAST. Without
BLAST we can't support multi container sync, multi buffer sync, etc, but we can
support the same sort of synchronization we've supported before. Let's recall how
the old PIP animation works: At the end of the enter animation, or the beginning
of the leave animation, the Surface changes size (When the Windowing mode changes).
We detect this size change deep in the guts of WindowStateAnimator, and when
we detect that we are called from "relayoutWindow" defer a transaction changing
the PIP scaling factors. This approach is we simply allow SysUI to set a pending
Transaction on a task via the WindowContainerTransaction API. The next BASE_APPLICATION
window to resize in this task will consume this transaciton, and defer the transaction
until the frame in which it resizes.

Bug: 139371701
Bug: 139371701
Test: Manual test with pending SysUI branch
Change-Id: I1e757d87e2f276db626de00685b0432508ac6d62
2020-02-20 01:59:37 +00:00
Andrii Kulian
5877c7d6c0 Exempt-From-Owner-Approval: Report non-visual Context misuse
Make obtaining a visual service from non-visual Context instance
report a strict mode violation and print the stacktrace.

Make calling getDisplay() throw an exception if called on an instance
that is not associated with a display. For existing usages introduce
a new internal method that does not perform the verification until
the usages are properly fixed.

Bug: 128338354
Test: StrictModeTest#testIncorrectContextUse_GetSystemService
Test: StrictModeTest#testIncorrectContextUse_GetDisplay
Change-Id: Id25d590eca6e10066e55d7ed6436d3bc9e433beb
2020-02-20 01:29:25 +00:00
Jackal Guo
bc67dc3f21 Merge "Adjust the logic of isImportantForAccessibility" 2020-02-20 01:23:14 +00:00
Yohei Yukawa
d277d6902f Offload user-switching task from startInputOrWindowGainedFocus()
As tracked in Bug 28750507, InputMethodManagerService#onSwitchUser()
is known to be slow, and the direct reason of the UI jank in the
launcher discussed Bug 139806621 is that #onSwitchUser() is running as
part of IMMS#startInputOrWindowGainedFocus() that is called as a sync
IPC from the UI thread of the launcher.  Note that this is a
relatively new behavior that was introduced in Android 10 to support
per-profile IME mode (Bug 111083076). So users shouldn't see this code
path unless the device is running on Android 10 with work profile
enabled.

What this CL does is removing that direct code path from
IMMS#startInputOrWindowGainedFocus() to #onSwitchUser() by introducing
a new pending result

  InputBindResult.ResultCode.SUCCESS_WAITING_USER_SWITCHING,

which means

  IMMS is now performing user switching and cannot start input session
  right now, but it will call the client back when the IME becomes
  available for the target user.

Note that InputMethodManager is already able to handle this kind of
pending state, where IME is not yet available, since we already have a
similar pending results as follows.

 * InputBindResult.ResultCode.SUCCESS_WAITING_USER_SWITCHING
 * InputBindResult.ResultCode.SUCCESS_WAITING_IME_BINDING

One remaining concern is that when IMMS#switchUserOnHandlerLocked() is
running with holding the giant lock (IMMS#mMethodMap), thus it's still
possible that IMMS#startInputOrWindowGainedFocus() can be blocked
because of lock contention, which eventually blocks client's UI
thread.  Although its chance wouldn't be that high, in order to tackle
that scenario we need to pursue different approaches such as:

 * Further optimize IMMS#startInputOrWindowGainedFocus() to reduce the
   likelihood of lock contention. This isn't a perfect solution for
   this particular case but it's still worth doing.  Possible
   candidate of optimizations are:
    * Bug 28750507:  optimize IMMS#switchUserOnHandlerLocked()
    * Bug 149864769: off-load Context#unbindService()
    * Reconsider the use of giant lock.

 * Redesign the current "startInput" protocol as part of our on-going
   effort to redesign IME focus handling protocol (Bug 141738570)
   e.g. can we completely make IMMS#startInputOrWindowGainedFocus()
   async IPC?

Bug: 139806621
Fix: 144291210
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: Manually made sure that IMMS#startInputOrWindowGainedFocus()
      isn't blocking Launcher's UI thread when swiping home.
  1. lunch aosp_coral-userdebug && make -j
  2. Flash the image
  3. Open the system settings
  4. System -> Gestures -> System nagivation
  5. Select "Gesture nagivation"
  6. Install Test DPC.
  7. Enable managed profile with Test DPC.
  8. adb install -r \
        $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
  # deal with dex2oat
  9. adb shell cmd package compile -m speed \
        -f com.google.android.inputmethod.latin
 10. adb shell cmd package compile -m speed \
        -f com.android.inputmethod.tools.edittextvariations
 11. adb shell cmd package compile -m speed \
        -f com.google.android.apps.nexuslauncher
 12. adb root
 13. adb shell setprop pm.dexopt.disable_bg_dexopt true
 14. adb reboot
 15. adb shell am start -u 10 \
        -n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
 16. Tap the first edit text on the EditTextVariations
 17. Make sure that AOSP Keyboard is shown
 18. adb shell am trace-ipc start
 19. external/chromium-trace/systrace.py \
        gfx freq am wm sched binder_driver view \
        -a com.android.launcher3 -o binder.html
 20. Swipe up the home button
 21. Hit the enter key to terminate the systrace.
 22. Check the IPC log to see how much the UI thread is blocked by
     IMMS#startInputOrWindowGainedFocus()
Change-Id: I5a73a66d2b8acadad9b3577ebc4c17b5a25fd011
2020-02-19 17:12:17 -08:00
TreeHugger Robot
ac8f1fbd2f Merge "Logically revert previous attempts on Bug 139806621" 2020-02-20 01:07:41 +00:00
Automerger Merge Worker
6374aaf5c5 Merge "Make me an owner of accessibility frameworks" am: 269d57b7da
Change-Id: Ibf012b4b2221ceee9d616b78aae7971ddd042cc6
2020-02-20 00:24:03 +00:00
Feng Cao
6c821f6ea1 Merge "Introduces the Bundle to inline suggestions APIs to encode custom UI styling information." 2020-02-19 22:35:42 +00:00
Qasid Ahmad Sadiq
88d52e8ca6 Make me an owner of accessibility frameworks
Test: Relying on treehugger. No functional changes.
Change-Id: If0e88345001ec286bd0a9a01314dba53e45dc6ac
2020-02-19 14:02:07 -08:00
Steven Thomas
1b1b9d2a1d Merge "Add compatibility param to setFrameRate() api" 2020-02-19 18:53:04 +00:00
Evan Rosky
2d88183bde Merge "SystemUI Split via TaskOrganizer" 2020-02-19 18:43:36 +00:00
Rob Carr
0dc3f99580 Merge "SurfaceView: Fix BLAST Sync initialization." 2020-02-19 18:40:42 +00:00
TreeHugger Robot
4090e95ba6 Merge "Allow unbuffered MotionEvent dispatch for View (1/2)" 2020-02-19 18:24:52 +00:00
Feng Cao
36960ee20e Introduces the Bundle to inline suggestions APIs to encode custom UI styling information.
* The bundle will be generated/consumed by the support library.
* More API documentation and example usage will be added later once we have the support library impl ready.
* The old style resource name approach doesn't work due to the potential mismatch in the support library version across the host IME and the platform renderer service, and the non-static nature of the public attribute int id in the support lib.
* The Bundle added to the onCreateInlineSuggestionsRequest() is intended for the platform/ExtServices to communicate the UI versions it supports.
* The Bundle added to the InlinePresentationSpec is intended for the IME to communicate the custom styles for the chosen UI versions.

Test: manual verification, and also atest CtsInputMethodTestCases:InlineSuggestionInfoTest CtsInputMethodTestCases:InlineSuggestionTest CtsInputMethodTestCases:InlineSuggestionsRequestTest CtsInputMethodTestCases:InlineSuggestionsResponseTest
Bug: 146454892

Change-Id: Id7fea32a7550fb924fec811b376790474a7b92eb
2020-02-19 09:42:22 -08:00
Dieter Hsu
3ef9003e18 Merge "Refresh new extra data AccessibilityNodeInfo.ExtraRenderingInfo" 2020-02-19 17:05:34 +00:00
Arthur Hung
5d0197890b Allow unbuffered MotionEvent dispatch for View (1/2)
MotionEvents sent from InputDispather would be buffered and dispatched
align the vsync by default. And it would provides many of benifits.

But for a high quality gaming experience, low latency input is critical
when we use analogs inputs (e.g mouse or joystick, etc.). So It's
important for gaming applications to process these input events in a
raw way, without them being coalesced on each frame.

- Add new api View.requestUnbufferedDispatch(source) to control which
  input source classes could be unbuffered while handled by the view.

Bug: 135740001
Bug: 136277595
Test: atest ViewUnbufferedTest
Change-Id: If65ed1906f59947dcd1e5062519b643a17d0e8e5
2020-02-19 15:01:13 +00:00
TreeHugger Robot
78c2b7a44f Merge "DeviceProductInfo API." 2020-02-19 14:52:48 +00:00