// 头文件相关函数
@interface SBLockScreenManager : XXUnknownSuperclass <SBLockScreenViewControllerDelegate, SBUIBiometricEventObserver, SBUIBiometricEventMonitorDelegate> {
    BOOL _isUILocked; // 读取这个变量可以判断当前是否锁屏状态
}
+ (id)sharedInstance;
- (void)unlockUIFromSource:(int)source withOptions:(id)options;
- (void)lockUIFromSource:(int)source withOptions:(id)options;
- (_Bool)attemptUnlockWithPasscode:(id)arg1; // 密码解锁
@end

实验:
PiaoYuns-iPad:~ root# cycript -p SpringBoard
cy# var lockScreenManager = [SBLockScreenManager sharedInstance]
#"<SBLockScreenManager: 0x1780ab5e0>"
cy# [lockScreenManager unlockUIFromSource: 0 withOptions: nil]
cy# [lockScreenManager lockUIFromSource: 1 withOptions: nil]
cy# [lockScreenManager isUILocked]
true
cy# [lockScreenManager  attemptUnlockWithPasscode: @"1111"]
false
cy# [lockScreenManager  attemptUnlockWithPasscode: @"8888"]
true

// Tweaks判断是否锁屏状态
static bool isLocked() {    
    if (%c(SBLockScreenManager)){
        SBLockScreenManager * lockScreenManager = (SBLockScreenManager*) [%c(SBLockScreenManager) sharedInstance];
        return [lockScreenManager isUILocked];
    }
    return NO;
}


你可能感兴趣的文章

评论区

发表评论

必填

选填

选填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。