Fix rebooting

reboot3 requires platformization. Use FrontBoardServices to do it instead
This commit is contained in:
Dhinak G 2023-12-30 13:23:54 -05:00
parent 28aab08dec
commit eed1d42792
No known key found for this signature in database
3 changed files with 10 additions and 4 deletions

View File

@ -63,6 +63,8 @@ BOOL getDeveloperModeState(xpc_connection_t connection) {
return NO;
}
NSLog(@"[getDeveloperModeState] got reply %@", reply);
NSObject* success = reply[@"success"];
if (!success || ![success isKindOfClass:[NSNumber class]] || ![(NSNumber*)success boolValue]) {
NSLog(@"[getDeveloperModeState] request failed with error %@", reply[@"error"]);

View File

@ -44,5 +44,9 @@
<string>Uninstall</string>
<string>UpdatePlaceholderMetadata</string>
</array>
<key>com.apple.private.amfi.developer-mode-control</key>
<true/>
<key>com.apple.frontboard.shutdown</key>
<true/>
</dict>
</plist>

View File

@ -21,6 +21,7 @@
#endif
#import <SpringBoardServices/SpringBoardServices.h>
#import <FrontBoardServices/FBSSystemService.h>
#import <Security/Security.h>
#ifdef EMBEDDED_ROOT_HELPER
@ -50,8 +51,6 @@ typedef CFDictionaryRef (*_CFPreferencesCopyMultipleWithContainerType)(CFArrayRe
BOOL _installPersistenceHelper(LSApplicationProxy* appProxy, NSString* sourcePersistenceHelper, NSString* sourceRootHelper);
extern int reboot3(uint64_t flags, ...);
NSArray<LSApplicationProxy*>* applicationsWithGroupId(NSString* groupId)
{
LSEnumerator* enumerator = [LSEnumerator enumeratorForApplicationProxiesWithOptions:0];
@ -1529,8 +1528,9 @@ int MAIN_NAME(int argc, char *argv[], char *envp[])
}
else if([cmd isEqualToString:@"reboot"])
{
sync();
ret = reboot3(0); // do a normal reboot
[[FBSSystemService sharedService] reboot];
// Give the system some time to reboot
sleep(1);
}
NSLog(@"trollstorehelper returning %d", ret);