From 70206e6ff2454a22c8336a09ff74b210c16df50e Mon Sep 17 00:00:00 2001 From: Doris Ling Date: Tue, 24 Apr 2018 13:19:27 -0700 Subject: [PATCH] Fixes crash in security settings. - save the loaded icon drawable to a local var, instead of setting it to the tile.icon and later reset it, so that we will not run into the issue that the icon will become null when this is called multiple times. Change-Id: I0fc73961986cddd97ad1e74b0609ac47d011cc87 Fixes: 78445923 Test: make RunSettingsRoboTests --- .../settings/dashboard/DashboardFeatureProviderImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java index 82a5b9bd2d0..f403e056da0 100644 --- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java @@ -258,10 +258,9 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { Log.w(TAG, "Failed to get icon from uri " + uri); return; } - tile.icon = Icon.createWithResource(iconInfo.first, iconInfo.second); + final Icon icon = Icon.createWithResource(iconInfo.first, iconInfo.second); ThreadUtils.postOnMainThread(() -> { - preference.setIcon(tile.icon.loadDrawable(preference.getContext())); - tile.icon = null; + preference.setIcon(icon.loadDrawable(preference.getContext())); } ); });