Commit Graph

10646 Commits

Author SHA1 Message Date
Richard Ledley
beef470baf Merge "Add entity types to Options." 2017-12-19 17:14:27 +00:00
Richard Ledley
db18a578f1 Add entity types to Options.
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Bug: b/67629726
Change-Id: I9cad0159ab539a71d9f504019ebe91fe18206d60
2017-12-19 14:42:52 +00:00
TreeHugger Robot
866a3836ae Merge "Fix issue #70722141: Fix broken WindowTest.testSetLocalFocus" 2017-12-18 20:05:41 +00:00
Richard Ledley
26b8722de6 Show Floating Toolbar when tapping a selectable TextLink in TextView.
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest\#testToolbarAppearsAfterLinkClicked
Bug: b/67629726
Change-Id: Ied7a1903a308db37d0eb288c8e611da8229f381a
2017-12-18 10:12:59 +00:00
TreeHugger Robot
42c11e7a3a Merge "Make IMM more robust for window focus stealing" 2017-12-16 18:23:40 +00:00
TreeHugger Robot
216da5dc44 Merge "Made Autofill Field Classification API public and documented it." 2017-12-16 00:57:50 +00:00
Dianne Hackborn
011944c759 Fix issue #70722141: Fix broken WindowTest.testSetLocalFocus
We need to make sure to dispatch every focus change, even if
the focus itself doesn't actually change.

Bug: 70722141
Test: bit CtsViewTestCases:WindowTest\#testSetLocalFocus
Change-Id: I12f4b18b93516f3bf03fb0d4a897a968cda65f41
2017-12-15 15:50:27 -08:00
Yohei Yukawa
2553e48886 Make IMM more robust for window focus stealing
This CL is a generalized version of my previous CL [1], which addresed
Bug 31056744 where InputMethodManager (IMM) fails to recover from
failure mode when IMMS#startInputOrWindowGainedFocus() failes because
the app's window is no longer eligible to be the IME target.

This CL finally addressed one TODO in that CL. InputBindResult now has
the error code, which allows us to force restart input upon the next
window-focus-in event.  This should make IMM much more robust for
that kind of failure modes.  For instance, Bug 70629102 is fixed as
demonstrated in a newly added CTS test case [2].  Hopefully this may
also fix Bug 31056744, which we still do not know how to reproduce.

 [1]: I60adb38013b063918b074c7b947649eada77b2c8
      8e9214b4bd
 [2]: I4ea24c87cbbd05e4e68ad7dfafb774c8520188e2

Bug: 31056744
Fixes: 70629102
Test: Added a test case for Bug 70629102
      atest CtsInputMethodTestCases
Test: Manually made sure that Bug 28281870 is still fixed:
      1. Open app that has EditText.
      2. Start Input.
      3. Long press the task switch button to start multi-window mode.
      4. Tap the EditText that is used in step 2.
      5. Make sure that the IME still works as expected
Test: atest CtsViewTestCates
Change-Id: I7572d4b9d678f3669ca54d55718877b145015777
2017-12-15 15:47:33 -08:00
TreeHugger Robot
793fdca682 Merge "Improve testibility of applicatin switches." 2017-12-15 10:00:26 +00:00
Felipe Leme
78172e70f4 Made Autofill Field Classification API public and documented it.
Test: mmm frameworks/base/:doc-comment-check-docs
Test: atest FrameworksCoreTests:SettingsBackupTest
Test: m -j 100 update-api

Fixes: 67867469

Change-Id: Iedf56a2bbcde3826eb22f5ed7a96d6ed70b968f4
2017-12-14 19:48:26 -08:00
Dianne Hackborn
5c3296af2d Improve testibility of applicatin switches.
Things can be flaky, because window focus changes are
dispatched to the window on a separate path from input events,
and the window will drop events if it gets them before it sees
the focus change.  I am trying to mitigate this some by noting
ASAP what the next upcoming focus state will be, so we can check
that and dispatch it before dispatching a key event if needed.

This definitely makes things better, but not perfect.  ctate
suggested that maybe we should be dispatching window focus events
through the input system, which at a glance sounds like a really
really good idea to me...  so maybe we can look at that later.

Also changed the wm command to just be a shell wrapper around
all of the implementation that is now in WindowManagerShellCommand.

And fixed a few places where we write debug info to streams that
would trigger strict mode violations that we really don't care
about.

Test: manual
Change-Id: I5235653bcec5522ab84c7f2e1de96d86f2f59326
2017-12-14 15:29:21 -08:00
TreeHugger Robot
33d9a341d5 Merge "Filter out position jitter in hover tooltip handling" 2017-12-14 21:36:28 +00:00
Jorim Jaggi
349f7886fb Merge changes from topic "lock_free_win"
* changes:
  Fix minor issues with new window animations.
  Fix possible race conditions when cancelling animations
  Lock free animations (2/2)
2017-12-14 13:36:27 +00:00
TreeHugger Robot
895d73105b Merge "Add more IntDef prefixes for auto-documenting." 2017-12-14 07:17:52 +00:00
Jeff Sharkey
ce8db99114 Add more IntDef prefixes for auto-documenting.
Test: builds, boots
Bug: 70177949
Exempt-From-Owner-Approval: annotation-only changes
Change-Id: I76dde6054e06f52240bd4b1a0f196dcb74623608
2017-12-13 20:05:36 -07:00
Jorim Jaggi
a5e105728f Lock free animations (2/2)
Second CL that migrates WSA to use SurfaceAnimator

We start our synchronized app transition journey by showing that
the concept works by using WindowState animations as proof of
concept.

The main class in this CL are SurfaceAnimator and
SurfaceAnimatorRunner. When we start an animation on a Window, we
create a new bufferless surface, called "The Leash", in the
hierarchy and attach the surface of WindowState onto it, while
attaching the leash onto the old surface parent which is still
responsible for z-layering.

Then, we pass off the Leash into SurfaceAnimationRunner, which then
changes the surface properties of Leash in every animation frame,
without holding the WM lock. While it's doing that we can still
update the z-layering of the window, or even relayout the window
of needed - the important surfaces for this are still under WM's
control.

In case the animation is finished the window surface gets
reparented to its original parent, and the leash is abandoned.
Note that the reparenting is done in the same transaction as
processing the animation finish, such that we don't end up with
a flicker in case of a disappearing animation, where the window
surface gets destroyed.

In case the animation needs to be cancelled, WM can revoke control
of the leash by reparenting the window surface. Even if the
cancellation signal is heavily delayed, WM immediately regains
control over the surface by reparenting it within a transaction.

We also introduce the concept of animating a WindowContainer. We
clean up isAnimating:
- isLocalAnimating: is the container itself animating
- isAnimating: is the container or one of its parents animating
- isSelfOrChildAnimating: is local animating or any child
animating.

SurfaceAnimationRunner also needs it's own thread so it's not getting
bogged down by any WM lock contention by processing regular
animation frames. We call that thread android.anim.lf (lockfree).

Now, imagine that SurfaceAnimationAnimator would sit behind an IPC in
another process and instead of animating WindowState, we'd animate
AppWindowToken. Then, synchronized app transitions would be done.

Test: go/wm-smoke
Test: SurfaceAnimatorTest
Test: SurfaceAnimationRunnerTest
Test: WindowContainerTests
Bug: 64674361

Change-Id: Idf59daa90361af57fce1128d19a0c0dbf5971d18
2017-12-13 18:42:43 -08:00
Yohei Yukawa
f0bd6d95b5 Merge "SoftInput flag requires focused View to show IME" 2017-12-13 23:36:41 +00:00
Siarhei Vishniakou
d60090dd4c Fix identation for switch statement.
Presubmit hooks for repo are currently failing
due to the identation of the body of the switch
statement. Fix this spacing issue here.

Test: None
Change-Id: If96914a9f7345212077215502c5bf537f36e695f
2017-12-12 18:17:00 -08:00
Adrian Roos
ba5aaf1867 Merge "DisplayCutout: Only dispatch to apps requesting it" 2017-12-12 21:15:59 +00:00
Vladislav Kaznacheev
556ac61c5f Filter out position jitter in hover tooltip handling
Allow for some jitter when detecting stationary hover in the tooltip
handling code. This makes it possible to invoke a tooltip with stylus.

Bug: 70173905
Test: android.view.cts.TooltipTest
Change-Id: I016e378df5b48fdc45bcc3a4dbe46e3644ecb74a
2017-12-12 10:39:53 -08:00
TreeHugger Robot
659f6b2204 Merge "Fix bug when generating the textclassifier intent." 2017-12-12 17:35:25 +00:00
Yohei Yukawa
cf68d52ce8 SoftInput flag requires focused View to show IME
Historically SOFT_INPUT_STATE_VISIBLE/SOFT_INPUT_STATE_ALWAYS_VISIBLE
have not required focused editor View [1] to work.  This is easy to
use, but also easy to tell IMEs to connect to InputConnection, which
is often recognized as a bug by users because often nothing happens
when the user taps the software keyboard.

This would become more obvious when we start allowing nothing to have
focus (Bug 68841055) in Android P.

Although how we should deal with "dummy InputConnection" is still an
open question, ignoring these SoftInput flags for apps that target P+
when there is no focused editor view is probably better than the
current behavior, where non-functional software keyboard is likely to
be shown.  The user is still able to show the IME by explicitly tap
the edit field.

As an implementation note, this CL trusts the targetSdkVersion
reported from the target application process, which is in general
unsafe.  That said, for this particular purpose it is acceptable.

 [1]: focused View that returns true from View#onCheckIsTextEditor().

Bug: 69256929
Test: atest CtsInputMethodTestCases
Test: atest FrameworksCoreTests:com.android.internal.inputmethod.InputMethodUtilsTest
Change-Id: I56682c7dee71d461687b9e80ab746d382fd55e0c
2017-12-12 09:33:26 -08:00
Adrian Roos
2b0dcb3fd2 DisplayCutout: Only dispatch to apps requesting it
Fixes a compatibility issues, where apps that were not expecting
a cutout were dispatched one anyway, which caused the WindowInsets
dispatch to continue down the hierarchy even though the SystemInsets
were consumed by the app.

To avoid this, we pre-emptively consume the cutout for any apps that
did not request to be laid out in the cutout area. This is safe,
because for apps that don't request it, the status bar will take care
of consuming it, or they won't be laid out in the cutout at all.

If apps still need to know where the cutout is, they can query for it
via View.getRootWindowInsets().

Fixes: 65689439
Bug: 70490585
Test: atest android.view.cts.DisplayCutoutTest
Change-Id: If06674c619f095d4105be1b3a511fb5823b63d2b
2017-12-12 18:16:27 +01:00
TreeHugger Robot
ac6aaf5fdd Merge "Nullcheck to fix Autofill CTS" 2017-12-12 05:47:48 +00:00
TreeHugger Robot
950c769caf Merge "Convert screenshot hw Bitmap to sw Bitmap for screenshot preview." 2017-12-12 02:07:10 +00:00
Eugene Susla
dfb43327da Nullcheck to fix Autofill CTS
Test: presubmit
Fixes: 70506475
Change-Id: I187bed4889a4901a7137a2995178ea651ed09186
2017-12-11 15:35:12 -08:00
TreeHugger Robot
a21ae5cb5d Merge "Fix resizing when hardware renderer is off." 2017-12-11 19:36:57 +00:00
Abodunrinwa Toki
46664a88fe Fix bug when generating the textclassifier intent.
Our automated tests should have caught this issue, but they weren't run
 on the offending cl (I294f7e4d16c98c6512d56d08d488b204c1f91d47).

Fixes: 70279108
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Change-Id: I99ced41a7c92bece02754fc72966c5440752d8d6
2017-12-11 17:44:13 +00:00
Jeff Sharkey
27674aedc0 Merge "Add auto-doc support for @StringDef." 2017-12-11 16:47:13 +00:00
TreeHugger Robot
b8f2728a78 Merge "Prevent reporting fake package name - framework" 2017-12-09 19:51:00 +00:00
Svet Ganov
240aed987c Prevent reporting fake package name - framework
Test: added AccessibilityEndToEndTest#testPackageNameCannotBeFaked
      cts-tradefed run cts -m CtsAccessibilityServiceTestCases
      cts-tradefed run cts -m CtsAccessibilityTestCases

bug:69981755

Change-Id: I13304efbee10d1affa087e9c8bc4ec237643283e
2017-12-09 09:04:24 -08:00
Tor Norbye
60f1ee2df7 Merge "Switch @IntDef from long to int, and add @LongDef" 2017-12-09 15:10:47 +00:00
Jorim Jaggi
096959932b Merge "Lock free animations (1/2)" 2017-12-09 14:23:37 +00:00
Jorim Jaggi
21c39a7771 Lock free animations (1/2)
First CL that introduces SurfaceAnimator/LockFreeAnimator

We start our synchronized app transition journey by showing that
the concept works by using WindowState animations as proof of
concept.

The main class in this CL are SurfaceAnimator and
SurfaceAnimatorRunner. When we start an animation on a Window, we
create a new bufferless surface, called "The Leash", in the
hierarchy and attach the surface of WindowState onto it, while
attaching the leash onto the old surface parent which is still
responsible for z-layering.

Then, we pass off the Leash into SurfaceAnimationRunner, which then
changes the surface properties of Leash in every animation frame,
without holding the WM lock. While it's doing that we can still
update the z-layering of the window, or even relayout the window
of needed - the important surfaces for this are still under WM's
control.

In case the animation is finished the window surface gets
reparented to its original parent, and the leash is abandoned.
Note that the reparenting is done in the same transaction as
processing the animation finish, such that we don't end up with
a flicker in case of a disappearing animation, where the window
surface gets destroyed.

In case the animation needs to be cancelled, WM can revoke control
of the leash by reparenting the window surface. Even if the
cancellation signal is heavily delayed, WM immediately regains
control over the surface by reparenting it within a transaction.

We also introduce the concept of animating a WindowContainer. We
clean up isAnimating:
- isLocalAnimating: is the container itself animating
- isAnimating: is the container or one of its parents animating
- isSelfOrChildAnimating: is local animating or any child
animating.

SurfaceAnimationRunner also needs it's own thread so it's not getting
bogged down by any WM lock contention by processing regular
animation frames. We call that thread android.anim.lf (lockfree).

Now, imagine that SurfaceAnimationAnimator would sit behind an IPC in
another process and instead of animating WindowState, we'd animate
AppWindowToken. Then, synchronized app transitions would be done.

Test: go/wm-smoke
Test: SurfaceAnimatorTest
Test: SurfaceAnimationRunnerTest
Test: WindowContainerTests
Bug: 64674361
Change-Id: I10d41f7a289ab2158da3f2f1c3ddd78edd1efc86
Exempt-From-Owner-Approval: Tiny change unrelated to display management.
2017-12-09 14:23:03 +00:00
Tor Norbye
f740c7ea08 Switch @IntDef from long to int, and add @LongDef
This CL mirrors changes made to the android.support.annotation version
of IntDef, to keep the usage and semantics identical (though the
internal version of @IntDef and @LongDef are of course hidden and not
part of the SDK.)

Test: These annotations have source retention and therefore have
no runtime impact; the change was compiling the SDK.

Change-Id: Idaf47e8d983c88be1bd8f938615c86611014b45a
2017-12-08 20:54:50 -08:00
TreeHugger Robot
21084779c5 Merge "Improved AccessibilityNodeInfo.toString()." 2017-12-09 01:53:11 +00:00
Jeff Sharkey
5db9a91135 Add auto-doc support for @StringDef.
Behaves pretty much the same as @IntDef, but now supports "suffix"
in addition to "prefix" when matching constants.

Test: manual docs output looks sane
Bug: 70406696
Change-Id: I35064b0f9f36f1f13ccdb40302d818a004014f15
2017-12-08 17:33:40 -07:00
Felipe Leme
ac645bae45 Improved AccessibilityNodeInfo.toString().
Test: manual verification
Bug: 70292857

Change-Id: I2d81071402c429ed29e6c5b443956b085944e12f
2017-12-08 14:05:09 -08:00
Tarandeep Singh
d8d03a8e1b Move IME related API methods from IMM to IMS.
InputMethodManager is public InputMethod API for apps. The methods
that take Window-token as parameter are restricted to system
and/or IME developers. Such methods should really live
in InputMethodService.
This CL deprecates such methods in IMM and moves them to IMS.

This is the first step towards simplifying IME APIs.

Bug: 70282603
Test: atest InputMethodManagerTest
Change-Id: I3163f3cbe557c85103ca287bee0874a3b4194032
2017-12-08 10:40:38 -08:00
Adrian Roos
dcc92eda11 Adjust window layout for DisplayCutout
Add policy around how the display cutout should influence window layout:
- if not requested, windows should not overlap with the display cutout
 - except windows that asked for LAYOUT_IN_SCREEN | LAYOUT_INSET_DECOR,
   which overlap only with a top cutout, provided they did not request any FULLSCREEN mode.
- the content frame must never overlap with the display cutout
- adds FLAG2_LAYOUT_IN_CUTOUT to explicitly ask to be laid out in the cutout area.

Bug: 65689439
Test: atest com.android.server.policy.PhoneWindowManagerLayoutTest
Change-Id: I3a966bc78ef7a4e076104a996799369c60ab7de1
2017-12-08 14:45:18 +01:00
Tarandeep Singh
89a6c48a8b Add support for VR InputMethod.
This change adds support for VR-only IMEs in InputMethod framework.
In order to set this VR IME, setVrInputMethod(ComponentName) should be
called by VrManager.

When VrManager calls setVrInputMethod(), IMMS changes updates
the selected input method in a transient way i.e. it doesn't
update the Settings or input history. Once VR mode finishes,
it restores last input from settings.

Bug: 63037786
Test: Manually using the sample app in bug.

Change-Id: I1db7981b5198e7e203d4578cae7e5b6d20037d0d
2017-12-08 00:55:11 +00:00
TreeHugger Robot
ac74dc42f7 Merge "Further improvements when app forges package info for autofill:" 2017-12-07 21:05:59 +00:00
TreeHugger Robot
33203ffd18 Merge "Display Cutout: Dispatch Cutout from WindowManager" 2017-12-07 20:36:13 +00:00
Adrian Roos
5c6b622328 Display Cutout: Dispatch Cutout from WindowManager
Adds the logic to dispatch a DisplayCutout from DisplayFrames
through WindowState to the View hierarchy. Does however not yet
change how windows are laid out in response to a DisplayCutout.

The display cutout is currently never present, the following CL
will add logic to emulate a display cutout on devices that do
not have a physical one.

Bug: 65689439
Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java
Change-Id: Ie4cd4b575755b66a7ffead31e28640983ef4894e
2017-12-07 19:43:33 +01:00
TreeHugger Robot
734afbe61e Merge "Moar changes for Autofill Field Classification mechanism:" 2017-12-07 17:35:23 +00:00
Felipe Leme
637e05ee0f Further improvements when app forges package info for autofill:
- Dont create a session if the component is not owned by the calling UID.
- Log metrics for forged attempts.
- Avoid possible NPEs on AutofillManager when context or client is null.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.VirtualContainerActivityTest#testAppCannotFakePackageName
Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases

Bug: 69981710

Change-Id: I9695bc046f3eb8aeecfe44f80fd0366f68b2c635
2017-12-06 16:58:13 -08:00
Makoto Onuki
299504742f Merge "Extreme battery saver: Allow lowering framerate for experiments." 2017-12-07 00:18:56 +00:00
TreeHugger Robot
a8b9e2a545 Merge changes from topics "moar_fields", "fc_refactor_score"
* changes:
  Implemented autofill field classification on multiple fields and user data.
  Refactored the FieldsClassification score mechanism.
2017-12-06 23:03:17 +00:00
TreeHugger Robot
dac644cd4a Merge "Deprecate inKeyguardRestrictedInputMode" 2017-12-06 22:27:51 +00:00
John Reck
9f51644abf Extreme battery saver: Allow lowering framerate for experiments.
Bug: 68769804
Test: manual
Change-Id: Ic0c95f32c7ba6d86a997997e480e6d8a5f228f25
2017-12-06 13:59:19 -08:00