清除手机图案解锁(执行adb命令工具类)
16lz
2021-01-25
前提 :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); }}
更多相关文章
- Android(安卓)File类 根据官方文档理解
- Matisse Android(安卓)图片选择器
- 最详细的mac下Android(安卓)studio配置gradle的路径
- Android(安卓)添加百度地图的问题
- Android调用系统相机拍照并保存,解决OOM
- uses-permission android:name="android.permission.INSTALL_PAC
- android 7.0 手机调用手机相机、相册常见的两个崩溃:FileUriExpos
- Android(安卓)LockScreen .
- 【Android】网络监测