Skip to content
Commit c57e3455 authored by Martijn Coenen's avatar Martijn Coenen
Browse files

Make sure we preserve preserveLegacyExternalStorage.

This could be lost after a reboot, due to the following sequence of
events:

1) App targets SDK 29 and has LEGACY_STORAGE
2) App updates to a version with targetSdk30 and preserveLegacyExternalStorage
3) App maintains LEGACY_STORAGE, because we currently have it and preserve
was requested
4) We reboot
5) When evaluating the READ_EXTERNAL_STORAGE permission, we check
whether we should grant the LEGACY_STORAGE extra app-op by calling
mayAllowExtraAppOp(); this call returns false, because there's a
check whether the app *currently* has LEGACY_STORAGE, which isn't true.
6) We then check whether we should deny LEGACY_STORAGE if it was
previously granted; this returns true, because it was implemented as the
inverse of 5)
7) LEGACY_STORAGE is denied

Fix this by more explicitly coding what allows us to get the appop, and
how it can be removed once we already have it.

Bug: 169943139
Test: atest RestrictedStoragePermissionTest
Test: atest PreserveLegacyStorageHostTest
Change-Id: Ic24372348118ad9ed818a28f377e0decc78b9ecc
parent 3acf806a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment