From 1fc3aee9a260c38e14637869d5f5327a35af69ff Mon Sep 17 00:00:00 2001 From: Shahriyar Amini Date: Wed, 28 Dec 2016 08:51:04 -0800 Subject: [PATCH] Make methods for Tile content provider data public. Bug: 31002801 Test: make RunSettingsLibRoboTests The public methods can be used to retrieve Tile data from a content provider dynamically in other Settings components. Change-Id: I2ce1f5620b09dcdb46f315c8ddf04e9f07084e91 --- .../android/settingslib/drawer/TileUtils.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java b/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java index baf12a0ceefee..a0109e29831a6 100644 --- a/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java +++ b/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java @@ -414,13 +414,28 @@ public class TileUtils { return false; } - private static int getIconFromUri(Context context, String uriString, + /** + * Gets the icon resource id from content provider. + * @param Context context + * @param uriString URI for the content provider + * @param providerMap Maps URI authorities to providers + * @return Resource id if returned by the content provider, otherwise 0 + */ + public static int getIconFromUri(Context context, String uriString, Map providerMap) { Bundle bundle = getBundleFromUri(context, uriString, providerMap); return (bundle != null) ? bundle.getInt(META_DATA_PREFERENCE_ICON, 0) : 0; } - private static String getTextFromUri(Context context, String uriString, + /** + * Gets text associated with the input key from the content provider. + * @param Context context + * @param uriString URI for the content provider + * @param providerMap Maps URI authorities to providers + * @param key Key mapping to the text in bundle returned by the content provider + * @return Text associated with the key, if returned by the content provider + */ + public static String getTextFromUri(Context context, String uriString, Map providerMap, String key) { Bundle bundle = getBundleFromUri(context, uriString, providerMap); return (bundle != null) ? bundle.getString(key) : null;