diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-07-16 07:47:21 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-07-16 07:47:21 +0000 |
commit | f3b62ee094b4b7761794fa87cb16579265317171 (patch) | |
tree | c2f876e790df9f3bf1faa6a1355bd5a516649c11 | |
parent | 725a3037234669749fc58ea96371ee95167e5720 (diff) | |
parent | 96e6a679e90fb08a4698b4ab07f2b61a70bf76f0 (diff) | |
download | Mtp-android-mainline-12.0.0_r101.tar.gz |
Snap for 7555280 from 96e6a679e90fb08a4698b4ab07f2b61a70bf76f0 to mainline-cellbroadcast-releaseandroid-mainline-12.0.0_r86android-mainline-12.0.0_r71android-mainline-12.0.0_r7android-mainline-12.0.0_r60android-mainline-12.0.0_r43android-mainline-12.0.0_r24android-mainline-12.0.0_r116android-mainline-12.0.0_r101android12-mainline-cellbroadcast-release
Change-Id: I173e674d4b9094d0108160e2b64e782f2cd01771
-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()); |