Merge "Mark widget_update broadcasts sent post-boot as "interactive"."

This commit is contained in:
Sudheer Shanka
2023-02-16 18:39:48 +00:00
committed by Android (Google) Code Review

View File

@@ -1142,7 +1142,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
} else {
// For any widget other then the first one, we just send update intent
// as we normally would.
sendUpdateIntentLocked(provider, new int[]{appWidgetId});
sendUpdateIntentLocked(provider, new int[]{appWidgetId}, true);
}
// Schedule the future updates.
@@ -2379,7 +2379,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
if (!canSendCombinedBroadcast) {
// If this function is called by mistake, send two separate broadcasts instead
sendEnableIntentLocked(p);
sendUpdateIntentLocked(p, appWidgetIds);
sendUpdateIntentLocked(p, appWidgetIds, true);
return;
}
@@ -2399,12 +2399,12 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
sendBroadcastAsUser(intent, p.id.getProfile(), true);
}
private void sendUpdateIntentLocked(Provider provider, int[] appWidgetIds) {
private void sendUpdateIntentLocked(Provider provider, int[] appWidgetIds,
boolean interactive) {
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
intent.setComponent(provider.id.componentName);
// Periodic background widget update heartbeats are not an interactive use case
sendBroadcastAsUser(intent, provider.id.getProfile(), false);
sendBroadcastAsUser(intent, provider.id.getProfile(), interactive);
}
private void sendDeletedIntentLocked(Widget widget) {
@@ -3589,7 +3589,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
scheduleNotifyProviderChangedLocked(widget);
}
// Now that we've told the host, push out an update.
sendUpdateIntentLocked(provider, appWidgetIds);
sendUpdateIntentLocked(provider, appWidgetIds, false);
}
}
providersUpdated = true;