[Thread] use dedicated flag for Thread settings
a larger THREAD_ENABLED_PLATFORM flag which guards all Thread-related platform changes is used for the Thread settings change. But we need more flexible control of the UX release timeline. So use a dedicated THREAD_SETTINGS_ENABLED flag here. Bug: 329384658 Change-Id: Ib5b3ae3c71ccc890fc46af982b021858774938f3
This commit is contained in:
8
aconfig/settings_threadnetwork_flag_declarations.aconfig
Normal file
8
aconfig/settings_threadnetwork_flag_declarations.aconfig
Normal file
@@ -0,0 +1,8 @@
|
||||
package: "com.android.settings.flags"
|
||||
|
||||
flag {
|
||||
name: "thread_settings_enabled"
|
||||
namespace: "thread_network"
|
||||
description: "Controls whether the Thread Settings UX is displayed"
|
||||
bug: "329384658"
|
||||
}
|
@@ -34,9 +34,9 @@ import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.android.net.thread.platform.flags.Flags
|
||||
import com.android.settings.R
|
||||
import com.android.settings.core.TogglePreferenceController
|
||||
import com.android.settings.flags.Flags
|
||||
import java.util.concurrent.Executor
|
||||
|
||||
/** Controller for the "Thread" toggle in "Connected devices > Connection preferences". */
|
||||
@@ -110,7 +110,7 @@ class ThreadNetworkPreferenceController @VisibleForTesting constructor(
|
||||
}
|
||||
|
||||
override fun getAvailabilityStatus(): Int {
|
||||
return if (!Flags.threadEnabledPlatform()) {
|
||||
return if (!Flags.threadSettingsEnabled()) {
|
||||
CONDITIONALLY_UNAVAILABLE
|
||||
} else if (!isThreadSupportedOnDevice) {
|
||||
UNSUPPORTED_ON_DEVICE
|
||||
|
@@ -33,13 +33,13 @@ import androidx.preference.PreferenceManager
|
||||
import androidx.preference.SwitchPreference
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.android.net.thread.platform.flags.Flags
|
||||
import com.android.settings.R
|
||||
import com.android.settings.core.BasePreferenceController.AVAILABLE
|
||||
import com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE
|
||||
import com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING
|
||||
import com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE
|
||||
import com.android.settings.connecteddevice.threadnetwork.ThreadNetworkPreferenceController.BaseThreadNetworkController
|
||||
import com.android.settings.flags.Flags
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
@@ -68,7 +68,7 @@ class ThreadNetworkPreferenceControllerTest {
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_THREAD_ENABLED_PLATFORM)
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_THREAD_SETTINGS_ENABLED)
|
||||
context = spy(ApplicationProvider.getApplicationContext<Context>())
|
||||
executor = ContextCompat.getMainExecutor(context)
|
||||
fakeThreadNetworkController = FakeThreadNetworkController(executor)
|
||||
@@ -96,7 +96,7 @@ class ThreadNetworkPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
fun availabilityStatus_flagDisabled_returnsConditionallyUnavailable() {
|
||||
mSetFlagsRule.disableFlags(Flags.FLAG_THREAD_ENABLED_PLATFORM)
|
||||
mSetFlagsRule.disableFlags(Flags.FLAG_THREAD_SETTINGS_ENABLED)
|
||||
assertThat(controller.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user