package com.ss.android.ugc.aweme.services;

import X.2Pr;
import X.3af;
import X.3i8;
import X.8n2;
import X.F5X;
import X.Jcz;
import X.JdC;
import X.Lsh;
import X.M12;
import android.app.Activity;
import android.content.Intent;
import android.os.Environment;
import android.text.TextUtils;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.im.INotificationManagerService;
import com.ss.android.ugc.aweme.im.sdk.notification.NotificationManagerServiceImpl;
import java.io.File;
import kotlin.h.b.n;

public final /* synthetic */ class ProfileDependentComponentImpl$startCameraActivity$1 extends JdC implements Lsh<Activity, Fragment, Integer, String, String, 2Pr> {
    public static final ProfileDependentComponentImpl$startCameraActivity$1 INSTANCE = new ProfileDependentComponentImpl$startCameraActivity$1();

    static {
        Covode.recordClassIndex(105165);
    }

    public ProfileDependentComponentImpl$startCameraActivity$1() {
        super(5, F5X.class, "startCameraActivity", "startCameraActivity(Landroid/app/Activity;Landroidx/fragment/app/Fragment;ILjava/lang/String;Ljava/lang/String;)V", 1);
    }

    public final /* synthetic */ Object invoke(Object obj, Object obj2, Object obj3, Object obj4, Object obj5) {
        invoke((Activity) obj, (Fragment) obj2, ((Number) obj3).intValue(), (String) obj4, (String) obj5);
        return 2Pr.LIZ;
    }

    public final void invoke(Activity activity, Fragment fragment, int i, String str, String str2) {
        M12.LIZ(activity, str, str2);
        M12.LIZ(activity, str, str2);
        if (!8n2.LJIIIZ || TextUtils.isEmpty(8n2.LJIJI)) {
            8n2.LJIJI = Environment.getExternalStorageState();
        }
        if (!n.LIZ("mounted", 8n2.LJIJI)) {
            3af r1 = new 3af(activity);
            r1.LIZIZ(2131231629);
            r1.LJ(2131827967);
            3af.LIZ(r1);
            return;
        }
        Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
        File file = new File(str);
        if (!file.exists()) {
            file.mkdirs();
        }
        File file2 = new File(file, str2);
        intent.addFlags(1);
        intent.putExtra("output", Jcz.LIZ(activity, file2));
        if (fragment != null) {
            try {
                fragment.startActivityForResult(intent, i);
            } catch (Exception unused) {
                3af r12 = new 3af(activity);
                r12.LIZIZ(2131231629);
                r12.LJ(2131827964);
                3af.LIZ(r12);
                return;
            }
        } else {
            3i8.LIZ(intent, activity);
            activity.startActivityForResult(intent, i);
        }
        INotificationManagerService LIZJ = NotificationManagerServiceImpl.LIZJ();
        if (LIZJ != null) {
            LIZJ.LIZ(true);
        }
    }
}
