package defpackage;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.opengl.Matrix;
import android.view.Display;

/* renamed from: ᵿˌ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C5495 implements SensorEventListener {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final Display f20601;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public boolean f20602;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final InterfaceC3649[] f20603;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final float[] f20605 = new float[16];

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final float[] f20606 = new float[16];

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final float[] f20604 = new float[16];

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final float[] f20607 = new float[3];

    public C5495(Display display, InterfaceC3649... interfaceC3649Arr) {
        this.f20601 = display;
        this.f20603 = interfaceC3649Arr;
    }

    @Override // android.hardware.SensorEventListener
    public final void onAccuracyChanged(Sensor sensor, int i) {
    }

    @Override // android.hardware.SensorEventListener
    public final void onSensorChanged(SensorEvent sensorEvent) {
        int i;
        float[] fArr = sensorEvent.values;
        float[] fArr2 = this.f20605;
        SensorManager.getRotationMatrixFromVector(fArr2, fArr);
        int rotation = this.f20601.getRotation();
        float[] fArr3 = this.f20606;
        if (rotation != 0) {
            int i2 = 129;
            if (rotation != 1) {
                i = 130;
                if (rotation != 2) {
                    if (rotation != 3) {
                        ᵨᴵᵺ.ˌʾˀ();
                        return;
                    } else {
                        i2 = 130;
                        i = 1;
                    }
                }
            } else {
                i = 129;
                i2 = 2;
            }
            System.arraycopy(fArr2, 0, fArr3, 0, fArr3.length);
            SensorManager.remapCoordinateSystem(fArr3, i2, i, fArr2);
        }
        SensorManager.remapCoordinateSystem(fArr2, 1, 131, fArr3);
        float[] fArr4 = this.f20607;
        SensorManager.getOrientation(fArr3, fArr4);
        float f = fArr4[2];
        Matrix.rotateM(fArr2, 0, 90.0f, 1.0f, 0.0f, 0.0f);
        boolean z = this.f20602;
        float[] fArr5 = this.f20604;
        if (!z) {
            C4699.m9877(fArr5, fArr2);
            this.f20602 = true;
        }
        System.arraycopy(fArr2, 0, fArr3, 0, fArr3.length);
        Matrix.multiplyMM(fArr2, 0, fArr3, 0, fArr5, 0);
        for (int i3 = 0; i3 < 2; i3++) {
            this.f20603[i3].mo5887(fArr2, f);
        }
    }
}
