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

Commit fc959a38 authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am 9e197141: Merge "Add new ASSIST key and map it to the global assist intent." into jb-dev

* commit '9e197141':
  Add new ASSIST key and map it to the global assist intent.
parents 0f03d771 9e197141
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23186,6 +23186,7 @@ package android.view {
    field public static final int KEYCODE_ALT_RIGHT = 58; // 0x3a
    field public static final int KEYCODE_APOSTROPHE = 75; // 0x4b
    field public static final int KEYCODE_APP_SWITCH = 187; // 0xbb
    field public static final int KEYCODE_ASSIST = 219; // 0xdb
    field public static final int KEYCODE_AT = 77; // 0x4d
    field public static final int KEYCODE_AVR_INPUT = 182; // 0xb6
    field public static final int KEYCODE_AVR_POWER = 181; // 0xb5
+1 −0
Original line number Diff line number Diff line
@@ -23198,6 +23198,7 @@ package android.view {
    field public static final int KEYCODE_ALT_RIGHT = 58; // 0x3a
    field public static final int KEYCODE_APOSTROPHE = 75; // 0x4b
    field public static final int KEYCODE_APP_SWITCH = 187; // 0xbb
    field public static final int KEYCODE_ASSIST = 219; // 0xdb
    field public static final int KEYCODE_AT = 77; // 0x4d
    field public static final int KEYCODE_AVR_INPUT = 182; // 0xb6
    field public static final int KEYCODE_AVR_POWER = 181; // 0xb5
+30 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.graphics.Rect;
@@ -32,6 +33,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;
import android.view.KeyEvent;

import java.util.List;
@@ -837,4 +839,32 @@ public class SearchManager
        }
    }

    /**
     * Returns true if the global assist activity is available.
     * @return True if the assistant is available.
     *
     * @hide
     */
    public final boolean isAssistantAvailable() {
        Intent intent = getAssistIntent();
        return intent != null
                && mContext.getPackageManager().queryIntentActivities(intent,
                        PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
    }

    /**
     * Gets an intent to launch the global assist activity, or null if not available.
     * @return The assist intent.
     *
     * @hide
     */
    public final Intent getAssistIntent() {
        ComponentName globalSearchActivity = getGlobalSearchActivity();
        if (globalSearchActivity != null) {
            Intent intent = new Intent(Intent.ACTION_ASSIST);
            intent.setPackage(globalSearchActivity.getPackageName());
            return intent;
        }
        return null;
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -620,8 +620,11 @@ public class KeyEvent extends InputEvent implements Parcelable {
    public static final int KEYCODE_RO              = 217;
    /** Key code constant: Japanese kana key. */
    public static final int KEYCODE_KANA            = 218;
    /** Key code constant: Assist key.
     * Launches the global assist activity.  Not delivered to applications. */
    public static final int KEYCODE_ASSIST          = 219;

    private static final int LAST_KEYCODE           = KEYCODE_KANA;
    private static final int LAST_KEYCODE           = KEYCODE_ASSIST;

    // NOTE: If you add a new keycode here you must also add it to:
    //  isSystem()
@@ -862,6 +865,7 @@ public class KeyEvent extends InputEvent implements Parcelable {
        names.append(KEYCODE_YEN, "KEYCODE_YEN");
        names.append(KEYCODE_RO, "KEYCODE_RO");
        names.append(KEYCODE_KANA, "KEYCODE_KANA");
        names.append(KEYCODE_ASSIST, "KEYCODE_ASSIST");
    };

    // Symbolic names of all metakeys in bit order from least significant to most significant.
+1 −0
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ static const KeycodeLabel KEYCODES[] = {
    { "YEN", 216 },
    { "RO", 217 },
    { "KANA", 218 },
    { "ASSIST", 219 },

    // NOTE: If you add a new keycode here you must also add it to several other files.
    //       Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
Loading