diff options
| author | 2024-06-28 19:23:07 +0200 | |
|---|---|---|
| committer | 2024-07-01 19:35:07 +0200 | |
| commit | 799bf765c6c60e96c3fa11075e22fa81c482257f (patch) | |
| tree | 4746ab0d0a4fa0c9c7e1be87a3ea0c44d0a78fe2 | |
| parent | bd4dca1d1fadb46332494bedb620b993f4ef6e58 (diff) | |
Supply icon (in addition to name) for addCustomManualMode()
Bug: 326442408
Flag: android.app.modes_ui
Test: atest com.android.settings.notification.modes
Change-Id: I1249fcf52770705c8f899fed9ff1f09587ce301f
| -rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenModesBackend.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenModesBackend.java b/packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenModesBackend.java index 5529da009329..62a5763cbd2c 100644 --- a/packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenModesBackend.java +++ b/packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenModesBackend.java @@ -27,6 +27,8 @@ import android.service.notification.Condition; import android.service.notification.ZenModeConfig; import android.util.Log; +import androidx.annotation.DrawableRes; + import com.android.settingslib.R; import java.time.Duration; @@ -184,15 +186,18 @@ public class ZenModesBackend { * Creates a new custom mode with the provided {@code name}. The mode will be "manual" (i.e. * not have a schedule), this can be later updated by the user in the mode settings page. * + * @param name mode name + * @param iconResId resource id of the chosen icon, {code 0} if none. * @return the created mode. Only {@code null} if creation failed due to an internal error */ @Nullable - public ZenMode addCustomMode(String name) { + public ZenMode addCustomManualMode(String name, @DrawableRes int iconResId) { AutomaticZenRule rule = new AutomaticZenRule.Builder(name, ZenModeConfig.toCustomManualConditionId()) .setPackage(ZenModeConfig.getCustomManualConditionProvider().getPackageName()) .setType(AutomaticZenRule.TYPE_OTHER) .setOwner(ZenModeConfig.getCustomManualConditionProvider()) + .setIconResId(iconResId) .setManualInvocationAllowed(true) .build(); |