PeopleSpaceWidgetManager: log slightly more We're seeing a weird probelm where Conversation widgets are still showing content even though the relevant notifications have been dismissed. I'm currently assuming that the widget is failing to update for some reason when the notification is dismissed. This change logs all the warnings and errors in PeopleSpaceWidgetManager unconditionally, and includes the widget ID in all of them. Hopefully this will give us a clue what's going wrong when the notification is dismissed. Bug: 230268718 Test: manual; errors logged trying to add widget with no convo notifs Change-Id: Ie7fdf91dccbb4b02ba4b9ffa9e20ec758abb96b9
diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java index 1a7bd8c..18be0aa 100644 --- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
@@ -289,7 +289,7 @@ if (DEBUG) Log.d(TAG, "Updating widget: " + appWidgetId); PeopleSpaceTile tile = getTileForExistingWidget(appWidgetId); if (tile == null) { - Log.e(TAG, "Matching conversation not found for shortcut ID"); + Log.e(TAG, "Matching conversation not found for widget " + appWidgetId); } updateAppWidgetOptionsAndView(appWidgetId, tile); widgetIdToTile.put(appWidgetId, tile); @@ -308,7 +308,7 @@ if (DEBUG) Log.d(TAG, "Widget: " + appWidgetId + " for: " + key.toString()); if (!PeopleTileKey.isValid(key)) { - Log.e(TAG, "Cannot update invalid widget"); + Log.e(TAG, "Invalid tile key updating widget " + appWidgetId); return; } RemoteViews views = PeopleTileViewHelper.createRemoteViews(mContext, tile, appWidgetId, @@ -330,7 +330,7 @@ /** Updates tile in app widget options and the current view. */ public void updateAppWidgetOptionsAndView(int appWidgetId, PeopleSpaceTile tile) { if (tile == null) { - if (DEBUG) Log.w(TAG, "Storing null tile"); + Log.w(TAG, "Storing null tile for widget " + appWidgetId); } synchronized (mTiles) { mTiles.put(appWidgetId, tile); @@ -348,7 +348,7 @@ try { return getTileForExistingWidgetThrowing(appWidgetId); } catch (Exception e) { - Log.e(TAG, "failed to retrieve tile for widget ID " + appWidgetId, e); + Log.e(TAG, "failed to retrieve tile for existing widget " + appWidgetId, e); return null; } } @@ -388,7 +388,7 @@ boolean supplementFromStorage) throws PackageManager.NameNotFoundException { if (!PeopleTileKey.isValid(key)) { - Log.e(TAG, "PeopleTileKey invalid: " + key.toString()); + Log.e(TAG, "Invalid tile key finding tile for existing widget " + appWidgetId); return null; } @@ -423,7 +423,7 @@ // Add current state. return getTileWithCurrentState(storedTile.build(), ACTION_BOOT_COMPLETED); } catch (RemoteException e) { - Log.e(TAG, "getTileFromPersistentStorage failing", e); + Log.e(TAG, "getTileFromPersistentStorage failing for widget " + appWidgetId, e); return null; } } @@ -591,10 +591,7 @@ if (DEBUG) Log.d(TAG, "Augmenting tile for existing widget: " + widgetId); PeopleSpaceTile tile = getTileForExistingWidget(widgetId); if (tile == null) { - if (DEBUG) { - Log.w(TAG, "Widget: " + widgetId - + ". Null tile for existing widget, skipping update."); - } + Log.w(TAG, "Null tile for existing widget " + widgetId + ", skipping update."); return Optional.empty(); } String contactUriString = mSharedPrefs.getString(String.valueOf(widgetId), null); @@ -816,7 +813,7 @@ tile = getTileFromPersistentStorage(key, appWidgetId, /* supplementFromStorage= */ false); } catch (PackageManager.NameNotFoundException e) { - Log.e(TAG, "Cannot add widget since app was uninstalled"); + Log.e(TAG, "Cannot add widget " + appWidgetId + " since app was uninstalled"); return; } if (tile == null) { @@ -851,7 +848,7 @@ Collections.singletonList(tile.getId()), tile.getUserHandle(), LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS); } catch (Exception e) { - Log.w(TAG, "failed to cache shortcut", e); + Log.w(TAG, "failed to cache shortcut for widget " + appWidgetId, e); } PeopleSpaceTile finalTile = tile; mBgExecutor.execute( @@ -862,7 +859,7 @@ public void registerConversationListenerIfNeeded(int widgetId, PeopleTileKey key) { // Retrieve storage needed for registration. if (!PeopleTileKey.isValid(key)) { - if (DEBUG) Log.w(TAG, "Could not register listener for widget: " + widgetId); + Log.w(TAG, "Invalid tile key registering listener for widget " + widgetId); return; } TileConversationListener newListener = new TileConversationListener(); @@ -911,7 +908,7 @@ widgetSp.getInt(USER_ID, INVALID_USER_ID), widgetSp.getString(PACKAGE_NAME, null)); if (!PeopleTileKey.isValid(key)) { - if (DEBUG) Log.e(TAG, "Could not delete " + widgetId); + Log.e(TAG, "Invalid tile key trying to remove widget " + widgetId); return; } storedWidgetIdsForKey = new HashSet<>( @@ -1083,7 +1080,8 @@ synchronized (mLock) { existingTile = getTileForExistingWidgetThrowing(appWidgetId); if (existingTile == null) { - Log.e(TAG, "Matching conversation not found for shortcut ID"); + Log.e(TAG, "Matching conversation not found for widget " + + appWidgetId); continue; } updatedTile = getTileWithCurrentState(existingTile, entryPoint); @@ -1091,7 +1089,7 @@ } } catch (PackageManager.NameNotFoundException e) { // Delete data for uninstalled widgets. - Log.e(TAG, "package no longer found for tile", e); + Log.e(TAG, "Package no longer found for widget " + appWidgetId, e); JobScheduler jobScheduler = mContext.getSystemService(JobScheduler.class); if (jobScheduler != null && jobScheduler.getPendingJob(PeopleBackupFollowUpJob.JOB_ID) != null) {