Merge "Add lifecycle-livedata-ktx for SpaLib"
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
},
|
||||
{
|
||||
"name": "SpaPrivilegedLibTests"
|
||||
},
|
||||
{
|
||||
"name": "SettingsSpaUnitTests"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ android_library {
|
||||
"androidx.compose.runtime_runtime",
|
||||
"androidx.compose.runtime_runtime-livedata",
|
||||
"androidx.compose.ui_ui-tooling-preview",
|
||||
"androidx.lifecycle_lifecycle-livedata-ktx",
|
||||
"androidx.navigation_navigation-compose",
|
||||
"com.google.android.material_material",
|
||||
"lottie_compose",
|
||||
|
||||
@@ -59,13 +59,14 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api "androidx.appcompat:appcompat:1.6.0-rc01"
|
||||
api "androidx.appcompat:appcompat:1.7.0-alpha01"
|
||||
api "androidx.compose.material3:material3:$jetpack_compose_material3_version"
|
||||
api "androidx.compose.material:material-icons-extended:$jetpack_compose_version"
|
||||
api "androidx.compose.runtime:runtime-livedata:$jetpack_compose_version"
|
||||
api "androidx.compose.ui:ui-tooling-preview:$jetpack_compose_version"
|
||||
api 'androidx.navigation:navigation-compose:2.5.0'
|
||||
api 'com.google.android.material:material:1.6.1'
|
||||
api "androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha02"
|
||||
api "androidx.navigation:navigation-compose:2.5.0"
|
||||
api "com.google.android.material:material:1.6.1"
|
||||
debugApi "androidx.compose.ui:ui-tooling:$jetpack_compose_version"
|
||||
implementation 'com.airbnb.android:lottie-compose:5.2.0'
|
||||
implementation "com.airbnb.android:lottie-compose:5.2.0"
|
||||
}
|
||||
|
||||
10
packages/SettingsLib/SpaPrivileged/TEST_MAPPING
Normal file
10
packages/SettingsLib/SpaPrivileged/TEST_MAPPING
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"presubmit": [
|
||||
{
|
||||
"name": "SpaPrivilegedLibTests"
|
||||
},
|
||||
{
|
||||
"name": "SettingsSpaUnitTests"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
|
||||
class AppOpsController(
|
||||
context: Context,
|
||||
@@ -36,7 +36,7 @@ class AppOpsController(
|
||||
val mode: LiveData<Int>
|
||||
get() = _mode
|
||||
val isAllowed: LiveData<Boolean>
|
||||
get() = Transformations.map(_mode) { it == MODE_ALLOWED }
|
||||
get() = _mode.map { it == MODE_ALLOWED }
|
||||
|
||||
fun setAllowed(allowed: Boolean) {
|
||||
val mode = if (allowed) MODE_ALLOWED else MODE_ERRORED
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.app.admin.DevicePolicyResources.Strings.Settings
|
||||
import android.content.Context
|
||||
import android.os.UserHandle
|
||||
import android.os.UserManager
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.liveData
|
||||
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin
|
||||
import com.android.settingslib.RestrictedLockUtilsInternal
|
||||
import com.android.settingslib.spaprivileged.R
|
||||
@@ -58,13 +58,8 @@ class RestrictionsProvider(
|
||||
private val userManager by lazy { UserManager.get(context) }
|
||||
private val enterpriseRepository by lazy { EnterpriseRepository(context) }
|
||||
|
||||
val restrictedMode = object : LiveData<RestrictedMode>() {
|
||||
override fun onActive() {
|
||||
postValue(getRestrictedMode())
|
||||
}
|
||||
|
||||
override fun onInactive() {
|
||||
}
|
||||
val restrictedMode = liveData {
|
||||
emit(getRestrictedMode())
|
||||
}
|
||||
|
||||
private fun getRestrictedMode(): RestrictedMode {
|
||||
|
||||
@@ -41,6 +41,6 @@ android_test {
|
||||
],
|
||||
kotlincflags: [
|
||||
"-Xjvm-default=all",
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-opt-in=kotlin.RequiresOptIn",
|
||||
],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user