jiangdou 发表于 2015-8-29 10:53:53

给android_增加遥控KEY_F1调用Settings.apk







1,修改kernel/drivers/input/xxx

增加KEY_F1上报按键F1 code    //此内容不多说,,平台各异



2,修改frameworks\base\policy\src\com\android\internal\policy\impl\PhoneWindowManager.java

部分code/*      .......(略)*/

      } else if (keyCode == KeyEvent.KEYCODE_MENU) {
            // Hijack modified menu keys for debugging features
            final int chordBug = KeyEvent.META_SHIFT_ON;

            if (down && repeatCount == 0) {
                if (mEnableShiftMenuBugReports && (metaState & chordBug) == chordBug) {
                  Intent intent = new Intent(Intent.ACTION_BUG_REPORT);
                  mContext.sendOrderedBroadcastAsUser(intent, UserHandle.CURRENT,
                            null, null, null, 0, null, null);
                  return -1;
                } else if (SHOW_PROCESSES_ON_ALT_MENU &&
                        (metaState & KeyEvent.META_ALT_ON) == KeyEvent.META_ALT_ON) {
                  Intent service = new Intent();
                  service.setClassName(mContext, "com.android.server.LoadAverageService");
                  ContentResolver res = mContext.getContentResolver();
                  boolean shown = Settings.Global.getInt(
                            res, Settings.Global.SHOW_PROCESSES, 0) != 0;
                  if (!shown) {
                        mContext.startService(service);
                  } else {
                        mContext.stopService(service);
                  }
                  Settings.Global.putInt(
                            res, Settings.Global.SHOW_PROCESSES, shown ? 0 : 1);
                  return -1;
                }
            }
      
               
/* add by jiangdou for KEY_F1 into Settins.apk20150827. start{{------------ */                        
                } else if((keyCode == KeyEvent.KEYCODE_F1) &&!down){
         
                  
                                 Intent intent = new Intent();
                              ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.Settings");
                              intent.setComponent(cn);
                              intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                              intent.setAction("android.intent.action.MAIN");
                              mContext.startActivity(intent);
      
/* add by jiangdou for KEY_F1 into Settins.apk20150827.end      ------------}} */
                        
      } else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
            if (down) {
                if (repeatCount == 0) {
                  mSearchKeyShortcutPending = true;
                  mConsumeSearchKeyUp = false;
                }
            } else {
                mSearchKeyShortcutPending = false;
                if (mConsumeSearchKeyUp) {
                  mConsumeSearchKeyUp = false;
                  return -1;
                }
            }
            return 0;
      } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
                        
/*      .......(略)*/..




页: [1]
查看完整版本: 给android_增加遥控KEY_F1调用Settings.apk