package o; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import java.util.ArrayList; import java.util.Iterator; /* loaded from: classes.dex */ public final class EkX implements Iterable { public final Context c; public final ArrayList d = new ArrayList<>(); /* loaded from: classes.dex */ public interface HBt { Intent getSupportParentActivityIntent(); } private EkX(Context context) { this.c = context; } public static EkX b(Context context) { return new EkX(context); } public final EkX nk_(ComponentName componentName) { int size = this.d.size(); try { Intent mo_ = uLO.mo_(this.c, componentName); while (mo_ != null) { this.d.add(size, mo_); mo_ = uLO.mo_(this.c, mo_.getComponent()); } return this; } catch (PackageManager.NameNotFoundException e) { throw new IllegalArgumentException(e); } } @Override // java.lang.Iterable @Deprecated public final Iterator iterator() { return this.d.iterator(); } public final void c() { if (this.d.isEmpty()) { throw new IllegalStateException("No intents added to TaskStackBuilder; cannot startActivities"); } Intent[] intentArr = (Intent[]) this.d.toArray(new Intent[0]); intentArr[0] = new Intent(intentArr[0]).addFlags(268484608); if (nMh.startActivities(this.c, intentArr, null)) { return; } Intent intent = new Intent(intentArr[intentArr.length - 1]); intent.addFlags(268435456); this.c.startActivity(intent); } }