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
This commit is contained in:
Matt Pape
2019-07-12 15:53:03 -07:00
parent 8ccd63b057
commit 6a769b52e2

View File

@@ -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) {