[MT8766][Android12] 系统设置隐藏休眠时间和锁屏选项

文章目录

    • 开发平台基本信息
    • 问题描述
    • 解决方法

开发平台基本信息

芯片: MT8766
版本: Android 12
kernel: msm-4.19

问题描述

最近开发的一款智能盒子,没有屏幕显示;所以,系统默认设置成永不休眠以及默认不锁屏;但是,如果去系统设置中重新设置休眠时间或者更改锁屏方式,还是会触发设备的休眠跟锁屏;所以,干脆把系统设置中的休眠时间选项和锁屏设置选项隐藏掉。

解决方法

  • 隐藏休眠时间选项
--- a/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/display_settings.xml
+++ b/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/display_settings.xml
@@ -73,12 +73,12 @@
     </com.android.settingslib.RestrictedPreference>
 
     <!-- Cross-listed item, if you change this, also change it in power_usage_summary.xml -->
-    <com.android.settingslib.RestrictedPreference
+    <!-- <com.android.settingslib.RestrictedPreference
         android:key="screen_timeout"
         android:title="@string/screen_timeout"
         android:summary="@string/summary_placeholder"
         android:fragment="com.android.settings.display.ScreenTimeoutSettings"
-        settings:controller="com.android.settings.display.ScreenTimeoutPreferenceController" />
+        settings:controller="com.android.settings.display.ScreenTimeoutPreferenceController" /> -->
 
     <SwitchPreference
         android:key="auto_rotate"

  • 隐藏锁屏界面
--- a/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java
+++ b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java
@@ -71,7 +71,8 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
         } else if (className.equals(FingerprintEnrollSuggestionActivity.class.getName())) {
             return FingerprintEnrollSuggestionActivity.isSuggestionComplete(context);
         } else if (className.equals(ScreenLockSuggestionActivity.class.getName())) {
-            return ScreenLockSuggestionActivity.isSuggestionComplete(context);
+            // return ScreenLockSuggestionActivity.isSuggestionComplete(context);
+            return true;
         } else if (className.equals(WifiCallingSuggestionActivity.class.getName())) {
             return WifiCallingSuggestionActivity.isSuggestionComplete(context);
         } else if (className.equals(NightDisplaySuggestionActivity.class.getName())) {
--- a/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/security/ChangeScreenLockPreferenceController.java
+++ b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/security/ChangeScreenLockPreferenceController.java
@@ -74,7 +74,8 @@ public class ChangeScreenLockPreferenceController extends AbstractPreferenceCont
 
     @Override
     public boolean isAvailable() {
-        return mContext.getResources().getBoolean(R.bool.config_show_unlock_set_or_change);
+        // return mContext.getResources().getBoolean(R.bool.config_show_unlock_set_or_change);
+        return false;
     }
 
     @Override

你可能感兴趣的:(Android12,MT8766,Android12,Settings,锁屏,休眠时间)