我目前正在探索创建越狱插件。我想解锁手机屏幕。这个要怎么做呢?在iOS 7上可以使用哪些私有API来实现此功能?
我目前正在探索创建越狱插件。我想解锁手机屏幕。这个要怎么做呢?在iOS 7上可以使用哪些私有API来实现此功能?
如果我们在谈论越狱,那么你可以编写一个SpringBoard插件来实现这个功能(仅适用于iOS 7)。
[[objc_getClass("SBBacklightController") sharedInstance] turnOnScreenFullyWithBacklightSource:0];
[[objc_getClass("SBLockScreenManager") sharedInstance] unlockUIFromSource:0 withOptions:nil];
如果没有密码锁定,手机按键会自动开启屏幕并解锁设备。而有了密码锁定,手机按键开启屏幕后还需要输入密码才能解锁。
我使用Cydia中的Activator通过SSH唤醒和解锁设备。在IOS 10.1上可行。
activator send libactivator.system.homebutton
activator send libactivator.system.homebutton
锁定命令在这里:
activator send libactivator.system.sleepbutton
祝你好运,玩得开心 :)
我的解决方案分为两部分,但是还有改进的空间:
Power on screen by simulating a power button press with this code:
VNCSendHIDEvent(IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, mach_absolute_time(),
kHIDPage_Consumer, kHIDUsage_Csmr_Power, 1, 0)); // Power button down
VNCSendHIDEvent(IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, mach_absolute_time(),
kHIDPage_Consumer, kHIDUsage_Csmr_Power, 0, 0)); // Power button up
After 1, the screen will light up and then you can use SimulateTouch's stouch tool to simulate a swipe from the command line.
对于上面的问题,你的代码需要有com.apple.private.hid.client.event-dispatch
许可证。
更多信息,你还可以研究一下Activator如何执行解锁屏幕监听器。
SpringBoard
进程的上下文中调用此代码。
对于某些情况,您可以使用tweak。
[[NSClassFromString(@"SBBacklightController") sharedInstance] turnOnScreenFullyWithBacklightSource:0];
[[NSClassFromString(@"SBLockScreenManager") sharedInstance] unlockUIFromSource:0xD withOptions:nil];
CFNotificationCenterGetDarwinNotifyCenter
、CFNotificationCenterPostNotification
和CFNotificationCenterAddObserver
函数是你所需要的全部。 - creker