Question

I'm currently exploring creating a jailbreak tweak. I want to unlock the phone screen. How is this done? What private API can be used to achieve this on iOS 7?

Was it helpful?

Solution

If we are talking about jailbreak then you can write a SpringBoard tweak that does this (iOS 7 only)

[[objc_getClass("SBBacklightController") sharedInstance] turnOnScreenFullyWithBacklightSource:0];
[[objc_getClass("SBLockScreenManager") sharedInstance] unlockUIFromSource:0 withOptions:nil];

Without passcode lock the code will turn on the screen and unlock the device. With passcode it will turn on the screen and request passcode.

OTHER TIPS

I use Activator from Cydia to wake and unlock the device via SSH. It works on IOS 10.1.

activator send libactivator.system.homebutton
activator send libactivator.system.homebutton

lock command is here:

activator send libactivator.system.sleepbutton

Good Luck Have Fun :)

My solution comes in two parts but it could be better:

  1. 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
    
  2. After 1, the screen will light up and then you can use SimulateTouch's stouch tool to simulate a swipe from the command line.

For 1 above, your code needs to have the com.apple.private.hid.client.event-dispatch entitlement.

For more, you can also investigate how Activator performs the Unlock screen listener.

Maybe not a direct solution. You can use this tweak and library https://github.com/iolate/SimulateTouch to simulate a user swipe on the lockscreen to unlock the device.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top