use of com.android.internal.compat.CompatibilityChangeInfo in project android_packages_apps_Settings by omnirom.
the class PlatformCompatDashboardTest method createChangeCategoryPreference_enabledAndDisabled_hasTitleAndEntries.
@Test
public void createChangeCategoryPreference_enabledAndDisabled_hasTitleAndEntries() {
Set<Long> enabledChanges = new HashSet<>();
enabledChanges.add(mChanges[0].getId());
enabledChanges.add(mChanges[1].getId());
enabledChanges.add(mChanges[2].getId());
Set<Long> disabledChanges = new HashSet<>();
disabledChanges.add(mChanges[3].getId());
disabledChanges.add(mChanges[4].getId());
CompatibilityChangeConfig config = new CompatibilityChangeConfig(new ChangeConfig(enabledChanges, disabledChanges));
List<CompatibilityChangeInfo> changesToAdd = new ArrayList<>();
for (int i = 0; i < mChanges.length; ++i) {
changesToAdd.add(new CompatibilityChangeInfo(mChanges[i].getId(), mChanges[i].getName(), -1, mChanges[i].getEnableSinceTargetSdk(), mChanges[i].getDisabled(), mChanges[i].getLoggingOnly(), mChanges[i].getDescription(), mChanges[i].getOverridable()));
}
PreferenceCategory category = mDashboard.createChangeCategoryPreference(changesToAdd, config, "foo");
assertThat(category.getTitle()).isEqualTo("foo");
assertThat(category.getPreferenceCount()).isEqualTo(mChanges.length);
for (int i = 0; i < mChanges.length; ++i) {
Preference childPreference = category.getPreference(i);
assertThat(childPreference instanceof SwitchPreference).isTrue();
}
}
use of com.android.internal.compat.CompatibilityChangeInfo in project android_packages_apps_Settings by omnirom.
the class PlatformCompatDashboardTest method createPreferenceForChange_cannotOverride_createDisabledEntry.
@Test
public void createPreferenceForChange_cannotOverride_createDisabledEntry() throws RemoteException {
CompatibilityChangeInfo enabledChange = mChanges[0];
CompatibilityChangeConfig config = new CompatibilityChangeConfig(new ChangeConfig(new HashSet<Long>(Arrays.asList(enabledChange.getId())), new HashSet<Long>()));
when(mOverrideValidator.getOverrideAllowedState(anyLong(), anyString())).thenReturn(new OverrideAllowedState(DISABLED_NOT_DEBUGGABLE, -1, -1));
Preference preference = mDashboard.createPreferenceForChange(mContext, enabledChange, config);
SwitchPreference switchPreference = (SwitchPreference) preference;
assertThat(preference.getSummary()).isEqualTo(mChanges[0].getName());
assertThat(preference instanceof SwitchPreference).isTrue();
assertThat(switchPreference.isChecked()).isTrue();
assertThat(switchPreference.isEnabled()).isFalse();
}
Aggregations