Android Press Menu key to unlock function switch

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.