Commit Graph

11253 Commits

Author SHA1 Message Date
Eric Holk
3b95621e12 [layout precompilation] Add testing hook for precompiled layouts
We want to be able to control at a fine grained level whether precompiled
layouts are enabled so we can compare inflation results with and without. This
changes adds a @TestApi method that supports this.

Bug: 111895153
Merged-In: Ib6b62d79a9ca7aefefff8639752aa5838e491038
Change-Id: I2f28f6912499825e52c17cc163be9c0fe93855cb
2019-01-30 16:19:29 +00:00
Eric Holk
928bbac9c5 [LayoutInflater] Use precompiled layouts if available
This change enables the use of precompiled layouts, provided a couple of
conditions are met:

1. Precompiled layouts are enabled by the system property
   view.use_precompiled_layouts.
2. There is a file called compiled_view.dex in the application's code cache
   directory.

If these conditions are met, when a layout is inflated, the LayoutInflater will
first check if a precompiled version is available and use that. If anything goes
wrong, such as if the layout is not available or something goes wrong during the
inflation process, then the LayoutInflater will fall back on interpretting the
layout resource as before.

Bug: 111895153
Test: atest $ANDROID_BUILD_TOP/cts/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java
Change-Id: Id050072c0206080322a0e876782ee2b66d03916d
2019-01-17 09:11:27 -08:00
Nikita Iashchenko
06eb53cede Merge "Switch TextClassifier implementation from native to java" 2019-01-17 15:34:02 +00:00
Nikita Iashchenko
7ea2f83f9f Switch TextClassifier implementation from native to java
Thic CL eliminates the native dependency on libtextclassifier in favor of the java one
because the .java implementation is built on top of stable APIs (@CorePlatformAPI, Android SDK)
while the native API might change in future, leading to breakages.

Bug: 119788152
Test: m droid successfully builds + atest frameworks/base/core/tests/coretests/src/android/view/textclassifier
Change-Id: I4c3bb4790c360dd514ed2ea48e0634de43dab9e7
Merged-In: Ide5e58d1c80d9a028cea4e9192a91aeac2843c71
(cherry picked from commit 64c4cb2ea9)
2019-01-15 13:23:17 +00:00
Treehugger Robot
e0a34bf17f Merge "Avoid adding node itself as child node." 2019-01-12 15:37:43 +00:00
Treehugger Robot
179f30a443 Merge "Null locale causing the VTS fail." 2019-01-07 04:19:22 +00:00
qinyige
0b5ca24a41 Avoid adding node itself as child node.
Apps can call addChild through AccessibilityNodeProvider, so it's
possible that an app adds a node itself as a child node. This will break
down the integrity of UI tree and cause failure to operation in
UIAutomator. Thus I suggest do this integrity check when adding child.

Test: as follows
    - built
    - flashed
    - booted
    - run my test script based on uiautomator

Change-Id: I8cba22a1d9d1a49365c6bce4241ef5067502fb79
Signed-off-by: qinyige <qinyige@xiaomi.com>
2019-01-07 10:31:42 +08:00
Eric Holk
29d0cd6fa1 Add tryCreateView to LayoutInflater
This method is needed so that precompiled layouts can reuse the factory logic
from the LayoutInflater.

Bug: 111895153
Test: atest android.view.cts.LayoutInflaterTest
Change-Id: Ifd1028906b655af2bd14247d586dc16b35550c82
2019-01-04 12:57:14 -08:00
Eric Holk
bfc687007c [LayoutInflater] Cleanup - remove some nesting
The parseInclude method had some deep nesting that could be improved by
rearranging things a little.

Test: atest android.view.cts.LayoutInflaterTest
Change-Id: I2ee13c2ee80bcb220371d39a5a6da6044cfa245c
2019-01-02 11:11:24 -08:00
Mathew Inwood
55418eada5 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 14:26:35 +00:00
Treehugger Robot
321b208f0f Merge changes from topic "fw_container"
* changes:
  DO NOT MERGE Set ContainerLayer for buffer-less surface
  DO NOT MERGE: WM: Restrict SC Builder to set a single surface type
  Implement construction of container layers
2018-12-20 22:45:18 +00:00
Manpreet
b99c60c36e Null locale causing the VTS fail.
Added a null check to avoid exceptions caused by timing delay during VTS run.This case fail is because AccessibilityWindowQueryActivity execute scheduleTraversals before Activity destroyed and execute doTraversal after Activity destroyed. This means window animation is not stop after AccessibilityWindowQueryActivity is destroyed and this will lead to test crash.

Test: Tested 5 times and it is passed 5 times.
Bug: 121169721
Change-Id: I915d46f925fb7a5ca43cac3ef3a343822b952b02
2018-12-18 05:48:07 +00:00
Xin Li
15b123ef45 DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
Bug: 120502534
Change-Id: Idc8bfb6d97a869b76cfb87ca1a494201baf9e8bd
2018-12-11 14:13:44 -08:00
Vishnu Nair
cb122ec8a5 DO NOT MERGE: WM: Restrict SC Builder to set a single surface type
When building a surface control, only allow a single surface type to be set, clearing any
previously set types so the surface creating flags remain valid.

Test: reboot device, rotate the screen, enter and exit multi window, check the UI is normal Dump SF layer and check the container layer is set successfully

Bug: 111164627

Change-Id: Ifc022881ee7fec0561a39ce647868d5b43cb49d9
2018-12-07 09:45:41 -08:00
Robert Carr
c1ea10447f Implement construction of container layers
Expose existing native functionality. In preparation for use as
bufferless-input-catching-surfaces.

Bug: 80101428
Bug: 113136004
Bug: 111440400

Change-Id: I455792aec3ee58d9dd20016b484ce7c27808d522
Merged-In: I455792aec3ee58d9dd20016b484ce7c27808d522
2018-12-07 08:55:00 -08:00
Treehugger Robot
29f0f9a910 Merge "Update API doc of View.DragShadowBuilder" 2018-11-13 03:15:51 +00:00
Nathan Harold
f5cf9f24ed Merge "Move some members to the "Q blacklist"." 2018-10-23 21:53:51 +00:00
Mathew Inwood
45d2c252b1 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Merged-In: I719b5c94e5b1f4fa562dd5d655953422958ad37e
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
(cherry picked from commit 8c854f86a4)
2018-10-22 17:28:24 -07:00
Daichi Hirono
1f68b5e91d Update API doc of View.DragShadowBuilder
Since Android P, DragShadowBuilder#onProvideShadowMetrics must provides
positive values for shadow width/height.

Bug: 113779428
Test: None
Change-Id: Idd8c24ee5bf2c7023f7c82137399c59a60162a4f
2018-10-09 13:49:30 +09: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
Treehugger Robot
7bd18423f6 Merge "Set InputMethoMananger#mCurRootView to null when window dismissed" 2018-09-20 00:35:25 +00:00
daqi
dff365ef4d Set InputMethoMananger#mCurRootView to null when window dismissed
InputMethodManager#sInstance is a long live static object so we have to
set its field with right value, otherwise any object referenced by it
cannot be gc including potential activity context.

Now InputMethodManager#mCurRootView is set to null in
InputMethodManager#onPreWindowFocus which is invoked when app's
ViewRootImpl received ViewRootImpl#W#windowfocusChanged from WMS.
However, in the ViewRootImpl#W#windowfocusChanged, mViewAncestor is a
weak reference which get() may returns null sometimes.
One scenario is the ViewRootImpl#W#windowfocusChanged is called after
ActivityThread#handleDestroyActivity. The activity is destroyed and its
ViewRootImpl get GC'd. Then InputMethodManager#onPreWindowFocus won't
get called and InputMethodManager#mCurRootView won't be set to null.

And it is a proper time to set InputMethodManager#mCurRootView to null
when the window it served dismissed.

Fix: 116078227
Test: Break at ActivityThread#handleDestroyActivity and ViewRootImpl#W#windowfocusChanged

Change-Id: I8fabb30f14bcb2cd7019e29b6642b4562d49d248
Signed-off-by: daqi <daqi@xiaomi.com>
2018-09-20 08:30:40 +08:00
Yohei Yukawa
81be3fdc66 Merge "Restrict IMM.notifyUserAction() with targetSdkVersion <= P"
am: ec52757ecb

Change-Id: Ia35a97362a467b452abf8649d3ac30b61a410560
2018-09-12 14:39:44 -07:00
Yohei Yukawa
5b83a80aab Restrict IMM.notifyUserAction() with targetSdkVersion <= P
With my change [1] in Android N, applications no longer need to
manually call this hidden API even when directly implementing
InputConnection interface without extending BaseInputConnection [2].

So far applications that we have confirmed to be using this hidden API
is Chromium and browsers that are supposed to be built on top of
Chromium source code [3].  Actually my change [1] was per request from
Chromium team and Chromium does not use this hidden API on Android N
and later devices [4].

Moving forward, with this CL applications that target API 29 and later
are no longer allowed to use this hidden API since we see no actual
use case of this hidden API on Android N and later devices so far.

If you have any reason to continue relying on this hidden API, please
leave a comment in Bug 114740982.

 [1]: I571d6cc9c6e461d8994aa7496e7e18be13766411
      159dd47db3
 [2]: This scenario had not been suppored until Android N.
      See also other CLs that are tagged with Bug 24688781.
 [3]: https://cs.chromium.org/chromium/src/content/public/android/java/src/org/chromium/content/browser/input/InputMethodManagerWrapperImpl.java?rcl=525c72b0f4694d6b3f93bcc7797d0411c2fa683c&l=113-128
 [4]: crbug.com/551193

Bug: 114159783
Bug: 114740982
Test: compile
Merged-In: I41d6419438cef92cce81cc33d9db00dd2ee89d33
Change-Id: Iac81f49413605271fccc0b8aec3e6ed95925f061
2018-09-11 13:34:36 -07:00
Adrian Roos
c05c2d1e48 Merge "Cutout: Add developer setting to mask the display cutout" into pi-dev 2018-08-21 19:51:58 +00:00
Adrian Roos
8c28c7c2d9 Cutout: Add developer setting to mask the display cutout
Adds an option to mask the cutout by effectively shrinking the logical display
such that developers can test apps as if the device did not have a notch.

Bug: 112876936
Test: Go to Settings > Developer Options > Simulate display with cutout > "No cutout". Cutout should be hidden. Rotate screen, take screenshots, screenrecord, screen off animation should all work as expected.
Change-Id: I5cdb201734d238bf3785ab55843114e4b5b4ee41
2018-08-21 21:47:51 +02:00
Mathew Inwood
ec73e7514f resolve merge conflicts of 597229d681 to stage-aosp-master
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: I0807ae67e0ed3e84f17af962dc8b7a3152f8103f
Merged-In: I4147b038ed7adf0311ee9918b44766f82a057eaf
2018-08-21 09:31:16 +01:00
TreeHugger Robot
c9443e3894 Merge "Improved AutofillManager and Activity dump() methods:" into pi-dev 2018-08-21 01:18:09 +00:00
TreeHugger Robot
db7648f374 Merge "Log AutofillClient on CompatibilityBridge.onAccessibilityEvent()." into pi-dev 2018-08-20 20:29:21 +00:00
TreeHugger Robot
e4d35b6dc0 Merge "Log CompatibilityBridge.onAccessibilityEvent()" into pi-dev 2018-08-20 19:07:10 +00:00
Mathew Inwood
e5ad598d11 Add @UnsupportedAppUsage annotations
For packages:
  android.view.textservice
  android.view.textclassifier.logging
  android.view.textclassifier
  android.view.inputmethod
  android.view.autofill
  android.view.accessibility
  android.view

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: Ie4663ebd4640b2893e575e599582d2c9530da313
Merged-In: I4147b038ed7adf0311ee9918b44766f82a057eaf
2018-08-20 14:52:19 +01:00
Felipe Leme
4226033998 Improved AutofillManager and Activity dump() methods:
- Print compatibility mode info and activity token on AutofillManager.dump().
- Add --autofill option on Activity so it just dump autofill state.

Also fixed checkstyle import warnings on ActivityManagerShellCommand.

Bug: 112417431
Bug: 112584717

Test: adb shell dumpsys activity top --autofill

Change-Id: Id56b56a5d7e591d5204663a1da1322a15f8ef3aa
(cherry picked from commit b546ca7916)
2018-08-17 14:18:37 -07:00
Felipe Leme
3438421295 Log AutofillClient on CompatibilityBridge.onAccessibilityEvent().
This is useful to identify cases where a browser used a trampoline activity to
launch its rendering activity.

Bug: 112584717
Bug: 112690889

Test: adb logcat AutofillManager

Change-Id: I5e58cd8c8dc67ddeed8aa0996233dca9b89cc0d3
(cherry picked from commit 7d4461d133)
2018-08-17 13:55:58 -07:00
Felipe Leme
a9aacf9bfd Log CompatibilityBridge.onAccessibilityEvent()
Altough these are super spammy, they're super valuable when debugging why
compat mode doesn't work.

Bug: 112417431
Fixes: 112584717

Test: adb logcat AutofillManager

Change-Id: I1574b51b1c6caf783038b82ff207986b726b2e8b
(cherry picked from commit 5d35d3d2d6)
2018-08-17 13:54:38 -07:00
Laura Davis
43e75d98d8 Docs: Inserted links to relevant guide pages.
This is the proof of concept for adding relevant
links in API pages to narrative content.
The design doc is hosted at:
https://docs.google.com/document/d/1Y6bFua27Gs7ONZ27gz0nHz3Djv0WND_V_rX-XvbeB3U/edit?usp=sharing

Test: make ds-docs

Bug: 112478848
Change-Id: Ic3842629c802fe89582d4d7b4a153e54d4ba1713
2018-08-16 16:57:18 -07:00
Joshua Baxter
ce01dba2b7 Merge "docs: fixed typo" into pi-dev 2018-08-13 22:46:02 +00:00
Mathew Inwood
04f16736ae resolve merge conflicts of 6987a91e7c to stage-aosp-master
am: 5346961615

Change-Id: I2bcb356c7cbd76067202b27ec6db7f1eeef17aa3
2018-08-03 02:41:47 -07:00
Mathew Inwood
5346961615 resolve merge conflicts of 6987a91e7c to stage-aosp-master
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Merged-In: I773bda19dc7b32c01bf064bf78b517896e8df991
Change-Id: I2c9bd92522932175856fb72ca5cce2c1999f4a1e
2018-08-03 09:00:19 +01:00
Mathew Inwood
8452828b5b Add @UnsupportedAppUsage annotations
For packages:
  android.view.animation

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I52f3e770dd1e8240e67c897e7788bd928145f583
Merged-In: I773bda19dc7b32c01bf064bf78b517896e8df991
2018-07-27 16:06:00 +01:00
Tiger Huang
926f7d815c Don't flash system bars while showing an immersive app on lockscreen
Before applying this patch, when a show-when-locked immersive app is
showing, the system bars would quickly show and hide, which are
redundant to the user.

The root cause is that, for nav bar, we have a policy to show nav bar
if the width and height of status bar are MATCH_PARENT and status bar
has no PRIVATE_FLAG_KEYGUARD. When keyguard is becoming status bar,
its keyguard flag would be removed first, and then the height would
be changed to the bar height. So the nav bar would be shown between
these events. For status bar, we force showing it when it is expanded
by checking its width and height are MATCH_PARENT or not.

To fix the issue, this change introduces a new private flag which
indicates that the status bar window is now in an explicit expanded
state. We check this flag instead of checking the width and height of
status bar.

This change also fix a bug that: when AOD is enabled, if the
foreground app has FLAG_SHOW_WHEN_LOCKED, FLAG_TURN_SCREEN_ON, and
FLAG_FULLSCREEN, clicking on the power key would make it show the app
again instead of AOD. (not 100%, but chances)

Bug: 80147982
Test: 1. go/wm-smoke
      2. Launch a show-when-locked turn-screen-on immersive app on
         AOD, and see if any system bar flashes.
      3. Launch a show-when-locked turn-screen-on immersive app on
         lockscreen, and see if any system bar flashes.
      4. a. Enable AOD in Settings.
         b. Open a show-when-locked turn-screen-on immersive app.
         c. Click on power key, and see if AOD shows.
      5. Launch an immersive app and drag down the status bar, see
         if nav bar keeps there as long as status bar is expanded.

Change-Id: Ie885d504eb73ae8a86736b2c3ed4fb03eb9f739e
Merged-In: Ie885d504eb73ae8a86736b2c3ed4fb03eb9f739e
(cherry picked from commit 3404601e07)
2018-07-26 05:31:16 +00:00
youngmin0822.lee
762b60ce74 Merge "don't call setSize() when creating SurfaceControl" am: 57e98b19be
am: e332fe4b3d

Change-Id: I384dd4a03db135c703e3672037212a970d222689
2018-07-24 22:14:56 -07:00
youngmin0822.lee
e332fe4b3d Merge "don't call setSize() when creating SurfaceControl"
am: 57e98b19be

Change-Id: Iec44550e5c18fa7d3005c8c79e607fc1bc656c13
2018-07-24 22:01:41 -07:00
Jorim Jaggi
7823ee73ee Move allocateBuffers to RT
Such that it gets executed after setSurface, in order that
mReqUsage has the correct flags set.

Test: Take trace, ensure that allocateBuffers actually allocates
in the right format/usage by ensuring that dequeueBuffer doesn't
trash them immediately again.
Bug: 111517695
Change-Id: I94b402d7b29d565155a77a2d09106246261712d2
2018-07-17 17:34:49 +02:00
Jorim Jaggi
511ac80149 DO NOT MERGE Remove WTF spam
Root cause has been identified, but fix is too risky. Instead, we
remove the WTF for now and readd the fix as well as the WTF
in master.

Note that due to defensive programming, in case we land in the WTF
case, it doesn't cause any real bug.

Test: boots
Bug: 110834518
Change-Id: I0da1e48e420c3fcde0e818b7fe0527da9155a159
2018-07-12 12:01:48 +00:00
youngmin0822.lee
4dde7d19cb don't call setSize() when creating SurfaceControl
When SurfaceControl is created with creating variable
in updateSurface(), sizeChanged is also set.
So, setSize() is called, and it blocks UI thread
until the transaction is handled in SF.
There is no need to resize in the creation time,
because size is already set when creating SurfaceControl.

Test: systrace any app including SurfaceView

Change-Id: I65028b4d0d0ba2b75fbe089c98a11a56b6c08104
2018-07-09 15:27:43 +09:00
Jorim Jaggi
606405180f Only use simple rects for cutout region
Otherwise there is a big performance hit in all kinds of
situations where we do operations with the region, specifically
when:

- updating input windows
- insetting the cutout during layout
- touch dispatch

Test: DisplayCutoutTest, WmDisplayCutoutTest
Bug: 110464019
Bug: 110452325
Change-Id: I94a25c3794ecd33b8b7204ca308ac91623498f13
2018-07-02 17:58:10 +02:00
TreeHugger Robot
e4e9ee7951 Merge "Move nulling of nextFrameCallback" into pi-dev 2018-06-07 22:14:51 +00:00
Jorim Jaggi
e6a026bdfe Move nulling of nextFrameCallback
If draw() invokes postDraw that sets the next callback, the
callback will never be invoked.

Test: Long-swipe-up from navigation bar
Change-Id: If2e4dfff8a845b73fa77426305d5ece1921857e5
Fixes: 109701914
2018-06-07 17:49:01 +02:00
Laura Davis
890662c3c4 docs: Changed language to be gender-neutral.
Test: make ds-docs

Bug: 75324366
Change-Id: Ia2dbcbe4bec303791cbbb004bab6a0b585c5dfb6
2018-06-05 16:02:42 -07:00
Jorim Jaggi
9c52ebbf96 Crashing can not override Keyguard transit
If an app crashes during Keyguard transition, make sure to keep
Keyguard transition

Test: AppTransitionTests
Test: go/wm-smoke
Change-Id: I80b80952f93d2b5611754f05a3dc333905cd1c86
Fixes: 80132133
2018-06-01 16:32:44 +02:00