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

Commit ec1ef09c authored by Winson Chung's avatar Winson Chung
Browse files

2/ Add API to start overview activity with assist callbacks

- Only the recents component package can launch the overview activity
  directly, and if an assist data receiver is provided, then assist data
  will be proxied to the caller.

Bug: 67864419
Test: com.android.server.am.RecentTasksTest
Test: com.android.server.am.AssistDataRequesterTest
Test: CtsVoiceInteractionTestCases
Change-Id: Icdd7e6716a84c11e9262ce5453f7d39ae7d8ce77
parent da2818fe
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,27 @@ public abstract class ActivityManagerInternal {
     */
     */
    public static final int APP_TRANSITION_SNAPSHOT = 4;
    public static final int APP_TRANSITION_SNAPSHOT = 4;


    /**
     * The bundle key to extract the assist data.
     */
    public static final String ASSIST_KEY_DATA = "data";

    /**
     * The bundle key to extract the assist structure.
     */
    public static final String ASSIST_KEY_STRUCTURE = "structure";

    /**
     * The bundle key to extract the assist content.
     */
    public static final String ASSIST_KEY_CONTENT = "content";

    /**
     * The bundle key to extract the assist receiver extras.
     */
    public static final String ASSIST_KEY_RECEIVER_EXTRAS = "receiverExtras";


    /**
    /**
     * Grant Uri permissions from one app to another. This method only extends
     * Grant Uri permissions from one app to another. This method only extends
     * permission grants if {@code callingUid} has permission to them.
     * permission grants if {@code callingUid} has permission to them.
+3 −1
Original line number Original line Diff line number Diff line
@@ -422,6 +422,9 @@ interface IActivityManager {
            in Bundle options, int userId);
            in Bundle options, int userId);
    int startAssistantActivity(in String callingPackage, int callingPid, int callingUid,
    int startAssistantActivity(in String callingPackage, int callingPid, int callingUid,
            in Intent intent, in String resolvedType, in Bundle options, int userId);
            in Intent intent, in String resolvedType, in Bundle options, int userId);
    int startRecentsActivity(in IAssistDataReceiver assistDataReceiver, in Bundle options,
            int userId);
    int startActivityFromRecents(int taskId, in Bundle options);
    Bundle getActivityOptions(in IBinder token);
    Bundle getActivityOptions(in IBinder token);
    List<IBinder> getAppTasks(in String callingPackage);
    List<IBinder> getAppTasks(in String callingPackage);
    void startSystemLockTaskMode(int taskId);
    void startSystemLockTaskMode(int taskId);
@@ -429,7 +432,6 @@ interface IActivityManager {
    void finishVoiceTask(in IVoiceInteractionSession session);
    void finishVoiceTask(in IVoiceInteractionSession session);
    boolean isTopOfTask(in IBinder token);
    boolean isTopOfTask(in IBinder token);
    void notifyLaunchTaskBehindComplete(in IBinder token);
    void notifyLaunchTaskBehindComplete(in IBinder token);
    int startActivityFromRecents(int taskId, in Bundle options);
    void notifyEnterAnimationComplete(in IBinder token);
    void notifyEnterAnimationComplete(in IBinder token);
    int startActivityAsCaller(in IApplicationThread caller, in String callingPackage,
    int startActivityAsCaller(in IApplicationThread caller, in String callingPackage,
            in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho,
            in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho,
+3 −16
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


package android.service.voice;
package android.service.voice;


import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;

import android.annotation.Nullable;
import android.annotation.Nullable;
import android.app.Activity;
import android.app.Activity;
import android.app.Dialog;
import android.app.Dialog;
@@ -46,7 +48,6 @@ import android.view.Gravity;
import android.view.KeyEvent;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.FrameLayout;
@@ -63,8 +64,6 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.lang.ref.WeakReference;


import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;

/**
/**
 * An active voice interaction session, providing a facility for the implementation
 * An active voice interaction session, providing a facility for the implementation
 * to interact with the user in the voice interaction layer.  The user interface is
 * to interact with the user in the voice interaction layer.  The user interface is
@@ -110,16 +109,6 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
     */
     */
    public static final int SHOW_SOURCE_ACTIVITY = 1<<4;
    public static final int SHOW_SOURCE_ACTIVITY = 1<<4;


    // Keys for Bundle values
    /** @hide */
    public static final String KEY_DATA = "data";
    /** @hide */
    public static final String KEY_STRUCTURE = "structure";
    /** @hide */
    public static final String KEY_CONTENT = "content";
    /** @hide */
    public static final String KEY_RECEIVER_EXTRAS = "receiverExtras";

    final Context mContext;
    final Context mContext;
    final HandlerCaller mHandlerCaller;
    final HandlerCaller mHandlerCaller;


@@ -1423,9 +1412,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
    public void setContentView(View view) {
    public void setContentView(View view) {
        ensureWindowCreated();
        ensureWindowCreated();
        mContentFrame.removeAllViews();
        mContentFrame.removeAllViews();
        mContentFrame.addView(view, new FrameLayout.LayoutParams(
        mContentFrame.addView(view, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        mContentFrame.requestApplyInsets();
        mContentFrame.requestApplyInsets();
    }
    }


+4 −7
Original line number Original line Diff line number Diff line
@@ -16,10 +16,10 @@


package com.android.server.autofill;
package com.android.server.autofill;


import static android.app.ActivityManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
import static android.app.ActivityManagerInternal.ASSIST_KEY_STRUCTURE;
import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
import static android.service.autofill.FillRequest.INVALID_REQUEST_ID;
import static android.service.autofill.FillRequest.INVALID_REQUEST_ID;
import static android.service.voice.VoiceInteractionSession.KEY_RECEIVER_EXTRAS;
import static android.service.voice.VoiceInteractionSession.KEY_STRUCTURE;
import static android.view.autofill.AutofillManager.ACTION_START_SESSION;
import static android.view.autofill.AutofillManager.ACTION_START_SESSION;
import static android.view.autofill.AutofillManager.ACTION_VALUE_CHANGED;
import static android.view.autofill.AutofillManager.ACTION_VALUE_CHANGED;
import static android.view.autofill.AutofillManager.ACTION_VIEW_ENTERED;
import static android.view.autofill.AutofillManager.ACTION_VIEW_ENTERED;
@@ -55,14 +55,12 @@ import android.os.SystemClock;
import android.service.autofill.AutofillService;
import android.service.autofill.AutofillService;
import android.service.autofill.Dataset;
import android.service.autofill.Dataset;
import android.service.autofill.FillContext;
import android.service.autofill.FillContext;
import android.service.autofill.FillEventHistory;
import android.service.autofill.FillRequest;
import android.service.autofill.FillRequest;
import android.service.autofill.FillResponse;
import android.service.autofill.FillResponse;
import android.service.autofill.InternalSanitizer;
import android.service.autofill.InternalSanitizer;
import android.service.autofill.InternalValidator;
import android.service.autofill.InternalValidator;
import android.service.autofill.SaveInfo;
import android.service.autofill.SaveInfo;
import android.service.autofill.SaveRequest;
import android.service.autofill.SaveRequest;
import android.service.autofill.Transformation;
import android.service.autofill.ValueFinder;
import android.service.autofill.ValueFinder;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.ArraySet;
@@ -92,7 +90,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Collections;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicInteger;


/**
/**
@@ -210,13 +207,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
    private final IAssistDataReceiver mAssistReceiver = new IAssistDataReceiver.Stub() {
    private final IAssistDataReceiver mAssistReceiver = new IAssistDataReceiver.Stub() {
        @Override
        @Override
        public void onHandleAssistData(Bundle resultData) throws RemoteException {
        public void onHandleAssistData(Bundle resultData) throws RemoteException {
            final AssistStructure structure = resultData.getParcelable(KEY_STRUCTURE);
            final AssistStructure structure = resultData.getParcelable(ASSIST_KEY_STRUCTURE);
            if (structure == null) {
            if (structure == null) {
                Slog.e(TAG, "No assist structure - app might have crashed providing it");
                Slog.e(TAG, "No assist structure - app might have crashed providing it");
                return;
                return;
            }
            }


            final Bundle receiverExtras = resultData.getBundle(KEY_RECEIVER_EXTRAS);
            final Bundle receiverExtras = resultData.getBundle(ASSIST_KEY_RECEIVER_EXTRAS);
            if (receiverExtras == null) {
            if (receiverExtras == null) {
                Slog.e(TAG, "No receiver extras - app might have crashed providing it");
                Slog.e(TAG, "No receiver extras - app might have crashed providing it");
                return;
                return;
+71 −25
Original line number Original line Diff line number Diff line
@@ -30,6 +30,12 @@ import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
import static android.app.ActivityManager.RESIZE_MODE_PRESERVE_WINDOW;
import static android.app.ActivityManager.RESIZE_MODE_PRESERVE_WINDOW;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManagerInternal.ASSIST_KEY_CONTENT;
import static android.app.ActivityManagerInternal.ASSIST_KEY_DATA;
import static android.app.ActivityManagerInternal.ASSIST_KEY_RECEIVER_EXTRAS;
import static android.app.ActivityManagerInternal.ASSIST_KEY_STRUCTURE;
import static android.app.AppOpsManager.OP_ASSIST_STRUCTURE;
import static android.app.AppOpsManager.OP_NONE;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
@@ -38,6 +44,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS;
import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS;
import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT;
import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT;
import static android.content.pm.PackageManager.FEATURE_LEANBACK_ONLY;
import static android.content.pm.PackageManager.FEATURE_LEANBACK_ONLY;
@@ -331,7 +338,6 @@ import android.provider.Downloads;
import android.provider.Settings;
import android.provider.Settings;
import android.service.voice.IVoiceInteractionSession;
import android.service.voice.IVoiceInteractionSession;
import android.service.voice.VoiceInteractionManagerInternal;
import android.service.voice.VoiceInteractionManagerInternal;
import android.service.voice.VoiceInteractionSession;
import android.telecom.TelecomManager;
import android.telecom.TelecomManager;
import android.text.TextUtils;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.DateUtils;
@@ -808,8 +814,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        }
    }
    }
    final ArrayList<PendingAssistExtras> mPendingAssistExtras
    final ArrayList<PendingAssistExtras> mPendingAssistExtras = new ArrayList<>();
            = new ArrayList<PendingAssistExtras>();
    /**
    /**
     * Process management.
     * Process management.
@@ -3053,7 +3058,7 @@ public class ActivityManagerService extends IActivityManager.Stub
    public void batterySendBroadcast(Intent intent) {
    public void batterySendBroadcast(Intent intent) {
        synchronized (this) {
        synchronized (this) {
            broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
            broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
                    AppOpsManager.OP_NONE, null, false, false,
                    OP_NONE, null, false, false,
                    -1, SYSTEM_UID, UserHandle.USER_ALL);
                    -1, SYSTEM_UID, UserHandle.USER_ALL);
        }
        }
    }
    }
@@ -4075,7 +4080,7 @@ public class ActivityManagerService extends IActivityManager.Stub
            ProcessRecord app = getProcessRecordLocked(aInfo.processName,
            ProcessRecord app = getProcessRecordLocked(aInfo.processName,
                    aInfo.applicationInfo.uid, true);
                    aInfo.applicationInfo.uid, true);
            if (app == null || app.instr == null) {
            if (app == null || app.instr == null) {
                intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.setFlags(intent.getFlags() | FLAG_ACTIVITY_NEW_TASK);
                final int resolvedUserId = UserHandle.getUserId(aInfo.applicationInfo.uid);
                final int resolvedUserId = UserHandle.getUserId(aInfo.applicationInfo.uid);
                // For ANR debugging to verify if the user activity is the one that actually
                // For ANR debugging to verify if the user activity is the one that actually
                // launched.
                // launched.
@@ -4147,7 +4152,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                String lastVers = Settings.Secure.getString(
                String lastVers = Settings.Secure.getString(
                        resolver, Settings.Secure.LAST_SETUP_SHOWN);
                        resolver, Settings.Secure.LAST_SETUP_SHOWN);
                if (vers != null && !vers.equals(lastVers)) {
                if (vers != null && !vers.equals(lastVers)) {
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
                    intent.setComponent(new ComponentName(
                    intent.setComponent(new ComponentName(
                            ri.activityInfo.packageName, ri.activityInfo.name));
                            ri.activityInfo.packageName, ri.activityInfo.name));
                    mActivityStarter.startActivityLocked(null, intent, null /*ephemeralIntent*/,
                    mActivityStarter.startActivityLocked(null, intent, null /*ephemeralIntent*/,
@@ -4693,6 +4698,49 @@ public class ActivityManagerService extends IActivityManager.Stub
                userId, null, "startAssistantActivity");
                userId, null, "startAssistantActivity");
    }
    }
    @Override
    public int startRecentsActivity(IAssistDataReceiver assistDataReceiver, Bundle bOptions,
            int userId) {
        if (!mRecentTasks.isCallerRecents(Binder.getCallingUid())) {
            String msg = "Permission Denial: startRecentsActivity() from pid="
                    + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()
                    + " not recent tasks package";
            Slog.w(TAG, msg);
            throw new SecurityException(msg);
        }
        final int recentsUid = mRecentTasks.getRecentsComponentUid();
        final ComponentName recentsComponent = mRecentTasks.getRecentsComponent();
        final String recentsPackage = recentsComponent.getPackageName();
        final long origId = Binder.clearCallingIdentity();
        try {
            synchronized (this) {
                // If provided, kick off the request for the assist data in the background before
                // starting the activity
                if (assistDataReceiver != null) {
                    final AppOpsManager appOpsManager = (AppOpsManager)
                            mContext.getSystemService(Context.APP_OPS_SERVICE);
                    final AssistDataReceiverProxy proxy = new AssistDataReceiverProxy(
                            assistDataReceiver, recentsPackage);
                    final AssistDataRequester requester = new AssistDataRequester(mContext, this,
                            mWindowManager, appOpsManager, proxy, this,
                            OP_ASSIST_STRUCTURE, OP_NONE);
                    requester.requestAssistData(mStackSupervisor.getTopVisibleActivities(),
                            true, false /* fetchScreenshots */, recentsUid, recentsPackage);
                }
                final Intent intent = new Intent();
                intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
                intent.setComponent(recentsComponent);
                return mActivityStarter.startActivityMayWait(null, recentsUid, recentsPackage,
                        intent, null, null, null, null, null, 0, 0, null, null, null, bOptions,
                        false, userId, null, "startRecentsActivity");
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
    }
    @Override
    @Override
    public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
    public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
            throws RemoteException {
            throws RemoteException {
@@ -4839,7 +4887,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    Intent.FLAG_ACTIVITY_FORWARD_RESULT|
                    Intent.FLAG_ACTIVITY_FORWARD_RESULT|
                    Intent.FLAG_ACTIVITY_CLEAR_TOP|
                    Intent.FLAG_ACTIVITY_CLEAR_TOP|
                    Intent.FLAG_ACTIVITY_MULTIPLE_TASK|
                    Intent.FLAG_ACTIVITY_MULTIPLE_TASK|
                    Intent.FLAG_ACTIVITY_NEW_TASK));
                    FLAG_ACTIVITY_NEW_TASK));
            // Okay now we need to start the new activity, replacing the
            // Okay now we need to start the new activity, replacing the
            // currently running activity.  This is a little tricky because
            // currently running activity.  This is a little tricky because
@@ -6268,7 +6316,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        mStackSupervisor.closeSystemDialogsLocked();
        mStackSupervisor.closeSystemDialogsLocked();
        broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
        broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
                AppOpsManager.OP_NONE, null, false, false,
                OP_NONE, null, false, false,
                -1, SYSTEM_UID, UserHandle.USER_ALL);
                -1, SYSTEM_UID, UserHandle.USER_ALL);
    }
    }
@@ -6370,7 +6418,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        intent.putExtra(Intent.EXTRA_UID, uid);
        intent.putExtra(Intent.EXTRA_UID, uid);
        intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.getUserId(uid));
        intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.getUserId(uid));
        broadcastIntentLocked(null, null, intent,
        broadcastIntentLocked(null, null, intent,
                null, null, 0, null, null, null, AppOpsManager.OP_NONE,
                null, null, 0, null, null, null, OP_NONE,
                null, false, false, MY_PID, SYSTEM_UID, UserHandle.getUserId(uid));
                null, false, false, MY_PID, SYSTEM_UID, UserHandle.getUserId(uid));
    }
    }
@@ -11591,7 +11639,7 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
            }
            final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSIONS);
            final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSIONS);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
            intent.addFlags(FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
            intent.putExtra(Intent.EXTRA_PACKAGE_NAME, cpi.packageName);
            intent.putExtra(Intent.EXTRA_PACKAGE_NAME, cpi.packageName);
@@ -12993,8 +13041,7 @@ public class ActivityManagerService extends IActivityManager.Stub
            // Caller wants result sent back to them.
            // Caller wants result sent back to them.
            Bundle sendBundle = new Bundle();
            Bundle sendBundle = new Bundle();
            // At least return the receiver extras
            // At least return the receiver extras
            sendBundle.putBundle(VoiceInteractionSession.KEY_RECEIVER_EXTRAS,
            sendBundle.putBundle(ASSIST_KEY_RECEIVER_EXTRAS, pae.receiverExtras);
                    pae.receiverExtras);
            try {
            try {
                pae.receiver.onHandleAssistData(sendBundle);
                pae.receiver.onHandleAssistData(sendBundle);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
@@ -13047,11 +13094,10 @@ public class ActivityManagerService extends IActivityManager.Stub
            if ((sendReceiver=pae.receiver) != null) {
            if ((sendReceiver=pae.receiver) != null) {
                // Caller wants result sent back to them.
                // Caller wants result sent back to them.
                sendBundle = new Bundle();
                sendBundle = new Bundle();
                sendBundle.putBundle(VoiceInteractionSession.KEY_DATA, pae.extras);
                sendBundle.putBundle(ASSIST_KEY_DATA, pae.extras);
                sendBundle.putParcelable(VoiceInteractionSession.KEY_STRUCTURE, pae.structure);
                sendBundle.putParcelable(ASSIST_KEY_STRUCTURE, pae.structure);
                sendBundle.putParcelable(VoiceInteractionSession.KEY_CONTENT, pae.content);
                sendBundle.putParcelable(ASSIST_KEY_CONTENT, pae.content);
                sendBundle.putBundle(VoiceInteractionSession.KEY_RECEIVER_EXTRAS,
                sendBundle.putBundle(ASSIST_KEY_RECEIVER_EXTRAS, pae.receiverExtras);
                        pae.receiverExtras);
            }
            }
        }
        }
        if (sendReceiver != null) {
        if (sendReceiver != null) {
@@ -13070,7 +13116,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                mContext.startServiceAsUser(pae.intent, new UserHandle(pae.userHandle));
                mContext.startServiceAsUser(pae.intent, new UserHandle(pae.userHandle));
            } else {
            } else {
                pae.intent.replaceExtras(pae.extras);
                pae.intent.replaceExtras(pae.extras);
                pae.intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                pae.intent.setFlags(FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_SINGLE_TOP
                        | Intent.FLAG_ACTIVITY_SINGLE_TOP
                        | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                closeSystemDialogs("assist");
                closeSystemDialogs("assist");
@@ -13837,7 +13883,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    .setPackage("android")
                    .setPackage("android")
                    .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
                    .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
            broadcastIntent(null, intent, null, null, 0, null, null, null,
            broadcastIntent(null, intent, null, null, 0, null, null, null,
                    android.app.AppOpsManager.OP_NONE, null, true, false, UserHandle.USER_ALL);
                    OP_NONE, null, true, false, UserHandle.USER_ALL);
        } finally {
        } finally {
            Binder.restoreCallingIdentity(ident);
            Binder.restoreCallingIdentity(ident);
        }
        }
@@ -14088,7 +14134,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                        | Intent.FLAG_RECEIVER_FOREGROUND);
                        | Intent.FLAG_RECEIVER_FOREGROUND);
                intent.putExtra(Intent.EXTRA_USER_HANDLE, currentUserId);
                intent.putExtra(Intent.EXTRA_USER_HANDLE, currentUserId);
                broadcastIntentLocked(null, null, intent,
                broadcastIntentLocked(null, null, intent,
                        null, null, 0, null, null, null, AppOpsManager.OP_NONE,
                        null, null, 0, null, null, null, OP_NONE,
                        null, false, false, MY_PID, SYSTEM_UID,
                        null, false, false, MY_PID, SYSTEM_UID,
                        currentUserId);
                        currentUserId);
                intent = new Intent(Intent.ACTION_USER_STARTING);
                intent = new Intent(Intent.ACTION_USER_STARTING);
@@ -14102,7 +14148,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                                    throws RemoteException {
                                    throws RemoteException {
                            }
                            }
                        }, 0, null, null,
                        }, 0, null, null,
                        new String[] {INTERACT_ACROSS_USERS}, AppOpsManager.OP_NONE,
                        new String[] {INTERACT_ACROSS_USERS}, OP_NONE,
                        null, true, false, MY_PID, SYSTEM_UID, UserHandle.USER_ALL);
                        null, true, false, MY_PID, SYSTEM_UID, UserHandle.USER_ALL);
            } catch (Throwable t) {
            } catch (Throwable t) {
                Slog.wtf(TAG, "Failed sending first user broadcasts", t);
                Slog.wtf(TAG, "Failed sending first user broadcasts", t);
@@ -18778,7 +18824,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    Intent intent = allSticky.get(i);
                    Intent intent = allSticky.get(i);
                    BroadcastQueue queue = broadcastQueueForIntent(intent);
                    BroadcastQueue queue = broadcastQueueForIntent(intent);
                    BroadcastRecord r = new BroadcastRecord(queue, intent, null,
                    BroadcastRecord r = new BroadcastRecord(queue, intent, null,
                            null, -1, -1, false, null, null, AppOpsManager.OP_NONE, null, receivers,
                            null, -1, -1, false, null, null, OP_NONE, null, receivers,
                            null, 0, null, null, false, true, true, -1);
                            null, 0, null, null, false, true, true, -1);
                    queue.enqueueParallelBroadcastLocked(r);
                    queue.enqueueParallelBroadcastLocked(r);
                    queue.scheduleBroadcastsLocked();
                    queue.scheduleBroadcastsLocked();
@@ -19774,7 +19820,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    : new String[] {requiredPermission};
                    : new String[] {requiredPermission};
            int res = broadcastIntentLocked(null, packageName, intent, resolvedType,
            int res = broadcastIntentLocked(null, packageName, intent, resolvedType,
                    resultTo, resultCode, resultData, resultExtras,
                    resultTo, resultCode, resultData, resultExtras,
                    requiredPermissions, AppOpsManager.OP_NONE, bOptions, serialized,
                    requiredPermissions, OP_NONE, bOptions, serialized,
                    sticky, -1, uid, userId);
                    sticky, -1, uid, userId);
            Binder.restoreCallingIdentity(origId);
            Binder.restoreCallingIdentity(origId);
            return res;
            return res;
@@ -20397,7 +20443,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                | Intent.FLAG_RECEIVER_FOREGROUND
                | Intent.FLAG_RECEIVER_FOREGROUND
                | Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS);
                | Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS);
        broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
        broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
                AppOpsManager.OP_NONE, null, false, false, MY_PID, SYSTEM_UID,
                OP_NONE, null, false, false, MY_PID, SYSTEM_UID,
                UserHandle.USER_ALL);
                UserHandle.USER_ALL);
        if ((changes & ActivityInfo.CONFIG_LOCALE) != 0) {
        if ((changes & ActivityInfo.CONFIG_LOCALE) != 0) {
            intent = new Intent(Intent.ACTION_LOCALE_CHANGED);
            intent = new Intent(Intent.ACTION_LOCALE_CHANGED);
@@ -20408,7 +20454,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
                intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
            }
            }
            broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
            broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null,
                    AppOpsManager.OP_NONE, null, false, false, MY_PID, SYSTEM_UID,
                    OP_NONE, null, false, false, MY_PID, SYSTEM_UID,
                    UserHandle.USER_ALL);
                    UserHandle.USER_ALL);
        }
        }
Loading