15

Auto.js 小米MIUI自动解锁屏幕脚本

 2 years ago
source link: https://www.wyr.me/post/694
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Auto.js 小米MIUI自动解锁屏幕脚本
Auto.js 小米MIUI自动解锁屏幕脚本

使用Auto.js解锁MIUI13的密码锁屏,不能直接滑动屏幕,会因为防误触功能导致解锁失败,关闭防误触也没用。只需要滑动的时候不那么直接即可。

if (!device.isScreenOn()) {        //从息屏状态  将屏幕唤醒
    device.wakeUp()//唤醒设备
    sleep(2000) // 等待屏幕亮起

    swipe(random(device.width / 3, device.width / 2), random(device.height * 8 / 10, device.height * 7 / 10), random(device.width / 3, device.width / 2), random(device.height * 2 / 10, device.height / 10), random(500, 1000))
    sleep(1000)

    //解锁
    desc(1).findOne().click()
    desc(2).findOne().click()
    desc(3).findOne().click()
    desc(4).findOne().click()
}

通过下拉再点击时间的方式在MIUI13行不通了,但实现也不复杂,核心实现是上述第四行代码。

由于部分应用在锁屏的时候会工作异常,设置电源管理和其它相关设置也无济于事,无奈只好采取上述方法确保程序始终处于工作状态。由于MIUI不允许OLED屏幕的手机永不息屏,为此还特地编写了一个纯黑的安卓APP,适用于OLED屏幕替代屏保。

全屏展示纯黑色安卓APP:%E5%85%A8%E5%B1%8F%E9%BB%91%E8%89%B2.apk

结合上述脚本,运行效果视频:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK