package com.seewo.ota.v.r;

import android.content.Context;
import android.util.Log;
import f.z.d.g;
import f.z.d.k;
import java.util.ArrayList;
import java.util.List;

/* JADX INFO: compiled from: UpdatedFinishActionManager.kt */
/* JADX INFO: loaded from: classes.dex */
public final class b {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final a f2376b = new a(null);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private static final List<com.seewo.ota.v.r.a> f2377c = new ArrayList();

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private static b f2378d;
    private Context a;

    /* JADX INFO: compiled from: UpdatedFinishActionManager.kt */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(g gVar) {
            this();
        }

        public final b a(Context context) {
            k.e(context, "context");
            if (b.f2378d == null) {
                b bVar = new b(null);
                bVar.f(context);
                b.f2378d = bVar;
            }
            b bVar2 = b.f2378d;
            k.c(bVar2);
            return bVar2;
        }
    }

    private b() {
    }

    public /* synthetic */ b(g gVar) {
        this();
    }

    private final void d() {
        boolean zA;
        Log.d("UpdatedFinishActionManager", "execute: " + f2377c);
        List<com.seewo.ota.v.r.a> list = f2377c;
        ArrayList<com.seewo.ota.v.r.a> arrayList = new ArrayList();
        for (Object obj : list) {
            com.seewo.ota.v.r.a aVar = (com.seewo.ota.v.r.a) obj;
            try {
                Context context = this.a;
                if (context == null) {
                    k.p("context");
                    throw null;
                }
                zA = aVar.a(context);
            } catch (Exception e2) {
                Log.e("UpdatedFinishActionManager/$" + aVar, "condition: " + aVar.getClass().getSimpleName(), e2);
                zA = false;
            }
            if (zA) {
                arrayList.add(obj);
            }
        }
        for (com.seewo.ota.v.r.a aVar2 : arrayList) {
            try {
                Context context2 = this.a;
                if (context2 == null) {
                    k.p("context");
                    throw null;
                }
                aVar2.b(context2);
            } catch (Exception e3) {
                Log.e("UpdatedFinishActionManager/$" + aVar2, "execute: " + aVar2.getClass().getSimpleName(), e3);
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void f(Context context) {
        if (this.a != null) {
            return;
        }
        this.a = context;
        g();
    }

    private final void g() {
        try {
            try {
                Class.forName("com.seewo.ota.business.CustomBusiness").newInstance();
            } catch (Exception e2) {
                Log.d("UpdatedFinishActionManager", "CustomBusiness init error", e2);
            }
        } catch (Exception unused) {
            Log.d("UpdatedFinishActionManager", "CustomBusiness not found");
        }
    }

    public final void e() {
        d();
    }
}
