浏览代码

Disable direct boot to fix auto start

世界 3 年之前
父节点
当前提交
40a6b43384

+ 2 - 2
app/src/main/AndroidManifest.xml

@@ -319,9 +319,9 @@
             android:enabled="false"
             android:exported="true"
             android:process=":bg">
-            <intent-filter>
+            <intent-filter android:priority="999">
                 <action android:name="android.intent.action.BOOT_COMPLETED" />
-                <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
+                <!--<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />-->
                 <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
             </intent-filter>
         </receiver>

+ 3 - 3
app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt

@@ -39,12 +39,12 @@ object DataStore : OnPreferenceDataStoreChangeListener {
     val profileCacheStore = RoomPreferenceDataStore(InMemoryDatabase.kvPairDao)
 
     fun init() {
-        if (Build.VERSION.SDK_INT >= 24) {
+        /*if (Build.VERSION.SDK_INT >= 24) {
             SagerNet.deviceStorage.moveDatabaseFrom(SagerNet.application, Key.DB_PUBLIC)
         }
         if (Build.VERSION.SDK_INT >= 24 && directBootAware && SagerNet.user.isUserUnlocked) {
             DirectBoot.flushTrafficStats()
-        }
+        }*/
     }
 
     var selectedProxy by configurationStore.long(Key.PROFILE_ID)
@@ -192,7 +192,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
     var showDirectSpeed by configurationStore.boolean(Key.SHOW_DIRECT_SPEED)
 
     val persistAcrossReboot by configurationStore.boolean(Key.PERSIST_ACROSS_REBOOT) { true }
-    val canToggleLocked: Boolean get() = configurationStore.getBoolean(Key.DIRECT_BOOT_AWARE) == true
+    val canToggleLocked: Boolean get() = false//configurationStore.getBoolean(Key.DIRECT_BOOT_AWARE) == true
     val directBootAware: Boolean get() = SagerNet.directBootSupported && canToggleLocked
 
     var requireHttp by configurationStore.boolean(Key.REQUIRE_HTTP) { false }

+ 2 - 2
app/src/main/res/xml/global_preferences.xml

@@ -8,11 +8,11 @@
             app:key="isAutoConnect"
             app:summary="@string/auto_connect_summary"
             app:title="@string/auto_connect" />
-        <SwitchPreference
+        <!--<SwitchPreference
             app:icon="@drawable/ic_action_lock"
             app:key="directBootAware"
             app:summary="@string/direct_boot_aware_summary"
-            app:title="@string/direct_boot_aware" />
+            app:title="@string/direct_boot_aware" />-->
         <SwitchPreference
             app:icon="@drawable/baseline_developer_board_24"
             app:key="acquireWakeLock"