Commit Graph

3514 Commits

Author SHA1 Message Date
Darrell Shi
4ccdca90b7 Merge changes Icea03eb6,Idad15d8e into tm-qpr-dev
* changes:
  Add more specific start/stop dream reasons.
  Dream manager improvements.
2022-10-11 16:15:11 +00:00
Darrell Shi
312db22a14 Add more specific start/stop dream reasons.
As dreams get more complex, we would like more specific loggings for how
dreams are started/stopped for better debugging.

This CL adds "reason" as a required parameter in the start/stop dream
internal/private API. This allows callers to specify reasons.

Bug: 252796782
Fix: 252796782
Test: verified reasons are correctly logged on device
Change-Id: Icea03eb6e23ca113f50fa047f6d57e6e1d0b5604
2022-10-10 20:17:05 +00:00
Yuri Lin
6303141f40 Fix existing dismissal surfaces, add one for lockscreen
DISMISSAL_BUBBLE previously had the same value as DISMISSAL_SHADE, so bubble dismissals weren't getting counted correctly. It also needed to be added as a new UiEvent on the logging side so that the dismissal surface could be handled correctly. This dismissal surface is getting set by BubbleManager already, so the necessary changes should be limited to the logging side.

This change also adds a new dismissal surface for the lockscreen, in conjunction with the already existing UiEvent enum for NOTIFICATION_CANCEL_USER_LOCKSCREEN. However, this change does not yet add correct handling of new dismissal surface on the side where notifications get dismissed; that will be in an upcoming change.

Bug: 234507856
Fixes: 252821281
Test: statsd_testdrive
Change-Id: Ib8fe37dc1277c55de1c26a5e2b3835b3a9f3c941
2022-10-10 15:54:07 -04:00
Lucas Silva
7cf2634f91 Fix PowerManager#dream API by partially rolling back ag/19763724
ag/19763724 modified Sandman.java to use LocalServices, but it turns out
that Sandman.java is exposed to clients via PowerManager - where
LocalServices isn't available. This caused PowerManager#dream to break

Fixes: 249916607
Test: atest UiModeManagerServiceTest
Test: "OKG go to ambient" voice command
Change-Id: I3e031593568fdb7b92a1209823463832feeb1601
2022-10-03 14:54:31 -04:00
Daniel Kim
4e528edd31 Merge "Disable proximity result for hotword" into tm-qpr-dev 2022-09-26 08:12:46 +00:00
Lucas Silva
2da886cb7d Merge "Hide the status bar dream overlay when low light is active." into tm-qpr-dev 2022-09-23 20:22:48 +00:00
Daniel
4dd69f2ebb Disable proximity result for hotword
Introducing a flag to gate the Attention Service usage by Hotword
Detection Service. The Attention Service will be disabled by default.

Bug: 247890608
Test: atest CtsVoiceInteractionTestCases
Change-Id: Ic8a6a11b2a0843a96f135b360f10f7fef5fce274
2022-09-22 22:55:09 +00:00
Hui Wu
1a25dca0bc Remove impl of cloudsearch api
Bug: 246376638
Test: Manually Tested
Change-Id: I1740d5e1a0fb25a0fedea0a92e8a901684e35635
2022-09-22 15:08:56 -07:00
Lucas Silva
0bfb405bd3 Hide the status bar dream overlay when low light is active.
We pipe the component name of the currently active dream into the
overlay service, and when the active dream is lowlight, we hide the
status bar.

Test: atest DreamOverlayStateControllerTest
Test: atest DreamOverlayStatusBarViewControllerTest
Test: manually on device by entering/exiting low light and ensuring the
status bar is hidden
Fixes: 245386662

Change-Id: I22973538bea19ef108360a319c70c878cfd81800
2022-09-22 13:12:53 -04:00
Yuri Lin
f36bcf9739 Merge "Limit lengths of fields in Condition to a max length." into tm-qpr-dev 2022-09-15 14:59:18 +00:00
Yuri Lin
81352c3775 Limit lengths of fields in Condition to a max length.
This app-generated input needs to not be too long to avoid errors in the process of writing to disk.

Bug: 242846316
Test: cts ConditionTest; atest ConditionTest; manually verified exploit apk is OK

Change-Id: Ic2fa8f06cc7a4c1f262115764fbd1be2a226b4b9
2022-09-14 15:27:11 -04:00
Aurélien Pomini
369f1b973e Move ImageWallpaper.java into package 'com.android.systemui.wallpapers'
Test: Manual on mobile (try to download & attach a wallpaper, check that
nothing breaks)
Test: atest ImageWallpaperTest
Bug: 243402530

Change-Id: I5af1acf08bb1c43a5e119597a9cef2ea667723c3
2022-09-12 09:49:31 +00:00
Beverly Tai
8129d7acb0 Merge "Don't show any trust granted message if passed an empty string" into tm-qpr-dev 2022-09-09 20:43:56 +00:00
Beverly
5dccdb24cf Don't show any trust granted message if passed an empty string
If the trustGranted call has flag DISPLAY_MESSAGE and
message is intentionally set to an empty string "", then
don't show ANY trust granted message. If the message is null
or DISPLAY_MESSAGE is not set when trust is granted,
then the device will show its default trust granted string.

Test: atest KeyguardIndicationControllerTest
Test: manually grantTrust with the FLAG_GRANT_TRUST_DISPLAY_MESSAGE
and an empty string. See that device has trust granted and doesn't
show any keyguard indication message.
Fixes: 243075236
Change-Id: Ic31a1758e9baa27b236f09ba8e656d15dd04e7f0
2022-09-07 15:57:29 +00:00
Lucas Silva
de117f20ff Merge "Fix vulnerability that allowed attackers to start arbitary activities" into tm-qpr-dev 2022-09-02 17:18:21 +00:00
Lucas Silva
deb4e7788a Merge "Don't start dreams immediately if keyguard is occluded when docked." into tm-qpr-dev 2022-09-01 17:09:01 +00:00
Lucas Silva
2ce1b7fd37 Fix vulnerability that allowed attackers to start arbitary
activities

Test: atest DreamServiceTest
Test: flashed device and verified dream settings works as expected
Fixes: 242845514
Change-Id: I6e90e3a0d513dceb7d7f5c59d6807ebe164c5716
2022-08-31 11:10:21 -04:00
Darrell Shi
3c94bacacd Add hidden system dream API in DreamManagerService.
This change
- adds a new private API in dream manager that allows a client with
  write dream permission to set a system dream component, which takes
  precedence over user configured dream
- fixes startDream() API in DreamManager which shouldn't take in a
  component name

Test: atest SystemDreamTest
Bug: 222529147
Change-Id: Iee9a0af1071e5ed57fa5bd4b0d06d8178118116e
2022-08-30 23:19:44 +00:00
Lucas Silva
1e16b3c217 Don't start dreams immediately if keyguard is occluded when docked.
The keyguard must be showing and unoccluded, or the device is not
interactive (eg screen off) in order for dreams to be started
immediately when docked. This prevents dreams from starting if there is
an activity currently showing over the lockscreen.

Also includes some refactoring to be able to unit test this change,
since dock state changes were not previously tested.

Fixes: 233412496
Test: atest UiModeManagerServiceTest
Test: manually on device with keyguard occluded, unoccluded, and screen
off while docked

Change-Id: I12f1a4cf3ae4784e391e3c5a3fd1d50b4d4f7ecd
2022-08-30 09:56:06 -04:00
Chloris Kuo
235ce54b78 Merge "Add new intent to open NAS detail settings page in NAS app." into tm-qpr-dev 2022-08-24 22:37:57 +00:00
Chloris Kuo
f99fd3c87e Add new intent to open NAS detail settings page in NAS app.
Bug: 231492005
Test: manually on local device
Change-Id: I87361b640c5fc7b258e3e807e14baeab52a66953
Merged-In: I87361b640c5fc7b258e3e807e14baeab52a66953
2022-08-24 19:50:12 +00:00
Joanne Chung
3292a30a1c Merge "Fix toolbar announce wrong text." into tm-qpr-dev 2022-08-24 01:07:32 +00:00
Daniel Kim
7811c2b731 Merge changes from topic "hotword_qpr" into tm-qpr-dev
* changes:
  Revert "Revert "Refactor ProximityUpdateCallbackInternal to inte..."
  Revert^2 "Add proximity state to the HotwordDetectedResult"
2022-08-20 01:30:46 +00:00
Joanne
53d6f568ec Fix toolbar announce wrong text.
This is a regression during refactor toolbar code, we don't intent
to announce the toolbar popup window so we should not set content
description for the container.

Bug: 239563674
Test: manual. Turn on talkback and make sure the announce is correct
and the behavior is the same
Test: atest TextViewIntegrationTest pass for local/remote
Test: atest TextViewActivityTest pass for local/remote
Test: atest SuggestionsPopupWindowTest pass for local/remote

Change-Id: I6e30d2f6d9a2c4905b702c25655fe5e4eb7de5d5
2022-08-19 13:42:24 +00:00
Mady Mellor
3448c2fe1c Merge "Add a method in IDreamManager to check if dreaming OR in dream preview" into tm-qpr-dev 2022-08-17 18:51:28 +00:00
Joanne Chung
9e263e643d Merge "Fix system toolbar doesn't use correct theme." into tm-qpr-dev 2022-08-16 10:00:57 +00:00
Tiger Huang
3712433349 Introduce IWindowSession#relayoutAsync
IWindowSession#relayoutAsync is similar to IWindowSession#relayout, but
the former is an oneway method which just sends the layout attributes to
the server. Since the client can compute its own window frame, it just
needs to send attributes to the server without getting blocked for
receving the window frame.

In somes cases, the client still needs to obtain things from the server.
Such as:

- When view visibility is changed. The client maybe not be able to
  receive the latest insets state while it is INVISIBLE or GONE. In this
  case, the client needs to obtain the frame and the insets state. Also,
  the client need to obtain the surface control when it becomes VISIBLE.

- When the insets state is stale but the config is up-to-date. This can
  happen when WindowProcessController sends the new config to the client
  before WindowState does. In this case, the client needs to obtain the
  window frame from the server.

- When the position and the size of the frame are both changed. This
  will trigger a BLAST sync, and the client needs to obtain the sync seq
  ID.

For cases above, the client needs to call the original relayout method.

Bug: 161810301
Bug: 175861051
Test: Seamless rotation, fixed rotation, and regular rotation.
Merged-In: Ifb365789fa08103773fd3180e486ba1d92042fc5
Change-Id: Ifb365789fa08103773fd3180e486ba1d92042fc5
2022-08-16 12:49:31 +08:00
Daniel Kim
aa972f2c88 Revert^2 "Add proximity state to the HotwordDetectedResult"
Reverting the previous revert commit which was merged to resolve the
broken tests. Adding a fix to the broken tests by surrounding
mAttentionManagerInternal with null checks.

dbe5ad1a72

Test: atest CtsVoiceInteractionTestCases, atest CtsVoiceInteractionTestCases:android.voiceinteraction.cts.AlwaysOnHotwordDetectorTest#testAlwaysOnHotwordDetector_startRecognitionWithData -- --abi x86_64
Change-Id: Ife5fb9220518a32a89494217f56932f290cce5f3
Merged-In: Ife5fb9220518a32a89494217f56932f290cce5f3
2022-08-15 22:45:55 +00:00
Joanne Chung
9325f9b97e Fix system toolbar doesn't use correct theme.
The toolbar should set the theme to the app's theme. Because the
service cannot get the application context, we should pass this
information from application to service.

Bug: 218833400
Test: manual. Use light/dark theme for app, the toolbar shows with
the same theme
Test: atest TextViewIntegrationTest
Test: atest android.widget.TextViewActivityTest

Change-Id: I6d4e4e117c680ce57e760a87987059eded09b2bc
2022-08-12 16:54:34 +00:00
Mady Mellor
a652dac675 Add a method in IDreamManager to check if dreaming OR in dream preview
Currently there is no signal to identify that dreaming has started
from the 'preview' option in screen saver settings. This adds a
way to query IDreamManager for this state.

Bubbles needs a way to identify this so that they can hide when
the dream preview starts, otherwise it wouldn't be an accurate
preview.

Bug: 240510360
Test: manual - (with the CL on top of this), have some bubbles and
      trigger dream preview, observe that the bubbles hide.
Change-Id: I5f67a8c793970ada05a010c8d36fd4a47b3f8565
2022-08-11 17:27:57 -07:00
Felipe Leme
88f2307219 Fixed VIMS to postpone ASSISTANT rule change on pre-created users.
RoleService should not be calling onRoleHoldersChanged() on
pre-created users, but that behavior cannot be changed because its
implemented by a system app, and pre-created users APIs are hidden.

To test it:

$ adb shell pm create-user --pre-create-only  --guest
Success: created user id 12

$ adb shell pm create-user --guest ElGuesto
Success: created user id 12

$ adb shell cmd user list --all -v
4 users:

0: id=0, name=Driver, type=system.HEADLESS, flags=ADMIN|INITIALIZED|PRIMARY|SYSTEM (running)
1: id=10, name=Driver, type=full.SECONDARY, flags=ADMIN|FULL|INITIALIZED (running) (current)
2: id=11, name=null, type=full.SECONDARY, flags=FULL|INITIALIZED (pre-created)
3: id=12, name=ElGuesto, type=full.GUEST, flags=EPHEMERAL|FULL|GUEST|INITIALIZED (converted)

$ adb shell am switch-user 12

$ adb shell dumpsys voiceinteraction |egrep '(mBound|implementation)'
  mBound=true mService=android.service.voice.IVoiceInteractionService$Stub$Proxy@77da1bc

$ adb shell cmd voiceinteraction show

Test: see bove
Bug: 216141085
Bug: 226201975

Merged-In: I12d9bb32e144ecf91ee4b452affea0dcea546127
Change-Id: I12d9bb32e144ecf91ee4b452affea0dcea546127
(cherry picked from commit 39acca1d72)
2022-08-03 16:03:02 +00:00
Tiger Huang
c77eaf873d Send size-compat scale to the client
The client computes the window frame on its own in ViewRootImpl#setView.
However, the bounds obtained from WindowConfiguration is not size-
compatible, which makes legacy apps produce wrong frames. The frame is
larger than expected, so when computing WindowInsets with size-
compatible InsetsState, the window cannot receive insets.

Although the client will receive the correct window frame from relayout,
but the first WindowInsets has been dispatched before that.

This CL sends the size-compat scale to the client, so the client can use
the correct WindowConfiguration to compute frames.

This is also a step to enable the client to perform local window layout.

Bug: 237749017
Bug: 161810301
Bug: 175861127
Test: atest StartingSurfaceDrawerTests WindowAddRemovePerfTest
      ActivityRecordTests WindowManagerServiceTests
Change-Id: I6b23901f4b1f009444c04da7e078ea971a386ad7
2022-07-27 14:10:10 +08:00
Tiger Huang
20eb3c91db Revert "Introduce updateVisibility and updateLayout"
This reverts commit:
db407ef12d, and
d8aa7f7882.

Reason for revert:
The surface size would be reduced by mTranslator unexpectedly.

Fix: 233017734
Test: Open a legacy app which has CompatibilityInfo.SCALING_REQUIRED
      and see if the app is cropped.
Change-Id: If830866328a5709cf6856fe840a804b304052003
2022-06-22 21:41:18 +08:00
Tiger Huang
157514510f Send the attached frame to the client
The attached frame is the frame of the parent window that its child
attaches to, as long as the child is not
TYPE_APPLICATION_ATTACHED_DIALOG. It is a factor while computing the
window frame.

Previously, we let the child obtain the attached frame from its parent
view root. However, if the parent and the child are not in the same
process, it can be tricky.

This CL sends the attached frame from the server to the client via
ClientWindowFrames. In this way, the child can compute its window frame
without having to accessing the parent view root.

Bug: 161810301
Bug: 175861127
Test: atest ActivityRecordTests WindowLayoutTests
Change-Id: Ia844a4c927027e305a56114216eaee2bf7933b1f
2022-06-20 21:09:40 +08:00
Chet Haase
f6541ab73e Pause animators when app is not visible am: b99cc5b4c8 am: f2e66fa4ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18528824

Change-Id: I4a220654954199c26f29a93d8afc3ad8a448547e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-07 20:28:07 +00:00
Chet Haase
f2e66fa4ed Pause animators when app is not visible am: b99cc5b4c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18528824

Change-Id: I2b041e112cfa55949a9d3f753388de3536dbd33a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-07 20:06:35 +00:00
Lucas Silva
bc20407897 Merge "Use try-with-resource statement for dream metadata to ensure proper cleanup." into tm-dev am: 2aa3ecaf9e am: 717707e390
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18700386

Change-Id: I8a10990fccf4fa381b9451364472aa8f532d8146
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 14:36:06 +00:00
Lucas Silva
b30b1683e1 Use try-with-resource statement for dream metadata to ensure proper
cleanup.

This ensures the memory is properly cleaned up if an exception is thrown
while building the DreamMetadata object.

Bug: 234343900
Test: locally on device
Change-Id: I29b2bed30c216d5e353fa0a8b0da74579b33cecb
2022-06-01 19:04:57 +00:00
TreeHugger Robot
72d9e091c4 Merge "Add support for onReject and onError for external hotword." into tm-dev am: 90579f32b3 am: 5ec4c563ce
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18308197

Change-Id: Ic3ec74aaaa851b3860e7bddcab1decc9a9db34e1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-26 17:46:37 +00:00
TreeHugger Robot
90579f32b3 Merge "Add support for onReject and onError for external hotword." into tm-dev 2022-05-26 17:14:11 +00:00
Riddle Hsu
9496a69d0b Merge "Do not force relayout for wallpaper visibility change" into tm-qpr-dev 2022-05-25 06:20:23 +00:00
Riddle Hsu
07f2a71eda Do not force relayout for wallpaper visibility change
The force-relayout was added in [1] for the side effect of [2].
Since the preserve-surface has been completely removed in [3].
So [1] can be restored to avoid unnecessary cost.

WallpaperService always calls relayout with View.VISIBLE, so
unless it requests to remove the wallpaper window, its surface
should not be removed. Though currently there might be no such
cases, add a log in case something goes wrong.

[1]: I79f97df61696eea325183e9b9057cbb10ce8cc66
[2]: Iea8ed86a9c4a7674804152aa44df7ef3d6341768
[3]: I4574ac0d3b8a63b13ac44846e729b73ca0f88f23

Bug: 233599092
Test: No additional relayout from wallpaper when turning on screen,
      swiping/closing up to home.
Test: Toggle overview from wallpaper picker while using live wallpaper.
      The wallpaper won't disappear.

Change-Id: I6673e458b5577f780be17a51cf5de1d6493ab5ca
2022-05-25 05:39:48 +00:00
Sergey Volnov
be0edce59a Add support for onReject and onError for external hotword.
Bug: 230658902
Test: atest --no-bazel-mode CtsVoiceInteractionTestCases:HotwordDetectionServiceBasicTest
Change-Id: Ic845f06c2e3943f4968067dd23a0520aecce3973
2022-05-24 01:39:21 +01:00
Chet Haase
b99cc5b4c8 Pause animators when app is not visible
Because animators are not tied to the lifecycle of any UI
elements, it is possible for an app to go into the background
and for the animators to continue running. Ideally, the app would
track the lifecycle of the activity/etc and pause or disable the
animators, but it is common for this to not happen, causing the
animators to continue spinning when the app does not need them.
The animators are not causing as much work as for a foreground
activity (since they do not cause any re-rendering), but they cause
work nonetheless by keeping Choreographer awake to continue pulsing
frames.

The ideal fix would be to introduce new API for animators that
tied them to lifecycle concepts (View, Activity, etc). But that kind
of fix would only be available for future versions of the platform,
and does not address existing app code. A workaround for the current
situation is to address the most egregious problems; infinite animators
running on backgrounded apps.

The fix here is exactly that: when an app's visible surface (either an
activity or, for Wallpapers, a WallpaperService) is backgrounded,
a request is sent to pause animators for that surface. When that surface
comes to the foreground, a request is sent to resume those animators.
Since all animators are handled on the same thread for the same process,
in AnimationHandler, we should only ever pause animators when *all*
surfaces for a process are not visible (and resume them when *any*
surface becomes visible). Also, to mitigate any issues with thrashing
animator state for apps which become only transiently backgrounded,
we delay pausing for some time.

Bug: 228598053
Bug: 233391022
Test: new AnimatorLeak CTS test, plus manual testing for activities
    and wallpapers

Change-Id: I8b9f841cc80babb972244c724968a5c085a06b69
Merged-In: I8b9f841cc80babb972244c724968a5c085a06b69
2022-05-23 20:31:19 +00:00
Shashwat Razdan
fb733f5bde Merge "Unlink to death before removing the callback wrapper in SmartspaceService/AppPredictionServic3e" into tm-dev am: 1ec2fe2e7d am: 187a2c4153
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18475472

Change-Id: I75b8a316fefe229b1fa683baa26c4e50c7b2bb45
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-23 18:29:47 +00:00
Shashwat Razdan
1ec2fe2e7d Merge "Unlink to death before removing the callback wrapper in SmartspaceService/AppPredictionServic3e" into tm-dev 2022-05-23 17:56:46 +00:00
TreeHugger Robot
3daba43266 Merge "Finish DreamActivity on creation if it is obsolete" into tm-dev am: abfe28784c am: 1f9957c76c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18090283

Change-Id: I28008d17a763141f1c8e08c6ea7bb82c1e3212b7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-21 22:09:42 +00:00
TreeHugger Robot
abfe28784c Merge "Finish DreamActivity on creation if it is obsolete" into tm-dev 2022-05-21 21:33:36 +00:00
Hyunyoung Song
9f3fde7d70 Unlink to death before removing the callback wrapper in
SmartspaceService/AppPredictionServic3e

Bug: 232548271
Test: ahat

Change-Id: Ia86343721c4c8c57e52dd7d3e76de0eba6809058
2022-05-20 15:49:02 -07:00
TreeHugger Robot
85284c84b6 Merge "Fix SearchUiService memory leak by removing DeathRecipient from CallbackWrapper" into tm-dev am: ea56fc681f am: f4aa226b18
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18453442

Change-Id: I4c142f9093f9c910d6b23a3284fa1c60dac4a96d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-19 08:39:48 +00:00