package o; import android.app.Activity; import android.content.Context; import android.hardware.Camera; import java.util.Comparator; import org.bouncycastle.crypto.tls.CipherSuite; /* loaded from: classes5.dex */ public final class fLA { static { new IeS((byte) 0); } public static int d(Context context, int i) { int i2 = 0; if (context == null) { return 0; } Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); Camera.getCameraInfo(i, cameraInfo); int rotation = ((Activity) context).getWindowManager().getDefaultDisplay().getRotation(); if (rotation != 0) { if (rotation == 1) { i2 = 90; } else if (rotation == 2) { i2 = CipherSuite.TLS_DHE_PSK_WITH_NULL_SHA256; } else if (rotation == 3) { i2 = 270; } } if (cameraInfo.facing == 1) { return (360 - ((cameraInfo.orientation + i2) % 360)) % 360; } return ((cameraInfo.orientation - i2) + 360) % 360; } /* loaded from: classes5.dex */ static class IeS implements Comparator { private IeS() { } @Override // java.util.Comparator public final /* bridge */ /* synthetic */ int compare(Camera.Size size, Camera.Size size2) { Camera.Size size3 = size; Camera.Size size4 = size2; if (size3.width == size4.width) { return 0; } return size3.width > size4.width ? 1 : -1; } /* synthetic */ IeS(byte b) { this(); } } }