Root权限下修改 Android 系统时间
16lz
2021-01-23
权限为 Root 权限
/** * 设置系统时间 * @param time 格式为“年月日.时分秒”,例如:20111209.121212 */ public static boolean setTime(String time) { Process process = null; DataOutputStream os = null; try { process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOutputStream()); os.writeBytes("date -s " + time + "\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor(); } catch (Exception e) { return false; } finally { try { if (os != null) { os.close(); } process.destroy(); } catch (Exception e) { } } return true; }
更多相关文章
- android 权限管理PermissionDispatcher使用
- Android SDK Permission大全访问权限
- Android 9.0网络权限适配
- Android SELinux开发入门指南之正确姿势解决访问data目录权限问
- [Android Pro] android root权限破解分析