宏-新项目物理按键不能用

这几次移植代码的时候,经常发现三个物理按键不起效果,后来发现是快捷手电筒引起的。解决的思路很简单,就是把快捷手电筒关掉,解决方法有两个

1.把宏关掉。这个操作起来稍微麻烦一些,因为你关掉了宏以后,还必须重新编译,而且,因为可能有patch,所以你要关好几处的宏.如下

1)关掉ProjectConfig.mk.global中的宏

zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25$ cd mediatek/config/common/
zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25/mediatek/config/common$ ls
audio_policy.conf  autoconfig  configs  custom.conf  fstab  fstab.fat.nand  fstab.nand  media_codecs.xml  meta_init.rc  ProjectConfig.mk  ProjectConfig.mk.global
zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25/mediatek/config/common$ vim ProjectConfig.mk.global

#################################################################################
#################################################################################
##                         vanzo default UI customize                         ##
#################################################################################
#################################################################################
AUTO_ADD_GLOBAL_DEFINE_BY_NAME_UI=VANZO_BEAUTYFACE_SUPPORT

#superuser for vtrunk
VANZO_VTRUNK_SUPERUSER_SUPPORT=no

# disable Notpad feature
MTK_NOTEBOOK_SUPPORT=no

#add funui marco
VANZO_BEAUTYFACE_SUPPORT = yes 
VANZO_CAMERA_WIDGET_SUPPORT=yes
VANZO_COOEE_UNI_LAUNCHER_SUPPORT=yes
VANZO_CUSTOM_DEFAULT_LOCKPAPER_SUPPORT=yes
VANZO_DROPZONE_DEFAULT_OPEN_SUPPORT=yes
VANZO_MUSIC_WIDGET_SUPPORT=yes
VANZO_NET_SPEED_SUPPORT=yes
VANZO_OOS_BROWSER_SUPPORT=yes
VANZO_OOS_CAMERA_UI_SUPPORT=yes
VANZO_PUTAO_CONTACTS_SUPPORT=yes
#让它的值为no(关闭)
VANZO_QUICK_TORCH_SUPPORT
=no

2)打入patch,也就是执行

zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25$ ./makeMtk listp

然后你查看是不是在patch中有对这个宏进行的操作,我们发现有这样两条记录

./config/vanzo6752_lwt_kk/ProjectConfig.mk:1706:VANZO_QUICK_TORCH_SUPPORT=yes
./config/vanzo6752_lwt_kk/ProjectConfig.mk.global:188:VANZO_QUICK_TORCH_SUPPORT=no

也就是说,这个宏重新在patch中打开了。我们手动把他们关闭

3)重新编译

这时候可以通过./makeMtk r dr 来快速编译

 

2.还有另外一种方法

关闭宏,说到底还是为了关闭快捷手电筒,所以我们可以在代码中强制关闭

zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25$ cd frameworks/base/policy/src/com/android/internal/policy/impl/
zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25/frameworks/base/policy/src/com/android/internal/policy/impl$ ls
BarController.java                  keyguard                OosGlobalActions.java           RecentApplicationsBackground.java        torch                      WindowOrientationListener.java
DrawGestureView.java                MainWindowView.java     package.html                    RecentApplicationsDialog.java            UnreadMessageView.java     WindowScrollLayout.java
EnableAccessibilityController.java  MissCallView.java       PhoneFallbackEventHandler.java  ShortcutManager.java                     WindowClockManager.java    YiYunMusicHelper.java
GlobalActions.java                  MusicHelper.java        PhoneLayoutInflater.java        SmallWindowView.java                     WindowClockView.java
GlobalKeyManager.java               MusicUtils.java         PhoneWindow.java                SmartWindowUtils.java                    WindowEventView.java
IconUtilities.java                  MusicView.java          PhoneWindowManager.java         SystemGesturesPointerEventListener.java  WindowGestureManager.java
ImmersiveModeConfirmation.java      NotificationsView.java  Policy.java                     TimeDateView.java                        WindowGestureView.java
zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25/frameworks/base/policy/src/com/android/internal/policy/impl$ vim PhoneWindowManager.java 

修改PhoneWindowManager.java代码

        if (FeatureOption.VANZO_QUICK_TORCH_SUPPORT) {
            mWindowTorchManager = new WindowTorchManager(context);
        }   
//更改为
  if (false) {
            mWindowTorchManager = new WindowTorchManager(context);
        }  

也就是所有用到FeatureOption.VANZO_QUICK_TORCH_SUPPORT 的地方,都用false替换掉

3)烧录

执行

zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25/frameworks/base/policy$ ls
Android.mk  src
zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25/frameworks/base/policy$ cd ../../..
zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25$ ./makeMkt mm frameworks/base/policy
bash: ./makeMkt: No such file or directory
zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25$ ./makeMtk mm frameworks/base/policy

然后push 进去就行了

zhangshuli@zhangshuli-MS-7817:~/PROJECT/PROJECT_V5/52_kk_qhd_k25$ adb push out/target/product/vanzo6752_lwt_kk/system/framework/android.policy.jar system/framework

 

posted @ 2015-03-03 21:31  小白屋  阅读(341)  评论(0编辑  收藏  举报