Android->Add recent key support

This commit is contained in:
zouxf
2015-11-20 11:33:07 +08:00
parent f958a0cfd6
commit f82a33231d
7 changed files with 36 additions and 2 deletions

View File

@ -16,6 +16,7 @@ key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 143 NOTIFICATION
key 113 VOLUME_MUTE
key 250 FIREFLY_RECENT
key 388 TV_KEYMOUSE_MODE_SWITCH
#key 400 TV_MEDIA_MULT_BACKWARD
#key 401 TV_MEDIA_MULT_FORWARD

View File

@ -32857,6 +32857,7 @@ package android.view {
field public static final int KEYCODE_F7 = 137; // 0x89
field public static final int KEYCODE_F8 = 138; // 0x8a
field public static final int KEYCODE_F9 = 139; // 0x8b
field public static final int KEYCODE_FIREFLY_RECENT = 275; // 0x113
field public static final int KEYCODE_FOCUS = 80; // 0x50
field public static final int KEYCODE_FORWARD = 125; // 0x7d
field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70

View File

@ -35091,6 +35091,7 @@ package android.view {
field public static final int KEYCODE_F7 = 137; // 0x89
field public static final int KEYCODE_F8 = 138; // 0x8a
field public static final int KEYCODE_F9 = 139; // 0x8b
field public static final int KEYCODE_FIREFLY_RECENT = 275; // 0x113
field public static final int KEYCODE_FOCUS = 80; // 0x50
field public static final int KEYCODE_FORWARD = 125; // 0x7d
field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70

View File

@ -773,7 +773,8 @@ public class KeyEvent extends InputEvent implements Parcelable {
public static final int KEYCODE_TV_MEDIA_PAUSE = 274;
//$_rbox_$_modify_$ end
private static final int LAST_KEYCODE = KEYCODE_TV_MEDIA_PAUSE;
public static final int KEYCODE_FIREFLY_RECENT = 275;
private static final int LAST_KEYCODE = KEYCODE_FIREFLY_RECENT;
// NOTE: If you add a new keycode here you must also add it to:
// isSystem()

View File

@ -3131,6 +3131,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
if(keyCode == KeyEvent.KEYCODE_FIREFLY_RECENT)
{
startRecent();
return -1 ;
}
// Shortcuts are invoked through Search+key, so intercept those here
// Any printing key that is chorded with Search should be consumed
// even if no shortcut was invoked. This prevents text from being
@ -6580,6 +6586,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
startActivityAsUser(mHomeIntent, UserHandle.CURRENT);
}
void startRecent()
{
try{
Intent recentIntent = new Intent();
recentIntent.setClassName("com.android.systemui","com.android.systemui.recents.RecentsActivity");
recentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
mContext.startActivityAsUser(recentIntent, UserHandle.CURRENT);
}catch(Exception ex){}
}
/**
* goes to the home screen
* @return whether it did anything

View File

@ -302,12 +302,23 @@ enum {
AKEYCODE_TV_CONTENTS_MENU = 256,
AKEYCODE_TV_MEDIA_CONTEXT_MENU = 257,
AKEYCODE_TV_TIMER_PROGRAMMING = 258,
AKEYCODE_HELP = 259,
AKEYCODE_TV_KEYMOUSE_LEFT = 260,
AKEYCODE_TV_KEYMOUSE_RIGHT = 261,
AKEYCODE_TV_KEYMOUSE_UP = 262,
AKEYCODE_TV_KEYMOUSE_DOWN = 263,
AKEYCODE_TV_KEYMOUSE_MODE_SWITCH = 264,
AKEYCODE_HELP = 259
AKEYCODE_TV_MEDIA_PLAY_PAUSE = 265,
AKEYCODE_TV_MEDIA_STOP = 266,
AKEYCODE_TV_MEDIA_NEXT = 267,
AKEYCODE_TV_MEDIA_PREVIOUS = 268,
AKEYCODE_TV_MEDIA_FAST_FORWARD = 269,
AKEYCODE_TV_MEDIA_REWIND = 270,
AKEYCODE_TV_MEDIA_MULT_FORWARD = 271,
AKEYCODE_TV_MEDIA_MULT_BACKWARD = 272,
AKEYCODE_TV_MEDIA_PLAY = 273,
AKEYCODE_TV_MEDIA_PAUSE = 274,
AKEYCODE_FIREFLY_RECENT = 275
// 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.

View File

@ -304,6 +304,7 @@ static const InputEventLabel KEYCODES[] = {
DEFINE_KEYCODE(TV_KEYMOUSE_DOWN),
DEFINE_KEYCODE(TV_KEYMOUSE_MODE_SWITCH),
DEFINE_KEYCODE(HELP),
DEFINE_KEYCODE(FIREFLY_RECENT),
{ NULL, 0 }
};