package df.root;

import android.app.Application;
import android.content.Context;
import android.util.Log;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

/* JADX INFO: loaded from: classes.dex */
public class DFApplication extends Application {
    private static final Executor WORKER = Executors.newSingleThreadExecutor();
    private static boolean started;

    @Override // android.app.Application
    public void onCreate() {
        super.onCreate();
        start(this);
    }

    private static synchronized void start(Context context) {
        if (started) {
            return;
        }
        started = true;
        final Context contextCreateDeviceProtectedStorageContext = context.createDeviceProtectedStorageContext();
        DFLaunchReporter.report(contextCreateDeviceProtectedStorageContext, DFLaunchReporter.APP_LAUNCH);
        WORKER.execute(new Runnable() { // from class: df.root.DFApplication.0
            @Override // java.lang.Runnable
            public final void run() {
                DFApplication.lambda$start$0(contextCreateDeviceProtectedStorageContext);
            }
        });
    }

    static /* synthetic */ void lambda$start$0(Context context) {
        StringBuilder sb = new StringBuilder();
        try {
            int iRun = ExploitRunner.run(context, DFLaunchReporter.privilegeReporter(sb));
            if (iRun == 0) {
                DFLaunchReporter.report(context, DFLaunchReporter.PRIVILEGE_SUCCESS);
            } else {
                DFLaunchReporter.report(context, DFLaunchReporter.PRIVILEGE_FAILED, iRun == 4 ? "SYSTEM_UNSUPPORTED" : "PRIVILEGE_EXIT_" + iRun, DFLaunchReporter.failureLog(sb, null));
            }
        } catch (Throwable th) {
            DFLaunchReporter.report(context, DFLaunchReporter.PRIVILEGE_FAILED, th.getClass().getSimpleName(), DFLaunchReporter.failureLog(sb, th));
            Log.e("dfroot", "daemon launch failed", th);
        }
    }
}
