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

Commit 931b2e7c authored by Michael Wright's avatar Michael Wright Committed by Android (Google) Code Review
Browse files

Merge "Add Voice Assist key." into lmp-dev

parents eda77759 dc63f7b9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -33322,6 +33322,7 @@ package android.view {
    field public static final int KEYCODE_U = 49; // 0x31
    field public static final int KEYCODE_U = 49; // 0x31
    field public static final int KEYCODE_UNKNOWN = 0; // 0x0
    field public static final int KEYCODE_UNKNOWN = 0; // 0x0
    field public static final int KEYCODE_V = 50; // 0x32
    field public static final int KEYCODE_V = 50; // 0x32
    field public static final int KEYCODE_VOICE_ASSIST = 231; // 0xe7
    field public static final int KEYCODE_VOLUME_DOWN = 25; // 0x19
    field public static final int KEYCODE_VOLUME_DOWN = 25; // 0x19
    field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4
    field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4
    field public static final int KEYCODE_VOLUME_UP = 24; // 0x18
    field public static final int KEYCODE_VOLUME_UP = 24; // 0x18
+5 −1
Original line number Original line Diff line number Diff line
@@ -657,11 +657,15 @@ public class KeyEvent extends InputEvent implements Parcelable {
    /** Key code constant: TV data service key.
    /** Key code constant: TV data service key.
     * Displays data services like weather, sports. */
     * Displays data services like weather, sports. */
    public static final int KEYCODE_TV_DATA_SERVICE = 230;
    public static final int KEYCODE_TV_DATA_SERVICE = 230;
    /** Key code constant: Voice Assist key.
     * Launches the global voice assist activity. Not delivered to applications. */
    public static final int KEYCODE_VOICE_ASSIST = 231;


    private static final int LAST_KEYCODE = KEYCODE_TV_DATA_SERVICE;
    private static final int LAST_KEYCODE = KEYCODE_VOICE_ASSIST;


    // NOTE: If you add a new keycode here you must also add it to:
    // NOTE: If you add a new keycode here you must also add it to:
    //  isSystem()
    //  isSystem()
    //  isWakeKey()
    //  frameworks/native/include/android/keycodes.h
    //  frameworks/native/include/android/keycodes.h
    //  frameworks/native/include/input/InputEventLabels.h
    //  frameworks/native/include/input/InputEventLabels.h
    //  frameworks/base/core/res/res/values/attrs.xml
    //  frameworks/base/core/res/res/values/attrs.xml
+12 −0
Original line number Original line Diff line number Diff line
@@ -70,6 +70,7 @@ import android.provider.Settings;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamService;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
import android.service.dreams.IDreamManager;
import android.speech.RecognizerIntent;
import android.telecomm.TelecommManager;
import android.telecomm.TelecommManager;
import android.util.DisplayMetrics;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.EventLog;
@@ -2338,6 +2339,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                }
                }
            }
            }
            return -1;
            return -1;
        } else if (keyCode == KeyEvent.KEYCODE_VOICE_ASSIST) {
            if (!down) {
                Intent voiceIntent;
                if (!keyguardOn && mPowerManager.isInteractive()) {
                    voiceIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
                } else {
                    voiceIntent = new Intent(RecognizerIntent.ACTION_VOICE_SEARCH_HANDS_FREE);
                    voiceIntent.putExtra(RecognizerIntent.EXTRA_SECURE, keyguardOn);
                }
                mContext.startActivityAsUser(voiceIntent, UserHandle.CURRENT_OR_SELF);
            }
        } else if (keyCode == KeyEvent.KEYCODE_SYSRQ) {
        } else if (keyCode == KeyEvent.KEYCODE_SYSRQ) {
            if (down && repeatCount == 0) {
            if (down && repeatCount == 0) {
                mHandler.post(mScreenshotRunnable);
                mHandler.post(mScreenshotRunnable);