Skip to content

Commit 6651a63

Browse files
author
Jeff Brown
committed
Fix application launch shortcuts.
Improved quick launch bookmarks to support category-based shortcuts instead of hardcoding package and class names for all apps. Added a set of Intent categories for typical applications on the platform. Added support for some of the HID application launch usages to reduce reliance on quick launch for special purpose keys. Some keyboard vendors have hardcoded launch keys that synthesize "Search + X" type key combos. The goal is to encourage them to stop doing this by implementing more of HID. Bug: 5674723 Change-Id: I79f1147c65a208efc3f67228c9f0fa5cd050c593
1 parent 500afb8 commit 6651a63

File tree

11 files changed

+222
-60
lines changed

11 files changed

+222
-60
lines changed

api/current.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5502,7 +5502,16 @@ package android.content {
55025502
field public static final java.lang.String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
55035503
field public static final java.lang.String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH";
55045504
field public static final java.lang.String CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE";
5505+
field public static final java.lang.String CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER";
5506+
field public static final java.lang.String CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR";
5507+
field public static final java.lang.String CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR";
5508+
field public static final java.lang.String CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS";
5509+
field public static final java.lang.String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL";
5510+
field public static final java.lang.String CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY";
5511+
field public static final java.lang.String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS";
55055512
field public static final java.lang.String CATEGORY_APP_MARKET = "android.intent.category.APP_MARKET";
5513+
field public static final java.lang.String CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING";
5514+
field public static final java.lang.String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC";
55065515
field public static final java.lang.String CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE";
55075516
field public static final java.lang.String CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK";
55085517
field public static final java.lang.String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE";
@@ -17056,7 +17065,7 @@ package android.provider {
1705617065
field public static final java.lang.String EXTRA_VIDEO_QUALITY = "android.intent.extra.videoQuality";
1705717066
field public static final java.lang.String INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH = "android.media.action.MEDIA_PLAY_FROM_SEARCH";
1705817067
field public static final java.lang.String INTENT_ACTION_MEDIA_SEARCH = "android.intent.action.MEDIA_SEARCH";
17059-
field public static final java.lang.String INTENT_ACTION_MUSIC_PLAYER = "android.intent.action.MUSIC_PLAYER";
17068+
field public static final deprecated java.lang.String INTENT_ACTION_MUSIC_PLAYER = "android.intent.action.MUSIC_PLAYER";
1706017069
field public static final java.lang.String INTENT_ACTION_STILL_IMAGE_CAMERA = "android.media.action.STILL_IMAGE_CAMERA";
1706117070
field public static final java.lang.String INTENT_ACTION_VIDEO_CAMERA = "android.media.action.VIDEO_CAMERA";
1706217071
field public static final java.lang.String MEDIA_IGNORE_FILENAME = ".nomedia";
@@ -22215,6 +22224,8 @@ package android.view {
2221522224
field public static final int KEYCODE_BUTTON_Y = 100; // 0x64
2221622225
field public static final int KEYCODE_BUTTON_Z = 101; // 0x65
2221722226
field public static final int KEYCODE_C = 31; // 0x1f
22227+
field public static final int KEYCODE_CALCULATOR = 210; // 0xd2
22228+
field public static final int KEYCODE_CALENDAR = 208; // 0xd0
2221822229
field public static final int KEYCODE_CALL = 5; // 0x5
2221922230
field public static final int KEYCODE_CAMERA = 27; // 0x1b
2222022231
field public static final int KEYCODE_CAPS_LOCK = 115; // 0x73
@@ -22223,6 +22234,7 @@ package android.view {
2222322234
field public static final int KEYCODE_CHANNEL_UP = 166; // 0xa6
2222422235
field public static final int KEYCODE_CLEAR = 28; // 0x1c
2222522236
field public static final int KEYCODE_COMMA = 55; // 0x37
22237+
field public static final int KEYCODE_CONTACTS = 207; // 0xcf
2222622238
field public static final int KEYCODE_CTRL_LEFT = 113; // 0x71
2222722239
field public static final int KEYCODE_CTRL_RIGHT = 114; // 0x72
2222822240
field public static final int KEYCODE_D = 32; // 0x20
@@ -22290,6 +22302,7 @@ package android.view {
2229022302
field public static final int KEYCODE_MINUS = 69; // 0x45
2229122303
field public static final int KEYCODE_MOVE_END = 123; // 0x7b
2229222304
field public static final int KEYCODE_MOVE_HOME = 122; // 0x7a
22305+
field public static final int KEYCODE_MUSIC = 209; // 0xd1
2229322306
field public static final int KEYCODE_MUTE = 91; // 0x5b
2229422307
field public static final int KEYCODE_N = 42; // 0x2a
2229522308
field public static final int KEYCODE_NOTIFICATION = 83; // 0x53

core/java/android/content/Intent.java

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,74 @@ public static Intent createChooser(Intent target, CharSequence title) {
23082308
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
23092309
public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE";
23102310

2311+
// ---------------------------------------------------------------------
2312+
// ---------------------------------------------------------------------
2313+
// Application launch intent categories (see addCategory()).
2314+
2315+
/**
2316+
* Used with {@link #ACTION_MAIN} to launch the browser application.
2317+
* The activity should be able to browse the Internet.
2318+
*/
2319+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2320+
public static final String CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER";
2321+
2322+
/**
2323+
* Used with {@link #ACTION_MAIN} to launch the calculator application.
2324+
* The activity should be able to perform standard arithmetic operations.
2325+
*/
2326+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2327+
public static final String CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR";
2328+
2329+
/**
2330+
* Used with {@link #ACTION_MAIN} to launch the calendar application.
2331+
* The activity should be able to view and manipulate calendar entries.
2332+
*/
2333+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2334+
public static final String CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR";
2335+
2336+
/**
2337+
* Used with {@link #ACTION_MAIN} to launch the contacts application.
2338+
* The activity should be able to view and manipulate address book entries.
2339+
*/
2340+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2341+
public static final String CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS";
2342+
2343+
/**
2344+
* Used with {@link #ACTION_MAIN} to launch the email application.
2345+
* The activity should be able to send and receive email.
2346+
*/
2347+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2348+
public static final String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL";
2349+
2350+
/**
2351+
* Used with {@link #ACTION_MAIN} to launch the gallery application.
2352+
* The activity should be able to view and manipulate image and video files
2353+
* stored on the device.
2354+
*/
2355+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2356+
public static final String CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY";
2357+
2358+
/**
2359+
* Used with {@link #ACTION_MAIN} to launch the maps application.
2360+
* The activity should be able to show the user's current location and surroundings.
2361+
*/
2362+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2363+
public static final String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS";
2364+
2365+
/**
2366+
* Used with {@link #ACTION_MAIN} to launch the messaging application.
2367+
* The activity should be able to send and receive text messages.
2368+
*/
2369+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2370+
public static final String CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING";
2371+
2372+
/**
2373+
* Used with {@link #ACTION_MAIN} to launch the music application.
2374+
* The activity should be able to play, browse, or manipulate music files stored on the device.
2375+
*/
2376+
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
2377+
public static final String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC";
2378+
23112379
// ---------------------------------------------------------------------
23122380
// ---------------------------------------------------------------------
23132381
// Standard extra data keys.

core/java/android/provider/MediaStore.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
import java.io.IOException;
4141
import java.io.InputStream;
4242
import java.io.OutputStream;
43-
import java.io.UnsupportedEncodingException;
44-
import java.text.Collator;
4543

4644
/**
4745
* The Media provider contains meta data for all available media on both internal
@@ -66,7 +64,10 @@ public final class MediaStore {
6664
/**
6765
* Activity Action: Launch a music player.
6866
* The activity should be able to play, browse, or manipulate music files stored on the device.
67+
*
68+
* @deprecated Use {@link android.content.Intent#CATEGORY_APP_MUSIC} instead.
6969
*/
70+
@Deprecated
7071
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
7172
public static final String INTENT_ACTION_MUSIC_PLAYER = "android.intent.action.MUSIC_PLAYER";
7273

core/java/android/view/KeyEvent.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,20 @@ public class KeyEvent extends InputEvent implements Parcelable {
579579
/** Key code constant: 3D Mode key.
580580
* Toggles the display between 2D and 3D mode. */
581581
public static final int KEYCODE_3D_MODE = 206;
582-
583-
private static final int LAST_KEYCODE = KEYCODE_BUTTON_16;
582+
/** Key code constant: Contacts special function key.
583+
* Used to launch an address book application. */
584+
public static final int KEYCODE_CONTACTS = 207;
585+
/** Key code constant: Calendar special function key.
586+
* Used to launch a calendar application. */
587+
public static final int KEYCODE_CALENDAR = 208;
588+
/** Key code constant: Music special function key.
589+
* Used to launch a music player application. */
590+
public static final int KEYCODE_MUSIC = 209;
591+
/** Key code constant: Calculator special function key.
592+
* Used to launch a calculator application. */
593+
public static final int KEYCODE_CALCULATOR = 210;
594+
595+
private static final int LAST_KEYCODE = KEYCODE_CALCULATOR;
584596

585597
// NOTE: If you add a new keycode here you must also add it to:
586598
// isSystem()
@@ -589,6 +601,8 @@ public class KeyEvent extends InputEvent implements Parcelable {
589601
// external/webkit/WebKit/android/plugins/ANPKeyCodes.h
590602
// frameworks/base/core/res/res/values/attrs.xml
591603
// emulator?
604+
// LAST_KEYCODE
605+
// KEYCODE_SYMBOLIC_NAMES
592606
//
593607
// Also Android currently does not reserve code ranges for vendor-
594608
// specific key codes. If you have new key codes to have, you
@@ -807,6 +821,10 @@ private static void populateKeycodeSymbolicNames() {
807821
names.append(KEYCODE_LANGUAGE_SWITCH, "KEYCODE_LANGUAGE_SWITCH");
808822
names.append(KEYCODE_MANNER_MODE, "KEYCODE_MANNER_MODE");
809823
names.append(KEYCODE_3D_MODE, "KEYCODE_3D_MODE");
824+
names.append(KEYCODE_CONTACTS, "KEYCODE_CONTACTS");
825+
names.append(KEYCODE_CALENDAR, "KEYCODE_CALENDAR");
826+
names.append(KEYCODE_MUSIC, "KEYCODE_MUSIC");
827+
names.append(KEYCODE_CALCULATOR, "KEYCODE_CALCULATOR");
810828
};
811829

812830
// Symbolic names of all metakeys in bit order from least significant to most significant.

core/res/res/values/attrs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,10 @@
14931493
<enum name="KEYCODE_LANGUAGE_SWITCH" value="204" />
14941494
<enum name="KEYCODE_MANNER_MODE" value="205" />
14951495
<enum name="KEYCODE_3D_MODE" value="206" />
1496+
<enum name="KEYCODE_CONTACTS" value="207" />
1497+
<enum name="KEYCODE_CALENDAR" value="208" />
1498+
<enum name="KEYCODE_MUSIC" value="209" />
1499+
<enum name="KEYCODE_CALCULATOR" value="210" />
14961500
</attr>
14971501

14981502
<!-- ***************************************************************** -->

data/keyboards/Generic.kl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ key 128 MEDIA_STOP
159159
# key 137 "KEY_CUT"
160160
# key 138 "KEY_HELP"
161161
key 139 MENU WAKE_DROPPED
162-
# key 140 "KEY_CALC"
162+
key 140 CALCULATOR
163163
# key 141 "KEY_SETUP"
164164
key 142 POWER WAKE
165165
key 143 POWER WAKE
@@ -190,7 +190,7 @@ key 167 MEDIA_RECORD
190190
key 168 MEDIA_REWIND
191191
key 169 CALL
192192
# key 170 "KEY_ISO"
193-
# key 171 "KEY_CONFIG"
193+
key 171 MUSIC
194194
key 172 HOME
195195
# key 173 "KEY_REFRESH"
196196
# key 174 "KEY_EXIT"
@@ -232,7 +232,7 @@ key 208 MEDIA_FAST_FORWARD
232232
# key 210 "KEY_PRINT"
233233
# key 211 "KEY_HP"
234234
key 212 CAMERA
235-
# key 213 "KEY_SOUND"
235+
key 213 MUSIC
236236
# key 214 "KEY_QUESTION"
237237
key 215 ENVELOPE
238238
# key 216 "KEY_CHAT"
@@ -344,7 +344,7 @@ key 377 TV
344344
# key 394 "KEY_DIRECTORY"
345345
# key 395 "KEY_LIST"
346346
# key 396 "KEY_MEMO"
347-
# key 397 "KEY_CALENDAR"
347+
key 397 CALENDAR
348348
# key 398 "KEY_RED"
349349
# key 399 "KEY_GREEN"
350350
# key 400 "KEY_YELLOW"
@@ -364,6 +364,7 @@ key 403 CHANNEL_DOWN
364364
# key 414 "KEY_TEEN"
365365
# key 415 "KEY_TWEN"
366366

367+
key 429 CONTACTS
367368

368369
# key 448 "KEY_DEL_EOL"
369370
# key 449 "KEY_DEL_EOS"

include/ui/KeycodeLabels.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ static const KeycodeLabel KEYCODES[] = {
231231
{ "LANGUAGE_SWITCH", 204 },
232232
{ "MANNER_MODE", 205 },
233233
{ "3D_MODE", 206 },
234+
{ "CONTACTS", 207 },
235+
{ "CALENDAR", 208 },
236+
{ "MUSIC", 209 },
237+
{ "CALCULATOR", 210 },
234238

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

native/include/android/keycodes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ enum {
250250
AKEYCODE_LANGUAGE_SWITCH = 204,
251251
AKEYCODE_MANNER_MODE = 205,
252252
AKEYCODE_3D_MODE = 206,
253+
AKEYCODE_CONTACTS = 207,
254+
AKEYCODE_CALENDAR = 208,
255+
AKEYCODE_MUSIC = 209,
256+
AKEYCODE_CALCULATOR = 210,
253257

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

packages/SettingsProvider/res/xml/bookmarks.xml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
Bookmarks for vendor apps should be added to a bookmarks resource overlay; not here.
2020
2121
Typical shortcuts (not necessarily defined here):
22+
'a': Calculator
2223
'b': Browser
2324
'c': Contacts
2425
'e': Email
@@ -32,27 +33,27 @@
3233
-->
3334
<bookmarks>
3435
<bookmark
35-
package="com.android.browser"
36-
class="com.android.browser.BrowserActivity"
36+
category="android.intent.category.APP_CALCULATOR"
37+
shortcut="a" />
38+
<bookmark
39+
category="android.intent.category.APP_BROWSER"
3740
shortcut="b" />
3841
<bookmark
39-
package="com.android.contacts"
40-
class="com.android.contacts.activities.ContactsFrontDoor"
42+
category="android.intent.category.APP_CONTACTS"
4143
shortcut="c" />
4244
<bookmark
43-
package="com.google.android.email"
44-
class="com.android.email.activity.Welcome"
45+
category="android.intent.category.APP_EMAIL"
4546
shortcut="e" />
4647
<bookmark
47-
package="com.google.android.calendar"
48-
class="com.android.calendar.LaunchActivity"
48+
category="android.intent.category.APP_CALENDAR"
4949
shortcut="l" />
5050
<bookmark
51-
package="com.android.music"
52-
class="com.android.music.MusicBrowserActivity"
51+
category="android.intent.category.APP_MAPS"
52+
shortcut="m" />
53+
<bookmark
54+
category="android.intent.category.APP_MUSIC"
5355
shortcut="p" />
5456
<bookmark
55-
package="com.android.mms"
56-
class="com.android.mms.ui.ConversationList"
57+
category="android.intent.category.APP_MESSAGING"
5758
shortcut="s" />
5859
</bookmarks>

0 commit comments

Comments
 (0)