package p138.p176.p177.p190.p236.p237;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.opengl.Matrix;
import android.view.Display;
import p138.p176.p177.p190.p240.p241.C4180;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྉ.ޒ.ށ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4076 implements SensorEventListener {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final float[] f12985 = new float[16];

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final float[] f12986 = new float[16];

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final float[] f12987 = new float[16];

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final float[] f12988 = new float[3];

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final Display f12989;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final InterfaceC4077[] f12990;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public boolean f12991;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྉ.ޒ.ށ$֏, reason: contains not printable characters */
    public interface InterfaceC4077 {
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        void mo6563(float[] fArr, float f);
    }

    public C4076(Display display, InterfaceC4077... interfaceC4077Arr) {
        this.f12989 = display;
        this.f12990 = interfaceC4077Arr;
    }

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

    @Override // android.hardware.SensorEventListener
    public void onSensorChanged(SensorEvent sensorEvent) {
        SensorManager.getRotationMatrixFromVector(this.f12985, sensorEvent.values);
        float[] fArr = this.f12985;
        int rotation = this.f12989.getRotation();
        if (rotation != 0) {
            int i = 129;
            int i2 = 130;
            if (rotation == 1) {
                i = 2;
                i2 = 129;
            } else if (rotation != 2) {
                if (rotation != 3) {
                    throw new IllegalStateException();
                }
                i = 130;
                i2 = 1;
            }
            float[] fArr2 = this.f12986;
            System.arraycopy(fArr, 0, fArr2, 0, fArr2.length);
            SensorManager.remapCoordinateSystem(this.f12986, i, i2, fArr);
        }
        SensorManager.remapCoordinateSystem(this.f12985, 1, 131, this.f12986);
        SensorManager.getOrientation(this.f12986, this.f12988);
        float f = this.f12988[2];
        Matrix.rotateM(this.f12985, 0, 90.0f, 1.0f, 0.0f, 0.0f);
        float[] fArr3 = this.f12985;
        if (!this.f12991) {
            C4180.m6831(this.f12987, fArr3);
            this.f12991 = true;
        }
        float[] fArr4 = this.f12986;
        System.arraycopy(fArr3, 0, fArr4, 0, fArr4.length);
        Matrix.multiplyMM(fArr3, 0, this.f12986, 0, this.f12987, 0);
        float[] fArr5 = this.f12985;
        for (InterfaceC4077 interfaceC4077 : this.f12990) {
            interfaceC4077.mo6563(fArr5, f);
        }
    }
}
