summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenModesBackend.java7
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();