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

Commit 708e7587 authored by Felix Oghina's avatar Felix Oghina Committed by Android (Google) Code Review
Browse files

Merge "[contextualsearch] add invocation time to launch intent" into main

parents 78fa5a56 7a117e5f
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.Context;
import android.os.IBinder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.util.Log;
import android.util.Log;


import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
@@ -51,6 +52,7 @@ public final class ContextualSearchManager {
     */
     */
    public static final String EXTRA_ENTRYPOINT =
    public static final String EXTRA_ENTRYPOINT =
            "android.app.contextualsearch.extra.ENTRYPOINT";
            "android.app.contextualsearch.extra.ENTRYPOINT";

    /**
    /**
     * Key to get the flag_secure value from the extras of the activity launched by contextual
     * Key to get the flag_secure value from the extras of the activity launched by contextual
     * search. The value will be true if flag_secure is found in any of the visible activities.
     * search. The value will be true if flag_secure is found in any of the visible activities.
@@ -58,12 +60,14 @@ public final class ContextualSearchManager {
     */
     */
    public static final String EXTRA_FLAG_SECURE_FOUND =
    public static final String EXTRA_FLAG_SECURE_FOUND =
            "android.app.contextualsearch.extra.FLAG_SECURE_FOUND";
            "android.app.contextualsearch.extra.FLAG_SECURE_FOUND";

    /**
    /**
     * Key to get the screenshot from the extras of the activity launched by contextual search.
     * Key to get the screenshot from the extras of the activity launched by contextual search.
     * Only supposed to be used with ACTON_LAUNCH_CONTEXTUAL_SEARCH.
     * Only supposed to be used with ACTON_LAUNCH_CONTEXTUAL_SEARCH.
     */
     */
    public static final String EXTRA_SCREENSHOT =
    public static final String EXTRA_SCREENSHOT =
            "android.app.contextualsearch.extra.SCREENSHOT";
            "android.app.contextualsearch.extra.SCREENSHOT";

    /**
    /**
     * Key to check whether managed profile is visible from the extras of the activity launched by
     * Key to check whether managed profile is visible from the extras of the activity launched by
     * contextual search. The value will be true if any one of the visible apps is managed.
     * contextual search. The value will be true if any one of the visible apps is managed.
@@ -71,6 +75,7 @@ public final class ContextualSearchManager {
     */
     */
    public static final String EXTRA_IS_MANAGED_PROFILE_VISIBLE =
    public static final String EXTRA_IS_MANAGED_PROFILE_VISIBLE =
            "android.app.contextualsearch.extra.IS_MANAGED_PROFILE_VISIBLE";
            "android.app.contextualsearch.extra.IS_MANAGED_PROFILE_VISIBLE";

    /**
    /**
     * Key to get the list of visible packages from the extras of the activity launched by
     * Key to get the list of visible packages from the extras of the activity launched by
     * contextual search.
     * contextual search.
@@ -79,6 +84,18 @@ public final class ContextualSearchManager {
    public static final String EXTRA_VISIBLE_PACKAGE_NAMES =
    public static final String EXTRA_VISIBLE_PACKAGE_NAMES =
            "android.app.contextualsearch.extra.VISIBLE_PACKAGE_NAMES";
            "android.app.contextualsearch.extra.VISIBLE_PACKAGE_NAMES";


    /**
     * Key to get the time the user made the invocation request, based on
     * {@link SystemClock#uptimeMillis()}.
     * Only supposed to be used with ACTON_LAUNCH_CONTEXTUAL_SEARCH.
     *
     * TODO: un-hide in W
     *
     * @hide
     */
    public static final String EXTRA_INVOCATION_TIME_MS =
            "android.app.contextualsearch.extra.INVOCATION_TIME_MS";

    /**
    /**
     * Key to get the binder token from the extras of the activity launched by contextual search.
     * Key to get the binder token from the extras of the activity launched by contextual search.
     * This token is needed to invoke {@link CallbackToken#getContextualSearchState} method.
     * This token is needed to invoke {@link CallbackToken#getContextualSearchState} method.
+4 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;


import static com.android.server.contextualsearch.flags.Flags.enableExcludePersistentUi;
import static com.android.server.contextualsearch.flags.Flags.enableExcludePersistentUi;

import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_CONTENT;
import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_CONTENT;
import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_STRUCTURE;
import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_STRUCTURE;


@@ -65,6 +64,7 @@ import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.os.ShellCallback;
import android.os.ShellCallback;
import android.os.SystemClock;
import android.util.Log;
import android.util.Log;
import android.util.Slog;
import android.util.Slog;
import android.view.IWindowManager;
import android.view.IWindowManager;
@@ -246,6 +246,9 @@ public class ContextualSearchManagerService extends SystemService {
        if (DEBUG_USER) Log.d(TAG, "Launch component: " + launchIntent.getComponent());
        if (DEBUG_USER) Log.d(TAG, "Launch component: " + launchIntent.getComponent());
        launchIntent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION
        launchIntent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION
                | FLAG_ACTIVITY_NO_USER_ACTION);
                | FLAG_ACTIVITY_NO_USER_ACTION);
        launchIntent.putExtra(
                ContextualSearchManager.EXTRA_INVOCATION_TIME_MS,
                SystemClock.uptimeMillis());
        launchIntent.putExtra(ContextualSearchManager.EXTRA_ENTRYPOINT, entrypoint);
        launchIntent.putExtra(ContextualSearchManager.EXTRA_ENTRYPOINT, entrypoint);
        launchIntent.putExtra(ContextualSearchManager.EXTRA_TOKEN, mToken);
        launchIntent.putExtra(ContextualSearchManager.EXTRA_TOKEN, mToken);
        boolean isAssistDataAllowed = mAtmInternal.isAssistDataAllowed();
        boolean isAssistDataAllowed = mAtmInternal.isAssistDataAllowed();