package com.coolcloud.uac.android.common.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build.VERSION;
import android.os.Environment;
import android.os.StatFs;
import android.os.storage.StorageManager;
import android.support.v4.os.EnvironmentCompat;
import android.telephony.TelephonyManager;
import com.sina.weibo.sdk.component.ShareRequestParam;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

public class SystemUtils {
    private static final String TAG = "SystemUtils";

    public static String getDeviceId(Context context) {
        return Device.getDeviceId(context);
    }

    public static String getSystemDeviceId(Context context) {
        return Device.getNativeDeviceId(context);
    }

    public static boolean replaceSettingsDeviceId(Context context, String nativeDeviceId, String settingsDeviceId) {
        return Device.replaceSettingsDeviceId(context, nativeDeviceId, settingsDeviceId);
    }

    public static String getSettingsDeviceId(Context context) {
        return Device.getSettingsDeviceId(context);
    }

    public static String getMacId(Context context) {
        return Device.getMACAddress(context);
    }

    public static String getDeviceType() {
        return Device.getDeviceType();
    }

    public static String getDeviceModel() {
        return Device.getDeviceModel();
    }

    public static boolean isConnectNet(Context context) {
        NetworkInfo networkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
        return networkInfo != null && networkInfo.isAvailable();
    }

    public static String getNetworkType(Context context) {
        String networkType = EnvironmentCompat.MEDIA_UNKNOWN;
        if (context == null) {
            LOG.w(TAG, "get network type failed(null context)");
            return networkType;
        }
        ConnectivityM