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

Commit ba880062 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Avoid home intent normalization if it is from trusted callers" into udc-dev

parents 37302550 880b2906
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.wm;

import static android.Manifest.permission.MANAGE_ACTIVITY_TASKS;
import static android.app.ActivityManager.INTENT_SENDER_ACTIVITY;
import static android.app.ActivityOptions.ANIM_OPEN_CROSS_PROFILE_APPS;
import static android.app.PendingIntent.FLAG_CANCEL_CURRENT;
@@ -34,6 +35,7 @@ import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_ACTIVITY_TASK_ON_HOME;
import static android.content.pm.ApplicationInfo.FLAG_SUSPENDED;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;

import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
import static com.android.server.wm.ActivityInterceptorCallback.MAINLINE_SDK_SANDBOX_ORDER_ID;
@@ -518,6 +520,14 @@ class ActivityStartInterceptor {
        }

        if (mComponentSpecified) {
            Slog.w(TAG, "Starting home with component specified, uid=" + mCallingUid);
            if (mService.isCallerRecents(mCallingUid)
                    || ActivityTaskManagerService.checkPermission(MANAGE_ACTIVITY_TASKS,
                            mCallingPid, mCallingUid) == PERMISSION_GRANTED) {
                // Allow home component specified from trusted callers.
                return false;
            }

            final ComponentName homeComponent = mIntent.getComponent();
            final Intent homeIntent = mService.getHomeIntent();
            final ActivityInfo aInfo = mService.mRootWindowContainer.resolveHomeActivity(