Merge "Fix security dialog bug" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2afa837b22
@@ -444,7 +444,7 @@ public class QSSecurityFooterUtils implements DialogInterface.OnClickListener {
|
|||||||
mShouldUseSettingsButton.set(false);
|
mShouldUseSettingsButton.set(false);
|
||||||
mBgHandler.post(() -> {
|
mBgHandler.post(() -> {
|
||||||
String settingsButtonText = getSettingsButton();
|
String settingsButtonText = getSettingsButton();
|
||||||
final View dialogView = createDialogView();
|
final View dialogView = createDialogView(quickSettingsContext);
|
||||||
mMainHandler.post(() -> {
|
mMainHandler.post(() -> {
|
||||||
mDialog = new SystemUIDialog(quickSettingsContext, 0);
|
mDialog = new SystemUIDialog(quickSettingsContext, 0);
|
||||||
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
@@ -469,14 +469,14 @@ public class QSSecurityFooterUtils implements DialogInterface.OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
View createDialogView() {
|
View createDialogView(Context quickSettingsContext) {
|
||||||
if (mSecurityController.isParentalControlsEnabled()) {
|
if (mSecurityController.isParentalControlsEnabled()) {
|
||||||
return createParentalControlsDialogView();
|
return createParentalControlsDialogView();
|
||||||
}
|
}
|
||||||
return createOrganizationDialogView();
|
return createOrganizationDialogView(quickSettingsContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private View createOrganizationDialogView() {
|
private View createOrganizationDialogView(Context quickSettingsContext) {
|
||||||
final boolean isDeviceManaged = mSecurityController.isDeviceManaged();
|
final boolean isDeviceManaged = mSecurityController.isDeviceManaged();
|
||||||
final boolean hasWorkProfile = mSecurityController.hasWorkProfile();
|
final boolean hasWorkProfile = mSecurityController.hasWorkProfile();
|
||||||
final CharSequence deviceOwnerOrganization =
|
final CharSequence deviceOwnerOrganization =
|
||||||
@@ -487,7 +487,7 @@ public class QSSecurityFooterUtils implements DialogInterface.OnClickListener {
|
|||||||
final String vpnName = mSecurityController.getPrimaryVpnName();
|
final String vpnName = mSecurityController.getPrimaryVpnName();
|
||||||
final String vpnNameWorkProfile = mSecurityController.getWorkProfileVpnName();
|
final String vpnNameWorkProfile = mSecurityController.getWorkProfileVpnName();
|
||||||
|
|
||||||
View dialogView = LayoutInflater.from(mContext)
|
View dialogView = LayoutInflater.from(quickSettingsContext)
|
||||||
.inflate(R.layout.quick_settings_footer_dialog, null, false);
|
.inflate(R.layout.quick_settings_footer_dialog, null, false);
|
||||||
|
|
||||||
// device management section
|
// device management section
|
||||||
|
|||||||
@@ -726,7 +726,7 @@ public class QSSecurityFooterTest extends SysuiTestCase {
|
|||||||
when(mSecurityController.isParentalControlsEnabled()).thenReturn(true);
|
when(mSecurityController.isParentalControlsEnabled()).thenReturn(true);
|
||||||
when(mSecurityController.getLabel(any())).thenReturn(PARENTAL_CONTROLS_LABEL);
|
when(mSecurityController.getLabel(any())).thenReturn(PARENTAL_CONTROLS_LABEL);
|
||||||
|
|
||||||
View view = mFooterUtils.createDialogView();
|
View view = mFooterUtils.createDialogView(getContext());
|
||||||
TextView textView = (TextView) view.findViewById(R.id.parental_controls_title);
|
TextView textView = (TextView) view.findViewById(R.id.parental_controls_title);
|
||||||
assertEquals(PARENTAL_CONTROLS_LABEL, textView.getText());
|
assertEquals(PARENTAL_CONTROLS_LABEL, textView.getText());
|
||||||
}
|
}
|
||||||
@@ -749,7 +749,7 @@ public class QSSecurityFooterTest extends SysuiTestCase {
|
|||||||
when(mSecurityController.getDeviceOwnerType(DEVICE_OWNER_COMPONENT))
|
when(mSecurityController.getDeviceOwnerType(DEVICE_OWNER_COMPONENT))
|
||||||
.thenReturn(DEVICE_OWNER_TYPE_FINANCED);
|
.thenReturn(DEVICE_OWNER_TYPE_FINANCED);
|
||||||
|
|
||||||
View view = mFooterUtils.createDialogView();
|
View view = mFooterUtils.createDialogView(getContext());
|
||||||
|
|
||||||
TextView managementSubtitle = view.findViewById(R.id.device_management_subtitle);
|
TextView managementSubtitle = view.findViewById(R.id.device_management_subtitle);
|
||||||
assertEquals(View.VISIBLE, managementSubtitle.getVisibility());
|
assertEquals(View.VISIBLE, managementSubtitle.getVisibility());
|
||||||
|
|||||||
Reference in New Issue
Block a user