Commit Graph

13742 Commits

Author SHA1 Message Date
Liahav Eitan
f50ced5f1e Fix sharing to another profile where an app has multiple targets
Moves the fixUris call from onTargetSelected directly to the intent
launch to ensure the intent which is actually started is updated with
userId specific URIs.

This is a backport of ag/19657256 and ag/20063949.

Bug:242165528
Bug:244876518
Bug:242605257
Test: manually share image from personal profile to work gmail,
first with chat target then backing up and selecting the main target
Test: manually share image from work Photos app to personal WhatsApp's
frequent contact target.

Change-Id: Id815984e691bf962e19e30a54f7247d16060b3b8
Merged-In: Id815984e691bf962e19e30a54f7247d16060b3b8
Merged-In: Ib41c8a3c46afcc2d62a4c1a924212bcd98bcfbe4
Merged-In: Iabf5dcf2612fe718f2f0886e2e5e9b76f37af1e1
2022-10-26 16:10:11 +00:00
Adrian Roos
31e8959439 Merge "Restrict getInputMethodWindowVisibleHeight" into rvc-dev 2022-06-08 07:20:12 +00:00
Raphael Kim
963c9f8bc8 Remove package title from notification access confirmation intent am: 51d47ec7c8 am: c1b4cacc66
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18670434

Change-Id: I3af28be0359c45814aacf66a6952292894fac72b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-05 02:32:27 +00:00
Raphael Kim
c1b4cacc66 Remove package title from notification access confirmation intent am: 51d47ec7c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18670434

Change-Id: I4fb8082b1f94c628417c41fd6bd6d1fd4906a12e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-05 02:14:42 +00:00
Raphael Kim
51d47ec7c8 Remove package title from notification access confirmation intent
Bug: 228178437
Test: Manually confirmed on an application
Change-Id: Idad6dc0c71d7b39de0bd9e4ad922b5e6020a6184
Merged-In: Idad6dc0c71d7b39de0bd9e4ad922b5e6020a6184
2022-06-01 22:26:34 +00:00
Adrian Roos
fd7847b533 Restrict getInputMethodWindowVisibleHeight
Make sure only the app currently interacting with the IME can
query this, and restrict the API to apps targeting SDKs before T

Fixes: 204906124
Test: atest 'InputMethodManagerTest#getInputMethodWindowVisibleHeight_returnsZeroIfNotFocused'
Change-Id: If1da19a3dd8c29542afc970b4b201d87547c27a9
Merged-In: If1da19a3dd8c29542afc970b4b201d87547c27a9
2022-05-20 18:11:19 +02:00
TreeHugger Robot
508167f720 Merge "[DO NOT MERGE] Keyguard - Treat messsages to lock with priority" into rvc-dev 2022-03-08 19:20:39 +00:00
Matt Pietal
21e48cf26b [DO NOT MERGE] Keyguard - Treat messsages to lock with priority
When switching users and attempting to lock the device, the sysui main
thread becomes overwhelmed with events, creating a significant lag
between the time a message is posted and processed on the main
thread. This can be dangerous when these events are critical for
security, such as calls coming from PhoneWindowManager#lockNow() that
call KeyguardViewMediator#doKeyguardTimeout(). On older devices with
slower CPUs and less memory, the delay in processing can be
significant (15 - 30s).

The result of not prioritizing these events leads to a window of time
where a guest user can switch back to the owner, and gain access to
the owner's homescreen without needing to unlock the device with the
owner's credentials.

As a mitigation, prioritize two events originating in two specific
methods to make sure the device locks as soon as possible as well as
have the system server preemptively update its local cache.

Bug: 151095871
Test: Very manual race condition - follow steps listed in bug
Change-Id: I7585a0a5eeb308e0e32a4f77f581556d883b5cda
Merged-In: I7585a0a5eeb308e0e32a4f77f581556d883b5cda
(cherry picked from commit 28c53ab8bc)
2022-02-11 20:23:48 +00:00
Jeff Chang
be7090b09e [RESTRICT AUTOMERGE] Add hide-non-system-overlay flag for HarmfulAppWarningActivity am: 53ee9c2472
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16743244

Change-Id: I647e79eb6b60514c34fcea06c0a23cc786de639b
2022-02-09 12:46:54 +00:00
Jeff Chang
53ee9c2472 [RESTRICT AUTOMERGE] Add hide-non-system-overlay flag for HarmfulAppWarningActivity
A malicious application could overlay the activity. The overlay is
able to be tapped through, which can trick the user into starting a
harmful activity.

The CL added the flag SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS for
the activity to prevent the tapjacking/overlay attack.

Bug: 205595291
Test: atest CtsHarmfulAppWarningHostTestCases
Change-Id: Ia1a1ae0dc451e04bf5c31e3cb8cf30a0d8e32991
(cherry picked from commit a04b3666b8)
2022-01-28 04:33:49 +00:00
Jeff Chang
2c87a8a7ce [RESTRICT AUTOMERGE] Add hide-non-system-overlay flag for HarmfulAppWarningActivity
A malicious application could overlay the activity. The overlay is
able to be tapped through, which can trick the user into starting a
harmful activity.

The CL added the flag SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS for
the activity to prevent the tapjacking/overlay attack.

Bug: 205595291
Test: atest CtsHarmfulAppWarningHostTestCases
Change-Id: Ia1a1ae0dc451e04bf5c31e3cb8cf30a0d8e32991
(cherry picked from commit a04b3666b8)
2022-01-28 03:49:51 +00:00
Hai Zhang
562f1bd91f DO NOT MERGE Re-implement reading/writing Throwables from/to Parcel, without
Parcel private APIs.

Bug:197228210
Test: atest CtsSecurityTestCases:android.security.cts.AndroidFutureTest
(cherry picked from I577da5a3bc4ed537123b7eceaa5addf8f7bb0d92 and
Icc5ce702f0cd84e9136dee3c65f63619df697358)

Change-Id: I1d488c475f2f7af835a67496535cecdd6987c0cf
2021-12-07 18:14:35 +00:00
Collin Fijalkovich
978809e428 Disallow overlays for ResolverActivity
Prevents non-system apps from placing a window over the app selection
screen.

Bug: 143559931
Test: Installed test app and attempted to overlay
Change-Id: Ied05088a5007e0f10cd3e1abd8d7da8ffeb3b674
Merged-In: Ied05088a5007e0f10cd3e1abd8d7da8ffeb3b674
(cherry picked from commit 34534e1fd2)
2021-10-07 14:24:33 +00:00
TreeHugger Robot
d4be365335 Merge "Disallow overlays for ResolverActivity" into qt-dev am: f3661fc780
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15960137

Change-Id: I9b7a79b6d27be475f72549b3716d8036459b3f31
2021-10-06 21:50:19 +00:00
Collin Fijalkovich
9bd0b2f9d0 Disallow overlays for ResolverActivity
Prevents non-system apps from placing a window over the app selection
screen.

Bug: 143559931
Test: Installed test app and attempted to overlay
Change-Id: Ied05088a5007e0f10cd3e1abd8d7da8ffeb3b674
Merged-In: Ied05088a5007e0f10cd3e1abd8d7da8ffeb3b674
(cherry picked from commit 34534e1fd2)
2021-10-01 19:20:03 +00:00
Miranda Kephart
a5141a4b96 [DO NOT MERGE] Close screenshot process on user switched
Currently, we keep the process up even if the user switches,
meaning that in some cases (if the user is switched while the
screenshot UI is up) we will save images to the wrong profile.
This change makes ScreenshotHelper listen for user switches and
close the screenshot service, so that a new screenshot is
guaranteed to be constructed with the correct user's context.

Bug: 170474245
Fix: 170474245
Test: manual -- verified bad state occurs if user switches within
the timeout period, ensured that screenshots work immediately
after switching with this change.

Change-Id: I9d32d0928e6c2bda161d04555438d0dd7afef0ba
(cherry picked from commit 7ef1a5dd15)
2021-02-03 14:29:12 +00:00
Miranda Kephart
9908e1a145 [DO NOT MERGE] Close screenshot process on user switched
Currently, we keep the process up even if the user switches,
meaning that in some cases (if the user is switched while the
screenshot UI is up) we will save images to the wrong profile.
This change makes ScreenshotHelper listen for user switches and
close the screenshot service, so that a new screenshot is
guaranteed to be constructed with the correct user's context.

Bug: 170474245
Fix: 170474245
Test: manual -- verified bad state occurs if user switches within
the timeout period, ensured that screenshots work immediately
after switching with this change.

Change-Id: I9d32d0928e6c2bda161d04555438d0dd7afef0ba
(cherry picked from commit 7ef1a5dd15)
2021-01-28 18:49:29 +00:00
Miranda Kephart
41a97a3fd7 [DO NOT MERGE] Close screenshot process on user switched
Currently, we keep the process up even if the user switches,
meaning that in some cases (if the user is switched while the
screenshot UI is up) we will save images to the wrong profile.
This change makes ScreenshotHelper listen for user switches and
close the screenshot service, so that a new screenshot is
guaranteed to be constructed with the correct user's context.

Bug: 170474245
Fix: 170474245
Test: manual -- verified bad state occurs if user switches within
the timeout period, ensured that screenshots work immediately
after switching with this change.

Change-Id: I9d32d0928e6c2bda161d04555438d0dd7afef0ba
(cherry picked from commit 7ef1a5dd15)
2021-01-28 14:36:00 +00:00
Winson Chiu
643416f8a3 Merge "Remove updateIntentVerificationStatusAsUser from ResolverActivity" into qt-qpr1-dev 2020-12-08 00:26:01 +00:00
Winson Chiu
a2cee8fb7b Merge "Remove updateIntentVerificationStatusAsUser from ResolverActivity" into qt-dev 2020-12-08 00:25:56 +00:00
Winson Chiu
ca2d8ec7b9 Merge "Remove updateIntentVerificationStatusAsUser from ResolverActivity" into rvc-dev 2020-12-08 00:25:37 +00:00
TreeHugger Robot
78c8bbdfaf Merge "Revoke the uri permission when the file is deleted" into pi-dev am: 2b52397d56 am: 9095b67c84
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12455472

Change-Id: Ic42474e16756dbd77c3a343ba1f7cbf95b2c10c8
2020-12-03 06:11:17 +00:00
TreeHugger Robot
9095b67c84 Merge "Revoke the uri permission when the file is deleted" into pi-dev am: 2b52397d56
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12455472

Change-Id: I46865cbc3572d68f2ef738c95bcc05de8088f403
2020-12-03 05:48:51 +00:00
Winson
7dc064e9ed Remove updateIntentVerificationStatusAsUser from ResolverActivity
DO NOT CHERRY PICK ANYWHERE: Security issue

This API is meant to grant an app complete verification over the
domains it has declared, meaning it will always resolve the domains it
declares for web links.

This can allow an app to take over links that are unowned. Any time a
user selects "Always" when resolving an Intent in the diambiguation
dialog, this API would be called, and all subsequent resolutions of any
domain declared by the app selected would be automatically directed to
that app, with no prompt to the user.

From a quick search, it's possible that all usages of this API are
actually unintended and should be removed. Should be considered for
deprecation in the future.

Bug: 163358811

Test: none, this is not generally testable, see linked bug for context

Merged-In: Iff7f788a83af68c7fbb1c6b9a8be7b47136be2b6
Change-Id: Iff7f788a83af68c7fbb1c6b9a8be7b47136be2b6
2020-10-28 20:59:17 +00:00
Winson
ebb4d67258 Remove updateIntentVerificationStatusAsUser from ResolverActivity
DO NOT CHERRY PICK ANYWHERE: Security issue

This API is meant to grant an app complete verification over the
domains it has declared, meaning it will always resolve the domains it
declares for web links.

This can allow an app to take over links that are unowned. Any time a
user selects "Always" when resolving an Intent in the diambiguation
dialog, this API would be called, and all subsequent resolutions of any
domain declared by the app selected would be automatically directed to
that app, with no prompt to the user.

From a quick search, it's possible that all usages of this API are
actually unintended and should be removed. Should be considered for
deprecation in the future.

Bug: 163358811

Test: none, this is not generally testable, see linked bug for context

Merged-In: Iff7f788a83af68c7fbb1c6b9a8be7b47136be2b6
Change-Id: Iff7f788a83af68c7fbb1c6b9a8be7b47136be2b6
2020-10-28 20:58:56 +00:00
Winson
0220a57ec5 Remove updateIntentVerificationStatusAsUser from ResolverActivity
DO NOT CHERRY PICK ANYWHERE: Security issue

This API is meant to grant an app complete verification over the
domains it has declared, meaning it will always resolve the domains it
declares for web links.

This can allow an app to take over links that are unowned. Any time a
user selects "Always" when resolving an Intent in the diambiguation
dialog, this API would be called, and all subsequent resolutions of any
domain declared by the app selected would be automatically directed to
that app, with no prompt to the user.

From a quick search, it's possible that all usages of this API are
actually unintended and should be removed. Should be considered for
deprecation in the future.

Bug: 163358811

Test: none, this is not generally testable, see linked bug for context

Merged-In: Iff7f788a83af68c7fbb1c6b9a8be7b47136be2b6
Change-Id: Iff7f788a83af68c7fbb1c6b9a8be7b47136be2b6
2020-10-28 20:58:32 +00:00
Ivan Chiang
c5c373c258 Revoke the uri permission when the file is deleted
When the file is deleted, renamed or moved, revoke all uri
permissions with the file

Bug: 157474195
Test: manual test with DocumentsUI
Test: atest DocumentsTest#testAfterMoveDocumentInStorage_revokeUriPermission
Change-Id: I4ffb183630aadb2d87b0965e8cecf88af15f4534
Merged-In: I4ffb183630aadb2d87b0965e8cecf88af15f4534
(cherry picked from commit 9efd606f43)
2020-08-26 07:23:34 +00:00
Ivan Chiang
2c80a71789 Revoke the uri permission when the file is deleted
When the file is deleted, renamed or moved, revoke all uri
permissions with the file

Bug: 157474195
Test: manual test with DocumentsUI
Test: atest DocumentsTest#testAfterMoveDocumentInStorage_revokeUriPermission
Change-Id: I4ffb183630aadb2d87b0965e8cecf88af15f4534
Merged-In: I4ffb183630aadb2d87b0965e8cecf88af15f4534
(cherry picked from commit 9efd606f43)
2020-08-26 06:40:54 +00: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
TreeHugger Robot
f65210f9ca Merge "Updated docs for IInlineSuggestionsRequestCallback.aidl." into rvc-dev 2020-07-14 23:02:42 +00:00
Adam He
4a1935d990 Updated docs for IInlineSuggestionsRequestCallback.aidl.
Fixes: 160729678
Test: atest android.autofillservice.cts.inline
Change-Id: Ie49267a594524651f0965296c164f7d1e0628cee
2020-07-13 15:28:28 -07:00
TreeHugger Robot
e15860371f Merge "Insets: make decorFitsSystemWindowInsets apply cutout insets" into rvc-dev 2020-07-09 21:18:44 +00:00
Adrian Roos
895a2e626a Merge "Fix IME flicker: move hiding the surface into the control target" into rvc-dev 2020-07-09 17:02:15 +00:00
Adrian Roos
2260ce4daf Fix IME flicker: move hiding the surface into the control target
Fixes a flicker that occurs during transitions between windows.

This happens for two reasons:

1.) Control is immediately transferred to the new window, and the
    previous window didn't get a chance to play the animation.

    This is addressed by adding logic to keep control on the
    exiting window for the duration of the transition - similar to
    what we do with the target for z-ordering purposes.

2.) Upon the input connection being severed, the InputMethodService
    immediately hides its window, preventing any animations whenever
    the input connection changes

    This is addressed by moving hiding of the surface into the
    controlling windows - where upon receiving control, we now
    trigger removal of the IME surface if we don't show it.

Additionally:

- Now ensures that any requests from the ImeInsetsSourceConsumer
  ensure that they come from the window that is currently served
  by IMM.

- Removes the transparancy clause from isImeTargetFromDisplayContentAndImeSame
  to match the updated IME target computation in DisplayContent in [1].

[1]: Iedd5f7407926167f4891ce9b7e9a79e22751e668

Fixes: 153145997
Fixes: 150902448
Test: atest WindowInsetsAnimationControllerTests
Test: atest DisplayContentTests InsetsSourceConsumerTest
Test: Open app with IME, press HOME button, verify IME smoothly animates away
Test: Open Messages, open a thread, open IME. Click search icon, verify IME opens in the search activity
Change-Id: I4910c2a06cc67b0470477b245fc1de54b75f10f9
2020-07-09 14:46:55 +02:00
Adrian Roos
e1be3292da Insets: make decorFitsSystemWindowInsets apply cutout insets
Fixes: 160698434
Test: atest WindowTest
Change-Id: I15d74c83daad3206c6f3fc4f6a3f082d20d3c769
Merged-In: I15d74c83daad3206c6f3fc4f6a3f082d20d3c769
2020-07-09 11:14:00 +00:00
lpeter
a383f339de Change to drop down when the inline suggestions don't be shown in IME.
The current implementation has a problem where:
In the autofill side, there can be multiple autofill sessions existed
at the same time. But in the IME side, there is always only one
InlineSuggestionSession at any given time. It will cause the previous
autofill session to fail communication with IME.

It would better change to drop down UI when the autofill inline
suggestions don't be shown in IME.

How to reproduce this issue:
To add an input field with autofillable into the authentication activity
of InlineFillService. To tap on the input field of the authentication
activity during the authentication flow. After completing the
authentication, the inline suggestions won't be shown in IME.

BTW, if the input field is marked as non-autofillable, this issue won't
occur.

Manual verification:
1.Tested this patch with InlineFillService and it worked well.
2.Feng also helped to test this patch with the webview
(sort of randomly), and didn't find any broken case

Bug: 158877106
Test: atest CtsInputMethodTestCases
Test: atest CtsAutoFillServiceTestCases
Test: new CTS test Ie1d9055b0eabfcaa00861869467be8dcee25833e
Test: manual verification with InlineFillService
Test: Feng also helped to test this patch with the webview
Change-Id: Ib06edd823fa4478f34362164f3f7dd3544e51705
2020-07-08 17:40:00 +00:00
TreeHugger Robot
47f3249ce1 Merge "Sharesheet - Fix crash when suspended app is selected" into rvc-dev 2020-06-30 01:46:20 +00:00
Matt Pietal
406a5a9331 Sharesheet - Fix crash when suspended app is selected
After selecting a suspended app, the package monitor would be
unregistered even though the app would never be launched. This would
cause an IllegalStateException on the next selection of any target,
and crash the sharesheet. Check for a suspended target before
unregistering.

Fixes: 160015744
Test: manual, follow BR steps and pause an app
Change-Id: I1b0c79bad0fa75aea6a543b6f8a4848720faa0c8
2020-06-29 17:49:20 -04:00
Antoan Angelov
625ada924d Merge "Also skip calling ShortcutManager APIs if work user is locked" into rvc-dev 2020-06-29 16:32:25 +00:00
arangelov
0769484c9a Also skip calling ShortcutManager APIs if work user is locked
Fixes: 159696895
Test: manual
Test: atest ChooserActivityTest
Change-Id: I3e90d5a56551b9952bfcd761c3a19a309d7cbc72
2020-06-29 14:27:29 +00:00
Antoan Angelov
054a8e32c1 Merge "Don't call ShortcutManager APIs if the work profile is paused or locked" into rvc-dev 2020-06-26 18:37:02 +00:00
Pinyao Ting
d76fa360e7 Merge "Deference mAppPredictor on destroy" into rvc-dev 2020-06-26 18:10:39 +00:00
Matt Pietal
3bc3fcfff0 Merge "Sharesheet - Cache loading of icons" into rvc-dev 2020-06-26 11:39:02 +00:00
Pinyao Ting
023c4e9234 Deference mAppPredictor on destroy
Bug: 159731946
Test: manual
Change-Id: If2bce9cdb8ff2cc96e78003a30b105c348b6e506
2020-06-25 16:45:23 -07:00
TreeHugger Robot
08e440cab2 Merge "Request keyguard dismissal from suspend dialog" into rvc-dev 2020-06-25 21:33:56 +00:00
Matt Pietal
563d7b9d17 Sharesheet - Cache loading of icons
For sharesheet, assume that the reordering of elements will make the
last assigned ViewHolder invalid for async icon loading. If we already
have an async task for the particular ResolveInfo, update the
ViewHolder target when it's complete.

Fixes: 158172791
Test: atest ChooserActivityTest ResolverActivityTest
Change-Id: I0ea9f443512f91e8fa4c5d6b72a35e9231e69e51
2020-06-25 16:01:49 -04:00
TreeHugger Robot
14eea93f57 Merge "Rank ChooserTargets using appTarget#rank instead of shortcut#rank. AppTarget#rank contains the score passed from AppPredictionService." into rvc-dev 2020-06-25 18:45:55 +00:00
arangelov
733b8ee06e Don't call ShortcutManager APIs if the work profile is paused or locked
Fixes: 159696895
Test: atest ChooserActivityTest
Change-Id: I7516cae8bc85b70a20693d8c23dc835e8cb69d1a
2020-06-25 19:44:10 +01:00
TreeHugger Robot
3c34454ae9 Merge "Also listen to ACTION_MANAGED_PROFILE_AVAILABLE in sharesheet ResolverActivity." into rvc-dev 2020-06-25 16:29:26 +00:00
Daniel Sandler
fc86cfb5bd Merge "Fixed bug: Not everyone has home controls yet, or pets." into rvc-dev 2020-06-25 14:34:52 +00:00