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
This commit is contained in:
Jeff Brown
2010-12-09 22:13:41 -08:00
parent 29f94b781e
commit caab4d0a50
3 changed files with 41 additions and 93 deletions

View File

@ -4,9 +4,9 @@
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.
@ -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"

View File

@ -1,56 +0,0 @@
<?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>

View File

@ -1330,38 +1330,40 @@ 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();
}
return true;
}
// Shortcuts are invoked through Search+key, so intercept those here
if (mShortcutKeyPressed != -1 && !mConsumeShortcutKeyUp) {
if (down && repeatCount == 0 && !keyguardOn) {
final KeyCharacterMap kcm = event.getKeyCharacterMap();
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;
// 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);
} else {
Slog.i(TAG, "Dropping unregistered shortcut key combination: "
+ KeyEvent.keyCodeToString(mShortcutKeyPressed)
+ "+" + KeyEvent.keyCodeToString(keyCode));
}
return true;
}
return true;
}
}