Commit Graph

14648 Commits

Author SHA1 Message Date
Ming-Shin Lu
d1cd540bbe Add Null check for mView.findFocus() in ViewRootImpl
Some apps like Netflix crashed while handleWindowFocusChanged but mView
somehow has became null.

It's fair to check null for mView.findFocus() since other places
in ViewRootImpl that calling this method also add null check.

Fix: 153862451
Test: atest CtsInputMethodTestCases

Change-Id: I86bd5f3193deabe28bb425a8564017f7b32b90f3
(cherry picked from commit bdaa14bf18)
2020-11-26 09:24:46 +00:00
Mark Goldstein
7887b8160b Doc: Fix typo the right way. Supersedes cl/318172931 am: d5726423ca am: 0e59503e96
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12828332

Change-Id: I2cd5851caad56c0922ec0a1c122207ae5baa7409
2020-10-14 22:00:31 +00:00
Mark Goldstein
0e59503e96 Doc: Fix typo the right way. Supersedes cl/318172931 am: d5726423ca
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12828332

Change-Id: Idfff776666d9175a45cea54996d61919f7df3057
2020-10-14 21:41:47 +00:00
Mark Goldstein
d5726423ca Doc: Fix typo the right way. Supersedes cl/318172931
Bug: 170764224

Change-Id: Iaef1aa4fd3143e6e9019d06834001b3bfa3d887d

Exempt-from-owner-approval: Docs-only typo fix
2020-10-14 20:38:09 +00:00
Ming-Shin Lu
44ecc735ec RESTRICT AUTOMERGE Reland "Fix showing keyboard without editor focused.."
Resolve SearchViewTest and InputMethodServiceTest failure when
landing CL[1] in QPR branch.

Also, CL[1] mentioned window focus behavior changes from R,
ignoring STATE_VISIBLE or STATE_ALWAYS_VISIBLE request doesn't enough
to fix unexpected keyboard visible issue when same window focused with
the above softInput flag without editor focus, since there is no
additional unspecified window focus to hide the current soft-input
as prior to R's behavior.

To fix that, we introduced new SoftInputShowHideReason to hide
soft-input when the same window focused without valid editor focus
after screen unlock, in order to align with the behavior prior to R.

[1]: I37ae6e30d1de581ba15131c2a90396b3a522a4d6

Bug: 161506356
Test: atest CtsInputMethodTestCases
Change-Id: Id51863a5b67d5d79d903adf43f19b52bd139e03f
2020-09-28 05:13:09 +00:00
Andrew Solovay
97b367c2d7 [RESTRICT AUTOMERGE] docs: Removing obsolee TODO am: b86df213a3 am: 9441161e17
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12663552

Change-Id: Ia6a1b39ffc137939621fcb29f50854f89d926106
2020-09-25 05:46:23 +00:00
Andrew Solovay
9441161e17 [RESTRICT AUTOMERGE] docs: Removing obsolee TODO am: b86df213a3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12663552

Change-Id: I3009f35dd371aad17c6787e98000c43dc4cee7d3
2020-09-25 05:24:25 +00:00
TreeHugger Robot
d6af5b5d1e Merge "Make process level rotated config and display metrics consistent" into rvc-qpr-dev 2020-09-25 03:54:37 +00:00
Andrew Solovay
b86df213a3 [RESTRICT AUTOMERGE] docs: Removing obsolee TODO
The TODO was in a Javadoc comment so it was exposed in public docs.
It looks like the TODO was removed from master, and per SME, it's
okay to remove it from RVC too.

Test: make ds-docs-java
Exempt-from-owner-approval: Docs-only change
Bug: 169103613
Change-Id: I7694bbc8fde0e7366db57770ff1792a1d2f3e6c1
Merged-In: I129f96f6ed716e25c476bacbdb38799675919b9a
2020-09-24 18:13:06 +00:00
Youngjun Kwak
4d714cb8e9 Merge "Map bar type to new ITYPE_{SIDE}_MANDATORY_GESTURES_INSETs" into rvc-qpr-dev 2020-09-24 15:19:11 +00:00
Tiger Huang
3b6bdffa44 Clear low profile mode while forcing client to show system bars
Forcing client to show system bars would clear system UI flags at the
client side. SYSTEM_UI_FLAG_LOW_PROFILE would be cleared as well in
previous Android versions. This CL makes the behavior compatible.

Fix: 167892531
Test: Steps in the bug
Change-Id: I466a05120a08ac95b619eadd8291fc546d3bb450
2020-09-24 17:35:48 +08:00
Riddle Hsu
6bb2b9c716 Make process level rotated config and display metrics consistent
The application may get Resources instance from Resources.getSystem()
and context.getApplicationContext().getResources(). Since fixed
rotation is introduced that allows an activity to start in a different
rotation than the current display, when using getConfiguration() and
getDisplayMetrics() of these Resources instances, the orientation
and metrics need to be the same as current display is rotated.
Otherwise the app may show unexpected UI layout.

Although it is not recommended to use global resources/config for
activity. One of the goal of fixed rotation transform is to simulate
the app is started in a rotated environment, so this CL makes the
configuration and display metrics of system resources are consistent
with application and activity for compatibility.

About WindowProcessController and ActivityStackSupervisor:
 The process configuration passed to LaunchActivityItem may be
 associated from activity. if the sequence number of configuration
 is overridden by activity, the configuration may be ignored when
 launching the activity because the sequence number isn't larger
 than the previous process configuration. Although there will be a
 ConfigurationChangeItem later to update correct state, the app may
 get the intermediate state with old configuration and metrics.

About ResourcesManager and DisplayAdjustments:
 There are 2 new fields appWidth and appHeight added to
 DisplayAdjustments#FixedRotationAdjustments because the display
 metrics from Resources.getSystem() is independent from activity
 configuration. Only window manager knows the rotated size, so
 the values need to send to client and then ResourcesManager takes
 the adjustment to change the global display metrics.

About WindowToken:
 When fixed rotation is applied on the token, send the
 FixedRotationAdjustmentsItem first so the later configuration
 change can pick the adjustment at ActivityThread. And because the
 registration of activity configuration only occurs on add/remove
 activity, if it is only switching to another existing activity in
 different orientation, the process configuration still needs to
 be updated.

About ActivityThread:
 The code flow for a rotated activity (DA = display adjustments):
 - Launch new activity
    handleLaunchActivity: override app DA
     handleConfigurationChanged: adjust global display metrics by DA
     performLaunchActivity
      createBaseContextForActivity: override activity DA
 - Resume existing activity
    handleFixedRotationAdjustments: override app and activity DA
    handleConfigurationChanged: adjust global display metrics by DA
    handleResumeActivity

Also some minor corrections:
- Fix wrong display metrics adjustment that xdpi and ydpi should
  not be swapped because they are physical attributes.

Bug: 167564038
Test: atest DisplayAdjustmentsTests
      AppConfigurationTests#testRotatedInfoWithFixedRotationTransform
      WindowProcessControllerTests#testProcessLevelConfiguration
      DisplayContentTests#testApplyTopFixedRotationTransform

Change-Id: I60bedc7e09f54683d5e857ccc51402d5d144cd9e
Merged-In: I60bedc7e09f54683d5e857ccc51402d5d144cd9e
2020-09-24 15:09:51 +08:00
Alison Cichowlas
96c7d2368f Merge "Set the default screenshot delay to 0ms" into rvc-qpr-dev 2020-09-23 15:39:42 +00:00
Miranda Kephart
c632e0f8df Set the default screenshot delay to 0ms
Bug: 165267251
Test: manual -- ensured that the time needed to hold is 0ms if the
screenshot_keychord_delay debug value is not set, and that the
delay can still be changed using

adb shell device_config put systemui screenshot_keychord_delay <ms>

Change-Id: Iab989ecf14ef379658130adbced241e084554e63
Merged-In: Iab989ecf14ef379658130adbced241e084554e63
(cherry picked from commit bf82822698)
2020-09-23 13:58:41 +00:00
kwaky
9b2063caaf Map bar type to new ITYPE_{SIDE}_MANDATORY_GESTURES_INSETs
Bug: 167565741
Bug: 167288724
Test: atest WindowInsetsPolicy and atest SystemBarConfigs all passing

Change-Id: I767a423bc2437021af02c01a84fa3e1834413c1e
2020-09-22 11:05:56 -07:00
Heemin Seog
ae42535e1a DO NOT MERGE Ensure mapping between internal and public insets
Bug: 166149440
Test: manual (flash automotive device with all system bars and show/hide
insets using WindowInsetsController), atest InsetsStateTest
InsetsStateControllerTest

Change-Id: I500b2fb0129739c6fc609561377d90cca6e45f7e
2020-09-18 09:48:08 -07:00
Julia Reynolds
71f51c54cd Merge "DO NOT MERGE Revert "Remove app ops indicators from notifications"" into rvc-qpr-dev 2020-09-16 15:09:31 +00:00
Julia Reynolds
8ec5bcb3d0 DO NOT MERGE Revert "Remove app ops indicators from notifications"
This reverts commit 2778b62f1d.

Reason for revert: these icons are still needed

Change-Id: I219af393f3d4cd08e431f38a3b66408e12f258bb
Bug: 163076432
2020-09-16 15:09:03 +00:00
Tiger Huang
dfc8abb1ff Update requested state after applying pending frames
When there is an insets animation, we will stop updating insets source
frames until the animation is done. The previous logic didn't update the
frames within the requested state while the animation is done. And the
frames was relied by InsetsPolicy while playing transient bar animation.
If the frames don't match the display, the insets would be wrong, and
the animation wouldn't be played correctly.

Fix: 161134197
Test: atest InsetsControllerTest
Merged-In: Id8f3c1956fbfe3ad16f167ff76297dde6c634e81
Change-Id: Id8f3c1956fbfe3ad16f167ff76297dde6c634e81
(cherry picked from commit 23c75281ef)
2020-09-07 16:09:08 +08:00
Tiger Huang
677078e872 Make display frame compatible
The display frame is used to limit the windows boundary. The frame is
the same as the parent frame in most cases if the window is not
attched. However, if a window doesn't have any layout related
window/sysui flags and the soft input mode is not ADJUST_RESIZE, the
display frame doesn't need to be inset by IME (but the parent frame
does).

Fix: 163435784
Test: atest ViewRootImplTest DisplayPolicyLayoutTests
Merged-In: Ia61933120027642d1f0e0a490546071ca2b6c853
Change-Id: Ia61933120027642d1f0e0a490546071ca2b6c853
2020-09-02 11:38:21 +00:00
Tiger Huang
e80e94182c Compare with oldSoftInputMode after restoring softInputMode
... of mWindowAttributes. Apps might update LayoutParams with
softInputMode unspecified on applying insets, and this can cause
infinite loop in the previous logic, because we would auto-compute
softInputMode for the unspecified one, which makes app's softInputMode
never be the same as the one in ViewRootImpl.mWindowAttributes.

Fix: 163009478
Test: Print stack trace before calling requestFitSystemWindows() and
      follow the steps in the bug.
Test: Open Messages, go to attachments, reopen IME
Change-Id: I2341121b69209688c2f6fb033f51611b21422a04
2020-09-02 06:48:08 +00:00
Tiger Huang
444e8dc6ce Refine system bar position restoring
The previous logic restores the system bar as long as its insets source
is visible. There can be a timing issue that if the user swipes to show
transient bars while an immersive app just becomes the control target
but the hide-bar info haven't sent to WM yet, WM will re-show the bar
incorrectly.

This CL uses the requested visibility and the behavior to decide if we
should restore the postion and the visibility.

This CL also refines and caches the arguments of showTransient. In this
way, we don't have to create the array every time while invoking that
method.

Fix: 161247175
Test: atest InsetsPolicyTest
Merged-In: Idef314dfe6625399b88b3dacb4c74c7071453497
Change-Id: Idef314dfe6625399b88b3dacb4c74c7071453497
(cherry picked from commit 533682ebb3)
2020-08-19 16:13:25 +00:00
Tiger Huang
23c75281ef Update requested state after applying pending frames
When there is an insets animation, we will stop updating insets source
frames until the animation is done. The previous logic didn't update the
frames within the requested state while the animation is done. And the
frames was relied by InsetsPolicy while playing transient bar animation.
If the frames don't match the display, the insets would be wrong, and
the animation wouldn't be played correctly.

Fix: 161134197
Test: atest InsetsControllerTest
Merged-In: Id8f3c1956fbfe3ad16f167ff76297dde6c634e81
Change-Id: Id8f3c1956fbfe3ad16f167ff76297dde6c634e81
2020-08-19 20:42:39 +08:00
Tiger Huang
1adfc8b85c Merge "Refine system bar position restoring" into rvc-qpr-dev 2020-08-19 11:57:15 +00:00
Tiger Huang
f8175d1a5b Dispatch insets to client if mState is changed
Previous logic in onStateChanged notifies insetsChanged based on the
change of mLastDispatchedState, which can make us dispatch redundant
insets changes to the app.

In this CL, we only notifies insetsChanged if mState is really changed
in onStateChanged -- we use the final mState (after updateState and
applyLocalVisibilityOverride) to compare with the one before changing.

Fix: 161924448
Test: atest InsetsControllerTest WindowInsetsControllerTests
Test: Swipe up to home while IME open and see if there is any jank
Merged-In: Ia536cdf76805caa56ca1b6eaf2b3db83b6ecd94e
Change-Id: Ia536cdf76805caa56ca1b6eaf2b3db83b6ecd94e
2020-08-19 15:32:53 +08:00
Tiger Huang
943589cf45 Merge "Update requested state after applying pending frames" into rvc-qpr-dev 2020-08-19 00:25:22 +00:00
Tiger Huang
533682ebb3 Refine system bar position restoring
The previous logic restores the system bar as long as its insets source
is visible. There can be a timing issue that if the user swipes to show
transient bars while an immersive app just becomes the control target
but the hide-bar info haven't sent to WM yet, WM will re-show the bar
incorrectly.

This CL uses the requested visibility and the behavior to decide if we
should restore the postion and the visibility.

This CL also refines and caches the arguments of showTransient. In this
way, we don't have to create the array every time while invoking that
method.

Fix: 161247175
Test: atest InsetsPolicyTest
Merged-In: Idef314dfe6625399b88b3dacb4c74c7071453497
Change-Id: Idef314dfe6625399b88b3dacb4c74c7071453497
2020-08-18 20:53:41 +08:00
Julia Reynolds
2778b62f1d Remove app ops indicators from notifications
Test: atest
Bug: 163076432
Change-Id: I5b7514f765811ffd3b0aca63d0108591755974ab
Merged-In: I5b7514f765811ffd3b0aca63d0108591755974ab
2020-08-14 15:02:02 +00:00
Tiger Huang
1a53789bc8 Update requested state after applying pending frames
When there is an insets animation, we will stop updating insets source
frames until the animation is done. The previous logic didn't update the
frames within the requested state while the animation is done. And the
frames was relied by InsetsPolicy while playing transient bar animation.
If the frames don't match the display, the insets would be wrong, and
the animation wouldn't be played correctly.

Fix: 161134197
Test: atest InsetsControllerTest
Change-Id: Id8f3c1956fbfe3ad16f167ff76297dde6c634e81
2020-08-13 14:58:06 +00:00
Tiger Huang
046b604fd4 Merge "Dispatch insets to client if mState is changed" into rvc-qpr-dev 2020-08-06 20:58:40 +00:00
Tiger Huang
b6478edb09 Dispatch insets to client if mState is changed
Previous logic in onStateChanged notifies insetsChanged based on the
change of mLastDispatchedState, which can make us dispatch redundant
insets changes to the app.

In this CL, we only notifies insetsChanged if mState is really changed
in onStateChanged -- we use the final mState (after updateState and
applyLocalVisibilityOverride) to compare with the one before changing.

Fix: 161924448
Test: atest InsetsControllerTest WindowInsetsControllerTests
Test: Swipe up to home while IME open and see if there is any jank
Change-Id: Ia536cdf76805caa56ca1b6eaf2b3db83b6ecd94e
2020-08-06 17:26:57 +08:00
Chavi Weingarten
464e51527f Merge "Revert "Reparent bounds layer if surface was replaced."" into rvc-d1-dev am: 15e6f37a16
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12308823

Change-Id: Iad5abb3a1498bbc45359a6e454aa446a0fc983d4
2020-08-06 01:41:08 +00:00
Chavi Weingarten
e6c662098d Revert "Reparent bounds layer if surface was replaced."
This was intended to fix a reparent issue when preserving
surfaces before the app was closed. That is no longer happening
so this change is no longer needed.

The reason this causes the flicker is it waits to reparent until
next frame. However, the frame can be submitted before WM gets a
chance to show the new Surface since that request is sent to WM.

Therefore, the SurfaceView can end up getting reparented to the
new SurfaceControl before the new SurfaceControl is visible,
causing it to be hidden for a few frames.

This reverts commit c1dcac9568.

Reason for revert: b/162377855

Fixes: 162377855
Test: Split screen with SurfaceView doesn't flicker
Change-Id: Ic7a209b7aa66e278b99a526d8427f140b31de0f6
2020-08-04 20:36:49 +00:00
Kevin Hufnagle
e500a9f38b Merge "docs: Changes "their" to "the" in 2 places" into rvc-dev am: 24ed56bd0c am: b4937f485e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12286685

Change-Id: I034901e5722e469498fd6c871de294edbb466a6e
2020-08-03 23:02:59 +00:00
Kevin Hufnagle
24ed56bd0c Merge "docs: Changes "their" to "the" in 2 places" into rvc-dev 2020-08-03 22:26:36 +00:00
Kevin Hufnagle
e39427591a docs: Changes "their" to "the" in 2 places
When referring to a client (piece of software), it's better not to use
a personified pronoun, such as "his" or "their". Changed to "the".

Change-Id: I5d79e70a9135d6f1e8da493fcdd50921b9696e31
Test: none (docs-only change)
Bug: 160937339
2020-07-31 23:28:24 +00:00
TreeHugger Robot
5b88562f8c Merge "Update FocusFinder" into rvc-qpr-dev 2020-07-30 19:07:05 +00:00
Adam He
7276e5680b Merge "Updated docs with clarifications on specific limitations with the new Inline APIs." into rvc-dev am: 3532bdaa36 am: f336feb6df
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12175369

Change-Id: I2f89dced04d50430651faf8a80036452da413768
2020-07-29 22:15:23 +00:00
Adam He
3532bdaa36 Merge "Updated docs with clarifications on specific limitations with the new Inline APIs." into rvc-dev 2020-07-29 21:45:59 +00:00
Adam He
edc354d399 Updated docs with clarifications on specific limitations with the new
Inline APIs.

* limitations with multiple locales.
* limit on max number of suggestions.
* guidance on managing the order of inline suggestions when inflating.

Fixes: 161486684
Test: atest android.autofillservice.cts.inline
Change-Id: Ia560d48f95730d79bc340ff9eb0cf4a5909bf0d3
2020-07-27 16:18:15 -07:00
Yabin Huang
18048e074b Update FocusFinder
Don't return the current view when finding the next or previous view.

Bug: 158492287
Test: atest cts/tests/tests/view/src/android/view/cts/FocusFinderTest.java
atest frameworks/base/core/tests/coretests/src/android/view/FocusFinderTest.java

Change-Id: Ib5c1854d1a13b9469ca55dfbf0be61bead47e29e
(cherry picked from commit 713af5fdd3)
2020-07-24 22:03:51 +00:00
Kevin Hufnagle
64a447986e Merge "docs: Use more inclusive pronouns" into rvc-dev am: 5c4491e04b am: eb65f3d86b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12196424

Change-Id: I6124999b50cdfc9b02d5ec5e761c24f7bec5b5a9
2020-07-22 00:47:02 +00:00
Kevin Hufnagle
5c4491e04b Merge "docs: Use more inclusive pronouns" into rvc-dev 2020-07-22 00:07:00 +00:00
Wale Ogunwale
256cbd1b51 Merge "Prevent exception when surrounding text retrieval" into rvc-dev am: 309cfa3431 am: f4fb8c1457
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12167896

Change-Id: I1b7446f698daabf5eae3039fa91efeccd111f1a9
2020-07-21 01:42:02 +00:00
Wale Ogunwale
309cfa3431 Merge "Prevent exception when surrounding text retrieval" into rvc-dev 2020-07-21 01:03:03 +00:00
Kevin Hufnagle
56cd67c4e4 docs: Use more inclusive pronouns
Change "his" to "their" in 2 places

Change-Id: Ib03e1967edd5d13f999c9290aabc56db33bf4fc0
Test: none (docs-only change)
Bug: 160937339
2020-07-20 22:55:07 +00:00
Adrian Roos
f9ea2989dd Merge "Fix hiding keyboard animation stuck while dialog dismissing." into rvc-dev am: dac09ee7fe am: 7df40a82f6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12174530

Change-Id: I252e2c0b62cf955c7ce2c7fafde18e0b51a9743e
2020-07-17 21:40:18 +00:00
TreeHugger Robot
a5404a59f2 Merge changes from topic "flexible_bars" into rvc-qpr-dev
* changes:
  Reintroduce flexible inset mapping
  Keep alternate reference to mStatusBar and mNavigationBar for flexible insets
2020-07-17 17:40:09 +00:00
Wilson Wu
0ebe70cb0f Prevent exception when surrounding text retrieval
We use same reference from TextView to set the initial
surrounding text. The actual surrounding text may be
modified before retrieval since the mSurroundingText
is mutable. Use a copy of subText should avoid this
concurrent issue.

Bug: 160390184
Test: atest FrameworksCoreTests:EditorInfoTest
Change-Id: I6082a4cae2fcdc4c529dc14e2e5e7a45ab1aae4d
2020-07-18 00:51:47 +08:00
Adrian Roos
a24622cfcd Fix hiding keyboard animation stuck while dialog dismissing.
When dismissing a dialog with EditText focused and keyboard shown,
the keyboard does not get correctly dismissed.

This happens because after CL[1] landed, returning to the  activity won't start
new input connection, and the activity will thus not regain control over
the IME.

This fix restores the previous behavior, where  IMM will start a fake input
connection even without an editor.

[1]: I1ef3d341af9d473d94d52fd1890deafbae2bc9e1

Fix: 161273049
Test: atest CtsInputMethodTestCases
Test: manual as follows
     0) Have some files downloaded in the device
     1) Launch Files app > Browse > Click Internal Storage
     2) Long press on any file > From menu, click "Rename"
     3) Enter some name with soft keyboard and click "OK"
     4) Expect Keyboard should hide

Change-Id: I022ad658844142ff4a4cf3b91953013f2bfbb58a
2020-07-17 18:09:13 +02:00