OSDN Git Service

Re-Add VPN-"Settings" button to QSFooter dialog
authorphweiss <phweiss@google.com>
Mon, 9 Jan 2017 14:56:00 +0000 (15:56 +0100)
committerphweiss <phweiss@google.com>
Mon, 9 Jan 2017 17:42:17 +0000 (18:42 +0100)
Button was removed during a redesign of the dialog in the case
of active device owner. However, when no DO is set, the button should
still be there.

Also, when VPN configuration is restricted, do not show the button, and
also do not show the link that is visible in the DO-version of the dialog.

Bug:34156553
Bug:29748723
Test: manual

Change-Id: I177afdc94dc396754fc7703e4316edaa7ce104cd

packages/SystemUI/src/com/android/systemui/qs/QSFooter.java

index 03cd959..b91800a 100644 (file)
@@ -196,6 +196,9 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene
                 profileVpn, deviceOwnerOrganization, hasProfileOwner, isBranded);
         if (deviceOwnerPackage == null) {
             mDialog.setMessage(msg);
+            if (mSecurityController.isVpnEnabled() && !mSecurityController.isVpnRestricted()) {
+                mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getSettingsButton(), this);
+            }
         } else {
             View dialogView = LayoutInflater.from(mContext)
                    .inflate(R.layout.quick_settings_footer_dialog, null, false);
@@ -213,10 +216,12 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene
                 final SpannableStringBuilder message = new SpannableStringBuilder();
                 message.append(mContext.getString(R.string.monitoring_description_do_body_vpn,
                         primaryVpn));
-                message.append(mContext.getString(
-                        R.string.monitoring_description_vpn_settings_separator));
-                message.append(mContext.getString(R.string.monitoring_description_vpn_settings),
-                        new VpnSpan(), 0);
+                if (!mSecurityController.isVpnRestricted()) {
+                    message.append(mContext.getString(
+                            R.string.monitoring_description_vpn_settings_separator));
+                    message.append(mContext.getString(R.string.monitoring_description_vpn_settings),
+                            new VpnSpan(), 0);
+                }
 
                 TextView vpnWarning = (TextView) dialogView.findViewById(R.id.vpn_warning);
                 vpnWarning.setText(message);