package androidx.core.app; import android.app.NotificationChannel; import android.app.NotificationChannelGroup; import android.os.Build; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import androidx.core.util.Preconditions; import java.util.ArrayList; import java.util.Collections; import java.util.List; /* loaded from: classes.dex */ public class NotificationChannelGroupCompat { private boolean mBlocked; private List mChannels; String mDescription; final String mId; CharSequence mName; @NonNull public List getChannels() { return this.mChannels; } @Nullable public String getDescription() { return this.mDescription; } @NonNull public String getId() { return this.mId; } @Nullable public CharSequence getName() { return this.mName; } public boolean isBlocked() { return this.mBlocked; } public static class Builder { final NotificationChannelGroupCompat mGroup; @NonNull public NotificationChannelGroupCompat build() { return this.mGroup; } public Builder(@NonNull String str) { this.mGroup = new NotificationChannelGroupCompat(str); } @NonNull public Builder setName(@Nullable CharSequence charSequence) { this.mGroup.mName = charSequence; return this; } @NonNull public Builder setDescription(@Nullable String str) { this.mGroup.mDescription = str; return this; } } public NotificationChannelGroupCompat(@NonNull String str) { this.mChannels = Collections.emptyList(); this.mId = (String) Preconditions.checkNotNull(str); } @RequiresApi(28) public NotificationChannelGroupCompat(@NonNull NotificationChannelGroup notificationChannelGroup) { this(notificationChannelGroup, Collections.emptyList()); } @RequiresApi(26) public NotificationChannelGroupCompat(@NonNull NotificationChannelGroup notificationChannelGroup, @NonNull List list) { this(Api26Impl.getId(notificationChannelGroup)); this.mName = Api26Impl.getName(notificationChannelGroup); int i = Build.VERSION.SDK_INT; if (i >= 28) { this.mDescription = Api28Impl.getDescription(notificationChannelGroup); } if (i >= 28) { this.mBlocked = Api28Impl.isBlocked(notificationChannelGroup); this.mChannels = getChannelsCompat(Api26Impl.getChannels(notificationChannelGroup)); } else { this.mChannels = getChannelsCompat(list); } } @RequiresApi(26) private List getChannelsCompat(List list) { ArrayList arrayList = new ArrayList(); for (NotificationChannel notificationChannel : list) { if (this.mId.equals(Api26Impl.getGroup(notificationChannel))) { arrayList.add(new NotificationChannelCompat(notificationChannel)); } } return arrayList; } public NotificationChannelGroup getNotificationChannelGroup() { int i = Build.VERSION.SDK_INT; NotificationChannelGroup createNotificationChannelGroup = Api26Impl.createNotificationChannelGroup(this.mId, this.mName); if (i >= 28) { Api28Impl.setDescription(createNotificationChannelGroup, this.mDescription); } return createNotificationChannelGroup; } @NonNull public Builder toBuilder() { return new Builder(this.mId).setName(this.mName).setDescription(this.mDescription); } @RequiresApi(26) public static class Api26Impl { private Api26Impl() { } public static NotificationChannelGroup createNotificationChannelGroup(String str, CharSequence charSequence) { return new NotificationChannelGroup(str, charSequence); } public static String getId(NotificationChannelGroup notificationChannelGroup) { return notificationChannelGroup.getId(); } public static CharSequence getName(NotificationChannelGroup notificationChannelGroup) { return notificationChannelGroup.getName(); } public static List getChannels(NotificationChannelGroup notificationChannelGroup) { return notificationChannelGroup.getChannels(); } public static String getGroup(NotificationChannel notificationChannel) { return notificationChannel.getGroup(); } } @RequiresApi(28) public static class Api28Impl { private Api28Impl() { } public static boolean isBlocked(NotificationChannelGroup notificationChannelGroup) { return notificationChannelGroup.isBlocked(); } public static String getDescription(NotificationChannelGroup notificationChannelGroup) { return notificationChannelGroup.getDescription(); } public static void setDescription(NotificationChannelGroup notificationChannelGroup, String str) { notificationChannelGroup.setDescription(str); } } }