Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 821eb602 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

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

parents 11b23bcc e056b30e
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -1142,7 +1142,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            } else {
            } else {
                // For any widget other then the first one, we just send update intent
                // For any widget other then the first one, we just send update intent
                // as we normally would.
                // as we normally would.
                sendUpdateIntentLocked(provider, new int[]{appWidgetId});
                sendUpdateIntentLocked(provider, new int[]{appWidgetId}, true);
            }
            }


            // Schedule the future updates.
            // Schedule the future updates.
@@ -2379,7 +2379,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
        if (!canSendCombinedBroadcast) {
        if (!canSendCombinedBroadcast) {
            // If this function is called by mistake, send two separate broadcasts instead
            // If this function is called by mistake, send two separate broadcasts instead
            sendEnableIntentLocked(p);
            sendEnableIntentLocked(p);
            sendUpdateIntentLocked(p, appWidgetIds);
            sendUpdateIntentLocked(p, appWidgetIds, true);
            return;
            return;
        }
        }


@@ -2399,12 +2399,12 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
        sendBroadcastAsUser(intent, p.id.getProfile(), true);
        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 intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
        intent.setComponent(provider.id.componentName);
        intent.setComponent(provider.id.componentName);
        // Periodic background widget update heartbeats are not an interactive use case
        sendBroadcastAsUser(intent, provider.id.getProfile(), interactive);
        sendBroadcastAsUser(intent, provider.id.getProfile(), false);
    }
    }


    private void sendDeletedIntentLocked(Widget widget) {
    private void sendDeletedIntentLocked(Widget widget) {
@@ -3589,7 +3589,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                                scheduleNotifyProviderChangedLocked(widget);
                                scheduleNotifyProviderChangedLocked(widget);
                            }
                            }
                            // Now that we've told the host, push out an update.
                            // Now that we've told the host, push out an update.
                            sendUpdateIntentLocked(provider, appWidgetIds);
                            sendUpdateIntentLocked(provider, appWidgetIds, false);
                        }
                        }
                    }
                    }
                    providersUpdated = true;
                    providersUpdated = true;