diff --git a/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/loader/utils/AssetsUtils.java b/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/loader/utils/AssetsUtils.java index 67ae5a7..06063d8 100644 --- a/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/loader/utils/AssetsUtils.java +++ b/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/loader/utils/AssetsUtils.java @@ -44,26 +44,6 @@ public class AssetsUtils { private static final String TAG = LogDebug.PLUGIN_TAG; - /** - * @param context - * @param name - * @return - */ - public static final String readUTF8(Context context, String name) { - InputStream is = null; - try { - is = context.getAssets().open(name); - return IOUtils.toString(is, Charsets.UTF_8); - } catch (Throwable e) { - if (LOGR) { - LogRelease.e(TAG, e.getMessage(), e); - } - } finally { - CloseableUtils.closeQuietly(is); - } - return null; - } - /** * 提取文件到目标位置 * @param context diff --git a/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/loader/utils/SysUtils.java b/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/loader/utils/SysUtils.java index e64c148..ae7a64c 100644 --- a/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/loader/utils/SysUtils.java +++ b/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/loader/utils/SysUtils.java @@ -16,17 +16,11 @@ package com.qihoo360.loader.utils; -import android.text.TextUtils; - import com.qihoo360.replugin.helper.LogRelease; - import com.qihoo360.replugin.utils.CloseableUtils; -import com.qihoo360.replugin.utils.IOUtils; import java.io.FileInputStream; -import java.io.InputStream; -import static com.qihoo360.replugin.helper.LogDebug.LOG; import static com.qihoo360.replugin.helper.LogRelease.LOGR; /** @@ -38,6 +32,7 @@ public final class SysUtils { /** * 返回当前的进程名 + * * @return */ public static String getCurrentProcessName() { @@ -64,39 +59,4 @@ public final class SysUtils { } return null; } - - /** - * 检测是否模拟器(Release版本不做任何处理,总是返回false) - * @return - */ - public static boolean isEmulator() { - if (LOG) { - try { - Process pr = Runtime.getRuntime().exec("getprop ro.hardware"); - int code = pr.waitFor(); - if (code == 0) { - InputStream in = pr.getInputStream(); - byte buffer[] = new byte[1024]; - try { - int rc = IOUtils.read(in, buffer, 0, buffer.length); - String str = new String(buffer, 0, rc, "UTF-8"); - if (!TextUtils.isEmpty(str) && str.contains("goldfish")) { - return true; - } - } catch (Throwable e) { - if (LOGR) { - LogRelease.e(TAG, e.getMessage(), e); - } - } - CloseableUtils.closeQuietly(in); - } - pr.destroy(); - } catch (Throwable e) { - if (LOGR) { - LogRelease.e(TAG, e.getMessage(), e); - } - } - } - return false; - } } diff --git a/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/IOUtils.java b/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/IOUtils.java index 3c1805e..08bf123 100644 --- a/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/IOUtils.java +++ b/replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/IOUtils.java @@ -269,34 +269,4 @@ public class IOUtils { } return count; } - - /** - * Reads bytes from an input stream. - * This implementation guarantees that it will read as many bytes - * as possible before giving up; this may not always be the case for - * subclasses of {@link InputStream}. - * - * @param input where to read input from - * @param buffer destination - * @param offset initial offset into buffer - * @param length length to read, must be >= 0 - * @return actual length read; may be less than requested if EOF was reached - * @throws IOException if a read error occurs - */ - public static int read(final InputStream input, final byte[] buffer, final int offset, final int length) - throws IOException { - if (length < 0) { - throw new IllegalArgumentException("Length must not be negative: " + length); - } - int remaining = length; - while (remaining > 0) { - final int location = length - remaining; - final int count = input.read(buffer, offset + location, remaining); - if (EOF == count) { // EOF - break; - } - remaining -= count; - } - return length - remaining; - } }