Add a new feature flag for the expand button in support lib.

- check the feature flag to determine whether to use the existing
progressive disclosure mixin or use the expand button in the support
library.
- add corresponding preference xml files that add the new preference
group attribute to use with the expand button in the support lib.

Bug: 63985174
Test: make RunSettingsRoboTests
Change-Id: Ida6eb6182a8066ad1413b7f6142512345fd914d0
This commit is contained in:
Doris Ling
2017-09-14 18:54:48 -07:00
parent fe18f8e876
commit 6f60cddc9e
14 changed files with 570 additions and 11 deletions

View File

@@ -2,8 +2,11 @@ package com.android.settings;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;
import android.content.Context;
import com.android.settings.dashboard.ProgressiveDisclosureMixin;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.XmlTestUtils;
import com.android.settings.testutils.shadow.ShadowPowerManagerWrapper;
@@ -13,6 +16,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
import java.util.ArrayList;
import java.util.List;
@@ -25,9 +29,9 @@ public class DisplaySettingsTest {
@Config(shadows = ShadowPowerManagerWrapper.class)
public void testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
final Context context = RuntimeEnvironment.application;
// PowerManager wrapper = mock(PowerManager.class);
// doReturn(wrapper).when(context).getSystemService(Context.POWER_SERVICE);
final DisplaySettings fragment = new DisplaySettings();
ReflectionHelpers.setField(fragment, "mProgressiveDisclosureMixin",
mock(ProgressiveDisclosureMixin.class));
final List<String> preferenceScreenKeys = XmlTestUtils.getKeysFromPreferenceXml(context,
fragment.getPreferenceScreenResId());
final List<String> preferenceKeys = new ArrayList<>();