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

Commit ec67daa9 authored by Nate Myren's avatar Nate Myren Committed by Automerger Merge Worker
Browse files

Merge "Do not show the notification prompt on noDisplay activities" into...

Merge "Do not show the notification prompt on noDisplay activities" into tm-dev am: 2ca8b4de am: d0be9bd9

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



Change-Id: I26bf0cb94a2588045dde71ac9bca4a93bcd6d217
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents d1ba99eb d0be9bd9
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManagerInternal;
import android.content.pm.PackageManagerInternal.PackageListObserver;
import android.content.pm.PermissionInfo;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -78,10 +79,12 @@ import android.util.Pair;
import android.util.Slog;
import android.util.SparseBooleanArray;

import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.app.IAppOpsCallback;
import com.android.internal.app.IAppOpsService;
import com.android.internal.infra.AndroidFuture;
import com.android.internal.policy.AttributeCache;
import com.android.internal.util.IntPair;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.server.FgThread;
@@ -1064,7 +1067,8 @@ public final class PermissionPolicyService extends SystemService {
                            ActivityInterceptorInfo info) {
                        super.onActivityLaunched(taskInfo, activityInfo, info);
                        if (!shouldShowNotificationDialogOrClearFlags(taskInfo,
                                activityInfo.packageName, info.intent, info.checkedOptions, true)) {
                                activityInfo.packageName, info.intent, info.checkedOptions, true)
                                || isNoDisplayActivity(activityInfo)) {
                            return;
                        }
                        UserHandle user = UserHandle.of(taskInfo.userId);
@@ -1139,6 +1143,22 @@ public final class PermissionPolicyService extends SystemService {
                    taskInfo, currPkg, intent, null, false);
        }

        private boolean isNoDisplayActivity(@NonNull ActivityInfo aInfo) {
            final int themeResource = aInfo.getThemeResource();
            if (themeResource == Resources.ID_NULL) {
                return false;
            }

            boolean noDisplay = false;
            final AttributeCache.Entry ent = AttributeCache.instance()
                    .get(aInfo.packageName, themeResource, R.styleable.Window, 0);
            if (ent != null) {
                noDisplay = ent.array.getBoolean(R.styleable.Window_windowNoDisplay, false);
            }

            return noDisplay;
        }

        /**
         * Determine if a particular task is in the proper state to show a system-triggered
         * permission prompt. A prompt can be shown if the task is just starting, or the task is