package c.n;

import android.graphics.Matrix;
import android.util.Log;
import android.view.View;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/* JADX INFO: compiled from: ViewUtilsApi21.java */
/* JADX INFO: loaded from: classes.dex */
class f0 extends e0 {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private static Method f1564e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private static boolean f1565f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private static Method f1566g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private static boolean f1567h;

    f0() {
    }

    private void j() {
        if (f1565f) {
            return;
        }
        try {
            Method declaredMethod = View.class.getDeclaredMethod("transformMatrixToGlobal", Matrix.class);
            f1564e = declaredMethod;
            declaredMethod.setAccessible(true);
        } catch (NoSuchMethodException e2) {
            Log.i("ViewUtilsApi21", "Failed to retrieve transformMatrixToGlobal method", e2);
        }
        f1565f = true;
    }

    private void k() {
        if (f1567h) {
            return;
        }
        try {
            Method declaredMethod = View.class.getDeclaredMethod("transformMatrixToLocal", Matrix.class);
            f1566g = declaredMethod;
            declaredMethod.setAccessible(true);
        } catch (NoSuchMethodException e2) {
            Log.i("ViewUtilsApi21", "Failed to retrieve transformMatrixToLocal method", e2);
        }
        f1567h = true;
    }

    @Override // c.n.h0
    public void f(View view, Matrix matrix) {
        j();
        Method method = f1564e;
        if (method != null) {
            try {
                method.invoke(view, matrix);
            } catch (IllegalAccessException unused) {
            } catch (InvocationTargetException e2) {
                throw new RuntimeException(e2.getCause());
            }
        }
    }

    @Override // c.n.h0
    public void g(View view, Matrix matrix) {
        k();
        Method method = f1566g;
        if (method != null) {
            try {
                method.invoke(view, matrix);
            } catch (IllegalAccessException unused) {
            } catch (InvocationTargetException e2) {
                throw new RuntimeException(e2.getCause());
            }
        }
    }
}
