Loading res/values/strings.xml +15 −0 Original line number Diff line number Diff line Loading @@ -8185,6 +8185,21 @@ <string name="enterprise_privacy_always_on_vpn_work">Always-on VPN turned on in your work profile</string> <!-- Label explaining that a global HTTP proxy was set by the admin. [CHAR LIMIT=NONE] --> <string name="enterprise_privacy_global_http_proxy">Global HTTP proxy set</string> <!-- Label explaining that the admin installed trusted CA certificates for the current user. [CHAR LIMIT=NONE] --> <plurals name="enterprise_privacy_ca_certs_user"> <item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed</item> <item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed</item> </plurals> <!-- Label explaining that the admin installed trusted CA certificates for the personal profile. [CHAR LIMIT=NONE] --> <plurals name="enterprise_privacy_ca_certs_personal"> <item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed in the personal profile</item> <item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed in the personal profile</item> </plurals> <!-- Label explaining that the admin installed trusted CA certificates for the work profile. [CHAR LIMIT=NONE] --> <plurals name="enterprise_privacy_ca_certs_work"> <item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed in the work profile</item> <item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed in the work profile</item> </plurals> <!-- Label explaining that the admin can lock the device and change the user's password. [CHAR LIMIT=NONE] --> <string name="enterprise_privacy_lock_device">Admin can lock device and reset password</string> <!-- Label explaining that the admin can wipe the device remotely. [CHAR LIMIT=NONE] --> res/xml/enterprise_privacy_settings.xml +8 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,14 @@ android:title="@string/enterprise_privacy_global_http_proxy" settings:allowDividerBelow="true" settings:multiLine="true"/> <com.android.settings.DividerPreference android:key="ca_certs_current_user" settings:allowDividerBelow="true" settings:multiLine="true"/> <com.android.settings.DividerPreference android:key="ca_certs_managed_profile" settings:allowDividerBelow="true" settings:multiLine="true"/> </PreferenceCategory> <PreferenceCategory android:title="@string/enterprise_privacy_device_access_category"> Loading src/com/android/settings/enterprise/CaCertsCurrentUserPreferenceController.java 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.android.settings.enterprise; import android.content.Context; import android.content.res.Resources; import android.support.v7.preference.Preference; import com.android.settings.R; import com.android.settings.core.PreferenceController; import com.android.settings.overlay.FeatureFactory; public class CaCertsCurrentUserPreferenceController extends PreferenceController { private static final String CA_CERTS_CURRENT_USER = "ca_certs_current_user"; private final EnterprisePrivacyFeatureProvider mFeatureProvider; public CaCertsCurrentUserPreferenceController(Context context) { super(context); mFeatureProvider = FeatureFactory.getFactory(context) .getEnterprisePrivacyFeatureProvider(context); } @Override public void updateState(Preference preference) { final int certs = mFeatureProvider.getNumberOfOwnerInstalledCaCertsInCurrentUser(); if (certs == 0) { preference.setVisible(false); return; } preference.setTitle(mContext.getResources().getQuantityString( mFeatureProvider.isInCompMode() ? R.plurals.enterprise_privacy_ca_certs_personal : R.plurals.enterprise_privacy_ca_certs_user, certs, certs)); preference.setVisible(true); } @Override public boolean isAvailable() { return true; } @Override public String getPreferenceKey() { return CA_CERTS_CURRENT_USER; } } src/com/android/settings/enterprise/CaCertsManagedProfilePreferenceController.java 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.android.settings.enterprise; import android.content.Context; import android.content.res.Resources; import android.support.v7.preference.Preference; import com.android.settings.R; import com.android.settings.core.PreferenceController; import com.android.settings.overlay.FeatureFactory; public class CaCertsManagedProfilePreferenceController extends PreferenceController { private static final String KEY_CA_CERTS_MANAGED_PROFILE = "ca_certs_managed_profile"; private final EnterprisePrivacyFeatureProvider mFeatureProvider; public CaCertsManagedProfilePreferenceController(Context context) { super(context); mFeatureProvider = FeatureFactory.getFactory(context) .getEnterprisePrivacyFeatureProvider(context); } @Override public void updateState(Preference preference) { final int certs = mFeatureProvider.getNumberOfOwnerInstalledCaCertsInManagedProfile(); if (certs == 0) { preference.setVisible(false); return; } preference.setTitle(mContext.getResources().getQuantityString( R.plurals.enterprise_privacy_ca_certs_work, certs, certs)); preference.setVisible(true); } @Override public boolean isAvailable() { return true; } @Override public String getPreferenceKey() { return KEY_CA_CERTS_MANAGED_PROFILE; } } src/com/android/settings/enterprise/DevicePolicyManagerWrapper.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.settings.enterprise; import android.annotation.NonNull; import android.content.ComponentName; import android.os.UserHandle; import android.support.annotation.Nullable; import java.util.List; /** * This interface replicates a subset of the android.app.admin.DevicePolicyManager (DPM). The * interface exists so that we can use a thin wrapper around the DPM in production code and a mock Loading Loading @@ -97,4 +100,12 @@ public interface DevicePolicyManagerWrapper { * @see android.app.admin.DevicePolicyManager#isCurrentInputMethodSetByOwner */ boolean isCurrentInputMethodSetByOwner(); /** * Calls {@code DevicePolicyManager.getOwnerInstalledCaCerts()}. * * @see android.app.admin.DevicePolicyManager#getOwnerInstalledCaCerts */ List<String> getOwnerInstalledCaCerts(@NonNull UserHandle user); } Loading
res/values/strings.xml +15 −0 Original line number Diff line number Diff line Loading @@ -8185,6 +8185,21 @@ <string name="enterprise_privacy_always_on_vpn_work">Always-on VPN turned on in your work profile</string> <!-- Label explaining that a global HTTP proxy was set by the admin. [CHAR LIMIT=NONE] --> <string name="enterprise_privacy_global_http_proxy">Global HTTP proxy set</string> <!-- Label explaining that the admin installed trusted CA certificates for the current user. [CHAR LIMIT=NONE] --> <plurals name="enterprise_privacy_ca_certs_user"> <item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed</item> <item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed</item> </plurals> <!-- Label explaining that the admin installed trusted CA certificates for the personal profile. [CHAR LIMIT=NONE] --> <plurals name="enterprise_privacy_ca_certs_personal"> <item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed in the personal profile</item> <item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed in the personal profile</item> </plurals> <!-- Label explaining that the admin installed trusted CA certificates for the work profile. [CHAR LIMIT=NONE] --> <plurals name="enterprise_privacy_ca_certs_work"> <item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed in the work profile</item> <item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed in the work profile</item> </plurals> <!-- Label explaining that the admin can lock the device and change the user's password. [CHAR LIMIT=NONE] --> <string name="enterprise_privacy_lock_device">Admin can lock device and reset password</string> <!-- Label explaining that the admin can wipe the device remotely. [CHAR LIMIT=NONE] -->
res/xml/enterprise_privacy_settings.xml +8 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,14 @@ android:title="@string/enterprise_privacy_global_http_proxy" settings:allowDividerBelow="true" settings:multiLine="true"/> <com.android.settings.DividerPreference android:key="ca_certs_current_user" settings:allowDividerBelow="true" settings:multiLine="true"/> <com.android.settings.DividerPreference android:key="ca_certs_managed_profile" settings:allowDividerBelow="true" settings:multiLine="true"/> </PreferenceCategory> <PreferenceCategory android:title="@string/enterprise_privacy_device_access_category"> Loading
src/com/android/settings/enterprise/CaCertsCurrentUserPreferenceController.java 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.android.settings.enterprise; import android.content.Context; import android.content.res.Resources; import android.support.v7.preference.Preference; import com.android.settings.R; import com.android.settings.core.PreferenceController; import com.android.settings.overlay.FeatureFactory; public class CaCertsCurrentUserPreferenceController extends PreferenceController { private static final String CA_CERTS_CURRENT_USER = "ca_certs_current_user"; private final EnterprisePrivacyFeatureProvider mFeatureProvider; public CaCertsCurrentUserPreferenceController(Context context) { super(context); mFeatureProvider = FeatureFactory.getFactory(context) .getEnterprisePrivacyFeatureProvider(context); } @Override public void updateState(Preference preference) { final int certs = mFeatureProvider.getNumberOfOwnerInstalledCaCertsInCurrentUser(); if (certs == 0) { preference.setVisible(false); return; } preference.setTitle(mContext.getResources().getQuantityString( mFeatureProvider.isInCompMode() ? R.plurals.enterprise_privacy_ca_certs_personal : R.plurals.enterprise_privacy_ca_certs_user, certs, certs)); preference.setVisible(true); } @Override public boolean isAvailable() { return true; } @Override public String getPreferenceKey() { return CA_CERTS_CURRENT_USER; } }
src/com/android/settings/enterprise/CaCertsManagedProfilePreferenceController.java 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.android.settings.enterprise; import android.content.Context; import android.content.res.Resources; import android.support.v7.preference.Preference; import com.android.settings.R; import com.android.settings.core.PreferenceController; import com.android.settings.overlay.FeatureFactory; public class CaCertsManagedProfilePreferenceController extends PreferenceController { private static final String KEY_CA_CERTS_MANAGED_PROFILE = "ca_certs_managed_profile"; private final EnterprisePrivacyFeatureProvider mFeatureProvider; public CaCertsManagedProfilePreferenceController(Context context) { super(context); mFeatureProvider = FeatureFactory.getFactory(context) .getEnterprisePrivacyFeatureProvider(context); } @Override public void updateState(Preference preference) { final int certs = mFeatureProvider.getNumberOfOwnerInstalledCaCertsInManagedProfile(); if (certs == 0) { preference.setVisible(false); return; } preference.setTitle(mContext.getResources().getQuantityString( R.plurals.enterprise_privacy_ca_certs_work, certs, certs)); preference.setVisible(true); } @Override public boolean isAvailable() { return true; } @Override public String getPreferenceKey() { return KEY_CA_CERTS_MANAGED_PROFILE; } }
src/com/android/settings/enterprise/DevicePolicyManagerWrapper.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.settings.enterprise; import android.annotation.NonNull; import android.content.ComponentName; import android.os.UserHandle; import android.support.annotation.Nullable; import java.util.List; /** * This interface replicates a subset of the android.app.admin.DevicePolicyManager (DPM). The * interface exists so that we can use a thin wrapper around the DPM in production code and a mock Loading Loading @@ -97,4 +100,12 @@ public interface DevicePolicyManagerWrapper { * @see android.app.admin.DevicePolicyManager#isCurrentInputMethodSetByOwner */ boolean isCurrentInputMethodSetByOwner(); /** * Calls {@code DevicePolicyManager.getOwnerInstalledCaCerts()}. * * @see android.app.admin.DevicePolicyManager#getOwnerInstalledCaCerts */ List<String> getOwnerInstalledCaCerts(@NonNull UserHandle user); }