File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
sysbridge/src/main/java/io/github/sds100/keymapper/sysbridge/manager Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class SystemBridgeConnectionManagerImpl @Inject constructor(
5555
5656 companion object {
5757 private const val TAG = " SystemBridgeConnectionManagerImpl"
58+ private const val MIUI_OPTIMIZATION_SETTING = " miui_optimization"
5859 }
5960
6061 private val systemBridgeLock: Any = Any ()
@@ -66,7 +67,7 @@ class SystemBridgeConnectionManagerImpl @Inject constructor(
6667 time = SystemClock .elapsedRealtime(),
6768 // Get whether the user previously stopped the system bridge.
6869 isStoppedByUser =
69- preferences.get(Keys .isSystemBridgeStoppedByUser).firstBlocking() ? : false ,
70+ preferences.get(Keys .isSystemBridgeStoppedByUser).firstBlocking() ? : false ,
7071 ),
7172 )
7273 private var isExpectedDeath: Boolean = false
@@ -241,6 +242,13 @@ class SystemBridgeConnectionManagerImpl @Inject constructor(
241242 1 ,
242243 )
243244 }
245+
246+ val isMiuiOptimisationEnabled =
247+ SettingsUtils .getGlobalSetting<Int >(ctx, MIUI_OPTIMIZATION_SETTING ) == 1
248+
249+ if (isWriteSecureSettingsGranted && isMiuiOptimisationEnabled) {
250+ SettingsUtils .putGlobalSetting(ctx, MIUI_OPTIMIZATION_SETTING , 0 )
251+ }
244252 }
245253
246254 private fun grantWriteSecureSettings (systemBridge : ISystemBridge ) {
You can’t perform that action at this time.
0 commit comments