Commit Graph

11623 Commits

Author SHA1 Message Date
Peiyong Lin
52bb6b436f [SurfaceControl] Add setColorTransform API.
Previously we have added methods to manipulate color transform for each
surface, this patch exposes this API to Java code land for WindowManager or
display service to set the color transform.

BUG: 111562338
Test: Build, flash and boot.
Change-Id: I0388eed5d72b043820786264f060cde2bd7a6aea
2018-10-09 10:25:52 -07:00
Yohei Yukawa
c53d78e992 Instantiate InputMethodManager for each display
InputMethodManager has been a per-process singleton object. In order
to support behavior changes for multi-display support in Android Q,
however, InputMethodManager now needs to be per-display objects.

With this CL, context.getSystemService(InputMethodManager.class) will
start returning per-display InputMethodManager (IMM) instance.

  Why?

There are two major reasons.
 1. To support per-display focused window.
 2. To support more simplified API for multi-session IME.

Currently per-process InputMethodManager instance directly receives
callback from ViewRootImpl upon windowFocusChanged, then it keeps
track of which Window is focused by storing its root view into
InputMethodManager#mCurRootView.

This design assumes that (within the same process) at most one Window
can have window focus, which is no longer true once we start
supporting per-display focused window (Bug 111361570).

  Why we need to do this to support per-display focused window:

For traditional non multi-session IME cases (e.g. apps that use
Virtual Display APIs on phones), internal state of IMM can be easily
messed up once the system starts sending per-display
windowFocusChanged events to the same process, because IMM still
doesn't know that now each display has focused window. It is hard to
precisely predict what kind of issues we would see simply because such
a use case is most likely not expected in the original design.

  Why we need to do this for multi-session IME:

For multi-session IME scenarios, in addition to the above concern in
InputMethodManager, the current design allows at most one IME session
per process. This means that if a process X is showing Activities to 3
different displays, only one Activity can interact with the
multi-session IME at the same time. If we do not change the current
design, the only way to work around is to ask app developers to
explicitly use different processes for each Activity, which may
require a lot of work (e.g. SharedPreference is not optimized for
multi-process use cases). This would also make multi-session IME
development complicated because the IME cannot know on which display
the IME is interacting until startInputOrWindowGainedFocus() is
actually called, and needs to do all the preparation and cleanup tasks
whenever startInputOrWindowGainedFocus() is called for a different
display than it's currently interacting with.

  Alternative solutions considered:

Another possible approach is to update InputMethodManager singleton to
be able to maintain multiple mCurRootView and mServedView for each
display. This approach was abandoned because those fields and methods
are already marked as @UnsupportedAppUsage.  I concluded that touching
@UnsupportedAppUsage things would have bigger compatibility risks than
per-display instance model.

  Implementation note:

* Public APIs in IMM that take View instance as the first parameter
  will verify whether the given View and IMM are associated with the
  same display ID or not.  If there is a display ID mismatch, such an
  API call will be automatically forwarded to the correct IMM instance
  IMM with a clear warning in logcat which tells that app developers
  should use the correct IMM instance to avoid unnecessary performance
  overhead.

* As a general rule, system server process cannot trust display ID
  reported from applications.  In order to enable IMMS to verify the
  reported display ID, this CL also exposes display ID verification
  logic from WMS to other system components via WindowManagerInternal.

* isInputMethodClientFocus() in WindowManagerService (WMS) is updated
  to use top-focused-display to determine whether a given IME client
  has IME focus or not.  This is now necessary because with a recent
  change [1] each display can have focused window.  The previous logic
  to check all the displays that belong to the given pid/uid [2] no
  longer makes sense.

* Currently per-display InputMethodManager instances will not be
  garbage collected because InputMethodManager#sInstanceMap keeps
  holding strong references to them.  Freeing those instances is
  technically possible, but we need to be careful because multiple
  processes (app, system, IME) are involved and at least system
  process has a strict verification logic that lets the calling
  process crash with SecurityException.  We need to carefully
  implement such a cleanup logic to avoid random process crash due to
  race condition.  Bug 116699479 will take care of this task.

 [1]: I776cabaeaf41ff4240f504fb1430d3e40892023d
      1e5b10a217
 [2]: I8da315936caebdc8b2c16cff4e24192c06743251
      90120a8b5b

Bug: 111364446
Fix: 115893206
Test: atest ActivityManagerMultiDisplayTests
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest FrameworksCoreTests:android.view.inputmethod.InputMethodManagerTest
Change-Id: I7242e765426353672823fcc8277f20ac361930d7
2018-10-05 15:54:41 -07:00
Andrew Solovay
b577f20c23 Merge "cherry-pick from pi-dev docs: Replacing {#link with {@link" 2018-10-04 18:17:23 +00:00
Andrew Solovay
5c05dedda1 cherry-pick from pi-dev docs: Replacing {#link with {@link
Several java files had the typo {#link (for cross-references to other
Javadocs) instead of the proper {@link format. This was confusing the
new doc publish tool (Mivi) since that's the format used for {# Django
comments #}.

Fixed a couple of links that had other errors (which prevented building
once the {# -> {@ was done) and other typos.

Replaced throughout the frameworks/base project; I'll need a separate CL
for the AndroidX fixes.

(Other files were not in the public Javadocs.)

Bug: 111925950
Test: make ds-docs
Change-Id: Ia06e1fffd814671289a1caebd5962aedc18a28d7
Original Change-Id: Ia06e1fffd814671289a1caebd5962aedc18a28d7
Exempt-From-Owner-Approval: Docs-only change
2018-10-04 18:17:05 +00:00
Issei Suzuki
495de00e0a Merge "Refactor DisplayCutout to use Rect instead of Region." 2018-10-04 08:43:54 +00:00
Louis Chang
bddeea865c Merge "Support launching home activity on secondary display" 2018-10-04 07:58:37 +00:00
Tiger Huang
e91ae63374 Merge "Track focus changes on external displays (2/4)" 2018-10-04 05:58:00 +00:00
Louis Chang
bd48dca2d0 Support launching home activity on secondary display
- Add a new flag indicating that the display should show
  system decorations, such as status bar, nav bar, home and IME.
- Automatically launches home activity on secondary display
  if the display support system decorations and home
  activity has multiple instances supports.
- Remove ActivityStackSupervisor#mHomeStack and move several
  home stack related methods to ActivityDisplay.

Bug: 111363427
Test: atest ActivityManagerMultiDisplayTests
      atest com.android.server.am
      Manual test on virtual display and chromecast

Change-Id: I48fe245ad12965a19a6768f5dbb4e974ce94b01a
2018-10-04 00:39:29 +00:00
Tiger Huang
1e5b10a217 Track focus changes on external displays (2/4)
Let each DisplayContent has its own focused window and focused app.
This change also moves the last tapped display to the top.

Test: atest ActivityManagerMultiDisplayTests
            ActivityStackSupervisorTests
            ActivityStackTests
            CtsWindowManagerDeviceTestCases
            DisplayContentTests
            PointerCaptureTest
Bug: 111361570
Change-Id: I776cabaeaf41ff4240f504fb1430d3e40892023d
2018-10-04 01:05:49 +08:00
Mihai Popa
3d71e1f388 Merge "[Magnifier-63] Hide it for rotated/scaled textview" 2018-10-03 10:19:50 +00:00
Issei Suzuki
43190bdf40 Refactor DisplayCutout to use Rect instead of Region.
Test: unittest
Bug: 112296834

Change-Id: I4245543c26f99afa59a34f5b6e6650b93d052a6e
2018-10-03 18:52:33 +09:00
Felipe Leme
f3b844b621 Improved log when notifyViewEntered() is ignored because service is disabled.
Test: manual verification
Bug: nope

Change-Id: Ieb26fb2bdc6a6f5a59aa3e6ad041b252f43aae3a
2018-10-02 14:10:30 -07:00
TreeHugger Robot
75d2c1f13a Merge changes I1276375c,I3fd96558,I39f7b1af
* changes:
  Remove detached wallpaper animations
  Remove WSA.mAnimLayer
  Remove WindowStateAnimator.isAnimationSet
2018-10-02 15:04:25 +00:00
Jorim Jaggi
8f52087d8a Remove detached wallpaper animations
Wasn't really supported anymore. Let's remove it from the API.

Bug: 112628612
Change-Id: I1276375cc204887a8da37a7f09ae2046216ca448
2018-10-02 15:43:04 +02:00
kopriva
d896dbd6db Merge "docs: bug 72853855, wrong parameter" into pi-dev am: 1f86e2f4ca
am: 978a89cfcb

Change-Id: Id1a616342ae1198d9f44718087dac3700686025c
2018-10-01 12:46:25 -07:00
kopriva
978a89cfcb Merge "docs: bug 72853855, wrong parameter" into pi-dev
am: 1f86e2f4ca

Change-Id: I95b3d8fe6ca585a5dc4168ced763ae1a9a70feb7
2018-10-01 12:03:55 -07:00
Mihai Popa
ddf9fe01be [Magnifier-63] Hide it for rotated/scaled textview
The magnifier is currently behaving badly when the magnified view is
scaled and/or rotated - the content of the magnifier and its position
are wrong, as we do not take these into account when computing
coordinates for content copy and magnifier positioning. This CL is
making the magnifier remain hidden when such transformations are applied
to the magnified view or a view above it in the view hierarchy.

Bug: 112519631
Test: manual testing
Change-Id: Ibb81fdc9d2ec8ba14914166e408c92a3aad7e312
2018-10-01 14:25:53 +01:00
kopriva
b350c7e53c docs: bug 72853855, wrong parameter
Test: make ds-docs

Bug: 72853855

Change-Id: Id6e64cba2af10488b677daabb5e113f278aa0f95
Exempt-From-Owner-Approval: Docs-only change
2018-09-29 14:22:07 -07:00
TreeHugger Robot
9c1c9c2acb Merge "Fix CtsApacheHttpLegacy27ApiSignatureTestCases:SignatureTests" 2018-09-28 18:01:14 +00:00
lumark
17159152cd Fix CtsApacheHttpLegacy27ApiSignatureTestCases:SignatureTests
Set InputMethod.updateInputMethodDisplay as default method for fixing API
check.
Since this method is @hide & we don't want to enforece user to implement.

Bug: 116662257
Bug: 111364446
Test: atest CtsApacheHttpLegacy27ApiSignatureTestCases:SignatureTest#testSignature

Change-Id: Ifb136d86d19bc4f95154a9076d42326ce12f665f
2018-09-28 13:05:21 +08:00
John Reck
702196562e Merge "Wire-up default force-dark based off of isLightTheme" 2018-09-27 23:04:02 +00:00
John Reck
bb3a358317 Wire-up default force-dark based off of isLightTheme
Bug: 102591313
Test: Compared settings in light & dark UI modes with
force_dark set to true. Observed that force_dark fixes
were not present when UI mode was set to dark, indicating
force_dark was appropriately globally-disabled

Change-Id: I5882829bb5871829fc8fc9911682f52a6ba5f445
2018-09-27 19:38:13 +00:00
John Reck
a6107c1659 Merge "De-couple RenderNode from View package" 2018-09-27 16:54:32 +00:00
John Reck
6b1644022b De-couple RenderNode from View package
First step of moving RenderNode to the graphics package

Test: builds
Change-Id: Ife7f5ec6698e32393d1b85ed2bad909ef0210be4
2018-09-26 16:29:32 -07:00
TreeHugger Robot
dfc12dba82 Merge "Export lib3 to AOSP (System server part)" 2018-09-26 16:53:28 +00:00
Yohei Yukawa
bf25f9ed4e Use DisplayContext to obtain InputMethodManager in ViewRootImpl
Historically ViewRootImpl#mContext has been just pointing to the
Context instance associated with whatever first View instance that is
being added to a Window.  In other words, ViewRootImpl#mContext is not
owned by ViewRootImpl.

This can become a problem if ViewRootImpl is moved from a display to
another display with ViewRootImpl#updateInternalDisplay(), which was
added last year to support multiple displays [1], because there is no
guarantee that the target Contaxt that is pointed from
ViewRootImpl#mContext is also updated to have the new display ID.

In order to support multi-display we need to use the right Context at
least when interacting with InputMethodManager. Hence as a short term
solution this CL introduces ViewRootImpl#mDisplayContext so that the
right instance of InputMethodManager can receive callback from
ViewRootImpl. In this way, we can make sure that the behavior change
in ViewRootImple is limited to how InputMethodManager instance is
obtained.

Longer term solution will be discussed in Bug 116349163.

 [1]: I9a9501cab788623ada15a31efb53e4b2378639fe
      b047b8bd7e

Bug: 115893206
Test: atest ActivityManagerMultiDisplayTests
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: Ifa0ca24e9cf764caf492ee065606680b6a06751a
2018-09-25 15:19:38 -07:00
Tony Mak
64c4cb2ea9 Export lib3 to AOSP (System server part)
The java counterpart of the JNI is now moved to external/libtextclassifier.

Test: atest android.view.textclassifier.TextClassificationManagerTest

Change-Id: Ide5e58d1c80d9a028cea4e9192a91aeac2843c71
2018-09-25 13:42:44 +01:00
TreeHugger Robot
fd74da1573 Merge "Deprecate InputMethodManager#getInstance()" 2018-09-24 22:41:07 +00:00
Felipe Leme
bc75159db6 Merge "Fixed when the CompatibilityBridge is attached to an activity." into pi-dev
am: 45fda27211

Change-Id: I420b0392602e0889862c7d77e62b614e2c5617bf
2018-09-24 15:22:37 -07:00
TreeHugger Robot
45fda27211 Merge "Fixed when the CompatibilityBridge is attached to an activity." into pi-dev 2018-09-24 22:04:27 +00:00
TreeHugger Robot
e64d55010f Merge "Create plumbing for disabling force-dark" 2018-09-24 19:54:33 +00:00
TreeHugger Robot
cc704723bd Merge "Fixed FillCallback.onFailure() and SaveCallback.onFailure() behavior." 2018-09-24 18:48:13 +00:00
John Reck
1423e1331f Create plumbing for disabling force-dark
Test: sysui's rounded corners are no longer white
Bug: 102591313

Change-Id: Id99ae38c354cef06b94a5fb79b5b1a9a216a514c
2018-09-24 09:34:18 -07:00
TreeHugger Robot
21ba5d4f3f Merge "Let IMM have internal APIs for layoutlib" 2018-09-22 16:31:28 +00:00
Yohei Yukawa
6c07572f16 Deprecate InputMethodManager#getInstance()
With this CL, no one in the Framework is using
InputMethodManager#getInstance() directly or indirectly.  It is time
to mark this method deprecated.

For applications that still call InputMethodManager#getInstance()
directly or indirectly via reflection, they will start seeing warnings
with stacktrace in logcat.

Except for that explict warnings in logcat, there is no behavior
change in this CL.  Added a new test to make sure that
InputMethodManager#getInstance() and InputMethodManager#peekInstance()
are still working in a way we expected for such applications.

Fix: 115891476
Test: atest FrameworksCoreTests:android.view.inputmethod.InputMethodManagerTest
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: Ib393086d921f91993395b5f0007b725a5db7bf22
2018-09-21 14:52:12 -07:00
Felipe Leme
d9dc954e8f Fixed FillCallback.onFailure() and SaveCallback.onFailure() behavior.
FillCallback.onFailure() was not working as intented - it finished the session
on AutofillManagerService, but didn't update the client state on
AutofillManager.

And both of these methods were displaying Toasts to the user, which is something
the autofill services could take care of. Hence, for services target with SDK
Q, the message is ignored.

Also added a new Autofill Metric: FIELD_AUTOFILL_MESSAGE_LEN

Test: atest CtsAutoFillServiceTestCases:android.autofillservice.cts.LoginActivityTest#testAutofillAgainAfterOnFailure
Test: atest CtsAutoFillServiceTestCases # to make sure it didn't break anything
Test: time mmm -j frameworks/base/:doc-comment-check-docs
Test: m -j update-api

Bug: 112192360
Fixes: 116103297

Change-Id: I499909200980943dedf1fc8524dd1f14b49e2158
2018-09-21 13:31:44 -07:00
TreeHugger Robot
e1b637d296 Merge "Make IMM#peekInstance() thread-safe" 2018-09-21 01:48:13 +00:00
kopriva
b7b399ed76 Merge "docs: fixing several minor documentation bugs" into pi-dev am: 82b0d17b39
am: f6b27fbff0

Change-Id: I14f98e023001c75719ab8b891db6abf3f0fd4564
2018-09-20 17:12:29 -07:00
kopriva
f6b27fbff0 Merge "docs: fixing several minor documentation bugs" into pi-dev
am: 82b0d17b39

Change-Id: Ieb1447c0d7cda629338de8d6e03f46670d8ed0b0
2018-09-20 16:55:47 -07:00
Yohei Yukawa
daf0d1b6fb Let IMM have internal APIs for layoutlib
In order to stub out InputMethodManager (IMM), currently layoutlib
tries to directly update internal details of InputMethodManager, which
is really fragile and hard to maintain.

With this CL, IMM officially defines an internal concept "EditMode"
and privately exposes internal APIs to layoutlib.

There should be no behavior difference in production build.

Bug: 115891476
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: Ide6aa5bc36c14449e87bec33a4962b87809b9d77
2018-09-20 15:53:07 -07:00
Yohei Yukawa
3b3a2ade94 Make IMM#peekInstance() thread-safe
Somehow InputMethodManager#peekInstance() has not been thread-safe.
Although we basically do not care this deprecated method, but let's
just update it for consistency.

Bug: 115891476
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I56bf05f76a7939f004efefdd956776e533bae058
2018-09-20 15:50:35 -07:00
Chavi Weingarten
3623c39cd3 Merge "Remove minLayer and maxLayer from display screenshot." 2018-09-20 19:03:42 +00:00
kopriva
f07a46058c docs: fixing several minor documentation bugs
Test: make ds-docs

Bug: 36949243
Bug: 116169695
Bug: 37001248
Bug: 37044885
Bug: 37053166

Change-Id: I844a8978518cd7214bf9d068d602902dfa7e8246
Exempt-From-Owner-Approval: Docs-only change
2018-09-20 11:20:27 -07:00
TreeHugger Robot
4435742cd1 Merge "Let IMMS be responsible for IInputMethodClient lifecycle" 2018-09-20 17:27:53 +00:00
daqi
ef4dda2d02 Merge "Merge "Set InputMethoMananger#mCurRootView to null when window dismissed" am: 7bd18423f6 am: 9c5a6e2c6c" into pi-dev-plus-aosp
am: 205f5bd249

Change-Id: I69f543dc6be8383b289e61aabb5de4bd1f8f09c1
2018-09-19 20:00:44 -07:00
daqi
4d5ba15e69 Merge "Set InputMethoMananger#mCurRootView to null when window dismissed" am: 7bd18423f6
am: 9c5a6e2c6c

Change-Id: I6198c9d52c19e48f61bb4d488018c067d4b80108
2018-09-19 19:35:27 -07:00
daqi
9c5a6e2c6c Merge "Set InputMethoMananger#mCurRootView to null when window dismissed"
am: 7bd18423f6

Change-Id: Ie0127bd83b714c540bcf387a3fc74d01bd60eb13
2018-09-19 19:22:12 -07:00
Yohei Yukawa
a71bb25cff Let IMMS be responsible for IInputMethodClient lifecycle
This is the last step to remove the dependency on IInputMethodClient
from WindowManagerService.

With my previous CL [1], now WindowManagerService (WMS) depends on
IInputMethodClient just because it implements lifecycle management of
IInputMethodClient on behalf of InputMethodManagerService (IMMS).

This CL mechanically moves that responsibility from WMS to IMMS for
better separation of concerns.  It is a bit ironic that this CL is
partly undoing my previous CLs [2][3] that removed
IInputMethodManager.addClient() though.

This CL aims to preserve the current observable behavior (e.g. when
InputMethodManager instance is being created) as much as possible.
Most likely there would be no observable behavior difference when seen
from other components.

 [1]: I444077b1e4af4033f67ab72c181fac85b601e08a
      41f89c3bcc
 [2]: I453200fd5847e9a78876affb6a1caec221525e1d
      e24ed79edb
 [3]: Id91dd600120e4981aa1d9005ce644728968430c9
      fffc0e53c6

Fix: 115993358
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I7726c70613ea72d6e78fa5754e9fc840f0a40f11
2018-09-19 19:21:24 -07:00
Felipe Leme
5cd660d5e9 Fixed when the CompatibilityBridge is attached to an activity.
The AccessibilityManager is a singleton, so we need to update it everytime
an activity is resumed.

Test: manual verification with Chrome (CTS test is an overkill here)
Test: atest CtsAutoFillServiceTestCases # to make sure it didn't break anything

Fixes: 112690889
Change-Id: If011db203dee96ec511da80f4e49395c0340f482
(cherry picked from commit ce40498dc2)
2018-09-19 17:55:06 -07:00
Treehugger Robot
7bd18423f6 Merge "Set InputMethoMananger#mCurRootView to null when window dismissed" 2018-09-20 00:35:25 +00:00