Android6 添加一个新的物理按键键值

From 4c1c576f1155f5e5bfc14675809944e938690287 Mon Sep 17 00:00:00 2001
From: hanyiyi <[email protected]>
Date: Wed, 7 Nov 2018 19:11:12 +0800
Subject: [PATCH] add broadcast for oem

---
 bootable/bootloader/lk/target/msm8909/include/target/display.h                                          |   4 ++++
 bootable/bootloader/lk/target/msm8909/target_display.c                                                  |   6 ++++++
 device/qcom/msm8909/channel-switch.kl                                                                   |   2 ++
 device/qcom/msm8909/gpio-keys.kl    注意格式,不能留空格                                   |   6 +++---
 frameworks/base/api/current.txt                                                                         |   8 ++++++++
 frameworks/base/api/system-current.txt                                                                  |   8 ++++++++
 frameworks/base/core/java/android/view/KeyEvent.java                                                    |  19 +++++++++++++++++++
 frameworks/base/core/res/res/values/attrs.xml                                                           |   8 ++++++++
 frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java                     |  21 ++++++++++++++++++++-
 frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java                    | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 frameworks/native/include/android/keycodes.h                                                            |  11 ++++++++++-
 frameworks/native/include/input/InputEventLabels.h                                                      |   8 ++++++++
 kernel/arch/arm/boot/dts/qcom/msm8909-qrd-skua.dtsi                                                     |   4 ++--
 kernel/drivers/input/channel_switch.c                                                                   |  36 ++++++++++++++++++++++++++++++------
 vendor/qcom/proprietary/common/scripts/SecImage/signed/integrity_check/default/appsbl/emmc_appsboot.mbn | Bin 496080 -> 0 bytes
 15 files changed, 295 insertions(+), 13 deletions(-)

diff --git a/bootable/bootloader/lk/target/msm8909/include/target/display.h b/bootable/bootloader/lk/target/msm8909/include/target/display.h
index c939480..6408425 100644
--- a/bootable/bootloader/lk/target/msm8909/include/target/display.h
+++ b/bootable/bootloader/lk/target/msm8909/include/target/display.h
@@ -65,6 +65,10 @@ static struct gpio_pin pwm_gpio = {
   0, 0, 0, 0, 0, 0
 };
 
+static struct gpio_pin green_led = {
+  "msmgpio", 22, 3, 1, 0, 1
+};
+
 /*---------------------------------------------------------------------------*/
 /* Target Physical configuration                                             */
 /*---------------------------------------------------------------------------*/
diff --git a/bootable/bootloader/lk/target/msm8909/target_display.c b/bootable/bootloader/lk/target/msm8909/target_display.c
index dd01851..9c14096 100644
--- a/bootable/bootloader/lk/target/msm8909/target_display.c
+++ b/bootable/bootloader/lk/target/msm8909/target_display.c
@@ -343,6 +343,12 @@ int target_panel_reset(uint8_t enable, struct panel_reset_sequence *resetseq,
                 gpio_set(reset_gpio.pin_id, GPIO_STATE_HIGH);
             mdelay(resetseq->sleep[i]);
         }
+
+        gpio_tlmm_config(green_led.pin_id, 0,
+            green_led.pin_direction, green_led.pin_pull,
+            green_led.pin_strength, green_led.pin_state);
+
+        gpio_set(green_led.pin_id, 2);
     } else if(!target_cont_splash_screen()) {
         gpio_set(reset_gpio.pin_id, 0);
         if (pinfo->mipi.use_enable_gpio)
diff --git a/device/qcom/msm8909/channel-switch.kl b/device/qcom/msm8909/channel-switch.kl
index e2891a1..fb37ff4 100644
--- a/device/qcom/msm8909/channel-switch.kl
+++ b/device/qcom/msm8909/channel-switch.kl
@@ -14,3 +14,5 @@ key 259   BUTTON_4
 key 260   BUTTON_5
 key 261   BUTTON_6
 key 262   BUTTON_7
+key 183   CHANNELDOWN
+key 184   CHANNELUP
diff --git a/device/qcom/msm8909/gpio-keys.kl b/device/qcom/msm8909/gpio-keys.kl
index 41a5d76..fdb8be9 100755
--- a/device/qcom/msm8909/gpio-keys.kl
+++ b/device/qcom/msm8909/gpio-keys.kl
@@ -27,6 +27,6 @@
 
 key 115   VOLUME_UP
 key 114   VOLUME_DOWN
-key 59   F1
-key 60   F2
-key 61   F3
+key 59   PTT
+key 60   FUNC
+key 61   FNUC
diff --git a/frameworks/base/api/current.txt b/frameworks/base/api/current.txt
index c2caf75..92575c2 100644
--- a/frameworks/base/api/current.txt
+++ b/frameworks/base/api/current.txt
@@ -35087,6 +35087,8 @@ package android.view {
     field public static final int KEYCODE_CAMERA = 27; // 0x1b
     field public static final int KEYCODE_CAPS_LOCK = 115; // 0x73
     field public static final int KEYCODE_CAPTIONS = 175; // 0xaf
+    field public static final int KEYCODE_CHANNELDOWN = 270; // 0x10e
+    field public static final int KEYCODE_CHANNELUP = 271; // 0x10f
     field public static final int KEYCODE_CHANNEL_DOWN = 167; // 0xa7
     field public static final int KEYCODE_CHANNEL_UP = 166; // 0xa6
     field public static final int KEYCODE_CLEAR = 28; // 0x1c
@@ -35123,9 +35125,11 @@ 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_FNUC = 267; // 0x10b
     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
+    field public static final int KEYCODE_FUNC = 269; // 0x10d
     field public static final int KEYCODE_FUNCTION = 119; // 0x77
     field public static final int KEYCODE_G = 35; // 0x23
     field public static final int KEYCODE_GRAVE = 68; // 0x44
@@ -35203,6 +35207,7 @@ package android.view {
     field public static final int KEYCODE_NUMPAD_SUBTRACT = 156; // 0x9c
     field public static final int KEYCODE_NUM_LOCK = 143; // 0x8f
     field public static final int KEYCODE_O = 43; // 0x2b
+    field public static final int KEYCODE_OEM = 268; // 0x10c
     field public static final int KEYCODE_P = 44; // 0x2c
     field public static final int KEYCODE_PAGE_DOWN = 93; // 0x5d
     field public static final int KEYCODE_PAGE_UP = 92; // 0x5c
@@ -35216,6 +35221,7 @@ package android.view {
     field public static final int KEYCODE_PROG_GREEN = 184; // 0xb8
     field public static final int KEYCODE_PROG_RED = 183; // 0xb7
     field public static final int KEYCODE_PROG_YELLOW = 185; // 0xb9
+    field public static final int KEYCODE_PTT = 266; // 0x10a
     field public static final int KEYCODE_Q = 45; // 0x2d
     field public static final int KEYCODE_R = 46; // 0x2e
     field public static final int KEYCODE_RIGHT_BRACKET = 72; // 0x48
@@ -35235,6 +35241,8 @@ package android.view {
     field public static final int KEYCODE_STAR = 17; // 0x11
     field public static final int KEYCODE_STB_INPUT = 180; // 0xb4
     field public static final int KEYCODE_STB_POWER = 179; // 0xb3
+    field public static final int KEYCODE_STEM_1 = 265; // 0x109
+    field public static final int KEYCODE_STEM_PRIMARY = 264; // 0x108
     field public static final int KEYCODE_SWITCH_CHARSET = 95; // 0x5f
     field public static final int KEYCODE_SYM = 63; // 0x3f
     field public static final int KEYCODE_SYSRQ = 120; // 0x78
diff --git a/frameworks/base/api/system-current.txt b/frameworks/base/api/system-current.txt
index 7685e39..0433f37 100644
--- a/frameworks/base/api/system-current.txt
+++ b/frameworks/base/api/system-current.txt
@@ -37380,6 +37380,8 @@ package android.view {
     field public static final int KEYCODE_CAMERA = 27; // 0x1b
     field public static final int KEYCODE_CAPS_LOCK = 115; // 0x73
     field public static final int KEYCODE_CAPTIONS = 175; // 0xaf
+    field public static final int KEYCODE_CHANNELDOWN = 270; // 0x10e
+    field public static final int KEYCODE_CHANNELUP = 271; // 0x10f
     field public static final int KEYCODE_CHANNEL_DOWN = 167; // 0xa7
     field public static final int KEYCODE_CHANNEL_UP = 166; // 0xa6
     field public static final int KEYCODE_CLEAR = 28; // 0x1c
@@ -37416,9 +37418,11 @@ 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_FNUC = 267; // 0x10b
     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
+    field public static final int KEYCODE_FUNC = 269; // 0x10d
     field public static final int KEYCODE_FUNCTION = 119; // 0x77
     field public static final int KEYCODE_G = 35; // 0x23
     field public static final int KEYCODE_GRAVE = 68; // 0x44
@@ -37496,6 +37500,7 @@ package android.view {
     field public static final int KEYCODE_NUMPAD_SUBTRACT = 156; // 0x9c
     field public static final int KEYCODE_NUM_LOCK = 143; // 0x8f
     field public static final int KEYCODE_O = 43; // 0x2b
+    field public static final int KEYCODE_OEM = 268; // 0x10c
     field public static final int KEYCODE_P = 44; // 0x2c
     field public static final int KEYCODE_PAGE_DOWN = 93; // 0x5d
     field public static final int KEYCODE_PAGE_UP = 92; // 0x5c
@@ -37509,6 +37514,7 @@ package android.view {
     field public static final int KEYCODE_PROG_GREEN = 184; // 0xb8
     field public static final int KEYCODE_PROG_RED = 183; // 0xb7
     field public static final int KEYCODE_PROG_YELLOW = 185; // 0xb9
+    field public static final int KEYCODE_PTT = 266; // 0x10a
     field public static final int KEYCODE_Q = 45; // 0x2d
     field public static final int KEYCODE_R = 46; // 0x2e
     field public static final int KEYCODE_RIGHT_BRACKET = 72; // 0x48
@@ -37528,6 +37534,8 @@ package android.view {
     field public static final int KEYCODE_STAR = 17; // 0x11
     field public static final int KEYCODE_STB_INPUT = 180; // 0xb4
     field public static final int KEYCODE_STB_POWER = 179; // 0xb3
+    field public static final int KEYCODE_STEM_1 = 265; // 0x109
+    field public static final int KEYCODE_STEM_PRIMARY = 264; // 0x108
     field public static final int KEYCODE_SWITCH_CHARSET = 95; // 0x5f
     field public static final int KEYCODE_SYM = 63; // 0x3f
     field public static final int KEYCODE_SYSRQ = 120; // 0x78
diff --git a/frameworks/base/core/java/android/view/KeyEvent.java b/frameworks/base/core/java/android/view/KeyEvent.java
index 6888558..e911a17 100644
--- a/frameworks/base/core/java/android/view/KeyEvent.java
+++ b/frameworks/base/core/java/android/view/KeyEvent.java
@@ -761,6 +761,25 @@ public class KeyEvent extends InputEvent implements Parcelable {
      * Backs out one level of a navigation hierarchy or collapses the item that currently has
      * focus. */
     public static final int KEYCODE_NAVIGATE_OUT    = 263;
+
+    /** Key code constant: Primary stem key for Wear
+     * Main power/reset button on watch. */
+    public static final int KEYCODE_STEM_PRIMARY = 264;
+    /** Key code constant: Generic stem key 1 for Wear */
+    public static final int KEYCODE_STEM_1 = 265;
+    /** Key code constant: Generic stem key 2 for Wear */
+    public static final int KEYCODE_PTT = 266;
+    /** Key code constant: Generic stem key 3 for Wear */
+    public static final int KEYCODE_FNUC = 267;
+
+    public static final int KEYCODE_OEM = 268;
+    /** Key code constant: Generic stem key 1 for Wear */
+    public static final int KEYCODE_FUNC = 269;
+    /** Key code constant: Generic stem key 2 for Wear */
+    public static final int KEYCODE_CHANNELDOWN = 270;
+    /** Key code constant: Generic stem key 3 for Wear */
+    public static final int KEYCODE_CHANNELUP = 271;
+
     /** Key code constant: Skip forward media key. */
     public static final int KEYCODE_MEDIA_SKIP_FORWARD = 272;
     /** Key code constant: Skip backward media key. */
diff --git a/frameworks/base/core/res/res/values/attrs.xml b/frameworks/base/core/res/res/values/attrs.xml
index 67abe8d..1e28f85 100644
--- a/frameworks/base/core/res/res/values/attrs.xml
+++ b/frameworks/base/core/res/res/values/attrs.xml
@@ -1806,6 +1806,14 @@ i
         
         
         
+        
+        
+        
+        
+        
+        
+        
+        
         
         
         
diff --git a/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java b/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
index dd08b69..eef71e7 100644
--- a/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -3868,7 +3868,26 @@ public class PackageManagerService extends IPackageManager.Stub {
     @Override
     public boolean isProtectedBroadcast(String actionName) {
         synchronized (mPackages) {
-            return mProtectedBroadcasts.contains(actionName);
+             if (mProtectedBroadcasts.contains(actionName)) {
+                return true;
+            } else if (actionName != null) {
+                if(actionName.equals("android.intent.action.PTT.down")
+                    || actionName.equals("android.intent.action.PTT.up")
+                    || actionName.equals("android.intent.action.FUN.down")
+                    || actionName.equals("android.intent.action.FUN.longpress")
+                    || actionName.equals("android.intent.action.FUN.up")
+                    || actionName.equals("android.intent.action.SOS.down")
+                    || actionName.equals("android.intent.action.FUNC_LONG_PRESS")
+                    || actionName.equals("android.intent.action.SOS.up")
+                    || actionName.equals("com.android.action.KEYCODE_BACKWARD")
+                    || actionName.equals("com.android.action.KEYCODE_FORWARD_NEW")
+                    || actionName.equals("com.android.action.KEYCODE_VOLUME_UP")
+                    || actionName.equals("com.android.action.KEYCODE_VOLUME_DOWN")
+                    || actionName.equals("com.dfl.knob")){
+                        return true;
+                }
+            }
+            return false;
         }
     }
 
diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 0bcd3ac..e7011fe 100644
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -656,6 +656,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     boolean mWifiDisplayConnected = false;
     int mWifiDisplayCustomRotation = -1;
 
+    private boolean mOemKeyHandled = false;
+    private long downCurrentTime=0;
+    private boolean isFirstSend=false;
+
     private class PolicyHandler extends Handler {
         @Override
         public void handleMessage(Message msg) {
@@ -3066,6 +3070,169 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             return -1;
         }
 
+    if(keyCode == KeyEvent.KEYCODE_FNUC || keyCode == KeyEvent.KEYCODE_FUNC || keyCode == KeyEvent.KEYCODE_PTT || keyCode == KeyEvent.KEYCODE_CHANNELDOWN
+           || keyCode == KeyEvent.KEYCODE_OEM || keyCode == KeyEvent.KEYCODE_CHANNELUP ||keyCode == KeyEvent.KEYCODE_F4 || keyCode == KeyEvent.KEYCODE_F5
+           || keyCode == KeyEvent.KEYCODE_F6|| keyCode == KeyEvent.KEYCODE_F7|| keyCode == KeyEvent.KEYCODE_F8|| keyCode == KeyEvent.KEYCODE_F9
+           || keyCode == KeyEvent.KEYCODE_F10|| keyCode == KeyEvent.KEYCODE_F11|| keyCode == KeyEvent.KEYCODE_F12|| keyCode == KeyEvent.KEYCODE_BUTTON_1
+           || keyCode == KeyEvent.KEYCODE_BUTTON_2|| keyCode == KeyEvent.KEYCODE_BUTTON_3|| keyCode == KeyEvent.KEYCODE_BUTTON_4|| keyCode == KeyEvent.KEYCODE_BUTTON_5
+           || keyCode == KeyEvent.KEYCODE_BUTTON_6|| keyCode == KeyEvent.KEYCODE_BUTTON_7){
+            //int currentTime=System.currentTimeMillis();
+            //Slog.w(TAG,"currentTime="+currentTime);
+            if (down){
+                //Slog.w(TAG, "------down-------keyCode-"+keyCode);
+                if(!mOemKeyHandled){
+                    downCurrentTime=System.currentTimeMillis();
+                    Slog.w(TAG,"downCurrentTime=="+downCurrentTime+"keyCode="+keyCode);
+                    switch(keyCode){
+                        case KeyEvent.KEYCODE_PTT:
+                            Intent oemIntent1 = new Intent("android.intent.action.PTT.down");
+                            mContext.sendBroadcastAsUser(oemIntent1, UserHandle.CURRENT_OR_SELF);
+                            break;
+                        case KeyEvent.KEYCODE_FUNC:
+                            Intent oemIntent2 = new Intent("android.intent.action.FUN.down");
+                            mContext.sendBroadcastAsUser(oemIntent2, UserHandle.CURRENT_OR_SELF);
+                            break;
+                        //case KeyEvent.KEYCODE_PTT:
+                            //Intent oemIntent222 = new Intent("android.intent.action.EXT_P2.down");
+                            //mContext.sendBroadcastAsUser(oemIntent222, UserHandle.CURRENT_OR_SELF);
+                            //break;
+                        case KeyEvent.KEYCODE_FNUC:
+                            Intent oemIntent3 = new Intent("android.intent.action.SOS.down");
+                            mContext.sendBroadcastAsUser(oemIntent3, UserHandle.CURRENT_OR_SELF);
+                            break;
+                        case KeyEvent.KEYCODE_CHANNELDOWN:
+                            Intent oemIntent5 = new Intent("com.android.action.KEYCODE_BACKWARD");
+                            mContext.sendBroadcastAsUser(oemIntent5, UserHandle.CURRENT_OR_SELF);
+                            break;
+                        case KeyEvent.KEYCODE_CHANNELUP:
+                            Intent oemIntent6 = new Intent("com.android.action.KEYCODE_FORWARD_NEW");
+                            mContext.sendBroadcastAsUser(oemIntent6, UserHandle.CURRENT_OR_SELF);
+                            break;
+                        case KeyEvent.KEYCODE_VOLUME_UP:
+                            Intent oemIntent7 = new Intent("com.android.action.KEYCODE_VOLUME_UP");
+                            mContext.sendBroadcastAsUser(oemIntent7, UserHandle.CURRENT_OR_SELF);
+                            break;
+                        case KeyEvent.KEYCODE_VOLUME_DOWN:
+                            Intent oemIntent8 = new Intent("com.android.action.KEYCODE_VOLUME_DOWN");
+                            mContext.sendBroadcastAsUser(oemIntent8, UserHandle.CURRENT_OR_SELF);
+                            break;
+                    }
+                    Slog.w(TAG,"keyCode="+keyCode);
+                    //knob
+                    if(keyCode == KeyEvent.KEYCODE_F4 || keyCode == KeyEvent.KEYCODE_F5
+                       || keyCode == KeyEvent.KEYCODE_F6|| keyCode == KeyEvent.KEYCODE_F7|| keyCode == KeyEvent.KEYCODE_F8|| keyCode == KeyEvent.KEYCODE_F9
+                       || keyCode == KeyEvent.KEYCODE_F10|| keyCode == KeyEvent.KEYCODE_F11|| keyCode == KeyEvent.KEYCODE_F12|| keyCode == KeyEvent.KEYCODE_BUTTON_1
+                       || keyCode == KeyEvent.KEYCODE_BUTTON_2|| keyCode == KeyEvent.KEYCODE_BUTTON_3|| keyCode == KeyEvent.KEYCODE_BUTTON_4|| keyCode == KeyEvent.KEYCODE_BUTTON_5
+                       || keyCode == KeyEvent.KEYCODE_BUTTON_6|| keyCode == KeyEvent.KEYCODE_BUTTON_7)
+                    {
+                        Intent oemIntent4 = new Intent("com.dfl.knob");
+                        switch(keyCode){
+                            case KeyEvent.KEYCODE_F4:
+                                oemIntent4.putExtra("frequencyNum",1);
+                                break;
+                            case KeyEvent.KEYCODE_F5:
+                                oemIntent4.putExtra("frequencyNum",2);
+                                break;
+                            case KeyEvent.KEYCODE_F6:
+                                oemIntent4.putExtra("frequencyNum",3);
+                                break;
+                            case KeyEvent.KEYCODE_F7:
+                                oemIntent4.putExtra("frequencyNum",4);
+                                break;
+                            case KeyEvent.KEYCODE_F8:
+                                oemIntent4.putExtra("frequencyNum",5);
+                                break;
+                            case KeyEvent.KEYCODE_F9:
+                                oemIntent4.putExtra("frequencyNum",6);
+                                break;
+                            case KeyEvent.KEYCODE_F10:
+                                oemIntent4.putExtra("frequencyNum",7);
+                                break;
+                            case KeyEvent.KEYCODE_F11:
+                                oemIntent4.putExtra("frequencyNum",8);
+                                break;
+                            case KeyEvent.KEYCODE_F12:
+                                oemIntent4.putExtra("frequencyNum",9);
+                                break;
+                            case KeyEvent.KEYCODE_BUTTON_1:
+                                oemIntent4.putExtra("frequencyNum",10);
+                                break;
+                            case KeyEvent.KEYCODE_BUTTON_2:
+                                oemIntent4.putExtra("frequencyNum",11);
+                                break;
+                            case KeyEvent.KEYCODE_BUTTON_3:
+                                oemIntent4.putExtra("frequencyNum",12);
+                                break;
+                            case KeyEvent.KEYCODE_BUTTON_4:
+                                oemIntent4.putExtra("frequencyNum",13);
+                                break;
+                            case KeyEvent.KEYCODE_BUTTON_5:
+                                oemIntent4.putExtra("frequencyNum",14);
+                                break;
+                            case KeyEvent.KEYCODE_BUTTON_6:
+                                oemIntent4.putExtra("frequencyNum",15);
+                                break;
+                            case KeyEvent.KEYCODE_BUTTON_7:
+                                oemIntent4.putExtra("frequencyNum",16);
+                                break;
+                        }
+                        mContext.sendBroadcastAsUser(oemIntent4, UserHandle.CURRENT_OR_SELF);
+                    }
+                    mOemKeyHandled = true;
+                }
+
+                if(mOemKeyHandled){
+                    if((System.currentTimeMillis()-downCurrentTime)>1000){
+                        Slog.w(TAG,"downCurrentTime2=="+downCurrentTime+"-keyCode="+keyCode+"--"+(System.currentTimeMillis()-downCurrentTime));
+                        if(!isFirstSend){
+                            switch(keyCode)
+                            {
+                                case KeyEvent.KEYCODE_FUNC:
+                                    Intent oemIntent12 = new Intent("android.intent.action.FUN.longpress");
+                                    mContext.sendBroadcastAsUser(oemIntent12, UserHandle.CURRENT_OR_SELF);
+                                    break;
+                                //case KeyEvent.KEYCODE_PTT:
+                                    //Intent oemIntent1222 = new Intent("android.intent.action.EXT_P2.longpress");
+                                    //mContext.sendBroadcastAsUser(oemIntent1222, UserHandle.CURRENT_OR_SELF);
+                                    //break;
+                                case KeyEvent.KEYCODE_FNUC:
+                                    Intent oemIntent13 = new Intent("android.intent.action.FUNC_LONG_PRESS");
+                                    mContext.sendBroadcastAsUser(oemIntent13, UserHandle.CURRENT_OR_SELF);
+                                    break;
+                            }
+                            isFirstSend=true;
+                        }
+                    }
+                }
+            }else{
+                //Slog.w(TAG, "------down-------keyCode-"+keyCode);
+                Slog.w(TAG,(System.currentTimeMillis()-downCurrentTime)+"-downCurrentTime="+downCurrentTime );
+                if((System.currentTimeMillis()-downCurrentTime)<1000){
+                    switch(keyCode)
+                    {
+                        case KeyEvent.KEYCODE_FUNC:
+                            Intent oemIntent122 = new Intent("android.intent.action.FUN.up");
+                            mContext.sendBroadcastAsUser(oemIntent122, UserHandle.CURRENT_OR_SELF);
+                            break;
+                        //case KeyEvent.KEYCODE_PTT:
+                            //Intent oemIntent1122 = new Intent("android.intent.action.EXT_P2.shortpress");
+                            //mContext.sendBroadcastAsUser(oemIntent1122, UserHandle.CURRENT_OR_SELF);
+                            //break;
+                        case KeyEvent.KEYCODE_FNUC:
+                            Intent oemIntent133 = new Intent("android.intent.action.SOS.up");
+                            mContext.sendBroadcastAsUser(oemIntent133, UserHandle.CURRENT_OR_SELF);
+                            break;
+                    }
+                }
+                if(keyCode == KeyEvent.KEYCODE_PTT){
+                    Intent oemIntent111 = new Intent("android.intent.action.PTT.up");
+                    mContext.sendBroadcastAsUser(oemIntent111, UserHandle.CURRENT_OR_SELF);
+                }
+                mOemKeyHandled = false;
+                isFirstSend=false;
+            }
+        }
+
         // Reserve all the META modifier combos for system behavior
         if ((metaState & KeyEvent.META_META_ON) != 0) {
             return -1;
diff --git a/frameworks/native/include/android/keycodes.h b/frameworks/native/include/android/keycodes.h
index 15bb786..d82f8f3 100644
--- a/frameworks/native/include/android/keycodes.h
+++ b/frameworks/native/include/android/keycodes.h
@@ -722,7 +722,16 @@ enum {
     AKEYCODE_NAVIGATE_PREVIOUS = 260,
     AKEYCODE_NAVIGATE_NEXT   = 261,
     AKEYCODE_NAVIGATE_IN     = 262,
-    AKEYCODE_NAVIGATE_OUT    = 263
+    AKEYCODE_NAVIGATE_OUT    = 263,
+    AKEYCODE_STEM_PRIMARY = 264,
+    AKEYCODE_STEM_1 = 265,
+    AKEYCODE_PTT = 266,
+    AKEYCODE_FNUC = 267,
+    AKEYCODE_OEM = 268,
+    AKEYCODE_FUNC = 269,
+    AKEYCODE_CHANNELDOWN = 270,
+    AKEYCODE_CHANNELUP= 271,
+
 
     // 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.
diff --git a/frameworks/native/include/input/InputEventLabels.h b/frameworks/native/include/input/InputEventLabels.h
index 3962001..1874544 100644
--- a/frameworks/native/include/input/InputEventLabels.h
+++ b/frameworks/native/include/input/InputEventLabels.h
@@ -303,6 +303,14 @@ static const InputEventLabel KEYCODES[] = {
     DEFINE_KEYCODE(NAVIGATE_NEXT),
     DEFINE_KEYCODE(NAVIGATE_IN),
     DEFINE_KEYCODE(NAVIGATE_OUT),
+    DEFINE_KEYCODE(STEM_PRIMARY),
+    DEFINE_KEYCODE(STEM_1),
+    DEFINE_KEYCODE(PTT),
+    DEFINE_KEYCODE(FNUC),
+    DEFINE_KEYCODE(OEM),
+    DEFINE_KEYCODE(FUNC),
+    DEFINE_KEYCODE(CHANNELDOWN),
+    DEFINE_KEYCODE(CHANNELUP),
 
     { NULL, 0 }
 };
diff --git a/kernel/arch/arm/boot/dts/qcom/msm8909-qrd-skua.dtsi b/kernel/arch/arm/boot/dts/qcom/msm8909-qrd-skua.dtsi
index 691cad9..4b3ffbb 100644
--- a/kernel/arch/arm/boot/dts/qcom/msm8909-qrd-skua.dtsi
+++ b/kernel/arch/arm/boot/dts/qcom/msm8909-qrd-skua.dtsi
@@ -179,11 +179,11 @@
             gpios = <&msm_gpio 22 0>;
             label = "green";
             linux,default-trigger = "none";
-            default-state = "off";
+            default-state = "on";
             retain-state-suspended;
         };
 
-        orange {
+        blue {
             gpios = <&msm_gpio 52 0>;
             label = "blue";
             linux,default-trigger = "none";
diff --git a/kernel/drivers/input/channel_switch.c b/kernel/drivers/input/channel_switch.c
index 14c6044..9d2fd35 100644
--- a/kernel/drivers/input/channel_switch.c
+++ b/kernel/drivers/input/channel_switch.c
@@ -120,6 +120,8 @@ struct switch_state switch_map_code[16] = {
 
 unsigned int current_code;
 unsigned int last_code;
+unsigned int channel_current_position;
+unsigned int channel_last_position;
 struct channel_switch_drvdata *channel_ddata;
 
 static unsigned int channel_switch_gpio_value_map_code(struct channel_switch_drvdata *ddata)
@@ -151,7 +153,7 @@ static unsigned int channel_switch_gpio_value_map_code(struct channel_switch_drv
     pr_err("%s : switch_value = %d ,switch_position = %u\n", __func__, switch_value, switch_position);
 
     current_code = switch_map_code[switch_position].code;
-
+    channel_current_position = switch_position;
     return current_code;
 }
 
@@ -165,13 +167,32 @@ static void channel_switch_gpio_report_event(struct channel_switch_button_data *
     channel_switch_gpio_value_map_code(channel_ddata);
     pr_debug("%s : last_code = %u, current_code = %u\n", __func__, last_code, current_code);
     if (current_code != last_code) {
-        input_event(input, type, current_code, 1);//switch down
-        input_sync(input);
-        msleep(5);
-        input_event(input, type, current_code, 0);//switch up
-        input_sync(input);
+        //input_event(input, type, current_code, 1);//switch down
+        //input_sync(input);
+        //msleep(5);
+        //input_event(input, type, current_code, 0);//switch up
+        //input_sync(input);
         last_code = current_code;
     }
+    pr_err("%s : channel_current_position = %u, channel_last_position = %u\n", __func__, channel_current_position, channel_last_position);
+
+    if (channel_current_position != channel_last_position) {
+        if (channel_current_position > channel_last_position) {
+            input_event(input, type, KEY_F14, 1);//forward
+            input_sync(input);
+            msleep(5);
+            input_event(input, type, KEY_F14, 0);
+            input_sync(input);
+        } else {
+            input_event(input, type, KEY_F13, 1);//backward
+            input_sync(input);
+            msleep(5);
+            input_event(input, type, KEY_F13, 0);
+            input_sync(input);
+        }
+        channel_last_position = channel_current_position;
+    }
+
     mutex_unlock(&channel_ddata->m_lock);
 }
 
@@ -620,6 +641,9 @@ static int channel_switch_probe(struct platform_device *pdev)
     for (i = 0; i < sizeof(switch_map_code)/sizeof(struct switch_state); i++)
         input_set_capability(input, EV_KEY, switch_map_code[i].code);
 
+    input_set_capability(input, EV_KEY, KEY_F13);//backward
+    input_set_capability(input, EV_KEY, KEY_F14);//forward
+
     /* Enable auto repeat feature of Linux input subsystem */
     if (pdata->rep)
         __set_bit(EV_REP, input->evbit);
diff --git a/vendor/qcom/proprietary/common/scripts/SecImage/signed/integrity_check/default/appsbl/emmc_appsboot.mbn b/vendor/qcom/proprietary/common/scripts/SecImage/signed/integrity_check/default/appsbl/emmc_appsboot.mbn
index ec93df4..aef802c 100755
Binary files a/vendor/qcom/proprietary/common/scripts/SecImage/signed/integrity_check/default/appsbl/emmc_appsboot.mbn and b/vendor/qcom/proprietary/common/scripts/SecImage/signed/integrity_check/default/appsbl/emmc_appsboot.mbn differ
--
libgit2 0.25.0
 

你可能感兴趣的:(Android6 添加一个新的物理按键键值)