// Path: sandriosCamera/src/main/java/com/sandrios/sandriosCamera/internal/configuration/CameraConfiguration.java
// public final class CameraConfiguration {
// 
//     public static final int MEDIA_QUALITY_AUTO = 10;
//     public static final int MEDIA_QUALITY_LOWEST = 15;
//     public static final int MEDIA_QUALITY_LOW = 11;
//     public static final int MEDIA_QUALITY_MEDIUM = 12;
//     public static final int MEDIA_QUALITY_HIGH = 13;
//     public static final int MEDIA_QUALITY_HIGHEST = 14;
// 
//     public static final int MEDIA_ACTION_VIDEO = 100;
//     public static final int MEDIA_ACTION_PHOTO = 101;
//     public static final int MEDIA_ACTION_BOTH = 102;
// 
//     public static final int CAMERA_FACE_FRONT = 0x6;
//     public static final int CAMERA_FACE_REAR = 0x7;
// 
//     public static final int SENSOR_POSITION_UP = 90;
//     public static final int SENSOR_POSITION_LEFT = 0;
//     public static final int SENSOR_POSITION_RIGHT = 180;
//     public static final int SENSOR_POSITION_UNSPECIFIED = -1;
//     public static final int ORIENTATION_PORTRAIT = 0x111;
//     public static final int ORIENTATION_LANDSCAPE = 0x222;
//     public static final int FLASH_MODE_ON = 1;
//     public static final int FLASH_MODE_OFF = 2;
//     public static final int FLASH_MODE_AUTO = 3;
//     static final int DISPLAY_ROTATION_0 = 0;
//     static final int DISPLAY_ROTATION_90 = 90;
//     static final int DISPLAY_ROTATION_180 = 180;
//     static final int DISPLAY_ROTATION_270 = 270;
// 
//     public interface Arguments {
//         String MEDIA_ACTION = "com.sandrios.sandriosCamera.media_action";
//         String MEDIA_QUALITY = "com.sandrios.sandriosCamera.camera_media_quality";
//         String VIDEO_DURATION = "com.sandrios.sandriosCamera.video_duration";
//         String MINIMUM_VIDEO_DURATION = "com.sandrios.sandriosCamera.minimum.video_duration";
//         String VIDEO_FILE_SIZE = "com.sandrios.sandriosCamera.camera_video_file_size";
//         String FLASH_MODE = "com.sandrios.sandriosCamera.camera_flash_mode";
//         String SHOW_PICKER = "com.sandrios.sandriosCamera.show_picker";
//         String ENABLE_CROP = "com.sandrios.sandriosCamera.enable_crop";
//         String AUTO_RECORD = "com.sandrios.sandriosCamera.auto_record";
//     }
// 
//     @IntDef({MEDIA_QUALITY_AUTO, MEDIA_QUALITY_LOWEST, MEDIA_QUALITY_LOW, MEDIA_QUALITY_MEDIUM, MEDIA_QUALITY_HIGH, MEDIA_QUALITY_HIGHEST})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface MediaQuality {
//     }
// 
//     @IntDef({MEDIA_ACTION_VIDEO, MEDIA_ACTION_PHOTO, MEDIA_ACTION_BOTH})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface MediaAction {
//     }
// 
//     @IntDef({CAMERA_FACE_FRONT, CAMERA_FACE_REAR})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface CameraFace {
//     }
// 
//     @IntDef({SENSOR_POSITION_UP, SENSOR_POSITION_LEFT, SENSOR_POSITION_RIGHT, SENSOR_POSITION_UNSPECIFIED})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface SensorPosition {
//     }
// 
//     @IntDef({DISPLAY_ROTATION_0, DISPLAY_ROTATION_90, DISPLAY_ROTATION_180, DISPLAY_ROTATION_270})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface DisplayRotation {
//     }
// 
//     @IntDef({ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface DeviceDefaultOrientation {
//     }
// 
//     @IntDef({FLASH_MODE_ON, FLASH_MODE_OFF, FLASH_MODE_AUTO})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface FlashMode {
//     }
// }


import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.media.CamcorderProfile;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;
    public static boolean hasCamera2(Context context) {
        if (context == null) return false;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return false;
        try {
            CameraManager manager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
            String[] idList = manager.getCameraIdList();
            boolean notNull = true;
            if (idList.length == 0) {
                notNull = false;
            } else {
                for (final String str : idList) {
                    if (str == null || str.trim().isEmpty()) {
                        notNull = false;
                        break;
                    }
                    final CameraCharacteristics characteristics = manager.getCameraCharacteristics(str);

                    final int supportLevel = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
                    if (supportLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
                        notNull = false;
                        break;
                    }
                }
            }
            return notNull;
        } catch (Throwable ignore) {
            return false;
        }
    }

// Path: sandriosCamera/src/main/java/com/sandrios/sandriosCamera/internal/configuration/CameraConfiguration.java
// public final class CameraConfiguration {
// 
//     public static final int MEDIA_QUALITY_AUTO = 10;
//     public static final int MEDIA_QUALITY_LOWEST = 15;
//     public static final int MEDIA_QUALITY_LOW = 11;
//     public static final int MEDIA_QUALITY_MEDIUM = 12;
//     public static final int MEDIA_QUALITY_HIGH = 13;
//     public static final int MEDIA_QUALITY_HIGHEST = 14;
// 
//     public static final int MEDIA_ACTION_VIDEO = 100;
//     public static final int MEDIA_ACTION_PHOTO = 101;
//     public static final int MEDIA_ACTION_BOTH = 102;
// 
//     public static final int CAMERA_FACE_FRONT = 0x6;
//     public static final int CAMERA_FACE_REAR = 0x7;
// 
//     public static final int SENSOR_POSITION_UP = 90;
//     public static final int SENSOR_POSITION_LEFT = 0;
//     public static final int SENSOR_POSITION_RIGHT = 180;
//     public static final int SENSOR_POSITION_UNSPECIFIED = -1;
//     public static final int ORIENTATION_PORTRAIT = 0x111;
//     public static final int ORIENTATION_LANDSCAPE = 0x222;
//     public static final int FLASH_MODE_ON = 1;
//     public static final int FLASH_MODE_OFF = 2;
//     public static final int FLASH_MODE_AUTO = 3;
//     static final int DISPLAY_ROTATION_0 = 0;
//     static final int DISPLAY_ROTATION_90 = 90;
//     static final int DISPLAY_ROTATION_180 = 180;
//     static final int DISPLAY_ROTATION_270 = 270;
// 
//     public interface Arguments {
//         String MEDIA_ACTION = "com.sandrios.sandriosCamera.media_action";
//         String MEDIA_QUALITY = "com.sandrios.sandriosCamera.camera_media_quality";
//         String VIDEO_DURATION = "com.sandrios.sandriosCamera.video_duration";
//         String MINIMUM_VIDEO_DURATION = "com.sandrios.sandriosCamera.minimum.video_duration";
//         String VIDEO_FILE_SIZE = "com.sandrios.sandriosCamera.camera_video_file_size";
//         String FLASH_MODE = "com.sandrios.sandriosCamera.camera_flash_mode";
//         String SHOW_PICKER = "com.sandrios.sandriosCamera.show_picker";
//         String ENABLE_CROP = "com.sandrios.sandriosCamera.enable_crop";
//         String AUTO_RECORD = "com.sandrios.sandriosCamera.auto_record";
//     }
// 
//     @IntDef({MEDIA_QUALITY_AUTO, MEDIA_QUALITY_LOWEST, MEDIA_QUALITY_LOW, MEDIA_QUALITY_MEDIUM, MEDIA_QUALITY_HIGH, MEDIA_QUALITY_HIGHEST})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface MediaQuality {
//     }
// 
//     @IntDef({MEDIA_ACTION_VIDEO, MEDIA_ACTION_PHOTO, MEDIA_ACTION_BOTH})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface MediaAction {
//     }
// 
//     @IntDef({CAMERA_FACE_FRONT, CAMERA_FACE_REAR})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface CameraFace {
//     }
// 
//     @IntDef({SENSOR_POSITION_UP, SENSOR_POSITION_LEFT, SENSOR_POSITION_RIGHT, SENSOR_POSITION_UNSPECIFIED})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface SensorPosition {
//     }
// 
//     @IntDef({DISPLAY_ROTATION_0, DISPLAY_ROTATION_90, DISPLAY_ROTATION_180, DISPLAY_ROTATION_270})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface DisplayRotation {
//     }
// 
//     @IntDef({ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface DeviceDefaultOrientation {
//     }
// 
//     @IntDef({FLASH_MODE_ON, FLASH_MODE_OFF, FLASH_MODE_AUTO})
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface FlashMode {
//     }
// }


// Path: sandriosCamera/src/main/java/com/sandrios/sandriosCamera/internal/utils/CameraHelper.java
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.media.CamcorderProfile;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.sandrios.sandriosCamera.internal.configuration.CameraConfiguration;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;

    public static boolean hasCamera2(Context context) {
        if (context == null) return false;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return false;
        try {
            CameraManager manager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
            String[] idList = manager.getCameraIdList();
            boolean notNull = true;
            if (idList.length == 0) {
                notNull = false;
            } else {
                for (final String str : idList) {
                    if (str == null || str.trim().isEmpty()) {
                        notNull = false;
                        break;
                    }
                    final CameraCharacteristics characteristics = manager.getCameraCharacteristics(str);

                    final int supportLevel = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
                    if (supportLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
                        notNull = false;
                        break;
                    }
                }
            }
            return notNull;
        } catch (Throwable ignore) {
            return false;
        }
    }

    public static File getOutputMediaFile(Context context, @CameraConfiguration.MediaAction int mediaAction) {