Package org.robovm.libimobiledevice
Class MobileImageMounterClient
java.lang.Object
org.robovm.libimobiledevice.MobileImageMounterClient
- All Implemented Interfaces:
java.lang.AutoCloseable
public class MobileImageMounterClient
extends java.lang.Object
implements java.lang.AutoCloseable
Mounts developer/debug disk images on the device.
-
Field Summary
Fields Modifier and Type Field Description protected MobileImageMounterClientRefrefstatic java.lang.StringSERVICE_NAME -
Constructor Summary
Constructors Constructor Description MobileImageMounterClient(IDevice device, LockdowndServiceDescriptor service)Creates a newMobileImageMounterClientand makes a connection to thecom.apple.mobile.mobile_image_mounterservice on the device. -
Method Summary
Modifier and Type Method Description protected voidcheckDisposed()voidclose()voiddispose()protected MobileImageMounterClientRefgetRef()com.dd.plist.NSDictionarylookupImage(java.lang.String imageType)Checks if an image of the specified type has already been mounted.static voidmain(java.lang.String[] args)com.dd.plist.NSDictionarymountImage(java.lang.String imagePath, byte[] imageSignature, java.lang.String imageType)Mounts an image on the device.voiduploadImage(java.io.File localImageFile, java.lang.String imageType, byte[] signature)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
SERVICE_NAME
public static final java.lang.String SERVICE_NAME- See Also:
- Constant Field Values
-
ref
-
-
Constructor Details
-
MobileImageMounterClient
Creates a newMobileImageMounterClientand makes a connection to thecom.apple.mobile.mobile_image_mounterservice on the device.- Parameters:
device- the device to connect to.service- the service descriptor returned byLockdowndClient.startService(String).
-
-
Method Details
-
mountImage
public com.dd.plist.NSDictionary mountImage(java.lang.String imagePath, byte[] imageSignature, java.lang.String imageType) throws java.io.IOExceptionMounts an image on the device. After an image has been mounted it will remain mounted until the device is rebooted. Returns anNSDictionarywithStatus=Completeon success. On error theNSDictionarywill containError=ImageMountFailed.- Parameters:
imagePath- the path of the image to be mounted. Should be an absolute path inside the AFC jail on the device.imageSignature- the image's signature data.imageType- type of the image. Ifnullis passedDeveloperwill be used.- Returns:
- the result of the mount.
- Throws:
java.io.IOException
-
lookupImage
public com.dd.plist.NSDictionary lookupImage(java.lang.String imageType) throws java.io.IOExceptionChecks if an image of the specified type has already been mounted. This method returns a plist similar to this when an image has been mounted:<plist version="1.0"> <dict> <key>ImageDigest</key> <data>rBSGlwMv4yovqGM7sOk44vrE6xI=</data> <key>ImagePresent</key> <true/> <key>Status</key> <string>Complete</string> </dict> </plist>TheImageDigestvalue is the SHA-1 digest if the image file.If no image has been mounted
ImagePresent=falseand there will be noImageDigestin the response.NOTE! It seems like this only returns
ImagePresent=truethe first time it is called after an image has been mounted. On subsequent calls it returnsImagePresent=falseeven if the image is still mounted.- Parameters:
imageType- type of the image to look for. Ifnullis passedDeveloperwill be used.- Returns:
- the result of the lookup.
- Throws:
java.io.IOException
-
uploadImage
public void uploadImage(java.io.File localImageFile, java.lang.String imageType, byte[] signature) throws java.io.IOException- Throws:
java.io.IOException
-
getRef
-
checkDisposed
protected final void checkDisposed() -
dispose
public void dispose() -
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-