好久没写文章了,最近做了一些新需求,有难的也有简单的,比如关机动画和关机铃声,本来想写关机动画的,但是我是用的是mtk的机器,关机动画的方法不适用AOSP,今天就写两个简单的,按power键直接关机,不弹出关机选项窗口以及去除锁屏功能。 首先是按power键直接关机,不弹出关机选项窗口,这个很简单,找到那个弹窗关掉就可以了:
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
old mode 100644
new mode 100755
index b2e91643bed..18a7dddfc19
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -499,7 +499,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
mDialog.dismiss();
mDialog = null;
} else {
- handleShow();
+ //handleShow();
+ mWindowManagerFuncs.shutdown();
}
}
去除锁屏是在SettingsProvide的一个defaults.xml的文件中,这个文件中有设置的好多功能
diff --git a/vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml b/vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml
old mode 100644
new mode 100755
index 714ca05..806bd76
--- a/vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml
+++ b/vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml
@@ -82,7 +82,7 @@
<string name="def_trusted_sound" translatable="false">/system/media/audio/ui/Trusted.ogg</string>
<string name="def_wireless_charging_started_sound" translatable="false">/system/media/audio/ui/WirelessChargingStarted.ogg</string>
- <bool name="def_lockscreen_disabled">false</bool>
+ <bool name="def_lockscreen_disabled">true</bool>
<bool name="def_device_provisioned">false</bool>
<integer name="def_dock_audio_media_enabled">1</integer>