[Spa] Fix State<T> as a parameter of SwitchPreference

Bug: 292036686
Test: manual - with Settings
Test: unit tests
Change-Id: I003f3b7f29117258da6ae3c48039fb50c2bee95c
This commit is contained in:
Chaohui Wang
2023-11-03 23:42:05 +08:00
parent 6584f32b6a
commit eedc7fd52d
9 changed files with 37 additions and 39 deletions

View File

@@ -24,8 +24,8 @@ import android.content.Context
import android.content.pm.ApplicationInfo
import android.os.UserManager
import androidx.compose.runtime.Composable
import androidx.compose.runtime.livedata.observeAsState
import com.android.settings.R
import com.android.settingslib.spa.livedata.observeAsCallback
import com.android.settingslib.spaprivileged.model.app.AppOpsController
import com.android.settingslib.spaprivileged.model.app.AppRecord
import com.android.settingslib.spaprivileged.model.app.userId
@@ -79,7 +79,7 @@ class InstallUnknownAppsListModel(private val context: Context) :
@Composable
override fun isAllowed(record: InstallUnknownAppsRecord) =
record.appOpsController.isAllowed.observeAsState()
record.appOpsController.isAllowed.observeAsCallback()
override fun isChangeable(record: InstallUnknownAppsRecord) =
isChangeable(record, getPotentialPackageNames(record.app.userId))