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

Commit 74047343 authored by Wen Zhang's avatar Wen Zhang
Browse files

[Bugfix]create different pendingintent via appwidgetId

avoid get wrong intent extra when start suspended app's widget

Bug: 263768644
Change-Id: I06ba867c06429a5c58ec573458edcbf8654b7ad9
Test: Build
parent ffeb11af
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -573,12 +573,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                }
            }

            if (onClickIntent != null) {
                views.setOnClickPendingIntent(android.R.id.background,
                        PendingIntent.getActivity(mContext, 0, onClickIntent,
                                PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE));
            }

            Icon icon = appInfo.icon != 0
                    ? Icon.createWithResource(appInfo.packageName, appInfo.icon)
                    : Icon.createWithResource(mContext, android.R.drawable.sym_def_app_icon);
@@ -590,6 +584,12 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            for (int j = 0; j < widgetCount; j++) {
                Widget widget = provider.widgets.get(j);
                if (targetWidget != null && targetWidget != widget) continue;
                if (onClickIntent != null) {
                    views.setOnClickPendingIntent(android.R.id.background,
                            PendingIntent.getActivity(mContext, widget.appWidgetId, onClickIntent,
                                    PendingIntent.FLAG_UPDATE_CURRENT
                                       | PendingIntent.FLAG_IMMUTABLE));
                }
                if (widget.replaceWithMaskedViewsLocked(views)) {
                    scheduleNotifyUpdateAppWidgetLocked(widget, widget.getEffectiveViewsLocked());
                }