Commit 416dca07 authored by Fawzi Mohamed's avatar Fawzi Mohamed

iostool: avoid deploying when just running, improve app lookup

-run now only runs
improved app path lookup efficiency (lookup only required info)

Change-Id: Ic32be229c997548eab4d63e43970d640c25a1abe
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 97f5b31c
......@@ -125,7 +125,7 @@ typedef am_res_t (MDEV_API *AMDeviceInstallApplicationPtr)(ServiceSocket, CFStri
typedef am_res_t (MDEV_API *AMDeviceUninstallApplicationPtr)(ServiceSocket, CFStringRef, CFDictionaryRef,
AMDeviceInstallApplicationCallback,
void*);
typedef am_res_t (MDEV_API *AMDeviceLookupApplicationsPtr)(AMDeviceRef, unsigned int, CFDictionaryRef *);
typedef am_res_t (MDEV_API *AMDeviceLookupApplicationsPtr)(AMDeviceRef, CFDictionaryRef, CFDictionaryRef *);
} // extern C
QString CFStringRef2QString(CFStringRef s)
......@@ -204,7 +204,7 @@ public :
am_res_t deviceUninstallApplication(int, CFStringRef, CFDictionaryRef,
AMDeviceInstallApplicationCallback,
void*);
am_res_t deviceLookupApplications(AMDeviceRef, unsigned int, CFDictionaryRef *);
am_res_t deviceLookupApplications(AMDeviceRef, CFDictionaryRef, CFDictionaryRef *);
void addError(const QString &msg);
void addError(const char *msg);
......@@ -1151,10 +1151,21 @@ QString AppOpSession::appPathOnDevice()
if (!connectDevice())
return QString();
CFDictionaryRef apps;
if (int err = lib()->deviceLookupApplications(device, 0, &apps)) {
CFDictionaryRef options;
const void *attributes[3] = { (const void*)(CFSTR("CFBundleIdentifier")),
(const void*)(CFSTR("Path")), (const void*)(CFSTR("CFBundleExecutable")) };
CFArrayRef lookupKeys = CFArrayCreate(kCFAllocatorDefault, (const void**)(&attributes[0]), 3,
&kCFTypeArrayCallBacks);
CFStringRef attrKey = CFSTR("ReturnAttributes");
options = CFDictionaryCreate(kCFAllocatorDefault, (const void**)(&attrKey),
(const void**)(&lookupKeys), 1,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFRelease(lookupKeys);
if (int err = lib()->deviceLookupApplications(device, options, &apps)) {
addError(QString::fromLatin1("app lookup failed, AMDeviceLookupApplications returned %1")
.arg(err));
}
CFRelease(options);
if (debugAll)
CFShow(apps);
if (apps && CFGetTypeID(apps) == CFDictionaryGetTypeID()) {
......@@ -1509,11 +1520,11 @@ am_res_t MobileDeviceLib::deviceUninstallApplication(int serviceFd, CFStringRef
return -1;
}
am_res_t MobileDeviceLib::deviceLookupApplications(AMDeviceRef device, unsigned int i,
am_res_t MobileDeviceLib::deviceLookupApplications(AMDeviceRef device, CFDictionaryRef options,
CFDictionaryRef *res)
{
if (m_AMDeviceLookupApplications)
return m_AMDeviceLookupApplications(device, i, res);
return m_AMDeviceLookupApplications(device, options, res);
return -1;
}
......
......@@ -106,7 +106,7 @@ IosTool::IosTool(QObject *parent):
ipv6(false),
inAppOutput(false),
splitAppOutput(true),
appOp(Ios::IosDeviceManager::Install),
appOp(Ios::IosDeviceManager::None),
outFile(),
out(&outFile),
gdbFileDescriptor(-1),
......@@ -281,7 +281,7 @@ void IosTool::didTransferApp(const QString &bundlePath, const QString &deviceId,
//out.writeCharacters(QString()); // trigger a complete closing of the empty element
outFile.flush();
if (status != Ios::IosDeviceManager::Success || --opLeft == 0)
doExit(-1);
doExit((status == Ios::IosDeviceManager::Success) ? 0 : -1);
}
void IosTool::didStartApp(const QString &bundlePath, const QString &deviceId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment