Add option to list vndservicemanager services.

Test: adb shell service list -v
Bug: 36987120
Change-Id: I081a0c725ddb4175f4ab43714c25cc41ed2239a3
diff --git a/cmds/service/service.cpp b/cmds/service/service.cpp
index 428b87c..09921e4 100644
--- a/cmds/service/service.cpp
+++ b/cmds/service/service.cpp
@@ -68,18 +68,12 @@
 
 int main(int argc, char* const argv[])
 {
-    sp<IServiceManager> sm = defaultServiceManager();
-    fflush(stdout);
-    if (sm == NULL) {
-        aerr << "service: Unable to get default service manager!" << endl;
-        return 20;
-    }
-    
     bool wantsUsage = false;
+    bool wantsVendorServices = false;
     int result = 0;
     
     while (1) {
-        int ic = getopt(argc, argv, "h?");
+        int ic = getopt(argc, argv, "vh?");
         if (ic < 0)
             break;
 
@@ -88,6 +82,9 @@
         case '?':
             wantsUsage = true;
             break;
+        case 'v':
+            wantsVendorServices = true;
+            break;
         default:
             aerr << "service: Unknown option -" << ic << endl;
             wantsUsage = true;
@@ -95,6 +92,16 @@
             break;
         }
     }
+
+    if (wantsVendorServices) {
+        ProcessState::initWithDriver("/dev/vndbinder");
+    }
+    sp<IServiceManager> sm = defaultServiceManager();
+    fflush(stdout);
+    if (sm == NULL) {
+        aerr << "service: Unable to get default service manager!" << endl;
+        return 20;
+    }
     
     if (optind >= argc) {
         wantsUsage = true;