Show biometric-specific dialog when appropriate
1) We need to pass a "restriction" string from settings to the dialog, otherwise the biometric dialog could be shown in non-biometric flows 2) Updates ActionDisabledByAdminDialogHelper to pass the restrition to be taken into consideration when creating the controller 3) Sets an optional onClickListener on the positive button. Bug: 5788943 Test: atest ParentalControlsUtilsTest Change-Id: Iedff7fef50e186b2779f061f37d3080c910d2179
This commit is contained in:
@@ -56,11 +56,16 @@ public final class ActionDisabledByAdminDialogHelper {
|
||||
private final Activity mActivity;
|
||||
|
||||
public ActionDisabledByAdminDialogHelper(Activity activity) {
|
||||
this(activity, null /* restriction */);
|
||||
}
|
||||
|
||||
public ActionDisabledByAdminDialogHelper(Activity activity, String restriction) {
|
||||
mActivity = activity;
|
||||
mDialogView = (ViewGroup) LayoutInflater.from(mActivity).inflate(
|
||||
R.layout.admin_support_details_dialog, null);
|
||||
mActionDisabledByAdminController = ActionDisabledByAdminControllerFactory
|
||||
.createInstance(mActivity, new DeviceAdminStringProviderImpl(mActivity));
|
||||
.createInstance(mActivity, restriction,
|
||||
new DeviceAdminStringProviderImpl(mActivity));
|
||||
}
|
||||
|
||||
private @UserIdInt int getEnforcementAdminUserId(@NonNull EnforcedAdmin admin) {
|
||||
@@ -74,7 +79,8 @@ public final class ActionDisabledByAdminDialogHelper {
|
||||
public AlertDialog.Builder prepareDialogBuilder(String restriction,
|
||||
EnforcedAdmin enforcedAdmin) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity)
|
||||
.setPositiveButton(R.string.okay, null)
|
||||
.setPositiveButton(R.string.okay,
|
||||
mActionDisabledByAdminController.getPositiveButtonListener())
|
||||
.setView(mDialogView);
|
||||
prepareDialogBuilder(builder, restriction, enforcedAdmin);
|
||||
return builder;
|
||||
|
Reference in New Issue
Block a user