You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.1 KiB

package p067w;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import java.util.ArrayList;
import java.util.Iterator;
import p069x.C1794a;
/* renamed from: w.q */
/* loaded from: classes.dex */
public final class C1788q implements Iterable<Intent> {
/* renamed from: d */
public final ArrayList<Intent> f4512d = new ArrayList<>();
/* renamed from: e */
public final Context f4513e;
/* renamed from: w.q$a */
/* loaded from: classes.dex */
public interface InterfaceC1789a {
/* renamed from: g */
Intent mo401g();
}
public C1788q(Context context) {
this.f4513e = context;
}
/* renamed from: d */
public static C1788q m404d(Context context) {
return new C1788q(context);
}
/* renamed from: a */
public C1788q m407a(Intent intent) {
this.f4512d.add(intent);
return this;
}
/* renamed from: b */
public C1788q m406b(Activity activity) {
Intent mo401g = activity instanceof InterfaceC1789a ? ((InterfaceC1789a) activity).mo401g() : null;
if (mo401g == null) {
mo401g = C1782l.m419a(activity);
}
if (mo401g != null) {
ComponentName component = mo401g.getComponent();
if (component == null) {
component = mo401g.resolveActivity(this.f4513e.getPackageManager());
}
m405c(component);
m407a(mo401g);
}
return this;
}
/* renamed from: c */
public C1788q m405c(ComponentName componentName) {
int size = this.f4512d.size();
try {
Context context = this.f4513e;
while (true) {
Intent m418b = C1782l.m418b(context, componentName);
if (m418b == null) {
return this;
}
this.f4512d.add(size, m418b);
context = this.f4513e;
componentName = m418b.getComponent();
}
} catch (PackageManager.NameNotFoundException e) {
Log.e("TaskStackBuilder", "Bad ComponentName while traversing activity parent metadata");
throw new IllegalArgumentException(e);
}
}
/* renamed from: e */
public void m403e() {
m402f(null);
}
/* renamed from: f */
public void m402f(Bundle bundle) {
if (this.f4512d.isEmpty()) {
throw new IllegalStateException("No intents added to TaskStackBuilder; cannot startActivities");
}
Intent[] intentArr = (Intent[]) this.f4512d.toArray(new Intent[0]);
intentArr[0] = new Intent(intentArr[0]).addFlags(268484608);
if (C1794a.m387e(this.f4513e, intentArr, bundle)) {
return;
}
Intent intent = new Intent(intentArr[intentArr.length - 1]);
intent.addFlags(268435456);
this.f4513e.startActivity(intent);
}
@Override // java.lang.Iterable
@Deprecated
public Iterator<Intent> iterator() {
return this.f4512d.iterator();
}
}