OSDN Git Service

add new hotkey for volume mute. Also fixed the keycode number sequence
authorYi Sun <beyounn@gmail.com>
Tue, 10 Nov 2009 03:24:02 +0000 (19:24 -0800)
committerYi Sun <beyounn@gmail.com>
Tue, 10 Nov 2009 03:24:02 +0000 (19:24 -0800)
api/current.xml
core/java/android/view/KeyEvent.java
core/res/res/values/attrs.xml
include/ui/KeycodeLabels.h
libs/ui/KeyLayoutMap.cpp

index 02a0e33..23708bc 100644 (file)
  visibility="public"
 >
 </field>
+<field name="KEYCODE_VOLUME_MUTE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="94"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEYCODE_SLEEP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="95"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEYCODE_WIFI"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="96"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="KEYCODE_W"
  type="int"
  transient="false"
index f2f79e1..a701702 100644 (file)
@@ -120,8 +120,10 @@ public class KeyEvent implements Parcelable {
     public static final int KEYCODE_MUTE            = 91;
     public static final int KEYCODE_PAGE_UP         = 92;
     public static final int KEYCODE_PAGE_DOWN       = 93;
-    public static final int KEYCODE_WIFI            = 238;
-    public static final int KEYCODE_SLEEP           = 142;
+    public static final int KEYCODE_VOLUME_MUTE     = 94;
+    public static final int KEYCODE_SLEEP           = 95;
+    public static final int KEYCODE_WIFI            = 96;
+
     // NOTE: If you add a new keycode here you must also add it to:
     //  isSystem()
     //  frameworks/base/include/ui/KeycodeLabels.h
@@ -136,7 +138,7 @@ public class KeyEvent implements Parcelable {
     //  those new codes.  This is intended to maintain a consistent
     //  set of key code definitions across all Android devices.
    
-    private static final int LAST_KEYCODE           = KEYCODE_PAGE_DOWN;
+    private static final int LAST_KEYCODE           = KEYCODE_WIFI;
     
     /**
      * @deprecated There are now more than MAX_KEYCODE keycodes.
@@ -601,6 +603,7 @@ public class KeyEvent implements Parcelable {
         case KEYCODE_CAMERA:
         case KEYCODE_FOCUS:
         case KEYCODE_SEARCH:
+        case KEYCODE_VOLUME_MUTE:
         case KEYCODE_SLEEP:
         case KEYCODE_WIFI:
             return true;
index 7865f1a..5db3d44 100644 (file)
         <enum name="KEYCODE_MUTE" value="91" />
         <enum name="KEYCODE_PAGE_UP" value="92" />
         <enum name="KEYCODE_PAGE_DOWN" value="93" />
-        <enum name="KEYCODE_WIFI" value="238" />
-        <enum name="KEYCODE_SLEEP" value="142" />
+        <enum name="KEYCODE_VOLUME_MUTE" value="94" />
+        <enum name="KEYCODE_SLEEP" value="95" />
+        <enum name="KEYCODE_WIFI" value="96" />
     </attr>
 
     <!-- ***************************************************************** -->
index 040034c..adefec6 100644 (file)
@@ -116,8 +116,9 @@ static const KeycodeLabel KEYCODES[] = {
     { "MUTE", 91 },
     { "PAGE_UP", 92 },
     { "PAGE_DOWN", 93 },
-    { "WIFI",238},
-    { "SLEEP",142},
+    { "VOLUME_MUTE",94},
+    { "SLEEP",95},
+    { "WIFI",96},
 
     // NOTE: If you add a new keycode here you must also add it to:
     //   (enum KeyCode, in this file)
@@ -225,8 +226,9 @@ typedef enum KeyCode {
     kKeyCodeMute = 91,
     kKeyCodePageUp = 92,
     kKeyCodePageDown = 93,
-    kKeyCodeWifi = 238,
-    kKeyCodeSleep = 142
+    kKeyCodeVolumeMute = 94,
+    kKeyCodeSleep = 95,
+    kKeyCodeWifi = 96,
 } KeyCode;
 
 static const KeycodeLabel FLAGS[] = {
index 15ae54c..7c44131 100644 (file)
@@ -154,7 +154,7 @@ KeyLayoutMap::load(const char* filename)
             case FLAG:
                 if (token == "key") {
                     if (scancode != -1) {
-                        //LOGI("got key decl scancode=%d keycode=%d"
+                        //      LOGI("got key decl scancode=%d keycode=%d"
                         //       " flags=0x%08x\n", scancode, keycode, flags);
                         Key k = { keycode, flags };
                         m_keys.add(scancode, k);
@@ -210,7 +210,7 @@ KeyLayoutMap::map(int32_t scancode, int32_t *keycode, uint32_t *flags) const
     *flags = k.flags;
 
     //LOGD("mapped scancode=%d to keycode=%d flags=0x%08x\n", scancode,
-    //        keycode, flags);
+    //        *keycode, *flags);
 
     return NO_ERROR;
 }