diff options
| author | 2021-02-17 09:59:30 +0000 | |
|---|---|---|
| committer | 2021-02-17 09:59:30 +0000 | |
| commit | 7de3040954454316da27b4fc0fceace3c187338a (patch) | |
| tree | 5ef4d7540a16838c1ea9e7d9bd37fab98c5db69f | |
| parent | 7c064eb586930d4b8f48772ab21e8fc52dca468c (diff) | |
| parent | c1671be864759c83389c9b1bc6689671e1612cf4 (diff) | |
Merge "Update network logging message" into sc-dev
3 files changed, 44 insertions, 6 deletions
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index d997ca2fa4a4..32381be5b5d6 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1341,6 +1341,9 @@ <!-- Monitoring dialog: Description of Network Logging. [CHAR LIMIT=NONE]--> <string name="monitoring_description_management_network_logging">Your admin has turned on network logging, which monitors traffic on your device.</string> + <!-- Monitoring dialog: Description of Network Logging in the work profile. [CHAR LIMIT=NONE]--> + <string name="monitoring_description_managed_profile_network_logging">Your admin has turned on network logging, which monitors traffic in your work profile but not in your personal profile.</string> + <!-- Monitoring dialog: Description of an active VPN. [CHAR LIMIT=NONE]--> <string name="monitoring_description_named_vpn">You\'re connected to <xliff:g id="vpn_app" example="Foo VPN App">%1$s</xliff:g>, which can monitor your network activity, including emails, apps, and websites.</string> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java index 386638217110..1411fa1ea21f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java @@ -170,7 +170,8 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen // Update visibility of footer mIsVisible = (isDeviceManaged && !isDemoDevice) || hasCACerts || hasCACertsInWorkProfile || vpnName != null || vpnNameWorkProfile != null - || isProfileOwnerOfOrganizationOwnedDevice || isParentalControlsEnabled; + || isProfileOwnerOfOrganizationOwnedDevice || isParentalControlsEnabled + || (hasWorkProfile && isNetworkLoggingEnabled); // Update the string mFooterTextContent = getFooterText(isDeviceManaged, hasWorkProfile, hasCACerts, hasCACertsInWorkProfile, isNetworkLoggingEnabled, vpnName, @@ -275,12 +276,30 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen vpnName); } if (isProfileOwnerOfOrganizationOwnedDevice) { + if (isNetworkLoggingEnabled) { + if (organizationName == null) { + return mContext.getString( + R.string.quick_settings_disclosure_management_monitoring); + } + return mContext.getString( + R.string.quick_settings_disclosure_named_management_monitoring, + organizationName); + } if (workProfileOrganizationName == null) { return mContext.getString(R.string.quick_settings_disclosure_management); } return mContext.getString(R.string.quick_settings_disclosure_named_management, workProfileOrganizationName); } + if (hasWorkProfile && isNetworkLoggingEnabled) { + if (workProfileOrganizationName == null) { + return mContext.getString( + R.string.quick_settings_disclosure_managed_profile_monitoring); + } + return mContext.getString( + R.string.quick_settings_disclosure_named_managed_profile_monitoring, + workProfileOrganizationName); + } return null; } @@ -367,7 +386,8 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen } // network logging section - CharSequence networkLoggingMessage = getNetworkLoggingMessage(isNetworkLoggingEnabled); + CharSequence networkLoggingMessage = getNetworkLoggingMessage(isDeviceManaged, + isNetworkLoggingEnabled); if (networkLoggingMessage == null) { dialogView.findViewById(R.id.network_logging_disclosures).setVisibility(View.GONE); } else { @@ -492,9 +512,15 @@ class QSSecurityFooter implements OnClickListener, DialogInterface.OnClickListen return mContext.getString(R.string.monitoring_description_ca_certificate); } - protected CharSequence getNetworkLoggingMessage(boolean isNetworkLoggingEnabled) { + protected CharSequence getNetworkLoggingMessage(boolean isDeviceManaged, + boolean isNetworkLoggingEnabled) { if (!isNetworkLoggingEnabled) return null; - return mContext.getString(R.string.monitoring_description_management_network_logging); + if (isDeviceManaged) { + return mContext.getString(R.string.monitoring_description_management_network_logging); + } else { + return mContext.getString( + R.string.monitoring_description_managed_profile_network_logging); + } } protected CharSequence getVpnMessage(boolean isDeviceManaged, boolean hasWorkProfile, diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSSecurityFooterTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSSecurityFooterTest.java index fd0715bbca29..862e3747f602 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSSecurityFooterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSSecurityFooterTest.java @@ -443,9 +443,18 @@ public class QSSecurityFooterTest extends SysuiTestCase { @Test public void testGetNetworkLoggingMessage() { - assertEquals(null, mFooter.getNetworkLoggingMessage(false)); + // Test network logging message on a device with a device owner. + // Network traffic may be monitored on the device. + assertEquals(null, mFooter.getNetworkLoggingMessage(true, false)); assertEquals(mContext.getString(R.string.monitoring_description_management_network_logging), - mFooter.getNetworkLoggingMessage(true)); + mFooter.getNetworkLoggingMessage(true, true)); + + // Test network logging message on a device with a managed profile owner + // Network traffic may be monitored on the work profile. + assertEquals(null, mFooter.getNetworkLoggingMessage(false, false)); + assertEquals( + mContext.getString(R.string.monitoring_description_managed_profile_network_logging), + mFooter.getNetworkLoggingMessage(false, true)); } @Test |