Android 4.4
Android 5.0
Android 5.1
Modify File Frameworks\base\packages\keyguard\res\values\config.xml
In the
<!--allow the menu hard key to being disabled in lockscreen on some devices [does not TRANSLATE]-
<bool name= "Config_disablemenukeyinlockscreen" >false</bool>
Change to True to disable the feature.
In the 5.1
: ~/code/ardroid5.1/frameworks/base/packages/keyguard$ Grep-rin "Config_disablemenukeyinlockscreen".
./res/values/config.xml:30: <bool name= "Config_disablemenukeyinlockscreen" >false</bool>
./src/com/android/keyguard/keyguardviewbase.java:412:final Boolean configdisabled = Res.getboolean (R.bool.config_d Isablemenukeyinlockscreen);
: ~/code/ardroid5.1/frameworks/base/packages/keyguard$ Grep-rin "configdisabled".
./src/com/android/keyguard/keyguardviewbase.java:412:final Boolean configdisabled = Res.getboolean (R.bool.config_d Isablemenukeyinlockscreen);
./src/com/android/keyguard/keyguardviewbase.java:415:return!configdisabled | | istestharness | | Fileoverride;
: ~/code/ardroid5.1/frameworks/base/packages/keyguard$ vim./src/com/android/keyguard/keyguardviewbase.java +415
private static final String Enable_menu_key_file = "/data/local/enable_menu_key";
Private Boolean Shouldenablemenukey () {
Final Resources res = getresources ();
Final Boolean configdisabled = Res.getboolean (R.bool.config_disablemenukeyinlockscreen);
Final Boolean istestharness = Activitymanager.isrunningintestharness ();
Final Boolean fileoverride = (new File (Enable_menu_key_file)). exists ();
return!configdisabled | | istestharness | | Fileoverride;
}
: ~/code/ardroid5.1/frameworks/base/packages/keyguard$ Grep-rin "Shouldenablemenukey".
./src/com/android/keyguard/keyguardviewbase.java:410:private Boolean Shouldenablemenukey () {
./src/com/android/keyguard/keyguardviewbase.java:421:if (Shouldenablemenukey () &&!mlockpatternutils.isse Cure ()) {
: ~/code/ardroid5.1/frameworks/base/packages/keyguard$ vim./src/com/android/keyguard/keyguardviewbase.java +421
public Boolean Handlemenukey () {
The following enables the MENU key to work for testing automation
if (Shouldenablemenukey () &&!mlockpatternutils.issecure ()) {
Dismiss ();
return true;
}
return false;
}
: ~/code/ardroid5.1/frameworks/base/packages/systemui$ Grep-rin "Handlemenukey".
./src/com/android/systemui/statusbar/phone/keyguardbouncer.java:226:if (Mkeyguardview.handlemenukey ()) {
public Boolean onmenupressed () {
Ensureview ();
if (Mkeyguardview.handlemenukey ()) {
We need to show it is secure. If not, it'll get dismissed in any case.
Mroot.setvisibility (view.visible);
Mkeyguardview.requestfocus ();
Mkeyguardview.onresume ();
return true;
} else {
return false;
}
}
: ~/code/ardroid5.1/frameworks/base/packages/systemui$ Grep-rin "onmenupressed".
./src/com/android/systemui/statusbar/phone/keyguardbouncer.java:224:public Boolean onmenupressed () {
./src/com/android/systemui/statusbar/phone/phonestatusbar.java:3875:public Boolean onmenupressed () {
./src/com/android/systemui/statusbar/phone/phonestatusbar.java:3876:return Mstate = = StatusBarState.KEYGUARD & & Mstatusbarkeyguardviewmanager.onmenupressed ();
./src/com/android/systemui/statusbar/phone/statusbarkeyguardviewmanager.java:406:public Boolean onMenuPressed () {
./src/com/android/systemui/statusbar/phone/statusbarkeyguardviewmanager.java:407:return mBouncer.onMenuPressed ( );
./src/com/android/systemui/statusbar/phone/statusbarwindowview.java:132:return mService.onMenuPressed ( );
./src/com/android/systemui/statusbar/phone/statusbarwindowview.java:132:return mService.onMenuPressed ( );
@Override
public boolean dispatchkeyevent (KeyEvent event) {
Boolean down = event.getaction () = = Keyevent.action_down;
Switch (Event.getkeycode ()) {
Case Keyevent.keycode_back:
if (!down) {
Mservice.onbackpressed ();
}
return true;
Case Keyevent.keycode_menu:
if (!down) {
return mservice.onmenupressed ();
}
Android Press Menu key to unlock function switch