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

Commit 69af3e57 authored by Liana Kazanova (xWF)'s avatar Liana Kazanova (xWF) Committed by Android (Google) Code Review
Browse files

Revert "Prevent unintentional removal of widgets pinned by another host"

This reverts commit 931b3043.

Reason for revert: DroidMonitor: Potential culprit for http://b/389135845 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I5733456908de0497b9adbae2bdae420acdc26a1b
parent 931b3043
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -5666,13 +5666,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
        }

        public boolean canAccessAppWidget(Widget widget, int uid, String packageName) {
            if (isDifferentPackageFromHost(widget.host, packageName)
                    && isDifferentPackageFromProvider(widget.provider, packageName)) {
                // Apps providing AppWidget are only allowed to access widgets provided by the
                // same package. Similarly, apps hosting AppWidget are only allowed to access
                // widgets hosted by the same package.
                return false;
            }
            if (isHostInPackageForUid(widget.host, uid, packageName)) {
                // Apps hosting the AppWidget have access to it.
                return true;
@@ -5775,19 +5768,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                    && provider.id.componentName.getPackageName().equals(packageName);
        }

        private boolean isDifferentPackageFromHost(
                @Nullable final Host host, @Nullable final String packageName) {
            return packageName == null || host == null || host.id == null
                || !packageName.equals(host.id.packageName);
        }

        private boolean isDifferentPackageFromProvider(
                @Nullable final Provider provider, @Nullable final String packageName) {
            return packageName == null || provider == null || provider.id == null
                    || provider.id.componentName == null
                    || !packageName.equals(provider.id.componentName.getPackageName());
        }

        private boolean isProfileEnabled(int profileId) {
            final long identity = Binder.clearCallingIdentity();
            try {