Commit Graph

3521 Commits

Author SHA1 Message Date
Darrell Shi
01fbf6b763 Smooth transition when switching dreaming.
This CL makes the following changes
- instead of stopping any existing dream before starting a new one, now
  stop *after* the new dream has been started
- do not reuse the same task for multiple dream activities

This allows a smooth inter-task transition when swiching between dreams,
e.g. between user configured dream and system dream.

Bug: 244315094
Fix: 244315094
Test: atest DreamControllerTest
Test: atest SystemDreamTest
Test: manually on device, see video in linked bug
Change-Id: I9576470ae0f54d553a0db3aee6fb720edaa5d733
Merged-In: I9576470ae0f54d553a0db3aee6fb720edaa5d733
2022-10-21 21:14:23 +00:00
Victor Truong
feb3aa71f9 Add Callback to wake up from Dream when DreamActivity is destroyed.
When a DreamActivity is destroyed, the devices remains in a dream state.
This makes it look like the DreamActivity is stuck in the background but
it is actually destroyed and DreamService does not allow another Dream
to take its place.

Bug: 242368903
Bug: 241569844
Test: Manually tested by checking that when a DreamActivity is destroyed
the device wakes up from dreaming.

Change-Id: Idcb38f2332f3a8dea0add78a4ca506877aeca8f7
2022-10-18 17:04:26 -04:00
Chris Poultney
0f8f2d726b Merge "Lock screen live wallpaper: adds home/lock screen flag as argument." into tm-qpr-dev 2022-10-18 15:06:21 +00:00
Chris Poultney
43a06cf7e3 Lock screen live wallpaper: adds home/lock screen flag as argument.
Adds flag to wallpaper setting methods to allow specifying
home/lock/both. This will be implemented in master.

Bug: 253481667
Test: TreeHugger
Change-Id: I590b2972b102fba672726633a86727b167a4b02b
2022-10-13 21:37:46 +00:00
Darrell Shi
51afda7a0e Redraw dream overlay when a new dream is connected.
Now that we allow two dreams to have a breif overlap to have a smooth
transition, the overlay service can be bound to by two dreams at once.
Extras put in the intent are now moved to startDream because onBind()
is called only when the first dream is connected to it.

Also fix a bug that under an edge case where the service is destroyed
before dream is started, removing the view from window manager throws an
illegal argument exception.

Bug: 244315094
Bug: 249038780
Bug: 248496636
Fix: 244315094
Fix: 249038780
Test: atest DreamOverlayServiceTest
Test: manually on device, see video in bug

Change-Id: I8278e5b40a25539ce68a9c17c6cec9387d2da201
2022-10-12 18:27:38 +00:00
TreeHugger Robot
2ab63d23d3 Merge "Update DreamService -> DreamOverlayService connection to handle crashes" into tm-qpr-dev 2022-10-12 14:53:54 +00:00
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
Lucas Silva
7bbcdc1c01 Update DreamService -> DreamOverlayService connection to handle crashes
This change implements PersistentServiceConnection and
ObservableServiceConnection helper classes in framework for better
handling of crashes.

Fixes: 247103878
Test: manually by crashing systemui using adb while dreaming and
verifying that the overlay is visible
Test: atest com.android.internal.util.PersistentServiceConnectionTest
Test: atest com.android.internal.util.ObservableServiceConnectionTest

Change-Id: Ib9a7e8675e408c1724567335a3c186fe5c9f5f59
Merged-In: Ib9a7e8675e408c1724567335a3c186fe5c9f5f59
2022-10-11 13:37:59 +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