Lookup whether the device is password protected before starting a debug server and log it as an event. (#566)

diff --git a/src/ios-deploy/MobileDevice.h b/src/ios-deploy/MobileDevice.h
index 329ef65..ffda687 100644
--- a/src/ios-deploy/MobileDevice.h
+++ b/src/ios-deploy/MobileDevice.h
@@ -439,7 +439,7 @@
 mach_error_t AMDeviceDisconnect(struct am_device *device);
 mach_error_t AMDeviceRetain(struct am_device *device);
 mach_error_t AMDeviceRelease(struct am_device *device);
-CFStringRef AMDeviceCopyValue(struct am_device *device, void*, CFStringRef cfstring);
+CFTypeRef AMDeviceCopyValue(struct am_device *device, void*, CFStringRef cfstring);
 CFStringRef AMDeviceCopyDeviceIdentifier(struct am_device *device);
 
 typedef void (*notify_callback)(CFStringRef notification, void *data);
diff --git a/src/ios-deploy/ios-deploy.m b/src/ios-deploy/ios-deploy.m
index 5b0ce2b..3ee07c7 100644
--- a/src/ios-deploy/ios-deploy.m
+++ b/src/ios-deploy/ios-deploy.m
@@ -1421,6 +1421,11 @@
     device_interface_name = get_device_interface_name(device);
 
     connect_and_start_session(device);
+    CFBooleanRef is_password_protected = AMDeviceCopyValue(device, 0, CFSTR("PasswordProtected"));
+    NSLogJSON(@{@"Event": @"PasswordProtectedStatus",
+                @"Status": @(CFBooleanGetValue(is_password_protected)),
+    });
+    CFRelease(is_password_protected);
 
     NSLogOut(@"------ Debug phase ------");