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

Commit caab4d0a authored by Jeff Brown's avatar Jeff Brown
Browse files

Update shortcuts.

Also modified the shortcut key handling so that it drops chorded
Search+X keys when even if no shortcut was found.  Without this
change, pressing an unhandled shortcut causes the Search widget to
pop up and the character to be typed.

Bug: 3022227
Change-Id: Ic0921428bd1270604ca28caf1f8493727127f4ed
parent 29f94b78
Loading
Loading
Loading
Loading
+21 −19
Original line number Diff line number Diff line
@@ -14,6 +14,22 @@
     limitations under the License.
-->

<!--
     Default system bookmarks for AOSP.
     Bookmarks for vendor apps should be added to a bookmarks resource overlay; not here.

     Typical shortcuts (not necessarily defined here):
       'b': Browser
       'c': Contacts
       'e': Email
       'g': GMail
       'l': Calendar
       'm': Maps
       'p': Music
       's': SMS
       't': Talk
       'y': YouTube
-->
<bookmarks>
    <bookmark
        package="com.android.browser"
@@ -21,30 +37,16 @@
        shortcut="b" />
    <bookmark
        package="com.android.contacts"
        class="com.android.contacts.DialtactsContactsEntryActivity"
        class="com.android.contacts.activities.ContactsFrontDoor"
        shortcut="c" />
    <bookmark
        package="com.android.email"
        package="com.google.android.email"
        class="com.android.email.activity.Welcome"
        shortcut="e" />
    <bookmark
        package="com.google.android.gm"
        class="com.google.android.gm.ConversationListActivityGmail"
        shortcut="g" />
    <bookmark
        package="com.android.im"
        class="com.android.im.app.LandingPage"
        shortcut="i" />
    <bookmark
        package="com.android.calendar"
        package="com.google.android.calendar"
        class="com.android.calendar.LaunchActivity"
        shortcut="l" />
<!--
    <bookmark
        package="com.google.android.apps.maps"
        class="com.google.android.maps.MapsActivity"
        shortcut="m" />
-->
    <bookmark
        package="com.android.music"
        class="com.android.music.MusicBrowserActivity"
+0 −56
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
          http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<bookmarks>
    <bookmark
        package="com.android.browser"
        class="com.android.browser.BrowserActivity"
        shortcut="b" />
    <bookmark
        package="com.android.contacts"
        class="com.android.contacts.DialtactsContactsEntryActivity"
        shortcut="c" />
    <bookmark
        package="com.android.email"
        class="com.android.email.activity.Welcome"
        shortcut="e" />
    <bookmark
        package="com.google.android.gm"
        class="com.google.android.gm.ConversationListActivityGmail"
        shortcut="g" />
    <bookmark
        package="com.android.im"
        class="com.android.im.app.LandingPage"
        shortcut="i" />
    <bookmark
        package="com.android.calendar"
        class="com.android.calendar.LaunchActivity"
        shortcut="l" />
<!--
    <bookmark
        package="com.google.android.apps.maps"
        class="com.google.android.maps.MapsActivity"
        shortcut="m" />
-->
    <bookmark
        package="com.android.music"
        class="com.android.music.MusicBrowserActivity"
        shortcut="p" />
    <bookmark
        package="com.android.mms"
        class="com.android.mms.ui.ConversationList"
        shortcut="s" />
</bookmarks>
+20 −18
Original line number Diff line number Diff line
@@ -1330,13 +1330,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                }
            } else if (keyCode == mShortcutKeyPressed) {
                mShortcutKeyPressed = -1;
                
                if (mConsumeShortcutKeyUp) {
                    // Consume the up-event
                    mConsumeShortcutKeyUp = false;
                    return true;
                }
            }
            return false;
        } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
            if (!down) {
                showRecentAppsDialog();
@@ -1345,23 +1344,26 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }

        // Shortcuts are invoked through Search+key, so intercept those here
        if (mShortcutKeyPressed != -1 && !mConsumeShortcutKeyUp) {
            if (down && repeatCount == 0 && !keyguardOn) {
        // Any printing key that is chorded with Search should be consumed
        // even if no shortcut was invoked.  This prevents text from being
        // inadvertently inserted when using a keyboard that has built-in macro
        // shortcut keys (that emit Search+x) and some of them are not registered.
        if (mShortcutKeyPressed != -1) {
            final KeyCharacterMap kcm = event.getKeyCharacterMap();
            if (kcm.isPrintingKey(keyCode)) {
                mConsumeShortcutKeyUp = true;
                if (down && repeatCount == 0 && !keyguardOn) {
                    Intent shortcutIntent = mShortcutManager.getIntent(kcm, keyCode, metaState);
                    if (shortcutIntent != null) {
                        shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        mContext.startActivity(shortcutIntent);
                    
                    /*
                     * We launched an app, so the up-event of the search key
                     * should be consumed
                     */
                    if (mShortcutKeyPressed != -1) {
                        mConsumeShortcutKeyUp = true;
                    } else {
                        Slog.i(TAG, "Dropping unregistered shortcut key combination: "
                                + KeyEvent.keyCodeToString(mShortcutKeyPressed)
                                + "+" + KeyEvent.keyCodeToString(keyCode));
                    }
                    return true;
                }
                return true;
            }
        }