Commit Graph

29539 Commits

Author SHA1 Message Date
Chris Tate
ab012da3a2 Merge "Revoke 'always' web handler status when not autoverifying" into oc-dev 2020-02-01 01:01:34 +00:00
TreeHugger Robot
5e0b069876 Merge "Fix security problem on PermissionMonitor#hasPermission" into oc-dev 2020-01-09 13:25:46 +00:00
Bryan Ferris
e422bc0c8f Merge changes I8ae4e331,Id4e37c3e,If0fd4834 into oc-dev
* changes:
  Fixes NPE when preparing app data during init
  Use KNOWN_PACKAGES when shared lib consumers
  Handles null outInfo in deleteSystemPackageLI
2020-01-08 22:46:45 +00:00
Patrick Baumann
5d3fc339b5 Fixes NPE when preparing app data during init
When deleting an unused static shared library on Q, the user manager was
fetched via mContext.getSystemService. At this time during boot, the
service wasn't registered and so null was returned. This has already
been addressed in R with a move to injecting dependencies in the
PackageManagerService constructor.

Bug: 142083996
Bug: 141413692
Test: manual; remove static dependency on eng Q build and reboot
Change-Id: I8ae4e331d09b4734c54cdc6887b273705dce88b1
Merged-In: I8ae4e331d09b4734c54cdc6887b273705dce88b1
2020-01-08 22:46:16 +00:00
Patrick Baumann
08315953bc Use KNOWN_PACKAGES when shared lib consumers
This change ensures we find ALL known packages that could be consuming a
shared library, not only currently installed ones. Without this check,
the system may get into a state in which we have currently uninstalled
but on-device apps that depend on a shared library that does not exist
on device.

This change also leaves static shared library packages on device even if
it's not installed for any of the remaining users as it could still be
used, but marked uninstalled for users in which it is consumed.

Bug: 141413692
Bug: 142083996
Test: Manual; attempt to remove shared lib after marking its consumer uninstalled.
Test: atest StaticSharedLibsHostTests
Change-Id: Id4e37c3e4d3ea3ad5fddae5d2c7305e56f50eeea
Merged-In: Id4e37c3e4d3ea3ad5fddae5d2c7305e56f50eeea
2020-01-08 22:45:56 +00:00
Christopher Tate
6cf5f92825 Revoke 'always' web handler status when not autoverifying
If an app has previously used autoVerify to make claims about its status
re handling web navigation intents, but is updated such that it no
longer makes those claims, step down its "official handler" status as
though it had never invoked autoVerify in the first place.

Bug: 146204120
Test: manual: as described in bug; observe policy before/after via
      'adb shell dumpsys package d'
Test: atest CtsOsHostTestCases
Change-Id: I58502d1b32d793aba9aa772fa2ad5ac38acca48a
Merged-In: I58502d1b32d793aba9aa772fa2ad5ac38acca48a
2020-01-07 17:49:18 -08:00
Patrick Baumann
6afabce549 Handles null outInfo in deleteSystemPackageLI
This change adds null checks before accessing outInfo in
deleteSystemPackageLI.

Bug: 142083996
Bug: 141413692
Test: manual; remove static dependency on eng build and reboot
Change-Id: If0fd48343e89cbb77ccd25826656194195d5b0cd
(cherry picked from commit 1747101650)
Merged-In: If0fd48343e89cbb77ccd25826656194195d5b0cd
2020-01-07 22:56:56 +00:00
paulhu
305946b910 Fix security problem on PermissionMonitor#hasPermission
PermissionMonitor#hasPermission only checks permssions that app
requested but it doesn't check whether the permission can be
granted to this app. If requested permission doens't be granted
to app, this method still returns that app has this permission.
Then PermissionMonitor will pass this info to netd that means
this app still can use network even restricted network without
granted privileged permission like CONNECTIVITY_INTERNAL or
CONNECTIVITY_USE_RESTRICTED_NETWORKS.

Bug: 144679405
Test: Build, flash, manual test
Change-Id: I5eba4909e4c2e1d9f275f66be90ac36466b93e90
Merged-In: I8a1575dedd6e3b7a8b60ee2ffd475d790aec55c4
Merged-In: Iae9c273af822b18c2e6fce04848a86f8dea6410a
2019-12-18 03:47:28 +00:00
Sterling Huber
0f41dc420f Merge "RESTRICT AUTOMERGE Make toasts non-clickable" into oc-dev 2019-12-13 16:44:15 +00:00
Sterling Huber
fe4bf7926e RESTRICT AUTOMERGE
Make toasts non-clickable

Since enforcement was only on client-side, in Toast class, an app could
use reflection (or other means) to make the Toast clickable. This is a
security vulnerability since it allows tapjacking, that is, intercept touch
events and do stuff like steal PINs and passwords.

This CL brings the enforcement to the system by applying flag
FLAG_NOT_TOUCHABLE.

Test: Construct app that uses reflection to remove flag FLAG_NOT_TOUCHABLE and
      log click events. Then:
      1) Observe click events are logged without this CL.
      2) Observer click events are not logged with this CL.
Bug: 128674520

Change-Id: Ica346c853dcb9a1e494f7143ba1c38d22c0003d0
Merged In: Ica346c853dcb9a1e494f7143ba1c38d22c0003d0
2019-12-09 18:17:39 +00:00
TreeHugger Robot
88c651eab1 Merge "Force FGS notifications to show for a minimum time" into oc-dev 2019-11-08 22:30:24 +00:00
Evan Laird
c73c296b49 Force FGS notifications to show for a minimum time
It's possible for a service to do a start/stop foreground and cause a
couple of things to happen:

NotificationManagerService will enqueue a EnqueueNotificationRunnable,
post a PostNotificationRunnable (for the startForeground), and then also
enqueue a CancelNotificationRunnable. There is some racy behavior here
in that the cancel runnable can get triggered in between enqueue and
post runnables. If the cancel happens first, then
NotificationListenerServices will never get the message.

This behavior is technically allowed, however for foreground services we
want to ensure that there is a minmum amount of time that notification
listeners are aware of the foreground service so that (for instance) the
FGS notification can be shown.

This CL does two things to mitigate this problem:

1. Introduce checking in the CancelNotificationRunnable such that it
will not cancel until after PostNotificationRunnable has finished
executing.

2. Introduce a NotificationLifetimeExtender method that will allow a
lifetime extender to manage the lifetime of a notification that has been
enqueued but not inflated yet.

Bug: 119041698
Test: atest NotificationManagerServiceTest
Test: atest ForegroundServiceLifetimeExtenderTest
Change-Id: I428bc334362f6e4b95f5f0c6974b71f76175c7ae
Merged-In: I0680034ed9315aa2c05282524d48faaed066ebd0
2019-11-06 16:41:25 -05:00
TreeHugger Robot
17fd658061 Merge "DO NOT MERGE Validate wallpaper dimension while generating crop" into oc-dev 2019-11-06 04:45:50 +00:00
Jing Ji
909ff7dc71 Merge "Prevent system uid component from running in an isolated app process" into oc-dev 2019-11-05 23:52:53 +00:00
Jing Ji
0bfebadf30 Prevent system uid component from running in an isolated app process
Bug: 140055304
Test: Manua
Change-Id: Ie7f6ed23f0c6009aad0f67a00af119b02cdceac3
Merged-In: I5a1618fab529cb0300d4a8e9c7762ee218ca09eb
2019-11-05 00:50:56 +00:00
Todd Kennedy
702d394762 Only allow INSTALL_ALLOW_TEST from shell or root
Bug: 141169173
Test: Manual. App can't be installed as test-only
Change-Id: Ib6dcca7901aa549d620448c0165c22270a3042be
Merged-In: Ib6dcca7901aa549d620448c0165c22270a3042be
2019-10-24 22:27:38 +00:00
Ahan Wu
160c28c36d DO NOT MERGE Validate wallpaper dimension while generating crop
If dimensions of cropped wallpaper image exceed max texture size that
GPU can support, it will cause ImageWallpaper keep crashing
because hwui crashes by invalid operation (0x502).

Bug: 120847476.
Test: Write a custom app to set a 8000x800 bitmap as wallpaper.
Test: The cropped file will be 29600x2960 and make sysui keep crashing.
Test: After applyed this cl, wallpaper will use fallback.
Test: Sysui will not keep crashing any more.
Change-Id: Ifaf2085a0bc94448e49fa2f30066f47310586236
2019-10-02 03:13:50 +00:00
Bryan Ferris
13a804ee27 [RESTRICT AUTOMERGE] Pass correct realCallingUid to startActivity() if provided by PendingIntentRecord#sendInner()
Previously we'd ignore realCallingPid and realCallingUid that
PendingIntentRecord#sendInner() provided to startActivityInPackage().
Now we correctly pass it on, preserving past behaviour if none
provided.

Test: manual; we added logging statements to check the value of realCallingUid
in startActivitiesMayWait when launching the calendar app from the calendar widget
and verified that it was the calendar uid rather than the system uid.

Bug: 123013720
Change-Id: I0ef42c2f89b537a720f1ad5aefac756b0ccac52e
Merged-In: I0ef42c2f89b537a720f1ad5aefac756b0ccac52e
2019-06-25 22:43:38 +00:00
TreeHugger Robot
4c9fa739ff Merge "[RESTRICT AUTOMERGE] Make Lock task default consistent w/ Settings (oc)." into oc-dev 2019-05-21 18:32:27 +00:00
Jonathan Scott
3be29d429b [RESTRICT AUTOMERGE] Make Lock task default consistent w/ Settings (oc).
Bug: 127605586
Test: Manual
Change-Id: Ifb049d147f9ef30976cdb93d7bf63a761efc1b86
Merged-In: I40c9a29935d9e5a27cdcdf90187efe61035448fd
2019-05-09 12:55:47 +00:00
Christopher Dombroski
43e682abef OP_REQUEST_INSTALL_PACKAGES denied by default
Some system apps may download unknown content and the user should
be explicitly asked whether they trust these files. System apps should
explicitly use the extra NOT_UNKNOWN_SOURCE to bypass this check.

Test: Builds, boots, existing tests pass:
atest CtsPackageInstallTestCases

Locally verified they pass if CtsPackageInstallTestCases.apk was signed by
the platform cert.

Bug: 123700348
Change-Id: I3028bf8ff3f79a41521deeee43fba3c32bb1b2ca
Merged-In: I2578251906f6656b83464d1c4fc4db99165841c9
2019-04-24 18:28:06 +00:00
TreeHugger Robot
2256fd4e11 Merge "[RESTRICT_AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage" into oc-dev 2019-04-10 22:59:44 +00:00
Julia Reynolds
bed6193b59 [RESTRICT_AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage
Test: atest
Fixes: 128599467
Change-Id: I13a0ca7590f8c4b44379730e0ee2088aba400c2a
(cherry picked from commit 657d164136)
2019-04-10 10:24:32 -07:00
Varun Shah
18e7dedf6c Added missing permission check to isPackageDeviceAdminOnAnyUser.
Added a check for the MANAGE_USERS permission to
PackageManagerService#isPackageDeviceAdminOnAnyUser.

To test that the method is still usable:
1) Enable virtual storage via: adb shell sm set-virtual-disk true
2) Follow instructions by clicking on notification to set up virtual storage
3) Go to Settings -> Apps & notifications -> See all X apps
4) Click on any non-system app (example Instagram)
5) Tap Storage and you should see a "Change" button (if not, choose another app)
6) Tap Change and you should see Internal and Virtual storage options listed
7) The above step confirms the method is still usable by Settings

Bug: 128599183
Test: SafetyNet logging (steps listed above)
Change-Id: I989f1daf52a71f6c778ebd81baa6f1bf83e9a718
Merged-In: I36521fa43daab399e08869647326a7ac32d1e512
2019-04-02 15:28:52 -07:00
WyattRiley
a7cb82eb85 DO NOT MERGE - SUPL ES Extension - Safer Init and Not After Boot
Safe order of pointer setting and background thread start
Verifying mCallEndElapsedRealtimeMillis is not the initial value

Bug: 112159033
Bug: 115361555
Bug: 125124724
Test: Verified not-after-boot with test code b/115361555#comment14
Test: Reproed NPE with test thread sleep and verify fix
Change-Id: Icd2ea91d71da71c8fda109ceb70514733d35060b
2019-03-01 21:12:55 +00:00
Android Build Merger (Role)
3c2abaa4da [automerger] Select only preinstalled Spell Checker Services am: ed5973b8a8 am: 5ab7f995ba am: d71a5db522 am: 276e18c147 am: d962aabf4c
Change-Id: I4fa4b56b1472ed6c25bc431ef9ce8060cb04a1f1
2019-01-10 17:55:03 +00:00
Android Build Merger (Role)
d962aabf4c [automerger] Select only preinstalled Spell Checker Services am: ed5973b8a8 am: 5ab7f995ba am: d71a5db522 am: 276e18c147
Change-Id: I2a8463e8e885a81229b28e7e99e7432a08a04c93
2019-01-10 17:54:53 +00:00
Android Build Merger (Role)
276e18c147 [automerger] Select only preinstalled Spell Checker Services am: ed5973b8a8 am: 5ab7f995ba am: d71a5db522
Change-Id: I9e0504f59437cc8fd72e96630a6fb753a4cbb423
2019-01-10 17:54:43 +00:00
Android Build Merger (Role)
d71a5db522 [automerger] Select only preinstalled Spell Checker Services am: ed5973b8a8 am: 5ab7f995ba
Change-Id: I51fbf27831b8b981a7b1a6e2af9cf46d8e544c12
2019-01-10 17:54:29 +00:00
Android Build Merger (Role)
5ab7f995ba [automerger] Select only preinstalled Spell Checker Services am: ed5973b8a8
Change-Id: I8da1dd728ff244a1363d9274aa3f41d1c6081ee8
2019-01-10 17:54:16 +00:00
Guliz Tuncay
ed5973b8a8 Select only preinstalled Spell Checker Services
When we are setting a new spell checker as the default one in
Secure.Settings, TSMS#findAvailSpellCheckerLocked can pick up
any available spell checker service. This violates the principle
that user should be warned whenever we are setting an untrusted
spell checker service as the default service, since the warning
dialog is never shown.

Fixes: 64764051
Bug: 118694079
Test: Manually as follows:
1. Open 'packages/inputmethods/LatinIME/java/AndroidManifest.xml'
     and remove 'AndroidSpellCheckerService'
2. lunch aosp_buillhead-userdebug && make -j
3. Flash the image
4. adb shell dumpsys textservices
    -> no spell checker is recognized
5. adb shell settings get secure selected_spell_checker
    -> null
6. tapas SampleSpellCheckerService
7. make -j
8. adb install -r $OUT/system/app/SampleSpellCheckerService/SampleSpellCheckerService.apk
9. adb shell dumpsys textservices
    -> SampleSpellCheckerService is recognized
10. adb shell settings get secure selected_spell_checker
    -> null

Change-Id: I16f12293d15258c9148677c7ee09fe6dcf81e81d
Merged-In: Idab3ecc246fe9344a09e6907a0ba39f8ea6506f9
2019-01-10 17:54:12 +00:00
Android Build Merger (Role)
576e4ac184 [automerger] Revert "Select only preinstalled Spell Checker Services" am: 170e24d4e1 am: fb3b187f10 am: 7abf49d3b7 am: 1684713f2e am: cd6eba50ba
Change-Id: I9b15a7332565cc39eee4abb9faccb2d148281bf0
2019-01-10 00:44:52 +00:00
Android Build Merger (Role)
cd6eba50ba [automerger] Revert "Select only preinstalled Spell Checker Services" am: 170e24d4e1 am: fb3b187f10 am: 7abf49d3b7 am: 1684713f2e
Change-Id: Ib4cbddb955c57d2d59fb3b7fe656e21bc56266aa
2019-01-10 00:44:47 +00:00
Android Build Merger (Role)
1684713f2e [automerger] Revert "Select only preinstalled Spell Checker Services" am: 170e24d4e1 am: fb3b187f10 am: 7abf49d3b7
Change-Id: I019b36991306a8f7887b7a0b8233b2c9f1c9ed32
2019-01-10 00:44:41 +00:00
Android Build Merger (Role)
7abf49d3b7 [automerger] Revert "Select only preinstalled Spell Checker Services" am: 170e24d4e1 am: fb3b187f10
Change-Id: Idfe048ca52ab0eb317e9313f56b884d264c14fd5
2019-01-10 00:44:36 +00:00
Android Build Merger (Role)
fb3b187f10 [automerger] Revert "Select only preinstalled Spell Checker Services" am: 170e24d4e1
Change-Id: I11efc66592aada0a9b54299b6d782e92e247f811
2019-01-10 00:44:29 +00:00
Bryan Ferris
170e24d4e1 Revert "Select only preinstalled Spell Checker Services"
This reverts commit fa265ed970.

Reason for revert: The backport for b/118694079 was applied improperly.

The fix involved filtering the class members list of spell checkers into a new list before searching it. The backport filtered the list but failed to update references to the class member into references to the local variable, creating no change in observable behavior. A new version of this commit will be simultaneously uploaded, which both fixes the bad behavior and allows us to have exactly 1 CL per branch that fixes the issue.

Bug: 118694079

Change-Id: Ic38a2ca2ddede7f0929779b0f2292b7823c11e87
Merged-In: Idab3ecc246fe9344a09e6907a0ba39f8ea6506f9
2019-01-10 00:44:27 +00:00
Android Build Merger (Role)
46f972fea5 [automerger] Adding SUPL NI Emergency Extension Time am: 64306e1e7b am: 882e4e7ba0 am: 478d13d664 am: 17232346f0
Change-Id: I896fbc8000b44041f54f7e314eb1b970c4644389
2018-12-21 16:49:09 +00:00
Android Build Merger (Role)
17232346f0 [automerger] Adding SUPL NI Emergency Extension Time am: 64306e1e7b am: 882e4e7ba0 am: 478d13d664
Change-Id: Ifd8d821683c3c61e2a0e10ac4ce0c24e74e06282
2018-12-21 16:49:03 +00:00
Android Build Merger (Role)
478d13d664 [automerger] Adding SUPL NI Emergency Extension Time am: 64306e1e7b am: 882e4e7ba0
Change-Id: I2bb3f878634f4ab80f400fccbd4d1fe6610e5a82
2018-12-21 16:48:57 +00:00
Android Build Merger (Role)
882e4e7ba0 [automerger] Adding SUPL NI Emergency Extension Time am: 64306e1e7b
Change-Id: I944dc076c63ba9fd5101bc0366a342e057a13d47
2018-12-21 16:48:50 +00:00
WyattRiley
64306e1e7b Adding SUPL NI Emergency Extension Time
Configurable by carrier config.xml resource

Bug: 118839234
Bug: 115361555
Bug: 112159033
Test: On device, see b/115361555#comment14
Change-Id: I52e61656cca8b6fa6468d32d2e69bf60f4c83c61
Merged-In: I52e61656cca8b6fa6468d32d2e69bf60f4c83c61
2018-12-12 08:23:09 -08:00
WyattRiley
1cd7883a76 Adding SUPL NI Emergency Extension Time
Configurable by carrier config.xml resource

Bug: 118839234
Bug: 115361555
Bug: 112159033
Test: On device, see b/115361555#comment14
Change-Id: I52e61656cca8b6fa6468d32d2e69bf60f4c83c61
Merged-In: I52e61656cca8b6fa6468d32d2e69bf60f4c83c61
2018-12-12 08:07:25 -08:00
TreeHugger Robot
546ba589a2 Merge "RESTRICT AUTOMERGE: Added an app id security check in isAppForeground." into oc-dev 2018-11-19 22:49:58 +00:00
Android Build Merger (Role)
608d567e43 [automerger] Select only preinstalled Spell Checker Services am: fa265ed970 am: c008f3df63 am: 8df481923f am: 6e652225ad am: 6bd38ca2aa
Change-Id: I63d8639a52f0be081b397e1bb7813d1e7e4b8aa4
2018-11-14 20:07:40 +00:00
Android Build Merger (Role)
6bd38ca2aa [automerger] Select only preinstalled Spell Checker Services am: fa265ed970 am: c008f3df63 am: 8df481923f am: 6e652225ad
Change-Id: Iece38d8723b40e22f86f4aa599d42dbf9a2fcbab
2018-11-14 20:07:32 +00:00
Android Build Merger (Role)
6e652225ad [automerger] Select only preinstalled Spell Checker Services am: fa265ed970 am: c008f3df63 am: 8df481923f
Change-Id: If661d9f3206b0e9da2a98ffb14b0ff38154cd757
2018-11-14 20:07:25 +00:00
Android Build Merger (Role)
8df481923f [automerger] Select only preinstalled Spell Checker Services am: fa265ed970 am: c008f3df63
Change-Id: I9541ff6206955ed3479d5b4aa6c78f23304d3165
2018-11-14 20:07:20 +00:00
Android Build Merger (Role)
c008f3df63 [automerger] Select only preinstalled Spell Checker Services am: fa265ed970
Change-Id: I6a0825a14c8b0f38415cccacc315ba84eb88f5b9
2018-11-14 20:07:12 +00:00
Guliz Tuncay
fa265ed970 Select only preinstalled Spell Checker Services
When we are setting a new spell checker as the default one in
Secure.Settings, TSMS#findAvailSpellCheckerLocked can pick up
any available spell checker service. This violates the principle
that user should be warned whenever we are setting an untrusted
spell checker service as the default service, since the warning
dialog is never shown.

Fixes: 64764051
Bug: 118694079
Test: Manually as follows:
0. Make sure AOSP keyboard is pre-installed.
1. adb shell settings put --user 0 secure selected_spell_checker com.android.inputmethod.latin/.spellcheck.AndroidSpellCheckerService
2. tapas SampleSpellCheckerService
3. make -j
4. adb install --user 0  -r out/target/product/generic/system/app/SampleSpellCheckerService/SampleSpellCheckerService.apk
5. adb shell pm disable com.android.inputmethod.latin
6. adb shell settings get --user 0 secure selected_spell_checker
    -> com.android.inputmethod.latin/.spellcheck.AndroidSpellCheckerService
7. adb reboot
8. adb shell settings get --user 0 secure selected_spell_checker
    -> com.android.inputmethod.latin/.spellcheck.AndroidSpellCheckerService
Change-Id: I298ffbcfa5e32f43753f54fbebc40a414a5c0f9e
Merged-In: I298ffbcfa5e32f43753f54fbebc40a414a5c0f9e
2018-11-14 20:07:09 +00:00