Fix preserveLegacyExternalStorage logic
preserveLegacyExternalStorage manifest flag was introduced in Ifd3410ed1a60f4c0e8414fce904139b539e13ad8 and allowed any app regardless of targetSdk preserve legacy storage. I31d4b989aea3b73efb3a3634073ee06b88e3ee97 changed the condition to only allow targetSdk <= Q preserve legacy. However, it interestingly didn't break behavior (cos we have test to catch this RestrictedStoragePermissionTest#testStorageTargetingSdk30CanPreserveLegacyOnUpdateFromLegacy) Here's why: In SoftRestrictedPermissionPolicy, the preserve flag effectively only changes the behavior of the mayDenyExtraAppOpIfGranted method. So even though the mayAllowExtraAppOp method behavior was changed, this wasn't needed to be true for the preserve flag to be effective, since it was only 'keeping' any existing legacy appop based on the result of mayDenyExtraAppOpIfGranted. There's no good regression test to add for this, since in theory behavior actually didn't regress. In any case, we now fix the condition. Test: atest RestrictedStoragePermissionTest Bug: 151393596 Change-Id: I1f4fd8c7b9fab72c2649f6c8e8fd91edc12d5cb4
Loading
Please register or sign in to comment