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

Commit 1ab7656b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Return widget uid only when it is bound to screen" into tm-qpr-dev am:...

Merge "Return widget uid only when it is bound to screen" into tm-qpr-dev am: 731c7bb7 am: 417d9b1e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20861026



Change-Id: I2a2a4fdc26fe22330cc257bc89179ab10d072959
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 45ec1d72 417d9b1e
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -826,7 +826,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            if (host != null) {
                host.callbacks = null;
                pruneHostLocked(host);
                mAppOpsManagerInternal.updateAppWidgetVisibility(host.getWidgetUids(), false);
                mAppOpsManagerInternal.updateAppWidgetVisibility(host.getWidgetUidsIfBound(),
                        false);
            }
        }
    }
@@ -897,12 +898,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            Host host = lookupHostLocked(id);

            if (host != null) {
                try {
                    mAppOpsManagerInternal.updateAppWidgetVisibility(host.getWidgetUids(), false);
                } catch (NullPointerException e) {
                    Slog.e(TAG, "setAppWidgetHidden(): Getting host uids: " + host.toString(), e);
                    throw e;
                }
                mAppOpsManagerInternal.updateAppWidgetVisibility(host.getWidgetUidsIfBound(),
                        false);
            }
        }
    }
@@ -4370,14 +4367,15 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                    PendingHostUpdate.appWidgetRemoved(appWidgetId));
        }

        public SparseArray<String> getWidgetUids() {
        public SparseArray<String> getWidgetUidsIfBound() {
            final SparseArray<String> uids = new SparseArray<>();
            for (int i = widgets.size() - 1; i >= 0; i--) {
                final Widget widget = widgets.get(i);
                if (widget.provider == null) {
                    if (DEBUG) {
                        Slog.e(TAG, "Widget with no provider " + widget.toString());
                        Slog.d(TAG, "Widget with no provider " + widget.toString());
                    }
                    continue;
                }
                final ProviderId providerId = widget.provider.id;
                uids.put(providerId.uid, providerId.componentName.getPackageName());