Add branded VPN messages to go along with branded icons am: 802bc6ee06

am: 57bf03152c

Change-Id: Ib35414d8234ca086c2a7e629ea756a5dd2c3cd5b
This commit is contained in:
Jason Monk
2016-09-02 17:41:17 +00:00
committed by android-build-merger
2 changed files with 25 additions and 12 deletions

View File

@@ -1001,6 +1001,9 @@
<!-- Footer vpn present text [CHAR LIMIT=50] --> <!-- Footer vpn present text [CHAR LIMIT=50] -->
<string name="vpn_footer">Network may be monitored</string> <string name="vpn_footer">Network may be monitored</string>
<!-- Footer vpn present text [CHAR LIMIT=50] -->
<string name="branded_vpn_footer">Network may be monitored</string>
<!-- Monitoring dialog title for device owned devices [CHAR LIMIT=35] --> <!-- Monitoring dialog title for device owned devices [CHAR LIMIT=35] -->
<string name="monitoring_title_device_owned">Device monitoring</string> <string name="monitoring_title_device_owned">Device monitoring</string>
@@ -1037,6 +1040,9 @@
<!-- Monitoring dialog text for single app (inside personal profile) [CHAR LIMIT=400] --> <!-- Monitoring dialog text for single app (inside personal profile) [CHAR LIMIT=400] -->
<string name="monitoring_description_app_personal">You\'re connected to <xliff:g id="application">%1$s</xliff:g>, which can monitor your personal network activity, including emails, apps, and websites.</string> <string name="monitoring_description_app_personal">You\'re connected to <xliff:g id="application">%1$s</xliff:g>, which can monitor your personal network activity, including emails, apps, and websites.</string>
<!-- Monitoring dialog text for single app (inside personal profile) [CHAR LIMIT=400] -->
<string name="branded_monitoring_description_app_personal">You\'re connected to <xliff:g id="application">%1$s</xliff:g>, which can monitor your personal network activity, including emails, apps, and websites.</string>
<!-- Monitoring dialog text for single app (inside work profile) [CHAR LIMIT=400] --> <!-- Monitoring dialog text for single app (inside work profile) [CHAR LIMIT=400] -->
<string name="monitoring_description_app_work">Your work profile is managed by <xliff:g id="organization">%1$s</xliff:g>. It is connected to <xliff:g id="application">%2$s</xliff:g>, which can monitor your work network activity, including emails, apps, and websites.\n\nFor more information, contact your administrator.</string> <string name="monitoring_description_app_work">Your work profile is managed by <xliff:g id="organization">%1$s</xliff:g>. It is connected to <xliff:g id="application">%2$s</xliff:g>, which can monitor your work network activity, including emails, apps, and websites.\n\nFor more information, contact your administrator.</string>

View File

@@ -120,11 +120,10 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene
mFooterTextId = R.string.device_owned_footer; mFooterTextId = R.string.device_owned_footer;
mIsVisible = true; mIsVisible = true;
} else { } else {
mFooterTextId = R.string.vpn_footer; boolean isBranded = mSecurityController.isVpnBranded();
mFooterTextId = isBranded ? R.string.branded_vpn_footer : R.string.vpn_footer;
// Update the VPN footer icon, if needed. // Update the VPN footer icon, if needed.
int footerIconId = (mSecurityController.isVpnBranded() int footerIconId = isBranded ? R.drawable.ic_qs_branded_vpn : R.drawable.ic_qs_vpn;
? R.drawable.ic_qs_branded_vpn
: R.drawable.ic_qs_vpn);
if (mFooterIconId != footerIconId) { if (mFooterIconId != footerIconId) {
mFooterIconId = footerIconId; mFooterIconId = footerIconId;
mMainHandler.post(mUpdateIcon); mMainHandler.post(mUpdateIcon);
@@ -148,11 +147,15 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene
String primaryVpn = mSecurityController.getPrimaryVpnName(); String primaryVpn = mSecurityController.getPrimaryVpnName();
String profileVpn = mSecurityController.getProfileVpnName(); String profileVpn = mSecurityController.getProfileVpnName();
boolean managed = mSecurityController.hasProfileOwner(); boolean managed = mSecurityController.hasProfileOwner();
boolean isBranded = deviceOwner == null && mSecurityController.isVpnBranded();
mDialog = new SystemUIDialog(mContext); mDialog = new SystemUIDialog(mContext);
mDialog.setTitle(getTitle(deviceOwner)); if (!isBranded) {
mDialog.setMessage(getMessage(deviceOwner, profileOwner, primaryVpn, profileVpn, managed)); mDialog.setTitle(getTitle(deviceOwner));
mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(), this); }
mDialog.setMessage(getMessage(deviceOwner, profileOwner, primaryVpn, profileVpn, managed,
isBranded));
mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(isBranded), this);
if (mSecurityController.isVpnEnabled() && !mSecurityController.isVpnRestricted()) { if (mSecurityController.isVpnEnabled() && !mSecurityController.isVpnRestricted()) {
mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getSettingsButton(), this); mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getSettingsButton(), this);
} }
@@ -163,12 +166,12 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene
return mContext.getString(R.string.status_bar_settings_settings_button); return mContext.getString(R.string.status_bar_settings_settings_button);
} }
private String getPositiveButton() { private String getPositiveButton(boolean isBranded) {
return mContext.getString(R.string.quick_settings_done); return mContext.getString(isBranded ? android.R.string.ok : R.string.quick_settings_done);
} }
private String getMessage(String deviceOwner, String profileOwner, String primaryVpn, private String getMessage(String deviceOwner, String profileOwner, String primaryVpn,
String profileVpn, boolean primaryUserIsManaged) { String profileVpn, boolean primaryUserIsManaged, boolean isBranded) {
// Show a special warning when the device has device owner, but -- // Show a special warning when the device has device owner, but --
// TODO See b/25779452 -- device owner doesn't actually have monitoring power. // TODO See b/25779452 -- device owner doesn't actually have monitoring power.
if (deviceOwner != null) { if (deviceOwner != null) {
@@ -184,8 +187,12 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene
return mContext.getString(R.string.monitoring_description_app_personal_work, return mContext.getString(R.string.monitoring_description_app_personal_work,
profileOwner, profileVpn, primaryVpn); profileOwner, profileVpn, primaryVpn);
} else { } else {
return mContext.getString(R.string.monitoring_description_app_personal, if (isBranded) {
primaryVpn); return mContext.getString(R.string.branded_monitoring_description_app_personal);
} else {
return mContext.getString(R.string.monitoring_description_app_personal,
primaryVpn);
}
} }
} else if (profileVpn != null) { } else if (profileVpn != null) {
return mContext.getString(R.string.monitoring_description_app_work, return mContext.getString(R.string.monitoring_description_app_work,