From 512cae0fd797fac428f07d9d955f880e9ee353c1 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@iotlink.com> Date: 星期四, 30 七月 2020 19:45:01 +0800 Subject: [PATCH] 修改人脸显示 --- app/src/main/java/com/basic/security/utils/LztekAndroidRoot.java | 96 ++++++++++++++++++++++++------------------------ 1 files changed, 48 insertions(+), 48 deletions(-) diff --git a/app/src/main/java/com/basic/security/utils/LztekAndroidRoot.java b/app/src/main/java/com/basic/security/utils/LztekAndroidRoot.java index 80a885c..aadbc95 100644 --- a/app/src/main/java/com/basic/security/utils/LztekAndroidRoot.java +++ b/app/src/main/java/com/basic/security/utils/LztekAndroidRoot.java @@ -1,54 +1,54 @@ package com.basic.security.utils; -public class LztekAndroidRoot{ -/* It is sample code for Lztek Android 7.1 and 8.1 root +public class LztekAndroidRoot { + /* It is sample code for Lztek Android 7.1 and 8.1 root */ public static void SafeClose(java.io.Closeable closeable) { - if (null != closeable) { - try { - closeable.close(); - } catch (java.io.IOException e) { - } - } - } - - /* The command sequence is like "su root chmod 666 /dev/i2c-1". - * Each command should be executed in this strange way :-) - */ - - public static String SuExec(String command, java.io.File workingDirectory) { - if (null == command || (command=command.trim()).length() == 0) { - return null; - } - if (null == workingDirectory) { - workingDirectory = new java.io.File("/"); - } - java.io.OutputStream out = null; - java.io.InputStream in = null; - java.io.InputStream err = null; - try { - Runtime runtime = Runtime.getRuntime(); - Process process = runtime.exec("su root " + command, null, workingDirectory); - StringBuffer inString = new StringBuffer(); - StringBuffer errString = new StringBuffer(); - out = process.getOutputStream(); - - in = process.getInputStream(); - err = process.getErrorStream(); - while (in.available() > 0) { - inString.append((char)in.read()); - } - while (err.available() > 0) { - errString.append((char)err.read()); - } - return inString.toString(); - } catch (Exception ioex) { - return null; - } finally { - SafeClose(out); - SafeClose(in); - SafeClose(err); - } - } + if (null != closeable) { + try { + closeable.close(); + } catch (java.io.IOException e) { + } + } + } + + /* The command sequence is like "su root chmod 666 /dev/i2c-1". + * Each command should be executed in this strange way :-) + */ + + public static String SuExec(String command, java.io.File workingDirectory) { + if (null == command || (command = command.trim()).length() == 0) { + return null; + } + if (null == workingDirectory) { + workingDirectory = new java.io.File("/"); + } + java.io.OutputStream out = null; + java.io.InputStream in = null; + java.io.InputStream err = null; + try { + Runtime runtime = Runtime.getRuntime(); + Process process = runtime.exec("su root " + command, null, workingDirectory); + StringBuffer inString = new StringBuffer(); + StringBuffer errString = new StringBuffer(); + out = process.getOutputStream(); + + in = process.getInputStream(); + err = process.getErrorStream(); + while (in.available() > 0) { + inString.append((char) in.read()); + } + while (err.available() > 0) { + errString.append((char) err.read()); + } + return inString.toString(); + } catch (Exception ioex) { + return null; + } finally { + SafeClose(out); + SafeClose(in); + SafeClose(err); + } + } } -- Gitblit v1.8.0