PTP host: Implement getObjectHandles and getObjectInfo commands

Change-Id: I3ff6e52237f400b4e50c534a1f964c80789bfe98
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/media/mtp/ptptest.cpp b/media/mtp/ptptest.cpp
index 2efa4c9..5da4d45 100644
--- a/media/mtp/ptptest.cpp
+++ b/media/mtp/ptptest.cpp
@@ -23,6 +23,7 @@
 
 #include "MtpClient.h"
 #include "MtpDeviceInfo.h"
+#include "MtpObjectInfo.h"
 #include "MtpStorageInfo.h"
 
 using namespace android;
@@ -47,11 +48,24 @@
     MtpStorageIDList* storageIDs = sClient->getStorageIDs();
     if (storageIDs) {
         for (int i = 0; i < storageIDs->size(); i++) {
-            MtpStorageInfo* info = sClient->getStorageInfo((*storageIDs)[i]);
+            MtpStorageID storageID = (*storageIDs)[i];
+            MtpStorageInfo* info = sClient->getStorageInfo(storageID);
             if (info) {
                 info->print();
                 delete info;
             }
+            MtpObjectHandleList* objects = sClient->getObjectHandles(storageID, 0, MTP_PARENT_ROOT);
+            if (objects) {
+                for (int j = 0; j < objects->size(); j++) {
+                    MtpObjectHandle handle = (*objects)[j];
+                    MtpObjectInfo* info = sClient->getObjectInfo(handle);
+                    if (info) {
+                        info->print();
+                        delete info;
+                    }
+                }
+                delete objects;
+            }
         }
     }
 }