完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
代码路径:frameworksbasepackagesSystemUIsrccomandroidsystemuiglobalactionsGlobalActionsDialog.java
private final class PowerAction extends SinglePressAction implements LongPressAction { private PowerAction() { super(R.drawable.ic_lock_power_off, R.string.global_action_power_off); } @Override public boolean onLongPress() { UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); if (!um.hasUserRestriction(UserManager.DISALLOW_SAFE_BOOT)) { mWindowManagerFuncs.reboot(true); return true; } return false; } @Override public boolean showDuringKeyguard() { return true; } @Override public boolean showBeforeProvisioning() { return true; } @Override public void onPress() { // shutdown by making sure radio and power are handled accordingly. //mWindowManagerFuncs.shutdown(); Log.d("tyzc","mWindowManagerFuncs.shutdown(false "); setNodeString("/sys/devices/system/cpu/cpufreq/policy0/scaling_governor","userspace"); //更改cpu setNodeString("/sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed","1008000"); //更改频率 mWindowManagerFuncs.shutdown(); } } public static boolean setNodeString(String path,String value){ try { BufferedWriter bufWriter = null; bufWriter = new BufferedWriter(new FileWriter(path)); bufWriter.write(value); // 写入数据 bufWriter.close(); Log.d("tyzc","Rewrite the node--"+path+"--to--"+value+" success!"); } catch (IOException e) { e.printStackTrace(); Log.d("tyzc","Rewrite the node--"+path+"--to--"+value+"--failure!"); //如果失败,可能是节点的权限不够,在init.rc文件中添加 //chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor //chmod 0666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor return false; } return true; } |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1348 浏览 1 评论
synopsys 的design ware:DW_fpv_div,浮点数除法器,默认32位下,想提升覆盖率(TMAX),如果用功能case去提升覆盖率呢?
1391 浏览 1 评论
RK3588 GStreamer调试四路鱼眼摄像头四宫格显示报错
2970 浏览 1 评论
【飞凌嵌入式OK3576-C开发板体验】RKNN神经网络-YOLO图像识别
254 浏览 0 评论
【飞凌嵌入式OK3576-C开发板体验】SSH远程登录网络配置及CAN通讯
1336 浏览 0 评论
浏览过的版块 |
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-3 06:47 , Processed in 0.486499 second(s), Total 41, Slave 34 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号