package androidx.slice;

import android.app.slice.Slice;
import java.util.Iterator;
import java.util.Set;

/* loaded from: classes.dex */
public abstract class b {
    /* JADX WARN: Failed to find 'out' block for switch in B:8:0x0042. Please report as an issue. */
    public static android.app.slice.Slice a(Slice slice) {
        if (slice == null || slice.e() == null) {
            return null;
        }
        Slice.Builder builder = new Slice.Builder(slice.e(), b(slice.d()));
        builder.addHints(slice.b());
        for (SliceItem sliceItem : slice.c()) {
            String c10 = sliceItem.c();
            c10.hashCode();
            char c11 = 65535;
            switch (c10.hashCode()) {
                case -1422950858:
                    if (c10.equals("action")) {
                        c11 = 0;
                        break;
                    }
                    break;
                case 104431:
                    if (c10.equals("int")) {
                        c11 = 1;
                        break;
                    }
                    break;
                case 3327612:
                    if (c10.equals("long")) {
                        c11 = 2;
                        break;
                    }
                    break;
                case 3556653:
                    if (c10.equals("text")) {
                        c11 = 3;
                        break;
                    }
                    break;
                case 100313435:
                    if (c10.equals("image")) {
                        c11 = 4;
                        break;
                    }
                    break;
                case 100358090:
                    if (c10.equals("input")) {
                        c11 = 5;
                        break;
                    }
                    break;
                case 109526418:
                    if (c10.equals("slice")) {
                        c11 = 6;
                        break;
                    }
                    break;
            }
            switch (c11) {
                case 0:
                    builder.addAction(sliceItem.b(), a(sliceItem.i()), sliceItem.j());
                    break;
                case 1:
                    builder.addInt(sliceItem.f(), sliceItem.j(), sliceItem.d());
                    break;
                case 2:
                    builder.addLong(sliceItem.g(), sliceItem.j(), sliceItem.d());
                    break;
                case 3:
                    builder.addText(sliceItem.k(), sliceItem.j(), sliceItem.d());
                    break;
                case 4:
                    builder.addIcon(sliceItem.e().l(), sliceItem.j(), sliceItem.d());
                    break;
                case 5:
                    builder.addRemoteInput(sliceItem.h(), sliceItem.j(), sliceItem.d());
                    break;
                case 6:
                    builder.addSubSlice(a(sliceItem.i()), sliceItem.j());
                    break;
            }
        }
        return builder.build();
    }

    private static android.app.slice.SliceSpec b(SliceSpec sliceSpec) {
        if (sliceSpec == null) {
            return null;
        }
        return new android.app.slice.SliceSpec(sliceSpec.c(), sliceSpec.b());
    }

    private static SliceSpec c(android.app.slice.SliceSpec sliceSpec) {
        if (sliceSpec == null) {
            return null;
        }
        return new SliceSpec(sliceSpec.getType(), sliceSpec.getRevision());
    }

    public static Set d(Set set) {
        androidx.collection.b bVar = new androidx.collection.b();
        if (set != null) {
            Iterator it = set.iterator();
            while (it.hasNext()) {
                bVar.add(c((android.app.slice.SliceSpec) it.next()));
            }
        }
        return bVar;
    }
}
