From 60264730c1c730dbd184bc661fd398d97f5df31d Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Tue, 18 Sep 2012 13:39:42 -0700 Subject: [PATCH] Tweaking how settings adds keyguard widgets -> Fix for issue 7173587 -> Fix for issue 7173877 Change-Id: I60cd3952113335df60292f67461d50f6c8bd2ed3 --- core/java/android/appwidget/AppWidgetHost.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/java/android/appwidget/AppWidgetHost.java b/core/java/android/appwidget/AppWidgetHost.java index 84a447f4ca4cc..185fb5a8de594 100644 --- a/core/java/android/appwidget/AppWidgetHost.java +++ b/core/java/android/appwidget/AppWidgetHost.java @@ -19,6 +19,7 @@ package android.appwidget; import java.util.ArrayList; import java.util.HashMap; +import android.app.ActivityThread; import android.content.Context; import android.os.Handler; import android.os.IBinder; @@ -201,12 +202,15 @@ public class AppWidgetHost { * @return a appWidgetId * @hide */ - public static int allocateAppWidgetIdForHost(String packageName, int hostId) { + public static int allocateAppWidgetIdForSystem(int hostId) { checkCallerIsSystem(); try { if (sService == null) { bindService(); } + Context systemContext = + (Context) ActivityThread.currentActivityThread().getSystemContext(); + String packageName = systemContext.getPackageName(); return sService.allocateAppWidgetId(packageName, hostId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); @@ -240,7 +244,7 @@ public class AppWidgetHost { * Stop listening to changes for this AppWidget. * @hide */ - public static void deleteAppWidgetIdForHost(int appWidgetId) { + public static void deleteAppWidgetIdForSystem(int appWidgetId) { checkCallerIsSystem(); try { if (sService == null) {