Separate "Keyboard" from "Language & input"

1. Separate "Keyboard" from "Language & input".
2. Use FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_UI to control the
   different UI until Settings launches the new UI design.

Bug: 242680328
Test: local test
Change-Id: Id1ea6d3e3c2e6b83bc4b4d835c6b27e31311c530
This commit is contained in:
danielwbhuang
2022-08-17 22:17:08 +08:00
parent 4d7259124c
commit c9cb6806f6
20 changed files with 660 additions and 40 deletions

View File

@@ -27,6 +27,7 @@ import android.content.res.AssetManager;
import androidx.preference.Preference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.testutils.FakeFeatureFactory;
import org.junit.Before;
@@ -59,7 +60,7 @@ public class PhoneLanguagePreferenceControllerTest {
mContext = spy(RuntimeEnvironment.application);
when(mContext.getAssets()).thenReturn(mAssets);
mFeatureFactory = FakeFeatureFactory.setupForTest();
mController = new PhoneLanguagePreferenceController(mContext);
mController = new PhoneLanguagePreferenceController(mContext, "key");
}
@Test
@@ -76,6 +77,22 @@ public class PhoneLanguagePreferenceControllerTest {
assertThat(mController.isAvailable()).isFalse();
}
@Test
public void testGetAvailabilityStatus_hasMultipleLocales_returnAvailable() {
when(mAssets.getLocales()).thenReturn(new String[] {"en", "de"});
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.AVAILABLE);
}
@Test
public void testGetAvailabilityStatus_hasSingleLocales_returnConditionallyUnavailable() {
when(mAssets.getLocales()).thenReturn(new String[] {"en"});
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
}
@Test
@Config(qualifiers = "mcc999")
public void testIsAvailable_ifDisabled_shouldReturnFalse() {