CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 5073|回复: 0

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

[复制链接]
发表于 2015-8-29 10:53:53 | 显示全部楼层 |阅读模式
QQ图片20150829091800.png





1,修改kernel/drivers/input/xxx

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



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

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

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

  5.             if (down && repeatCount == 0) {
  6.                 if (mEnableShiftMenuBugReports && (metaState & chordBug) == chordBug) {
  7.                     Intent intent = new Intent(Intent.ACTION_BUG_REPORT);
  8.                     mContext.sendOrderedBroadcastAsUser(intent, UserHandle.CURRENT,
  9.                             null, null, null, 0, null, null);
  10.                     return -1;
  11.                 } else if (SHOW_PROCESSES_ON_ALT_MENU &&
  12.                         (metaState & KeyEvent.META_ALT_ON) == KeyEvent.META_ALT_ON) {
  13.                     Intent service = new Intent();
  14.                     service.setClassName(mContext, "com.android.server.LoadAverageService");
  15.                     ContentResolver res = mContext.getContentResolver();
  16.                     boolean shown = Settings.Global.getInt(
  17.                             res, Settings.Global.SHOW_PROCESSES, 0) != 0;
  18.                     if (!shown) {
  19.                         mContext.startService(service);
  20.                     } else {
  21.                         mContext.stopService(service);
  22.                     }
  23.                     Settings.Global.putInt(
  24.                             res, Settings.Global.SHOW_PROCESSES, shown ? 0 : 1);
  25.                     return -1;
  26.                 }
  27.             }
  28.         
  29.                
  30. /* add by jiangdou for KEY_F1 into Settins.apk  20150827. start{{------------ */                        
  31.                 } else if((keyCode == KeyEvent.KEYCODE_F1) &&!down){
  32.            
  33.                   
  34.                                  Intent intent = new Intent();
  35.                                 ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.Settings");
  36.                                 intent.setComponent(cn);
  37.                                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  38.                                 intent.setAction("android.intent.action.MAIN");
  39.                                 mContext.startActivity(intent);
  40.         
  41. /* add by jiangdou for KEY_F1 into Settins.apk  20150827.  end        ------------}} */
  42.                         
  43.         } else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
  44.             if (down) {
  45.                 if (repeatCount == 0) {
  46.                     mSearchKeyShortcutPending = true;
  47.                     mConsumeSearchKeyUp = false;
  48.                 }
  49.             } else {
  50.                 mSearchKeyShortcutPending = false;
  51.                 if (mConsumeSearchKeyUp) {
  52.                     mConsumeSearchKeyUp = false;
  53.                     return -1;
  54.                 }
  55.             }
  56.             return 0;
  57.         } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
  58.                         
  59. /*        .......(略)  */
复制代码
..




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-3-29 14:44 , Processed in 0.024499 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部