Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9c01150 authored by Hai Zhang's avatar Hai Zhang
Browse files

Refresh legacy permission state right before writing.

This was done for writing all the package settings, but not when
writing runtime permissions only, so we need to do the same thing
before we eventually migrate to new persistence.

This is a resubmission of ag/12960409, and this time we are only
refreshing the state before the actual disk write, instead of whenever
a write is (asynchronously) scheduled.

Bug: 171755668
Bug: 172297495
Test: manual
Test: atest MultiUserPerfTests
Change-Id: I0c69b6a28ea795c6682e28a26be4cac5b644c70b
parent bbecd0e7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5390,6 +5390,8 @@ public final class Settings {
            mHandler.removeMessages(userId);
            mWriteScheduled.delete(userId);

            mPermissionDataProvider.writeLegacyPermissionStateTEMP();

            int version = mVersions.get(userId, INITIAL_VERSION);

            String fingerprint = mFingerprints.get(userId);
+10 −0
Original line number Diff line number Diff line
@@ -61,4 +61,14 @@ public interface LegacyPermissionDataProvider {
     */
    @NonNull
    int[] getGidsForUid(int uid);

    /**
     * This method should be in PermissionManagerServiceInternal, however it is made available here
     * as well to avoid serious performance regression in writePermissionSettings(), which seems to
     * be a hot spot and we should delay calling this method until wre are actually writing the
     * file, instead of every time an async write is requested.
     *
     * @see PermissionManagerServiceInternal#writeLegacyPermissionStateTEMP()
     */
    void writeLegacyPermissionStateTEMP();
}