1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settingslib.enterprise; 18 19 import android.annotation.NonNull; 20 import android.annotation.UserIdInt; 21 import android.content.Context; 22 import android.content.DialogInterface; 23 24 import androidx.annotation.Nullable; 25 26 import com.android.settingslib.RestrictedLockUtils; 27 28 /** 29 * A controller used to customize the action disabled by admin dialog. 30 */ 31 public interface ActionDisabledByAdminController { 32 33 /** 34 * Sets the {@link ActionDisabledLearnMoreButtonLauncher}. 35 */ initialize(ActionDisabledLearnMoreButtonLauncher launcher)36 void initialize(ActionDisabledLearnMoreButtonLauncher launcher); 37 38 /** 39 * Handles the adding and setting up of the learn more button. If button is not needed, then 40 * this method can be left empty. 41 */ setupLearnMoreButton(Context context)42 void setupLearnMoreButton(Context context); 43 44 /** 45 * Returns the admin support dialog's title resource id. 46 */ getAdminSupportTitle(@ullable String restriction)47 String getAdminSupportTitle(@Nullable String restriction); 48 49 /** 50 * Returns the admin support dialog's content string. 51 */ getAdminSupportContentString(Context context, @Nullable CharSequence supportMessage)52 CharSequence getAdminSupportContentString(Context context, 53 @Nullable CharSequence supportMessage); 54 55 /** 56 * Updates the enforced admin 57 */ updateEnforcedAdmin(RestrictedLockUtils.EnforcedAdmin admin, @UserIdInt int adminUserId)58 void updateEnforcedAdmin(RestrictedLockUtils.EnforcedAdmin admin, @UserIdInt int adminUserId); 59 60 /** 61 * Returns a listener for handling positive button clicks 62 */ 63 @Nullable getPositiveButtonListener(@onNull Context context, @NonNull RestrictedLockUtils.EnforcedAdmin enforcedAdmin)64 default DialogInterface.OnClickListener getPositiveButtonListener(@NonNull Context context, 65 @NonNull RestrictedLockUtils.EnforcedAdmin enforcedAdmin) { 66 return null; 67 } 68 } 69