This repository was archived by the owner on Jul 2, 2024. It is now read-only.
File tree 1 file changed +21
-0
lines changed
app/src/main/kotlin/com/sanmer/mrepo/ui/activity
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com.sanmer.mrepo.ui.activity
2
2
3
+ import android.content.ComponentName
4
+ import android.content.pm.PackageManager
3
5
import android.os.Bundle
4
6
import androidx.activity.ComponentActivity
5
7
import androidx.activity.compose.setContent
@@ -61,6 +63,7 @@ class MainActivity : ComponentActivity() {
61
63
62
64
ProviderCompat .init (userPreferences!! .workingMode)
63
65
NetworkUtils .setEnableDoh(userPreferences!! .useDoh)
66
+ setInstallActivityEnabled(userPreferences!! .isRoot)
64
67
}
65
68
66
69
CompositionLocalProvider (
@@ -92,4 +95,22 @@ class MainActivity : ComponentActivity() {
92
95
MediaStoreUtils .PermissionState ()
93
96
}
94
97
}
98
+
99
+ private fun setInstallActivityEnabled (enable : Boolean ) {
100
+ val component = ComponentName (
101
+ this , InstallActivity ::class .java
102
+ )
103
+
104
+ val state = if (enable) {
105
+ PackageManager .COMPONENT_ENABLED_STATE_ENABLED
106
+ } else {
107
+ PackageManager .COMPONENT_ENABLED_STATE_DISABLED
108
+ }
109
+
110
+ packageManager.setComponentEnabledSetting(
111
+ component,
112
+ state,
113
+ PackageManager .DONT_KILL_APP
114
+ )
115
+ }
95
116
}
You can’t perform that action at this time.
0 commit comments