@@ -336,6 +336,7 @@ private void dumpProvider(Provider p, int index, PrintWriter pw) {
336336 pw .print (info .autoAdvanceViewId );
337337 pw .print (" initialLayout=#" );
338338 pw .print (Integer .toHexString (info .initialLayout ));
339+ pw .print (" uid=" ); pw .print (p .uid );
339340 pw .print (" zombie=" ); pw .println (p .zombie );
340341 }
341342
@@ -699,6 +700,10 @@ public void bindRemoteViewsService(int appWidgetId, Intent intent, IBinder conne
699700 }
700701
701702 int userId = UserHandle .getUserId (id .provider .uid );
703+ if (userId != mUserId ) {
704+ Slog .w (TAG , "AppWidgetServiceImpl of user " + mUserId
705+ + " binding to provider on user " + userId );
706+ }
702707 // Bind to the RemoteViewsService (which will trigger a callback to the
703708 // RemoteViewsAdapter.onServiceConnected())
704709 final long token = Binder .clearCallingIdentity ();
@@ -966,6 +971,13 @@ public void partiallyUpdateAppWidgetIds(int[] appWidgetIds, RemoteViews views) {
966971 ensureStateLoadedLocked ();
967972 for (int i = 0 ; i < N ; i ++) {
968973 AppWidgetId id = lookupAppWidgetIdLocked (appWidgetIds [i ]);
974+ if (id == null ) {
975+ String message = "AppWidgetId NPE: mUserId=" + mUserId
976+ + ", callingUid=" + Binder .getCallingUid ()
977+ + ", appWidgetIds[i]=" + appWidgetIds [i ]
978+ + "\n mAppWidgets:\n " + getUserWidgets ();
979+ throw new NullPointerException (message );
980+ }
969981 if (id .views != null ) {
970982 // Only trigger a partial update for a widget if it has received a full update
971983 updateAppWidgetInstanceLocked (id , views , true );
@@ -974,6 +986,18 @@ public void partiallyUpdateAppWidgetIds(int[] appWidgetIds, RemoteViews views) {
974986 }
975987 }
976988
989+ private String getUserWidgets () {
990+ StringBuffer sb = new StringBuffer ();
991+ for (AppWidgetId widget : mAppWidgetIds ) {
992+ sb .append (" id=" ); sb .append (widget .appWidgetId );
993+ sb .append (", hostUid=" ); sb .append (widget .host .uid );
994+ sb .append (", provider=" ); sb .append (widget .provider .info .provider .toString ());
995+ sb .append ("\n " );
996+ }
997+ sb .append ("\n " );
998+ return sb .toString ();
999+ }
1000+
9771001 public void notifyAppWidgetViewDataChanged (int [] appWidgetIds , int viewId ) {
9781002 if (appWidgetIds == null ) {
9791003 return ;
0 commit comments