项目有两种内存,要求根据连接电脑拷贝文件时的盘符名称根据内存大小显示不同名称。
frameworks/base/media/java/android/mtp/MtpDatabase.java+//mh@
+import android.app.ActivityManager;
...
@@ -894,7 +896,19 @@ public class MtpDatabase implements AutoCloseable {private int getDeviceProperty(int property, long[] outIntValue, char[] outStringValue) {switch (property) {case MtpConstants.DEVICE_PROPERTY_SYNCHRONIZATION_PARTNER:case MtpConstants.DEVICE_PROPERTY_DEVICE_FRIENDLY_NAME:// writable string properties kept in shared preferencesString value = mDeviceProperties.getString(Integer.toString(property), "");
+ //mh@start 两种内存,大于1G加pro
+ if(getTotalMem() > 1000l) {
+ value = value + " PRO";
+ }
+ //mh@endint length = value.length();if (length > 255) {length = 255;...
+ //mh@start
+ private long getTotalMem() {
+ ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
+ ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
+ activityManager.getMemoryInfo(memInfo);
+ long totalMem = memInfo.totalMem / 1000000;
+ Log.d("mh.log", "MtpDatabase--getDeviceProperty--totalMem:" + totalMem);
+ return totalMem;
+ }
+ //mh@end