Merge "Hide potentially invisible DO Disclosures by default"
This commit is contained in:
committed by
Android (Google) Code Review
commit
38931ed7c1
@@ -8343,7 +8343,7 @@
|
|||||||
<!-- Label explaining that the admin can see app usage statistics. [CHAR LIMIT=NONE] -->
|
<!-- Label explaining that the admin can see app usage statistics. [CHAR LIMIT=NONE] -->
|
||||||
<string name="enterprise_privacy_usage_stats">Amount of time and data spent in each app</string>
|
<string name="enterprise_privacy_usage_stats">Amount of time and data spent in each app</string>
|
||||||
<!-- Label explaining that the admin can retrieve network logs on the device. [CHAR LIMIT=NONE] -->
|
<!-- Label explaining that the admin can retrieve network logs on the device. [CHAR LIMIT=NONE] -->
|
||||||
<string name="enterprise_privacy_network_logs">Network traffic logs on your device</string>
|
<string name="enterprise_privacy_network_logs">Most recent network traffic log</string>
|
||||||
<!-- Label explaining that the admin can request bug reports on the device. [CHAR LIMIT=NONE] -->
|
<!-- Label explaining that the admin can request bug reports on the device. [CHAR LIMIT=NONE] -->
|
||||||
<string name="enterprise_privacy_bug_reports">Most recent bug report</string>
|
<string name="enterprise_privacy_bug_reports">Most recent bug report</string>
|
||||||
<!-- Label explaining that the admin can retrieve security on from the device. [CHAR LIMIT=NONE] -->
|
<!-- Label explaining that the admin can retrieve security on from the device. [CHAR LIMIT=NONE] -->
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
<PreferenceCategory android:title="@string/enterprise_privacy_exposure_category">
|
<PreferenceCategory android:title="@string/enterprise_privacy_exposure_category">
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="enterprise_data"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:title="@string/enterprise_privacy_enterprise_data"
|
android:title="@string/enterprise_privacy_enterprise_data"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
@@ -35,12 +34,12 @@
|
|||||||
android:title="@string/enterprise_privacy_installed_packages"
|
android:title="@string/enterprise_privacy_installed_packages"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="usage_stats"
|
|
||||||
android:title="@string/enterprise_privacy_usage_stats"
|
android:title="@string/enterprise_privacy_usage_stats"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="network_logs"
|
android:key="network_logs"
|
||||||
android:title="@string/enterprise_privacy_network_logs"
|
android:title="@string/enterprise_privacy_network_logs"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="bug_reports"
|
android:key="bug_reports"
|
||||||
@@ -49,6 +48,7 @@
|
|||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="security_logs"
|
android:key="security_logs"
|
||||||
android:title="@string/enterprise_privacy_security_logs"
|
android:title="@string/enterprise_privacy_security_logs"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
@@ -56,58 +56,70 @@
|
|||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="number_enterprise_installed_packages"
|
android:key="number_enterprise_installed_packages"
|
||||||
android:title="@string/enterprise_privacy_enterprise_installed_packages"
|
android:title="@string/enterprise_privacy_enterprise_installed_packages"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="enterprise_privacy_number_location_access_packages"
|
android:key="enterprise_privacy_number_location_access_packages"
|
||||||
android:title="@string/enterprise_privacy_location_access"
|
android:title="@string/enterprise_privacy_location_access"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="enterprise_privacy_number_microphone_access_packages"
|
android:key="enterprise_privacy_number_microphone_access_packages"
|
||||||
android:title="@string/enterprise_privacy_microphone_access"
|
android:title="@string/enterprise_privacy_microphone_access"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="enterprise_privacy_number_camera_access_packages"
|
android:key="enterprise_privacy_number_camera_access_packages"
|
||||||
android:title="@string/enterprise_privacy_camera_access"
|
android:title="@string/enterprise_privacy_camera_access"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="number_enterprise_set_default_apps"
|
android:key="number_enterprise_set_default_apps"
|
||||||
android:title="@string/enterprise_privacy_enterprise_set_default_apps"
|
android:title="@string/enterprise_privacy_enterprise_set_default_apps"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="always_on_vpn_primary_user"
|
android:key="always_on_vpn_primary_user"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="always_on_vpn_managed_profile"
|
android:key="always_on_vpn_managed_profile"
|
||||||
android:title="@string/enterprise_privacy_always_on_vpn_work"
|
android:title="@string/enterprise_privacy_always_on_vpn_work"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="input_method"
|
android:key="input_method"
|
||||||
android:title="@string/enterprise_privacy_input_method"
|
android:title="@string/enterprise_privacy_input_method"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="global_http_proxy"
|
android:key="global_http_proxy"
|
||||||
android:title="@string/enterprise_privacy_global_http_proxy"
|
android:title="@string/enterprise_privacy_global_http_proxy"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="ca_certs"
|
android:key="ca_certs"
|
||||||
android:title="@string/enterprise_privacy_ca_certs"
|
android:title="@string/enterprise_privacy_ca_certs"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/enterprise_privacy_device_access_category">
|
<PreferenceCategory android:title="@string/enterprise_privacy_device_access_category">
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="lock_device"
|
|
||||||
android:title="@string/enterprise_privacy_lock_device"
|
android:title="@string/enterprise_privacy_lock_device"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="wipe_device"
|
|
||||||
android:title="@string/enterprise_privacy_wipe_device"
|
android:title="@string/enterprise_privacy_wipe_device"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="failed_password_wipe_primary_user"
|
android:key="failed_password_wipe_primary_user"
|
||||||
|
android:title="@string/enterprise_privacy_failed_password_wipe_device"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
<com.android.settings.DividerPreference
|
<com.android.settings.DividerPreference
|
||||||
android:key="failed_password_wipe_managed_profile"
|
android:key="failed_password_wipe_managed_profile"
|
||||||
|
android:title="@string/enterprise_privacy_failed_password_wipe_work"
|
||||||
|
android:visibility="gone"
|
||||||
settings:multiLine="true"/>
|
settings:multiLine="true"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -80,6 +80,20 @@ public interface DevicePolicyManagerWrapper {
|
|||||||
int getPermissionGrantState(@Nullable ComponentName admin, String packageName,
|
int getPermissionGrantState(@Nullable ComponentName admin, String packageName,
|
||||||
String permission);
|
String permission);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls {@code DevicePolicyManager.isSecurityLoggingEnabled()}.
|
||||||
|
*
|
||||||
|
* @see android.app.admin.DevicePolicyManager#isSecurityLoggingEnabled
|
||||||
|
*/
|
||||||
|
boolean isSecurityLoggingEnabled(@Nullable ComponentName admin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls {@code DevicePolicyManager.isNetworkLoggingEnabled()}.
|
||||||
|
*
|
||||||
|
* @see android.app.admin.DevicePolicyManager#isNetworkLoggingEnabled
|
||||||
|
*/
|
||||||
|
boolean isNetworkLoggingEnabled(@Nullable ComponentName admin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls {@code DevicePolicyManager.getLastSecurityLogRetrievalTime()}.
|
* Calls {@code DevicePolicyManager.getLastSecurityLogRetrievalTime()}.
|
||||||
*
|
*
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.enterprise;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
@@ -67,6 +68,18 @@ public class DevicePolicyManagerWrapperImpl implements DevicePolicyManagerWrappe
|
|||||||
return mDpm.getPermissionGrantState(admin, packageName, permission);
|
return mDpm.getPermissionGrantState(admin, packageName, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSecurityLoggingEnabled(@Nullable ComponentName admin) {
|
||||||
|
// TODO(b/36584321): Switch to DevicePolicyManager#isSecurityLoggingEnabled once that is
|
||||||
|
// callable by the system.
|
||||||
|
return SystemProperties.getBoolean("persist.logd.security", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isNetworkLoggingEnabled(@Nullable ComponentName admin) {
|
||||||
|
return mDpm.isNetworkLoggingEnabled(admin);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLastSecurityLogRetrievalTime() {
|
public long getLastSecurityLogRetrievalTime() {
|
||||||
return mDpm.getLastSecurityLogRetrievalTime();
|
return mDpm.getLastSecurityLogRetrievalTime();
|
||||||
|
@@ -63,6 +63,16 @@ public interface EnterprisePrivacyFeatureProvider {
|
|||||||
*/
|
*/
|
||||||
Date getLastNetworkLogRetrievalTime();
|
Date getLastNetworkLogRetrievalTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether security logging is currently enabled.
|
||||||
|
*/
|
||||||
|
boolean isSecurityLoggingEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether network logging is currently enabled.
|
||||||
|
*/
|
||||||
|
boolean isNetworkLoggingEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the Device Owner in the primary user set an always-on VPN.
|
* Returns whether the Device Owner in the primary user set an always-on VPN.
|
||||||
*/
|
*/
|
||||||
|
@@ -131,6 +131,16 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
|
|||||||
return timestamp < 0 ? null : new Date(timestamp);
|
return timestamp < 0 ? null : new Date(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSecurityLoggingEnabled() {
|
||||||
|
return mDpm.isSecurityLoggingEnabled(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isNetworkLoggingEnabled() {
|
||||||
|
return mDpm.isNetworkLoggingEnabled(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAlwaysOnVpnSetInPrimaryUser() {
|
public boolean isAlwaysOnVpnSetInPrimaryUser() {
|
||||||
return VpnUtils.isAlwaysOnVpnSet(mCm, MY_USER_ID);
|
return VpnUtils.isAlwaysOnVpnSet(mCm, MY_USER_ID);
|
||||||
|
@@ -30,6 +30,12 @@ public class NetworkLogsPreferenceController extends AdminActionPreferenceContro
|
|||||||
return mFeatureProvider.getLastNetworkLogRetrievalTime();
|
return mFeatureProvider.getLastNetworkLogRetrievalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable() {
|
||||||
|
return mFeatureProvider.isNetworkLoggingEnabled() ||
|
||||||
|
mFeatureProvider.getLastNetworkLogRetrievalTime() != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return KEY_NETWORK_LOGS;
|
return KEY_NETWORK_LOGS;
|
||||||
|
@@ -30,6 +30,12 @@ public class SecurityLogsPreferenceController extends AdminActionPreferenceContr
|
|||||||
return mFeatureProvider.getLastSecurityLogRetrievalTime();
|
return mFeatureProvider.getLastSecurityLogRetrievalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable() {
|
||||||
|
return mFeatureProvider.isSecurityLoggingEnabled() ||
|
||||||
|
mFeatureProvider.getLastSecurityLogRetrievalTime() != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return KEY_SECURITY_LOGS;
|
return KEY_SECURITY_LOGS;
|
||||||
|
@@ -21,11 +21,14 @@ import android.content.Context;
|
|||||||
import com.android.settings.SettingsRobolectricTestRunner;
|
import com.android.settings.SettingsRobolectricTestRunner;
|
||||||
import com.android.settings.TestConfig;
|
import com.android.settings.TestConfig;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link AdminActionPreferenceControllerBase}.
|
* Tests for {@link AdminActionPreferenceControllerBase}.
|
||||||
*/
|
*/
|
||||||
@@ -47,6 +50,11 @@ public final class AdminActionPreferenceControllerBaseTest extends
|
|||||||
mDate = date;
|
mDate = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsAvailable() {
|
||||||
|
assertThat(mController.isAvailable()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return null;
|
return null;
|
||||||
|
@@ -20,11 +20,13 @@ import com.android.settings.SettingsRobolectricTestRunner;
|
|||||||
import com.android.settings.TestConfig;
|
import com.android.settings.TestConfig;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +49,11 @@ public final class BugReportsPreferenceControllerTest extends
|
|||||||
.thenReturn(date);
|
.thenReturn(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsAvailable() {
|
||||||
|
assertThat(mController.isAvailable()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return "bug_reports";
|
return "bug_reports";
|
||||||
|
@@ -176,6 +176,24 @@ public final class EnterprisePrivacyFeatureProviderImplTest {
|
|||||||
assertThat(mProvider.getLastNetworkLogRetrievalTime()).isEqualTo(TIMESTAMP);
|
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
|
@Test
|
||||||
public void testIsAlwaysOnVpnSetInPrimaryUser() {
|
public void testIsAlwaysOnVpnSetInPrimaryUser() {
|
||||||
when(mConnectivityManger.getAlwaysOnVpnPackageForUser(MY_USER_ID)).thenReturn(null);
|
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.TestConfig;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +49,22 @@ public final class NetworkLogsPreferenceControllerTest extends
|
|||||||
.thenReturn(date);
|
.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
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return "network_logs";
|
return "network_logs";
|
||||||
|
@@ -20,11 +20,13 @@ import com.android.settings.SettingsRobolectricTestRunner;
|
|||||||
import com.android.settings.TestConfig;
|
import com.android.settings.TestConfig;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +49,22 @@ public final class SecurityLogsPreferenceControllerTest extends
|
|||||||
.thenReturn(date);
|
.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
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return "security_logs";
|
return "security_logs";
|
||||||
|
Reference in New Issue
Block a user