Commit Graph

104125 Commits

Author SHA1 Message Date
Makoto Onuki
822fbf618b Merge "Only allow the system server to connect to sync adapters" into qt-dev am: 99ccb4e5b0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18701369

Change-Id: Ie919bc05747a1009507a29de429c3e8d043fed9d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-08 19:20:45 +00:00
Makoto Onuki
99ccb4e5b0 Merge "Only allow the system server to connect to sync adapters" into qt-dev 2022-06-08 18:56:23 +00:00
Adrian Roos
c2d5e2cb81 Merge "Restrict getInputMethodWindowVisibleHeight" into qt-dev am: fa1fc20874
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18489968

Change-Id: Ia6115784eb97b7759750acca4f271772f8a59ba8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-08 07:40:15 +00:00
Adrian Roos
fa1fc20874 Merge "Restrict getInputMethodWindowVisibleHeight" into qt-dev 2022-06-08 07:21:26 +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
Makoto Onuki
7d1397a544 Only allow the system server to connect to sync adapters
Bug: 203229608
Test: Manual test with changing the check logic + debug log
Change-Id: If18009f61360564d02dcda9b1e5fa15685e3250f
(cherry picked from commit 58270527d1)
2022-06-01 20:35:21 +00:00
Adrian Roos
094ea03f14 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
Manjeet Rulhania
e545a5dbbf Merge "Fix duplicate permission privilege escalation" into qt-dev am: b22a6d7372
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18078651

Change-Id: I0e25a20970648244c2a72581478f5a09ac6c10b4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Merged-In: I1910dca44104e35a57eba4acfa8188cd9b8626ac
Merged-In: I34120fff2ec2a158dfa55779d2afd4bbd49487ff
Merged-In: I9bc839836786a0876e67fd73c05f8944bb532249
2022-05-16 19:49:21 +00:00
Manjeet Rulhania
31bd425bb6 Fix duplicate permission privilege escalation
Duplicate permissions definition with different group allows
privilege permission escalation to a different permission group.

Android studio and gradle plugin does not allow duplicate
permissions with different attributes, these tools only allow
if duplicate permissions are exact copies.

Also platform stores permissions in map at multiple places with
permission name as key. This suggests that we can disallow
duplicate permissions during package install/update.

Bug: 213323615
Test: manual
Change-Id: I6f44e740897305e7a0553c1cf6c3af37faf02a2e
Merged-In: I1910dca44104e35a57eba4acfa8188cd9b8626ac
Merged-In: I34120fff2ec2a158dfa55779d2afd4bbd49487ff
Merged-In: I9bc839836786a0876e67fd73c05f8944bb532249
2022-05-16 02:06:24 +00:00
Eric Biggers
7271432de9 [RESTRICT AUTOMERGE] Ignore errors preparing user storage for existing users am: 493aa93b84
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17416381

Change-Id: Ic637e5b26c0bb2561497dfb7ba1cf5300bd6af99
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-25 18:05:04 +00:00
Eric Biggers
a318c254f7 Merge changes from topic "unencrypted-dirs-q" into qt-dev
* changes:
  [RESTRICT AUTOMERGE] Log to EventLog on prepareUserStorage failure
  [RESTRICT AUTOMERGE] Ignore errors preparing user storage for existing users
  [RESTRICT AUTOMERGE] UserDataPreparer: reboot to recovery for system user only
  [RESTRICT AUTOMERGE] UserDataPreparer: reboot to recovery if preparing user storage fails
  [RESTRICT AUTOMERGE] StorageManagerService: don't ignore failures to prepare user storage
  Check user unlocked before write to /data/system_ce/0/snapshots
2022-04-25 17:11:39 +00:00
Jonathan Scott
9a83111755 [qt] RESTRICT AUTOMERGE Add finalizeWorkProfileProvisioning. am: c5037ec63c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17587088

Change-Id: I61409fd5cbe7409884dfe0e439d116b098cf9737
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-06 20:34:58 +00:00
Jonathan Scott
c5037ec63c [qt] RESTRICT AUTOMERGE Add finalizeWorkProfileProvisioning.
Test: atest android.devicepolicy.cts.DevicePolicyManagerTest
Bug: 210469972
Change-Id: I2de99f9ccd8b27ffdc2562fa451f132e73d54317
2022-04-06 09:23:04 +00:00
Eric Biggers
493aa93b84 [RESTRICT AUTOMERGE] Ignore errors preparing user storage for existing users
Unfortunately we can't rule out the existence of devices where the user
storage wasn't properly prepared, due to StorageManagerService
previously ignoring errors from mVold.prepareUserStorage, combined with
OEMs potentially creating files in per-user directories too early.  And
forcing these broken devices to be factory reset upon taking an OTA is
not currently considered to be acceptable.

One option is to only check for prepareUserStorage errors on devices
that launched with T or later.  However, this is a serious issue and it
would be strongly preferable to do more than that.

Therefore, this CL makes it so that errors are checked for all new
users, rather than all new devices.  A field ignorePrepareStorageErrors
is added to the user record; it is only ever set to true implicitly,
when reading a user record from disk that lacks this field.  This field
is used by StorageManagerService to decide whether to check for errors.

Bug: 164488924
Bug: 224585613
Test: Intentionally made a device affected by this issue by reverting
      the CLs that introduced the error checks, and changing vold to
      inject an error into prepareUserStorage.   Then, flashed a build
      with this CL without wiping userdata.  The device still boots, as
      expected, and the log shows that the error was intentionally
      ignored.  Tested that if a second user is added, the error is
      *not* ignored and the second user's storage is destroyed before it
      can be used.  Finally, wiped the device and verified that it won't
      boot up anymore, as expected since error checking is enabled for
      the system user in that case.
Change-Id: I9bdd1a4bf5b14542adb901f264a91d489115c89b
(cherry picked from commit 60d8318c47)
Merged-In: I9bdd1a4bf5b14542adb901f264a91d489115c89b
2022-03-29 20:52:58 +00:00
Ayush Sharma
efb797700e Fix security hole in GateKeeperResponse am: 658c53c47c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17343925

Change-Id: I809144ca234b9cd144b59a4666f75c5b18cc6b1f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-25 12:41:07 +00:00
Ayush Sharma
658c53c47c Fix security hole in GateKeeperResponse
GateKeeperResponse has inconsistent writeToParcel() and
createFromParcel() methods, making it possible for a malicious app to
create a Bundle that changes contents after reserialization. Such
Bundles can be used to execute Intents with system privileges.

We fixed related issues previously for GateKeeperResponse class, but
one of the case was remaining when payload is byte array of size 0,
Fixing this case now.

Bug: 220303465
Test: With the POC provided in the bug.
Change-Id: Ida28d611edd674e76ed39dd8037f52abcba82586
Merged-In: Ida28d611edd674e76ed39dd8037f52abcba82586

(cherry picked from commit 46653a91c3)

Change-Id: I486348c7a01c6f59c952b20fb4a36429fff22958
2022-03-23 06:39:47 +00:00
David Christie
21b078e99f Update GeofenceHardwareRequestParcelable to match parcel/unparcel format. am: 3e1ffdb294
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17185256

Change-Id: Ibe74e45782650c3d972306d5e43b4f646be78c79
2022-03-22 05:10:37 +00:00
David Christie
3e1ffdb294 Update GeofenceHardwareRequestParcelable to match parcel/unparcel format.
Test: manual
Bug: 216631962

Change-Id: I3d6d1be9d6c312fe0bf98f600ff8fc9c617f8ec3
2022-03-14 19:55:11 +00:00
TreeHugger Robot
972089ad30 Merge "Always restart apps if base.apk gets updated." into qt-dev am: 1adea76f46
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17111536

Change-Id: Ia35c96940c76b46ff5754f493e4f0c64df211483
2022-03-09 06:21:41 +00:00
Alex Buynytskyy
a5dd59db6d Always restart apps if base.apk gets updated.
Bug: 219044664
Fixes: 219044664
Test: atest PackageManagerShellCommandTest
Change-Id: I27a0c5009b2d5f1ea51618b9acfa1e6ccee71296
Merged-In: I27a0c5009b2d5f1ea51618b9acfa1e6ccee71296
2022-03-09 00:48:11 +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
Wu Ahan
14bfa0cbd0 Revert "DO NOT MERGE: Decode the input of both setStream and setResource calls first" am: b6509bdc18
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16630308

Change-Id: I27fbeb2579c5c9ff689b5e20593195bd66cb07de
2022-01-19 22:14:40 +00:00
Wu Ahan
b6509bdc18 Revert "DO NOT MERGE: Decode the input of both setStream and setResource calls first"
This reverts commit 4d91b5aa0b.

Reason for revert: will deliver a better fix for that, ag/16580245.

Change-Id: I8691f47251157aae83d326eb808dd1c06b13a420
2022-01-13 14:41:40 +00:00
Wu Ahan
6910c87745 DO NOT MERGE: Decode the input of both setStream and setResource calls first am: 4d91b5aa0b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16379915

Change-Id: Id96d35b0fe3a31764221a584faed10dd8780f849
2021-12-09 01:43:00 +00:00
Wu Ahan
4d91b5aa0b DO NOT MERGE: Decode the input of both setStream and setResource calls first
The size of the input of both setStream and setResource may very big
that system server got oom while handling it, so we try to decode it
first before copying it to the wallpaper path, if the decoding fails, we
treat the input as an invalid input.

Bug: 204087139
Test: Manually set wallpaper, no PDoS observed.
Change-Id: I014cf461954992782b3dfa0dde67c98a572cc770
2021-12-06 03:16:20 +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
TreeHugger Robot
204ab511e0 Merge "DO NOT MERGE Bluetooth: Fix formatting in getAlias()" into qt-dev 2021-09-02 01:20:06 +00:00
Hansong Zhang
e15791bbe1 DO NOT MERGE Bluetooth: Fix formatting in getAlias()
Bug: 180747689
Test: manual
Change-Id: Ic309f4aad116fd424d5d0d0e2016d61be8826b78
Merged-In: Ic309f4aad116fd424d5d0d0e2016d61be8826b78
2021-09-01 21:18:43 +00:00
TreeHugger Robot
7c35716464 Merge "Prevent apps from spamming addAccountExplicitly. See comment here for the discussion on solution https://b.corp.google.com/issues/169762606#comment14" into pi-dev am: a0226b4d47 am: b65ac540d2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15405290

Change-Id: Ib461e405d5bd65840fb4f1e962cdd5d1061a882f
2021-09-01 00:49:59 +00:00
TreeHugger Robot
b65ac540d2 Merge "Prevent apps from spamming addAccountExplicitly. See comment here for the discussion on solution https://b.corp.google.com/issues/169762606#comment14" into pi-dev am: a0226b4d47
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15405290

Change-Id: I0073721ed49e40043625eae71f37e7e95b987340
2021-09-01 00:34:01 +00:00
TreeHugger Robot
a0226b4d47 Merge "Prevent apps from spamming addAccountExplicitly. See comment here for the discussion on solution https://b.corp.google.com/issues/169762606#comment14" into pi-dev 2021-09-01 00:11:36 +00:00
Aseem Kumar
5beff34b57 Prevent apps from spamming addAccountExplicitly.
See comment here for the discussion on solution
https://b.corp.google.com/issues/169762606#comment14

Change-Id: If212df3a3b7be1de0fb26b8e88b2fcbb8077c253

Bug: 169762606
(cherry picked from commit 11053c17b3)

Change-Id: I6494366a5695daedc3f4f0046da9e130a5363f5f
Merged-In: If212df3a3b7be1de0fb26b8e88b2fcbb8077c253
2021-08-19 09:52:26 +00:00
Rhed Jao
eeb7b8088a Merge "DO NOT MERGE Apply a maximum char count to the load label api" into qt-dev 2021-08-11 03:39:57 +00:00
Jayant Chowdhary
250fe56a43 Merge "camera2: Fix exception swallowing in params classes createFromParcel" into oc-mr1-dev am: b8ce7ca6a1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15134188

Change-Id: I5b6f88fae24d84d5ca766e9dc3ef8863b7d35f9c
2021-08-10 00:41:08 +00:00
Jayant Chowdhary
b8ce7ca6a1 Merge "camera2: Fix exception swallowing in params classes createFromParcel" into oc-mr1-dev 2021-08-10 00:28:42 +00:00
Jayant Chowdhary
0cf6fdb791 Merge "camera2: Fix exception swallowing in params classes createFromParcel" into qt-dev am: 93e157955a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15121727

Change-Id: Id144b968bf5154f806900e030d2b7bd9ba407c67
2021-08-09 15:20:58 +00:00
Jayant Chowdhary
93e157955a Merge "camera2: Fix exception swallowing in params classes createFromParcel" into qt-dev 2021-08-09 15:12:22 +00:00
Rhed Jao
7380c153b9 DO NOT MERGE Apply a maximum char count to the load label api
The system is overwhelmed by an enormous label string returned by
the load label api. This cl truncates the label string if it exceeds
the maximum safe length.

Also update the max safe label length to 1000 characters, which is
enough.

Bug: 67013844
Test: atest PackageManagerTest
Change-Id: Ia4d768cc93a47cfb8b6f7c4b6dc73abd801809bd
Merged-in: Ia4d768cc93a47cfb8b6f7c4b6dc73abd801809bd
2021-08-03 14:00:18 +08:00
Rhed Jao
b55d314f46 DO NOT MERGE Apply a maximum char count to the load label api
The system is overwhelmed by an enormous label string returned by
the load label api. This cl truncates the label string if it exceeds
the maximum safe length.

Also update the max safe label length to 1000 characters, which is
enough.

Bug: 67013844
Test: atest PackageManagerTest
Change-Id: Ia4d768cc93a47cfb8b6f7c4b6dc73abd801809bd
Merged-in: Ia4d768cc93a47cfb8b6f7c4b6dc73abd801809bd
2021-08-02 22:46:59 +08:00
Rhed Jao
6172201637 DO NOT MERGE Apply a maximum char count to the load label api
The system is overwhelmed by an enormous label string returned by
the load label api. This cl truncates the label string if it exceeds
the maximum safe length.

Also update the max safe label length to 1000 characters, which is
enough.

Bug: 67013844
Test: atest PackageManagerTest
Change-Id: Ia4d768cc93a47cfb8b6f7c4b6dc73abd801809bd
Merged-in: Ia4d768cc93a47cfb8b6f7c4b6dc73abd801809bd
2021-08-02 19:44:04 +08:00
Bernardo Rufino
57af3050d2 Merge "Fix background bypass via notifications" into qt-dev am: 22500563c1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14937196

Change-Id: I193bfe3aa08c2f397d037c2d5c71cfe854cd343d
2021-06-30 15:30:23 +00:00
Bernardo Rufino
22500563c1 Merge "Fix background bypass via notifications" into qt-dev 2021-06-30 07:18:28 +00:00
Jayant Chowdhary
8a11538146 camera2: Fix exception swallowing in params classes createFromParcel
Do not catch exceptions when we attempt to create the following classes
from a parcel
- OutputConfiguration
- VendorTagDescriptor
- VendorTagDescriptorCache
- SessionConfiguration
This could cause subsequent parcel information to be read incorrectly.

Bug: 188675581

Test: Sample app which tries to write invalid data into an
      OutputConfiguration parcel to send in an intent via Broadcast. When read by the receiving app,
      gets an exception (not swallowed).

Merged-In: I745ca49daa6ca36b1020d518e9f346b52684f2b1
Change-Id: I745ca49daa6ca36b1020d518e9f346b52684f2b1
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit 6b0bcd60c8)
2021-06-29 01:08:28 +00:00
Jayant Chowdhary
7bf30cb92a camera2: Fix exception swallowing in params classes createFromParcel
Do not catch exceptions when we attempt to create the following classes
from a parcel
- OutputConfiguration
- VendorTagDescriptor
- VendorTagDescriptorCache
- SessionConfiguration
This could cause subsequent parcel information to be read incorrectly.

Bug: 188675581

Test: Sample app which tries to write invalid data into an
      OutputConfiguration parcel to send in an intent via Broadcast. When read by the receiving app,
      gets an exception (not swallowed).

Merged-In: I745ca49daa6ca36b1020d518e9f346b52684f2b1
Change-Id: I745ca49daa6ca36b1020d518e9f346b52684f2b1
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit 6b0bcd60c8)
2021-06-28 20:32:50 +00:00
TreeHugger Robot
c5b814ec0a Merge "Improve ellipsize performance" into qt-dev am: 819dc46ad3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14904663

Change-Id: Ia1486957866ef76461718a679e956e7ee627cc7f
2021-06-26 02:45:31 +00:00
Bernardo Rufino
14c1c7b4a7 Fix background bypass via notifications
This is a CP of ag/14736230 to qt-dev.

Apps were able to bypass BAL and BG-FGS restrictions by retrieving their
own notifications and firing their PI since those were allowlisted for
those operations.

Now we strip the token that granted them that ability
from notifications returned via NM.getActiveNotifications(), which
returns the notifications of the caller.

Notifications returned via notification listener APIs still contain such
token, as they should.

Bug: 185388103
Bug: 169821287
Test: Manually tested
Change-Id: I2ede0d639a560f6acacec3864a0a7d23af152ba5
Merged-In: I2ede0d639a560f6acacec3864a0a7d23af152ba5
(cherry picked from commit 5fbeff59df)
2021-06-24 18:15:04 +00:00
Seigo Nonaka
ae1912b62f Improve ellipsize performance
Instead of iterate all ellipsized characters, only iterate the necessary
ranges for copying.

Bug: 188913943
Test: atest CtsTextTestCases CtsGraphicsTestCases CtsWidgetTestCases
Change-Id: I3d03b1e3897e427c23fbe51315f412c57a4ce9e9
Merged-In: I3d03b1e3897e427c23fbe51315f412c57a4ce9e9
2021-06-08 20:38:08 -07:00