summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Bingner <sam@bingner.com>2019-05-16 10:30:22 -1000
committerSam Bingner <sam@bingner.com>2019-05-17 09:21:10 -1000
commit5b575f3209cc2538d8ef0fbd9051a9230c70804b (patch)
tree3b059d1ad9e8f34a8786eddbd0e7ebd334b981ba
parent171c8c469797f990ad2a66a7881558155b6e13de (diff)
Use newer respring methodv1.1.32%b16
-rw-r--r--MobileCydia.mm64
-rw-r--r--entitlements.xml4
2 files changed, 68 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 93c196e..3210d92 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -33,6 +33,8 @@
#include <objc/objc.h>
#include <objc/runtime.h>
+#include <launch.h>
+
#include <CoreGraphics/CoreGraphics.h>
#include <Foundation/Foundation.h>
@@ -274,6 +276,35 @@ static _finline void UpdateExternalStatus(uint64_t newStatus) {
notify_post("com.saurik.Cydia.status");
}
+static _finline pid_t launch_get_job_pid(const char * job)
+{
+ launch_data_t resp;
+ launch_data_t msg;
+
+ msg = launch_data_alloc(LAUNCH_DATA_DICTIONARY);
+ if (msg == NULL) {
+ return -1;
+ }
+
+ launch_data_dict_insert(msg, launch_data_new_string(job), LAUNCH_KEY_GETJOB);
+
+ resp = launch_msg(msg);
+ launch_data_free(msg);
+
+ if (resp == NULL) {
+ return -1;
+ }
+
+ if (launch_data_get_type(resp) != LAUNCH_DATA_DICTIONARY) return -1;
+
+ launch_data_t pid_data = launch_data_dict_lookup(resp, "PID");
+ if (launch_data_get_type(pid_data) != LAUNCH_DATA_INTEGER) return -1;
+
+ pid_t pid = (pid_t)launch_data_get_integer(pid_data);
+ launch_data_free(resp);
+ return pid;
+}
+
/* NSForcedOrderingSearch doesn't work on the iPhone */
static const NSStringCompareOptions MatchCompareOptions_ = NSLiteralSearch | NSCaseInsensitiveSearch;
static const NSStringCompareOptions LaxCompareOptions_ = NSNumericSearch | NSDiacriticInsensitiveSearch | NSWidthInsensitiveSearch | NSCaseInsensitiveSearch;
@@ -397,6 +428,22 @@ void CYArrayInsertionSortValues(Type_ *values, size_t length, CFComparisonResult
@end
/* }}} */
+@interface FBSSystemService
++(id)sharedService;
+-(void)sendActions:(NSSet*)actions withResult:(id)result;
+@end
+
+typedef enum {
+ None = 0,
+ RestartRenderServer = (1 << 0), // also relaunch backboardd
+ SnapshotTransition = (1 << 1),
+ FadeToBlackTransition = (1 << 2),
+} SBSRelaunchActionStyle;
+
+@interface SBSRelaunchAction
++(id)actionWithReason:(id)reason options:(int64_t)options targetURL:(NSURL*)url;
+@end
+
/* C++ NSString Wrapper Cache {{{ */
static _finline CFStringRef CYStringCreate(const char *data, size_t size) {
return size == 0 ? NULL :
@@ -8270,6 +8317,23 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
}
- (void) reloadSpringBoard {
+ if (kCFCoreFoundationVersionNumber >= 1443) { // XXX: iOS 11.x
+ Class $SBSRelaunchAction = objc_getClass("SBSRelaunchAction");
+ Class $FBSSystemService = objc_getClass("FBSSystemService");
+ pid_t sb_pid = launch_get_job_pid("com.apple.SpringBoard");
+ if ($SBSRelaunchAction && $FBSSystemService) {
+ id action = [$SBSRelaunchAction actionWithReason:@"respring" options:RestartRenderServer targetURL:nil];
+ id sharedService = [$FBSSystemService sharedService];
+ [sharedService sendActions:[NSSet setWithObject:action] withResult:nil];
+ for (int i=0; i<100; i++) {
+ if (kill(sb_pid, 0)) {
+ break;
+ }
+ usleep(1000);
+ }
+ if (kill(sb_pid, 0)) sleep(5);
+ }
+ }
if (kCFCoreFoundationVersionNumber >= 700) // XXX: iOS 6.x
system("/usr/libexec/cydia/cydo /bin/launchctl stop com.apple.backboardd");
else
diff --git a/entitlements.xml b/entitlements.xml
index 2beffeb..6adc334 100644
--- a/entitlements.xml
+++ b/entitlements.xml
@@ -16,6 +16,10 @@
<true/>
<key>com.apple.private.skip-library-validation</key>
<true/>
+ <key>com.apple.frontboard.launchapplications</key>
+ <true/>
+ <key>com.apple.frontboard.shutdown</key>
+ <true/>
<key>com.apple.springboard.launchapplications</key>
<true/>
<key>com.apple.springboard.opensensitiveurl</key>