MTP: Skip runtime thumbnail generation for Android Host

Android Host is not capable to deal with the long processing time for
runtime thumbnail generation.
Skip runtime thumbnail generation for Android Host
but keep no impact to other Host

Bug: 188752500
Test: atest MtpTests
Test: atest MtpServerTest
Test: atest MtpServiceTests
Test: manual test on Windows 10 File Explorer
Test: manual test on Android Host Files App
Change-Id: I07105266fe864116d744814efbf9281572a6cb5e
diff --git a/src/com/android/mtp/MtpManager.java b/src/com/android/mtp/MtpManager.java
index a7de631..6b211e4 100644
--- a/src/com/android/mtp/MtpManager.java
+++ b/src/com/android/mtp/MtpManager.java
@@ -29,6 +29,7 @@
 import android.mtp.MtpEvent;
 import android.mtp.MtpObjectInfo;
 import android.mtp.MtpStorageInfo;
+import android.os.Build;
 import android.os.CancellationSignal;
 import android.os.ParcelFileDescriptor;
 import android.util.Log;
@@ -108,6 +109,9 @@
                 "Not found MTP storages in the device.");
 
         mDevices.put(deviceId, device);
+
+        setInitVersion(rawDevice);
+
         return createDeviceRecord(rawDevice);
     }
 
@@ -263,6 +267,28 @@
         }
     }
 
+    private void setInitVersion(UsbDevice device) {
+        final MtpDevice mtpDevice = mDevices.get(device.getDeviceId());
+        final boolean opened = mtpDevice != null;
+        final String name = device.getProductName();
+        int[] devicePropertySupported = null;
+
+        if (opened) {
+            final MtpDeviceInfo info = mtpDevice.getDeviceInfo();
+
+            if (info != null) {
+                devicePropertySupported = info.getDevicePropertySupported();
+
+                if (MtpDeviceRecord.isSupported(devicePropertySupported,
+                        MtpConstants.DEVICE_PROPERTY_SESSION_INITIATOR_VERSION_INFO)) {
+                    mtpDevice.setDevicePropertyInitVersion("Android/"
+                        + Build.VERSION.RELEASE
+                        + " Build/" + Build.VERSION.INCREMENTAL);
+                }
+            }
+        }
+    }
+
     private MtpDeviceRecord createDeviceRecord(UsbDevice device) {
         final MtpDevice mtpDevice = mDevices.get(device.getDeviceId());
         final boolean opened = mtpDevice != null;
@@ -270,6 +296,8 @@
         MtpRoot[] roots;
         int[] operationsSupported = null;
         int[] eventsSupported = null;
+        int[] devicePropertySupported = null;
+
         if (opened) {
             try {
                 roots = getRoots(device.getDeviceId());