清除手机图案解锁(执行adb命令工具类)

前提 :android 设备root有权限

 1:第一行代码获取remount权限

2:删除data/system/....那个配置文件 ,就可以删除手指图案密码了

RootCmd.exusecmd("mount -o rw,remount /system");
RootCmd.exusecmd("rm -rf /data/system/gesture.key");


package com.cdl.key;

import android.util.Log;

import java.io.DataOutputStream;

public class RootCmd {

    /***
     * @param command
     * @return
     */
    public static boolean exusecmd(String command) {
        Process process = null;
        DataOutputStream os = null;
        try {
            process = Runtime.getRuntime().exec("su");
            os = new DataOutputStream(process.getOutputStream());
            os.writeBytes(command + "\n");
            os.writeBytes("exit\n");
            os.flush();
            Log.e("updateFile", "======000==writeSuccess======");
            process.waitFor();
        } catch (Exception e) {
            Log.e("updateFile", "======111=writeError======" + e.toString());
            return false;
        } finally {
            try {
                if (os != null) {
                    os.close();
                }
                if (process != null) {
                    process.destroy();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return true;
    }




    public static void writeFileToSystem(String filePath, String sysFilePath) {
        exusecmd("mount -o rw,remount /system");
        exusecmd("rm -rf /system/media/boomAnimal.zip");
        exusecmd("chmod 777 /system/media");
        exusecmd("cp  " + filePath + " " + sysFilePath);
    }


}

猜你喜欢

转载自blog.csdn.net/fkgjdkblxckvbxbgb/article/details/80514258