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

Commit 4568adf5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use callingUserId instead of system userId" into main

parents 2b6e889b de177d49
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -364,7 +364,7 @@ public class ContextualSearchManagerService extends SystemService {
    }

    @RequiresPermission(android.Manifest.permission.START_TASKS_FROM_RECENTS)
    private int invokeContextualSearchIntent(Intent launchIntent) {
    private int invokeContextualSearchIntent(Intent launchIntent, final int userId) {
        // Contextual search starts with a frozen screen - so we launch without
        // any system animations or starting window.
        final ActivityOptions opts = ActivityOptions.makeCustomTaskAnimation(mContext,
@@ -372,7 +372,7 @@ public class ContextualSearchManagerService extends SystemService {
        opts.setDisableStartingWindow(true);
        return mAtmInternal.startActivityWithScreenshot(launchIntent,
                mContext.getPackageName(), Binder.getCallingUid(), Binder.getCallingPid(), null,
                opts.toBundle(), Binder.getCallingUserHandle().getIdentifier());
                opts.toBundle(), userId);
    }

    private void enforcePermission(@NonNull final String func) {
@@ -446,6 +446,8 @@ public class ContextualSearchManagerService extends SystemService {
            synchronized (this) {
                if (DEBUG_USER) Log.d(TAG, "startContextualSearch");
                enforcePermission("startContextualSearch");
                final int callingUserId = Binder.getCallingUserHandle().getIdentifier();

                mAssistDataRequester.cancel();
                // Creates a new CallbackToken at mToken and an expiration handler.
                issueToken();
@@ -455,7 +457,7 @@ public class ContextualSearchManagerService extends SystemService {
                Binder.withCleanCallingIdentity(() -> {
                    Intent launchIntent = getContextualSearchIntent(entrypoint, mToken);
                    if (launchIntent != null) {
                        int result = invokeContextualSearchIntent(launchIntent);
                        int result = invokeContextualSearchIntent(launchIntent, callingUserId);
                        if (DEBUG_USER) Log.d(TAG, "Launch result: " + result);
                    }
                });