[Wi-Fi] Un-relevant string flash then disappear in WiFi direct page.
The "PEER DEVICES" and "REMEMBERED GROUPS" two strings appear then disappear suddenly. Solution: Set those two PreferenceGroups, which with empty preference child, invisible before showing. Bug: 141830944 Test: 1.Manual test. 2.Modify isAvailable() test case for make sure the initial visible of empty group is invisible. Change-Id: Ifb074ac758196096ca63b6f7fa1285f8148d98d4
This commit is contained in:
@@ -36,13 +36,13 @@ public abstract class P2pCategoryPreferenceController extends AbstractPreference
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
return mCategory.getPreferenceCount() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mCategory = screen.findPreference(getPreferenceKey());
|
||||
super.displayPreference(screen);
|
||||
}
|
||||
|
||||
public void removeAllChildren() {
|
||||
|
@@ -20,7 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -60,8 +60,8 @@ public class P2pCategoryPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAlwaysAvailable() {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
public void isAvailable_withInitialEmptyGroup_shouldBeFalse() {
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -69,7 +69,7 @@ public class P2pCategoryPreferenceControllerTest {
|
||||
mController.removeAllChildren();
|
||||
|
||||
verify(mCategory).removeAll();
|
||||
verify(mCategory).setVisible(false);
|
||||
verify(mCategory, times(2)).setVisible(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -79,7 +79,7 @@ public class P2pCategoryPreferenceControllerTest {
|
||||
|
||||
verify(mCategory).addPreference(pref);
|
||||
verify(mCategory, atLeastOnce()).setVisible(true);
|
||||
verify(mCategory, never()).setVisible(false);
|
||||
verify(mCategory).setVisible(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user