summaryrefslogtreecommitdiffstats
path: root/src/com/android/mtp
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2021-10-06 22:54:15 +0000
committerXin Li <delphij@google.com>2021-10-06 22:54:15 +0000
commit89d23e9569f95ca6c50451e51c81df4524b99ca9 (patch)
treec2f876e790df9f3bf1faa6a1355bd5a516649c11 /src/com/android/mtp
parente365ae93b18931a44014478c1ca30356de934d3b (diff)
parent3d791e886925e506dc1446301a24dc8ae1c6610e (diff)
downloadplatform_packages_services_Mtp-master.tar.gz
platform_packages_services_Mtp-master.tar.bz2
platform_packages_services_Mtp-master.zip
Merge Android 12HEADmaster
Bug: 202323961 Merged-In: I3b3ef768bb004daf8222e4171b72b02bb76497ab Change-Id: I8e55721c6f5a3e85af63ed0721ebefd72adf235d
Diffstat (limited to 'src/com/android/mtp')
-rw-r--r--src/com/android/mtp/MtpManager.java28
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());