diff options
| author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-06-24 01:09:39 +0000 |
|---|---|---|
| committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-06-24 01:09:39 +0000 |
| commit | 4c6ef14e0db9a36378500e49227e6459b08e0933 (patch) | |
| tree | c2f876e790df9f3bf1faa6a1355bd5a516649c11 | |
| parent | d7d8d8e57339fe053158d64bfdb58f8e6cec2a53 (diff) | |
| parent | e265268ad81b0783832d3bb7c74d3425fcbea185 (diff) | |
| download | platform_packages_services_Mtp-android12-release.tar.gz platform_packages_services_Mtp-android12-release.tar.bz2 platform_packages_services_Mtp-android12-release.zip | |
Snap for 7486544 from e265268ad81b0783832d3bb7c74d3425fcbea185 to sc-releaseandroid-vts-12.0_r1android-cts-12.0_r1android-12.0.0_r2android-12.0.0_r1android12-tests-releaseandroid12-release
Change-Id: I43a8f8fa0c691ebb3cea107eb4a1d26aace3196e
| -rw-r--r-- | src/com/android/mtp/MtpManager.java | 28 |
1 files changed, 28 insertions, 0 deletions
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.MtpDeviceInfo; 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 @@ class MtpManager { "Not found MTP storages in the device."); mDevices.put(deviceId, device); + + setInitVersion(rawDevice); + return createDeviceRecord(rawDevice); } @@ -263,6 +267,28 @@ class MtpManager { } } + 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 @@ class MtpManager { MtpRoot[] roots; int[] operationsSupported = null; int[] eventsSupported = null; + int[] devicePropertySupported = null; + if (opened) { try { roots = getRoots(device.getDeviceId()); |
