diff options
author | d34d <clark@cyngn.com> | 2015-07-14 17:19:16 -0700 |
---|---|---|
committer | Dave Kover <kover@cyngn.com> | 2016-05-27 15:58:55 -0700 |
commit | a7f5cf212800a52de5cf0b1e85b0f732141c88cf (patch) | |
tree | 60defe512bc44d816960f24d278e31112b767ce2 /src/com/android/launcher3/Utilities.java | |
parent | e6b7a315c802e68db1360994073aa4807aa966be (diff) | |
download | android_packages_apps_Trebuchet-a7f5cf212800a52de5cf0b1e85b0f732141c88cf.tar.gz android_packages_apps_Trebuchet-a7f5cf212800a52de5cf0b1e85b0f732141c88cf.tar.bz2 android_packages_apps_Trebuchet-a7f5cf212800a52de5cf0b1e85b0f732141c88cf.zip |
Wallpaper: Allow multiple partners to be loaded
Current implementation only allowed for one partner, and any
additional partner wallpapers would not be loaded.
Partrner.get() still returns the first partner and a new method,
getAllPartners is introduced which returns a list of all partners.
Ticket: FEIJ-410
Change-Id: I06b6cd4817d3f812e2110967f075d68ee31cb318
(cherry picked from commit 93e949f1a9931bf7188f4d2a43630603d7a388a8)
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 8ffc471a3..c7ff19f7f 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -63,6 +63,7 @@ import com.android.launcher3.settings.SettingsProvider; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.List; import java.util.Locale; import java.util.Set; import java.util.regex.Matcher; @@ -527,6 +528,29 @@ public final class Utilities { } } + /* + * Finds all system apks which had a broadcast receiver listening to a particular action. + * @param action intent action used to find the apk + * @return a list of pairs of apk package name and the resources. + */ + static List<Pair<String, Resources>> findSystemApks(String action, PackageManager pm) { + final Intent intent = new Intent(action); + List<Pair<String, Resources>> systemApks = new ArrayList<Pair<String, Resources>>(); + for (ResolveInfo info : pm.queryBroadcastReceivers(intent, 0)) { + if (info.activityInfo != null && + (info.activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { + final String packageName = info.activityInfo.packageName; + try { + final Resources res = pm.getResourcesForApplication(packageName); + systemApks.add(Pair.create(packageName, res)); + } catch (NameNotFoundException e) { + Log.w(TAG, "Failed to find resources for " + packageName); + } + } + } + return systemApks; + } + /** * Returns a widget with category {@link AppWidgetProviderInfo#WIDGET_CATEGORY_SEARCHBOX} * provided by the same package which is set to be global search activity. |