From d862802fdd066309fde07f286d9add8f4d496379 Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Wed, 15 Mar 2023 14:27:02 -0700 Subject: [PATCH] [SettingsProvider] reduce log spam In certain test scenarios, there can be more users than GenerationRegistry expects. Reduce the log spam in such scenarios. BUG: 273617810 Test: builds Change-Id: Ibef453f51d3eb6584c5189664af363ecb4d9243b --- .../android/providers/settings/GenerationRegistry.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/SettingsProvider/src/com/android/providers/settings/GenerationRegistry.java b/packages/SettingsProvider/src/com/android/providers/settings/GenerationRegistry.java index a4c59ea4178df..a8eeec3c2f240 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/GenerationRegistry.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/GenerationRegistry.java @@ -31,7 +31,7 @@ import java.io.IOException; /** * This class tracks changes for config/global/secure/system tables - * on a per user basis and updates shared memory regions which + * on a per-user basis and updates shared memory regions which * client processes can read to determine if their local caches are * stale. */ @@ -196,7 +196,9 @@ final class GenerationRegistry { if (backingStore == null) { try { if (mNumBackingStore >= NUM_MAX_BACKING_STORE) { - Slog.e(LOG_TAG, "Error creating backing store - at capacity"); + if (DEBUG) { + Slog.e(LOG_TAG, "Error creating backing store - at capacity"); + } return null; } backingStore = new MemoryIntArray(MAX_BACKING_STORE_SIZE); @@ -256,7 +258,9 @@ final class GenerationRegistry { + " on user:" + SettingsState.getUserIdFromKey(key)); } } else { - Slog.e(LOG_TAG, "Could not allocate generation index"); + if (DEBUG) { + Slog.e(LOG_TAG, "Could not allocate generation index"); + } } } return index;