登录
  • 欢迎访问 Sharezer Blog

sharezer的文章

Android

I420Frame转YuvImage

private YuvImage i420ToYuvImage(ByteBuffer[] yuvPlanes, int[] yuvStrides, int width, int height) { if (yuvStrides[0] != width) { return fastI420ToYuvImage(yuvPlanes, yuvStrides, width, height); } if (yuvStrides[1] != width / 2) { return fastI420ToYuvImage(yuvPlanes, yuvSt……继续阅读 »

9年前 (2017-07-13) 2518浏览 0评论 0个赞

Adb

通过adb获取task id

/** * 通过包名获取task id,不存在为-1 * * @param packageName * @return */ public int getTaskId(String packageName) { String result = execRootCmd("dumpsys activity | grep " + packageName); int start = result.indexOf("TaskRecord{"); if(start > 0){ int end = result……继续阅读 »

9年前 (2017-07-03) 3542浏览 0评论 0个赞

Adb

adb获取应用的pid

这里使用的是ps命令,不用root或系统权限。 public int getPid(String name) { String cmd = ("ps | grep " + name); String str = execRootCmd(cmd); if (str == null || str == "" || str.length() < 1) return -1; else { String[] arr = str.split("\\s+"); ……继续阅读 »

9年前 (2017-06-02) 3499浏览 0评论 5个赞

Adb

Android 执行su命令

// 执行命令并且输出结果 private String execRootCmd(String cmd) { Log.d(TAG, "cmd: " + cmd); String result = ""; DataOutputStream dos = null; DataInputStream dis = null; try { Process p = Runtime.getRuntime().exec("su");// 经过Root处理的android系统即有su命令 ……继续阅读 »

9年前 (2017-06-02) 2634浏览 0评论 2个赞