Use the standard place holder for the security summary.
This removes the jitter when the cache is empty and there is
initially no summary, and then it is replaced by the fetched summary
when it's available.
Bug:36463348
Test: make RunSettingsRoboTests
Change-Id: I92cafbf23e3c562a470488dea28fd5106bbdf885
diff --git a/src/com/android/settings/security/SecurityFeatureProviderImpl.java b/src/com/android/settings/security/SecurityFeatureProviderImpl.java
index 5a2ff2e..8c6d343 100644
--- a/src/com/android/settings/security/SecurityFeatureProviderImpl.java
+++ b/src/com/android/settings/security/SecurityFeatureProviderImpl.java
@@ -24,6 +24,7 @@
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
+import com.android.settings.R;
import com.android.settings.trustagent.TrustAgentManager;
import com.android.settings.trustagent.TrustAgentManagerImpl;
import com.android.settingslib.drawer.DashboardCategory;
@@ -49,8 +50,6 @@
@VisibleForTesting
static final Drawable DEFAULT_ICON = null;
- @VisibleForTesting
- static final String DEFAULT_SUMMARY = " ";
@VisibleForTesting
static Map<String, Pair<String, Integer>> sIconCache = new TreeMap<>();
@@ -118,7 +117,7 @@
// from shifting when the final summary is injected.
final String summaryUri =
tile.metaData.getString(TileUtils.META_DATA_PREFERENCE_SUMMARY_URI, null);
- String summary = DEFAULT_SUMMARY;
+ String summary = context.getString(R.string.summary_placeholder);
if ((summaryUri != null) && sSummaryCache.containsKey(summaryUri)) {
summary = sSummaryCache.get(summaryUri);
}
diff --git a/tests/robotests/src/com/android/settings/security/SecurityFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/security/SecurityFeatureProviderImplTest.java
index 77f5ecc..9cc33a3 100644
--- a/tests/robotests/src/com/android/settings/security/SecurityFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/security/SecurityFeatureProviderImplTest.java
@@ -28,6 +28,7 @@
import android.util.Pair;
import com.android.settings.SettingsRobolectricTestRunner;
+import com.android.settings.R;
import com.android.settings.TestConfig;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.Tile;
@@ -180,7 +181,7 @@
mImpl.initPreferences(mContext, screen, dashboardCategory);
verify(screen.findPreference(MOCK_KEY)).setIcon(SecurityFeatureProviderImpl.DEFAULT_ICON);
verify(screen.findPreference(MOCK_KEY))
- .setSummary(SecurityFeatureProviderImpl.DEFAULT_SUMMARY);
+ .setSummary(mContext.getString(R.string.summary_placeholder));
}
@Test