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

Commit c7ba23d1 authored by Matt Casey's avatar Matt Casey
Browse files

Add invocation type to PhoneWindowManager's launchAssistAction

Bug: 187826397
Test: Validate w/ assistant team
Change-Id: I063f75e4eb4b8a1b6bffd2ccef70a6a0c2f763a3
parent d772c72a
Loading
Loading
Loading
Loading
+11 −5
Original line number Original line Diff line number Diff line
@@ -192,6 +192,7 @@ import android.view.autofill.AutofillManagerInternal;


import com.android.internal.R;
import com.android.internal.R;
import com.android.internal.accessibility.AccessibilityShortcutController;
import com.android.internal.accessibility.AccessibilityShortcutController;
import com.android.internal.app.AssistUtils;
import com.android.internal.inputmethod.SoftInputShowHideReason;
import com.android.internal.inputmethod.SoftInputShowHideReason;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.logging.nano.MetricsProto;
@@ -650,7 +651,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                case MSG_LAUNCH_ASSIST:
                case MSG_LAUNCH_ASSIST:
                    final int deviceId = msg.arg1;
                    final int deviceId = msg.arg1;
                    final Long eventTime = (Long) msg.obj;
                    final Long eventTime = (Long) msg.obj;
                    launchAssistAction(null /* hint */, deviceId, eventTime);
                    launchAssistAction(null /* hint */, deviceId, eventTime,
                            AssistUtils.INVOCATION_TYPE_UNKNOWN);
                    break;
                    break;
                case MSG_LAUNCH_VOICE_ASSIST_WITH_WAKE_LOCK:
                case MSG_LAUNCH_VOICE_ASSIST_WITH_WAKE_LOCK:
                    launchVoiceAssistWithWakeLock();
                    launchVoiceAssistWithWakeLock();
@@ -1108,7 +1110,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                performHapticFeedback(HapticFeedbackConstants.ASSISTANT_BUTTON, false,
                performHapticFeedback(HapticFeedbackConstants.ASSISTANT_BUTTON, false,
                        "Power - Long Press - Go To Assistant");
                        "Power - Long Press - Go To Assistant");
                final int powerKeyDeviceId = Integer.MIN_VALUE;
                final int powerKeyDeviceId = Integer.MIN_VALUE;
                launchAssistAction(null, powerKeyDeviceId, eventTime);
                launchAssistAction(null, powerKeyDeviceId, eventTime,
                        AssistUtils.INVOCATION_TYPE_POWER_BUTTON_LONG_PRESS);
                break;
                break;
        }
        }
    }
    }
@@ -1541,7 +1544,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    launchAllAppsAction();
                    launchAllAppsAction();
                    break;
                    break;
                case LONG_PRESS_HOME_ASSIST:
                case LONG_PRESS_HOME_ASSIST:
                    launchAssistAction(null, deviceId, eventTime);
                    launchAssistAction(null, deviceId, eventTime,
                            AssistUtils.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS);
                    break;
                    break;
                case LONG_PRESS_HOME_NOTIFICATION_PANEL:
                case LONG_PRESS_HOME_NOTIFICATION_PANEL:
                    toggleNotificationPanel();
                    toggleNotificationPanel();
@@ -2772,7 +2776,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    } else if (mPendingMetaAction) {
                    } else if (mPendingMetaAction) {
                        launchAssistAction(Intent.EXTRA_ASSIST_INPUT_HINT_KEYBOARD,
                        launchAssistAction(Intent.EXTRA_ASSIST_INPUT_HINT_KEYBOARD,
                                event.getDeviceId(),
                                event.getDeviceId(),
                                event.getEventTime());
                                event.getEventTime(), AssistUtils.INVOCATION_TYPE_UNKNOWN);
                        mPendingMetaAction = false;
                        mPendingMetaAction = false;
                    }
                    }
                }
                }
@@ -3036,7 +3040,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    // various parts of the UI.
    // various parts of the UI.


    /** Asks the status bar to startAssist(), usually a full "assistant" interface */
    /** Asks the status bar to startAssist(), usually a full "assistant" interface */
    private void launchAssistAction(String hint, int deviceId, long eventTime) {
    private void launchAssistAction(String hint, int deviceId, long eventTime,
            int invocationType) {
        sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
        sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
        if (!isUserSetupComplete()) {
        if (!isUserSetupComplete()) {
            // Disable opening assist window during setup
            // Disable opening assist window during setup
@@ -3053,6 +3058,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            args.putBoolean(hint, true);
            args.putBoolean(hint, true);
        }
        }
        args.putLong(Intent.EXTRA_TIME, eventTime);
        args.putLong(Intent.EXTRA_TIME, eventTime);
        args.putInt(AssistUtils.INVOCATION_TYPE_KEY, invocationType);


        ((SearchManager) mContext.createContextAsUser(UserHandle.of(mCurrentUserId), 0)
        ((SearchManager) mContext.createContextAsUser(UserHandle.of(mCurrentUserId), 0)
                .getSystemService(Context.SEARCH_SERVICE)).launchAssist(args);
                .getSystemService(Context.SEARCH_SERVICE)).launchAssist(args);