package ZtlApi;

import android.content.Intent;
import android.media.AudioManager;
import android.os.SystemProperties;
import android.util.Log;
import com.google.android.exoplayer2.extractor.ts.TsExtractor;
import com.google.android.exoplayer2.util.MimeTypes;
import com.unity3d.ads.metadata.MediationMetaData;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;

public class ZtlManagerA33_A64 extends ZtlManager {
    private boolean DEBUG_ZTL = false;
    private String TAG = "ZtlManagerA33_A64";
    Map<String, Integer> gpios = new HashMap();

    public int getDisplayOrientation() {
        return 0;
    }

    public int getSystemBarState() {
        return 0;
    }

    public int getUsbDebugState() {
        return 0;
    }

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

    /* access modifiers changed from: package-private */
    public void LOGD(String str) {
        if (this.DEBUG_ZTL) {
            Log.d(this.TAG, str);
        }
    }

    public String getUsbStoragePath() {
        try {
            return getSystemProperty("persist.sys.usbDisk", "unKnown");
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public String getDeviceID() {
        File file = new File("/sys/class/android_usb/android0/iSerial");
        if (!file.exists()) {
            return null;
        }
        try {
            return new BufferedReader(new FileReader(file)).readLine();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public int setRaiseSystemVolume() {
        try {
            ((AudioManager) this.mContext.getSystemService(MimeTypes.BASE_TYPE_AUDIO)).adjustStreamVolume(3, 1, 4);
            return 0;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }

    public int setLowerSystemVolume() {
        try {
            ((AudioManager) this.mContext.getSystemService(MimeTypes.BASE_TYPE_AUDIO)).adjustStreamVolume(3, -1, 4);
            return 0;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }

    public void setBootPackageActivity(String str, String str2) {
        if (str == null || str2 == null) {
            String str3 = this.TAG;
            Log.e(str3, "pkgName (" + str + ") or pkgActivity (" + str2 + ") err");
            return;
        }
        execRootCmdSilent("setprop persist.sys.bootPkgName " + str);
        execRootCmdSilent("setprop persist.sys.bootPkgActivity " + str2);
    }

    public int setAppKey(String str) {
        if (str != null) {
            Intent intent = new Intent("com.ztl.key");
            intent.putExtra("enable", str);
            this.mContext.sendBroadcast(intent);
            return 0;
        }
        Log.e(this.TAG, "设置APP加密密钥值错误");
        return -1;
    }

    public void setDisplayOrientation(int i) {
        Intent intent = new Intent("com.ztl.rotation");
        intent.putExtra("enable", i);
        this.mContext.sendBroadcast(intent);
    }

    public void setOpenSystemBar() {
        Intent intent = new Intent("com.ztl.systembar");
        intent.putExtra("enable", "1");
        this.mContext.sendBroadcast(intent);
    }

    public void setCloseSystemBar() {
        Intent intent = new Intent("com.ztl.systembar");
        intent.putExtra("enable", "0");
        this.mContext.sendBroadcast(intent);
    }

    public void setScreenMode(String str) {
        Intent intent = new Intent("com.ztl.vga");
        intent.putExtra("enable", str);
        this.mContext.sendBroadcast(intent);
    }

    /* access modifiers changed from: package-private */
    public void init_gpiomap() {
        this.gpios.put("PE1", Integer.valueOf(TsExtractor.TS_STREAM_TYPE_AC3));
        this.gpios.put("PE2", 130);
        this.gpios.put("PE3", 131);
        this.gpios.put("PE4", 132);
        this.gpios.put("PE7", Integer.valueOf(TsExtractor.TS_STREAM_TYPE_E_AC3));
    }

    public int gpioStringToInt(String str) {
        if (this.gpios.get(str) == null) {
            Log.e("gpio", MediationMetaData.KEY_NAME + str + "缺乏映射，请联系管理员添加");
        }
        return this.gpios.get(str).intValue();
    }
}
