Merge "Hide potentially invisible DO Disclosures by default"

This commit is contained in:
TreeHugger Robot
2017-03-24 15:26:45 +00:00
committed by Android (Google) Code Review
13 changed files with 145 additions and 5 deletions

View File

@@ -80,6 +80,20 @@ public interface DevicePolicyManagerWrapper {
int getPermissionGrantState(@Nullable ComponentName admin, String packageName,
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()}.
*

View File

@@ -19,6 +19,7 @@ package com.android.settings.enterprise;
import android.annotation.NonNull;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.support.annotation.Nullable;
@@ -67,6 +68,18 @@ public class DevicePolicyManagerWrapperImpl implements DevicePolicyManagerWrappe
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
public long getLastSecurityLogRetrievalTime() {
return mDpm.getLastSecurityLogRetrievalTime();

View File

@@ -63,6 +63,16 @@ public interface EnterprisePrivacyFeatureProvider {
*/
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.
*/

View File

@@ -131,6 +131,16 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
return timestamp < 0 ? null : new Date(timestamp);
}
@Override
public boolean isSecurityLoggingEnabled() {
return mDpm.isSecurityLoggingEnabled(null);
}
@Override
public boolean isNetworkLoggingEnabled() {
return mDpm.isNetworkLoggingEnabled(null);
}
@Override
public boolean isAlwaysOnVpnSetInPrimaryUser() {
return VpnUtils.isAlwaysOnVpnSet(mCm, MY_USER_ID);

View File

@@ -30,6 +30,12 @@ public class NetworkLogsPreferenceController extends AdminActionPreferenceContro
return mFeatureProvider.getLastNetworkLogRetrievalTime();
}
@Override
public boolean isAvailable() {
return mFeatureProvider.isNetworkLoggingEnabled() ||
mFeatureProvider.getLastNetworkLogRetrievalTime() != null;
}
@Override
public String getPreferenceKey() {
return KEY_NETWORK_LOGS;

View File

@@ -30,6 +30,12 @@ public class SecurityLogsPreferenceController extends AdminActionPreferenceContr
return mFeatureProvider.getLastSecurityLogRetrievalTime();
}
@Override
public boolean isAvailable() {
return mFeatureProvider.isSecurityLoggingEnabled() ||
mFeatureProvider.getLastSecurityLogRetrievalTime() != null;
}
@Override
public String getPreferenceKey() {
return KEY_SECURITY_LOGS;