赞
踩
点击电源键、音量+、音量- 按键时不再在UI界面上弹出滚动条,长按电源键时不要弹出系统弹窗,而是让这些响应直接在自定的Launcher中处理(该部分不作介绍),处理的核心原则就是 按键触发时不再响应对应的处理流程 或者 处理流程被修改,而这些多数在framework的配置文件中修改达到效果,部分需要对android framework部分源码进行修改以达到效果。
@1 音量条不显示
注释掉<item>com.android.systemui.volume.VolumeUI 即可。
修改文件为frameworks/base/packages/SystemUI/res/values/config.xml。修改内容为:
- <!-- SystemUI Services: The classes of the stuff to start. -->
- <string-array name="config_systemUIServiceComponents" translatable="false">
- <item>com.android.systemui.util.NotificationChannels</item>
- <item>com.android.systemui.keyguard.KeyguardViewMediator</item>
- <item>com.android.systemui.recents.Recents</item>
- <!--<item>com.android.systemui.volume.VolumeUI</item>-->
- <item>com.android.systemui.stackdivider.Divider</item>
- <item>com.android.systemui.statusbar.phone.StatusBar</item>
- <item>com.android.systemui.usb.StorageNotification</item>
- <item>com.android.systemui.power.PowerUI</item>
- ...
- </string-array>
- ...
@2 电源键长按不显示
长按电源键不触发系统弹窗。修改文件为:aosp/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java;修改内容为:
- private void powerLongPress() {
- final int behavior = getResolvedLongPressOnPowerBehavior();
- switch (behavior) {
- case LONG_PRESS_POWER_NOTHING:
- break;
- case LONG_PRESS_POWER_GLOBAL_ACTIONS:
- mPowerKeyHandled = true;
- performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, false,
- "Power - Long Press - Global Actions");
- // showGlobalActionsInternal();//将这句话注释掉
- break;
- case LONG_PRESS_POWER_SHUT_OFF:
- case LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM:
- mPowerKeyHandled = true;
- performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, false,
- "Power - Long Press - Shut Off");
- sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
- mWindowManagerFuncs.shutdown(behavior == LONG_PRESS_POWER_SHUT_OFF);
- break;
- case LONG_PRESS_POWER_GO_TO_VOICE_ASSIST:
- mPowerKeyHandled = true;
- performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, false,
- "Power - Long Press - Go To Voice Assist");
- // Some devices allow the voice assistant intent during setup (and use that intent
- // to launch something else, like Settings). So we explicitly allow that via the
- // config_allowStartActivityForLongPressOnPowerInSetup resource in config.xml.
- launchVoiceAssist(mAllowStartActivityForLongPressOnPowerDuringSetup);
- break;
- case LONG_PRESS_POWER_ASSISTANT:
- mPowerKeyHandled = true;
- performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, false,
- "Power - Long Press - Go To Assistant");
- final int powerKeyDeviceId = Integer.MIN_VALUE;
- launchAssistAction(null, powerKeyDeviceId);
- break;
- }
- }

@3 导航栏不显示
去掉最近的应用一个图标,修改文件为:frameworks/base/core/res/res/values/config.xml,修改内容为:
- <!-- Whether the system enables per-display focus. If the system has the input method for each
- display, this value should be true. -->
- <bool name="config_perDisplayFocusEnabled">false</bool>
-
- <!-- Whether a software navigation bar should be shown. NOTE: in the future this may be
- autodetected from the Configuration. -->
- <!这里修改config_showNavigationBar的属性为false-->
- <bool name="config_showNavigationBar">false</bool>
-
- <!-- Whether action menu items should be displayed in ALLCAPS or not.
- Defaults to true. If this is not appropriate for specific locales
- it should be disabled in that locale's resources. -->
- <bool name="config_actionMenuItemAllCaps">true</bool>
同时这里将navigation_bar_height高度设置为0,这样导航栏因高度原因无法显示出来。修改文件为:aosp/frameworks/base/core/res/res/values/dimens.xml,修改内容为:
- <!-- Total height of QQS (quick_qs_offset_height + 128) -->
- <dimen name="quick_qs_total_height">176dp</dimen>
- <!-- Total height of QQS with two rows to fit media player (quick_qs_offset_height + 176) -->
- <dimen name="quick_qs_total_height_with_media">224dp</dimen>
- <!-- Height of the bottom navigation / system bar. -->
- <!--<dimen name="navigation_bar_height">48dp</dimen> -->
- <dimen name="navigation_bar_height">0dp</dimen>
- <!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
- <dimen name="navigation_bar_height_landscape">48dp</dimen>
- <!-- Width of the navigation bar when it is placed vertically on the screen -->
- <dimen name="navigation_bar_width">48dp</dimen>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。