From 0fe505bf82a265e51c556d7204976651cde7f55c Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 6 Aug 2014 09:55:36 -0700 Subject: Autoinstalls loading xml > Launcher checkes for an apk in the system image with a broadcast receiver for action: com.android.launcher3.action.LAUNCHER_CUSTOMIZATION > Default layout is parsed from that apk, which can also contain icons and string resources used in the layout config Change-Id: I44fc9e7c3134f525f7b5db29f4e8bb56e17ce445 --- .../src/com/android/launcher3/Partner.java | 24 ++++------------------ 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/Partner.java b/WallpaperPicker/src/com/android/launcher3/Partner.java index 418ec9ff9..1753997a0 100644 --- a/WallpaperPicker/src/com/android/launcher3/Partner.java +++ b/WallpaperPicker/src/com/android/launcher3/Partner.java @@ -16,13 +16,9 @@ package com.android.launcher3; -import android.content.Intent; -import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.ResolveInfo; import android.content.res.Resources; -import android.util.Log; +import android.util.Pair; import java.io.File; @@ -32,8 +28,6 @@ import java.io.File; * the system. */ public class Partner { - private static final String TAG = "Partner"; - /** Marker action used to discover partner */ private static final String ACTION_PARTNER_CUSTOMIZATION = "com.android.launcher3.action.PARTNER_CUSTOMIZATION"; @@ -55,19 +49,9 @@ public class Partner { */ public static synchronized Partner get(PackageManager pm) { if (!sSearched) { - final Intent intent = new Intent(ACTION_PARTNER_CUSTOMIZATION); - 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); - sPartner = new Partner(packageName, res); - break; - } catch (NameNotFoundException e) { - Log.w(TAG, "Failed to find resources for " + packageName); - } - } + Pair apkInfo = Utilities.findSystemApk(ACTION_PARTNER_CUSTOMIZATION, pm); + if (apkInfo != null) { + sPartner = new Partner(apkInfo.first, apkInfo.second); } sSearched = true; } -- cgit v1.2.3