Merge "Fix the NPE in the Settings Tile lib" into udc-d1-dev am: 2be625e241

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24104812

Change-Id: Iaea9b218a6b184992606e9df076c055ed8a56a36
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jason Chiu
2023-07-19 05:08:36 +00:00
committed by Automerger Merge Worker

View File

@@ -284,10 +284,10 @@ public abstract class Tile implements Parcelable {
* Optional key to use for this tile. * Optional key to use for this tile.
*/ */
public String getKey(Context context) { public String getKey(Context context) {
ensureMetadataNotStale(context);
if (!hasKey()) { if (!hasKey()) {
return null; return null;
} }
ensureMetadataNotStale(context);
if (mMetaData.get(META_DATA_PREFERENCE_KEYHINT) instanceof Integer) { if (mMetaData.get(META_DATA_PREFERENCE_KEYHINT) instanceof Integer) {
return context.getResources().getString(mMetaData.getInt(META_DATA_PREFERENCE_KEYHINT)); return context.getResources().getString(mMetaData.getInt(META_DATA_PREFERENCE_KEYHINT));
} else { } else {