Skip to content

Commit

Permalink
Misc update (#303)
Browse files Browse the repository at this point in the history
* Update dependencies

* Sync config at onPause and onDestroyView as well

* Exclude system apps by default

* Avoid using resetprop
  • Loading branch information
aviraxp authored Nov 30, 2024
1 parent c584f92 commit ec6e290
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,26 @@ class AppSettingsFragment : Fragment(R.layout.fragment_settings) {
AppSettingsViewModel.Factory(pack)
}

private fun onBack() {
private fun saveConfig() {
if (!viewModel.pack.enabled) ConfigManager.setAppConfig(viewModel.pack.app, null)
else ConfigManager.setAppConfig(viewModel.pack.app, viewModel.pack.config)
}

private fun onBack() {
saveConfig()
navController.navigateUp()
}

override fun onPause() {
super.onPause()
saveConfig()
}

override fun onDestroyView() {
super.onDestroyView()
saveConfig()
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner) { onBack() }
setupToolbar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class SettingsFragment : Fragment(R.layout.fragment_settings), PreferenceFragmen
findPreference<SwitchPreference>("appDataIsolation")?.let {
it.setOnPreferenceChangeListener { _, newValue ->
val value = if (newValue as Boolean) 1 else 0
val result = SuUtils.execPrivileged("resetprop ${Constants.ANDROID_APP_DATA_ISOLATION_ENABLED_PROPERTY} $value")
val result = SuUtils.execPrivileged("setprop ${Constants.ANDROID_APP_DATA_ISOLATION_ENABLED_PROPERTY} $value")
if (result) makeToast(R.string.settings_need_reboot)
else makeToast(R.string.settings_permission_denied)
it.isChecked = CommonUtils.isAppDataIsolationEnabled
Expand All @@ -126,7 +126,7 @@ class SettingsFragment : Fragment(R.layout.fragment_settings), PreferenceFragmen
findPreference<SwitchPreference>("voldAppDataIsolation")?.let {
it.setOnPreferenceChangeListener { _, newValue ->
val value = if (newValue as Boolean) 1 else 0
val result = SuUtils.execPrivileged("resetprop ${Constants.ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY} $value")
val result = SuUtils.execPrivileged("setprop ${Constants.ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY} $value")
if (result) makeToast(R.string.settings_need_reboot)
else makeToast(R.string.settings_permission_denied)
it.isChecked = CommonUtils.isVoldAppDataIsolationEnabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ data class JsonConfig(
@Serializable
data class AppConfig(
var useWhitelist: Boolean = false,
var excludeSystemApps: Boolean = false,
var excludeSystemApps: Boolean = true,
var applyTemplates: MutableSet<String> = mutableSetOf(),
var extraAppList: MutableSet<String> = mutableSetOf()
) {
Expand Down
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[versions]
agp = "8.7.0"
kotlin = "2.0.20"
rxhttp = "3.3.0"
agp = "8.7.2"
kotlin = "2.1.0"
rxhttp = "3.3.1"
hidden-api = "4.3.3"

[plugins]
agp-app = { id = "com.android.application", version.ref = "agp" }
agp-lib = { id = "com.android.library", version.ref = "agp" }
kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version = "2.0.20-1.0.25" }
ksp = { id = "com.google.devtools.ksp", version = "2.1.0-1.0.29" }
gms = { id = "com.google.gms.google-services", version = "4.4.2" }
nav-safeargs-kotlin = { id = "androidx.navigation.safeargs.kotlin", version = "2.8.2" }
nav-safeargs-kotlin = { id = "androidx.navigation.safeargs.kotlin", version = "2.8.4" }
autoresconfig = { id = "dev.rikka.tools.autoresconfig", version = "1.2.2" }
materialthemebuilder = { id = "dev.rikka.tools.materialthemebuilder", version = "1.5.1" }
refine = { id = "dev.rikka.tools.refine", version = "4.4.0" }

[libraries]
androidx-navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version = "2.8.2" }
androidx-navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version = "2.8.2" }
androidx-navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version = "2.8.4" }
androidx-navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version = "2.8.4" }
androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version = "1.2.1" }
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version = "1.1.0" }
com-android-tools-build-apksig = { module = "com.android.tools.build:apksig", version.ref = "agp" }
Expand All @@ -31,8 +31,8 @@ com-github-liujingxing-rxhttp-compiler = { module = "com.github.liujingxing.rxht
com-github-liujingxing-rxhttp-converter-serialization = { module = "com.github.liujingxing.rxhttp:converter-serialization", version.ref = "rxhttp" }
com-github-topjohnwu-libsu-core = { module = "com.github.topjohnwu.libsu:core", version = "6.0.0" }
com-google-android-material = { module = "com.google.android.material:material", version = "1.12.0" }
com-google-android-gms-play-services-ads = { module = "com.google.android.gms:play-services-ads", version = "23.4.0" }
com-google-firebase-bom = { module = "com.google.firebase:firebase-bom", version = "33.4.0" }
com-google-android-gms-play-services-ads = { module = "com.google.android.gms:play-services-ads", version = "23.5.0" }
com-google-firebase-bom = { module = "com.google.firebase:firebase-bom", version = "33.6.0" }
com-google-firebase-analytics-ktx = { module = "com.google.firebase:firebase-analytics-ktx" }
com-squareup-okhttp3 = { module = "com.squareup.okhttp3:okhttp", version = "4.12.0" }
de-robv-android-xposed-api = { module = "de.robv.android.xposed:api", version = "82" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit ec6e290

Please sign in to comment.