app-ng: Fix several compile warnings

This commit is contained in:
topjohnwu
2026-03-21 06:57:09 +00:00
parent 3021ef46ee
commit 6f93f74f80
9 changed files with 11 additions and 6 deletions
@@ -231,7 +231,7 @@ private fun DenyAppCard(app: DenyAppState) {
Column {
if (app.checkedPercent > 0f) {
LinearProgressIndicator(
progress = app.checkedPercent,
progress = { app.checkedPercent },
modifier = Modifier.fillMaxWidth()
)
}
@@ -31,7 +31,7 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.PrimaryTabRow
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
@@ -109,7 +109,7 @@ fun LogScreen(viewModel: LogViewModel) {
.fillMaxSize()
.padding(padding)
) {
TabRow(
PrimaryTabRow(
selectedTabIndex = selectedTab,
modifier = Modifier
.fillMaxWidth()
@@ -29,7 +29,7 @@ import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.CloudUpload
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material.icons.filled.Undo
import androidx.compose.material.icons.automirrored.filled.Undo
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
@@ -376,7 +376,7 @@ private fun ModuleCard(item: ModuleItem, viewModel: ModuleViewModel, onUpdateCli
) {
Icon(
modifier = Modifier.size(20.dp),
imageVector = if (item.isRemoved) Icons.Default.Undo else Icons.Default.Delete,
imageVector = if (item.isRemoved) Icons.AutoMirrored.Filled.Undo else Icons.Default.Delete,
tint = tint,
contentDescription = null
)
@@ -108,6 +108,7 @@ object AppContext : ContextWrapper(null),
}
networkObserver = NetworkObserver.init(this)
if (!BuildConfig.DEBUG && !isRunningAsStub) {
@OptIn(kotlinx.coroutines.DelicateCoroutinesApi::class)
GlobalScope.launch(Dispatchers.IO) {
ProfileInstaller.writeProfile(this@AppContext)
}
@@ -13,6 +13,7 @@ object Config : PreferenceConfig, DBConfig {
override val stringDB get() = ServiceLocator.stringDB
override val settingsDB get() = ServiceLocator.settingsDB
override val context get() = ServiceLocator.deContext
@OptIn(kotlinx.coroutines.DelicateCoroutinesApi::class)
override val coroutineScope get() = GlobalScope
object Key {
@@ -73,6 +73,7 @@ class JobService : BaseJobService() {
return true
}
@OptIn(kotlinx.coroutines.DelicateCoroutinesApi::class)
private fun checkUpdate(params: JobParameters): Boolean {
GlobalScope.launch(Dispatchers.IO) {
Info.fetchUpdate(ServiceLocator.networkService)?.let {
@@ -33,6 +33,7 @@ open class Receiver : BaseReceiver() {
intent ?: return
super.onReceive(context, intent)
@OptIn(kotlinx.coroutines.DelicateCoroutinesApi::class)
fun rmPolicy(uid: Int) = GlobalScope.launch {
policyDB.delete(uid)
}
@@ -78,6 +78,7 @@ fun <K, V> MutableMap<K, V>.synchronized(): MutableMap<K, V> = Collections.synch
fun Class<*>.reflectField(name: String): Field =
getDeclaredField(name).apply { isAccessible = true }
@OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
inline fun <T, R> Flow<T>.concurrentMap(crossinline transform: suspend (T) -> R): Flow<R> {
return flatMapMerge { value ->
flow { emit(transform(value)) }
@@ -76,7 +76,7 @@ class RootUtils(stub: Any?) : RootService() {
val module = File(Const.MODULE_PATH, "hosts")
if (module.exists()) return true
val hosts = File(module, "system/etc/hosts")
if (!hosts.parentFile.mkdirs()) return false
if (hosts.parentFile?.mkdirs() != true) return false
File(module, "module.prop").outputStream().writer().use {
it.write("""
id=hosts