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
This commit is contained in:
Doris Ling
2018-04-24 13:19:27 -07:00
parent 465f6da15b
commit 70206e6ff2

View File

@@ -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()));
}
);
});