package ZtlApi;

import android.content.Intent;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.util.Log;
import java.io.File;
import java.lang.reflect.InvocationTargetException;

public class ZtlManager3368 extends ZtlManager {
    public void setSplitScreenLeftRightEnable(boolean z) {
    }

    public void setSplitScreenUpDownEnable(boolean z) {
    }

    ZtlManager3368() {
        this.DEBUG_ZTL = SystemProperties.get("persist.sys.ztl.debug", "false").equals("true");
    }

    public void goToSleep() {
        PowerManager powerManager = (PowerManager) this.mContext.getSystemService("power");
        try {
            powerManager.getClass().getMethod("goToSleep", new Class[]{Long.TYPE}).invoke(powerManager, new Object[]{Long.valueOf(SystemClock.uptimeMillis())});
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e2) {
            e2.printStackTrace();
        } catch (NoSuchMethodException e3) {
            e3.printStackTrace();
        }
    }

    public void wakeUp() {
        PowerManager powerManager = (PowerManager) this.mContext.getSystemService("power");
        try {
            powerManager.getClass().getMethod("wakeUp", new Class[]{Long.TYPE}).invoke(powerManager, new Object[]{Long.valueOf(SystemClock.uptimeMillis())});
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e2) {
            e2.printStackTrace();
        } catch (NoSuchMethodException e3) {
            e3.printStackTrace();
        }
    }

    public String getUsbStoragePath() {
        File file = new File("/storage/");
        String str = null;
        try {
            if (!file.exists() || !file.isDirectory()) {
                return null;
            }
            File[] listFiles = file.listFiles();
            for (File absolutePath : listFiles) {
                str = absolutePath.getAbsolutePath();
                LOGD("shx : get file path " + str);
                if (str.contains("udisk")) {
                    LOGD("shx : open " + str);
                    File file2 = new File(str);
                    if (file2.exists() && file2.isDirectory()) {
                        String absolutePath2 = file2.getAbsolutePath();
                        LOGD("shx : usbPath " + absolutePath2);
                        return absolutePath2;
                    }
                }
            }
            return str;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public void setDisplayOrientation(int i) {
        int i2;
        if (i == 0) {
            i2 = 0;
        } else if (i == 90) {
            i2 = 1;
        } else if (i == 180) {
            i2 = 2;
        } else if (i != 270) {
            Log.e(TAG, "rotation(0,90,180,270) err,please check it");
            return;
        } else {
            i2 = 3;
        }
        try {
            Intent intent = new Intent("ACTION_ZTL_ROTATION");
            intent.putExtra("rotation", i2);
            this.mContext.sendBroadcast(intent);
        } catch (Exception unused) {
            Log.e(TAG, "set rotation err!");
        }
    }

    public int getDisplayOrientation() {
        return Integer.valueOf(getSystemProperty("persist.sys.ztlOrientation", "0")).intValue();
    }

    public int Getcurrentgpio(int i) {
        execRootCmdSilent("cat /sys/class/gpio/gpio" + i + "value");
        return 1;
    }

    public int getUsbDebugState() {
        String str = "1";
        String systemProperty = getSystemProperty("persist.usb.mode", str);
        if (!systemProperty.equals("0") && !systemProperty.equals("2")) {
            str = "0";
        }
        return Integer.valueOf(str).intValue();
    }

    public boolean isUsbDebugOpen() {
        String systemProperty = getSystemProperty("persist.usb.mode", "1");
        return systemProperty.equals("0") || systemProperty.equals("2");
    }

    public int getSystemBarState() {
        return Integer.valueOf(getSystemProperty("persist.sys.barState", "1")).intValue();
    }

    public String[] getScreenModes() {
        return getSystemProperty("persist.sys.displaymdoes", "").split(",");
    }

    public void setScreenMode(String str) {
        Intent intent = new Intent("android.ztl.action.SET_SCREEN_MODE");
        intent.putExtra("mode", str);
        this.mContext.sendBroadcast(intent);
    }
}
