Hide potentially invisible DO Disclosures by default
Hiding/unhiding a pref triggers an animation. DO Disclosures that may not be visible should be hidden by default so that they fade in if applicable, not fade out if not applicable. Also, the network and security logging disclosures should only be shown if logging is currently on or was on in the past and a network log was retrieved at least once. Bug: 32692748 Test: m RunSettingsRoboTests Change-Id: I8c85f2f66ba295f145e5f5e79febb1b1a9bc6ede
This commit is contained in:
@@ -21,11 +21,14 @@ import android.content.Context;
|
||||
import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link AdminActionPreferenceControllerBase}.
|
||||
*/
|
||||
@@ -47,6 +50,11 @@ public final class AdminActionPreferenceControllerBaseTest extends
|
||||
mDate = date;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAvailable() {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return null;
|
||||
|
@@ -20,11 +20,13 @@ import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
@@ -47,6 +49,11 @@ public final class BugReportsPreferenceControllerTest extends
|
||||
.thenReturn(date);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAvailable() {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return "bug_reports";
|
||||
|
@@ -176,6 +176,24 @@ public final class EnterprisePrivacyFeatureProviderImplTest {
|
||||
assertThat(mProvider.getLastNetworkLogRetrievalTime()).isEqualTo(TIMESTAMP);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsSecurityLoggingEnabled() {
|
||||
when(mDevicePolicyManager.isSecurityLoggingEnabled(null)).thenReturn(false);
|
||||
assertThat(mProvider.isSecurityLoggingEnabled()).isFalse();
|
||||
|
||||
when(mDevicePolicyManager.isSecurityLoggingEnabled(null)).thenReturn(true);
|
||||
assertThat(mProvider.isSecurityLoggingEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsNetworkLoggingEnabled() {
|
||||
when(mDevicePolicyManager.isNetworkLoggingEnabled(null)).thenReturn(false);
|
||||
assertThat(mProvider.isNetworkLoggingEnabled()).isFalse();
|
||||
|
||||
when(mDevicePolicyManager.isNetworkLoggingEnabled(null)).thenReturn(true);
|
||||
assertThat(mProvider.isNetworkLoggingEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAlwaysOnVpnSetInPrimaryUser() {
|
||||
when(mConnectivityManger.getAlwaysOnVpnPackageForUser(MY_USER_ID)).thenReturn(null);
|
||||
|
@@ -20,11 +20,13 @@ import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
@@ -47,6 +49,22 @@ public final class NetworkLogsPreferenceControllerTest extends
|
||||
.thenReturn(date);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAvailable() {
|
||||
setDate(null);
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider.isNetworkLoggingEnabled())
|
||||
.thenReturn(false);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
|
||||
setDate(new Date());
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
|
||||
setDate(null);
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider.isNetworkLoggingEnabled())
|
||||
.thenReturn(true);
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return "network_logs";
|
||||
|
@@ -20,11 +20,13 @@ import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
@@ -47,6 +49,22 @@ public final class SecurityLogsPreferenceControllerTest extends
|
||||
.thenReturn(date);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAvailable() {
|
||||
setDate(null);
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider.isSecurityLoggingEnabled())
|
||||
.thenReturn(false);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
|
||||
setDate(new Date());
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
|
||||
setDate(null);
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider.isSecurityLoggingEnabled())
|
||||
.thenReturn(true);
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return "security_logs";
|
||||
|
Reference in New Issue
Block a user