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

Commit 6a769b52 authored by Matt Pape's avatar Matt Pape
Browse files

Update GenerationRegistry to account for config table.

Update comments and increase the initial size of the backing store by
one to account for the new table.

Test: atest FrameworksCoreTests:DeviceConfigTest
      adding/updating/deleting global and secure settings via adb

Change-Id: I68aad0c4c80611a35479f27a1bb03cdf751545fc
parent 8ccd63b0
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -22,14 +22,16 @@ import android.provider.Settings;
import android.util.MemoryIntArray;
import android.util.Slog;
import android.util.SparseIntArray;

import com.android.internal.annotations.GuardedBy;

import java.io.IOException;

/**
 * This class tracks changes for global/secure/system tables on a
 * per user basis and updates a shared memory region which client
 * processes can read to determine if their local caches are stale,
 * This class tracks changes for config/global/secure/system tables
 * on a per user basis and updates a shared memory region which
 * client processes can read to determine if their local caches are
 * stale.
 */
final class GenerationRegistry {
    private static final String LOG_TAG = "GenerationRegistry";
@@ -114,11 +116,12 @@ final class GenerationRegistry {
    @GuardedBy("mLock")
    private MemoryIntArray getBackingStoreLocked() {
        if (mBackingStore == null) {
            // One for the global table, two for system and secure tables for a
            // managed profile (managed profile is not included in the max user
            // count), ten for partially deleted users if users are quickly removed,
            // and twice max user count for system and secure.
            final int size = 1 + 2 + 10 + 2 * UserManager.getMaxSupportedUsers();
            // One for the config table, one for the global table, two for system
            // and secure tables for a managed profile (managed profile is not
            // included in the max user count), ten for partially deleted users if
            // users are quickly removed, and twice max user count for system and
            // secure.
            final int size = 1 + 1 + 2 + 10 + 2 * UserManager.getMaxSupportedUsers();
            try {
                mBackingStore = new MemoryIntArray(size);
                if (DEBUG) {