Set LEGACY_STORAGE only from READ_EXTERNAL_STORAGE

Not from WRITE_EXTERNAL_STORAGE. Otherwise it is not clear what happens
if one of the permissions is white-listed and one not. This can lead to
a loop where we try to set LEGACY_STORAGE to two different values.

Fixes: 135763654, 135742960
Bug: 135933014
Test: atest RestrictedPermissionsTest
Change-Id: I35883f12525360fd7f760750505a27644342955c
3 files changed