仓廪实则知礼节,衣食足则知荣辱。这篇文章主要讲述android 按menu键解锁功能的开关相关的知识,希望能为你提供帮助。
android 4.4
android 5.0
android 5.1
修改文件frameworks\base\packages\Keyguard\res\values\config.xml
里的
<
!-- Allow the menu hard key to be disabled in LockScreen on some devices [DO NOT TRANSLATE] -->
<
bool name="config_disableMenuKeyInLockScreen">
false<
/bool>
改为true
即可禁用该功能。
在5.1中
【android 按menu键解锁功能的开关】:~/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_disableMenuKeyInLockScreen);
:~/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_disableMenuKeyInLockScreen);
./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.isSecure()) {
:~/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 in case it is secure. If not, it will 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();
}
推荐阅读
- Appium自动化时,如何快速获得Android app的包名和启动页
- android shell命令screenrecord和uptime
- Android JNI -基础篇
- Android6.0权限申请工具类
- Android 多线程-----AsyncTask详解
- 安卓微信自动抢红包插件优化和实现
- NDK笔记-在Android Studio中使用ndk-build
- 安卓appium无线调试
- Android菜鸟成长记15 -- BitMap