系统环境
- Android 4.4.2
问题描述
- 交换内外SD卡挂载路径
patch
MediaScannerReceiver
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
From cd5ff810f5940c91d265b7c298fb141a045c94bf Mon Sep 17 00:00:00 2001 From: fantasy <591888356@qq.com> Date: Wed, 15 Aug 2018 10:19:41 +0800 Subject: [PATCH 1/2] exchange extsd and sdcard --- .../com/android/providers/media/MediaScannerReceiver.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/providers/MediaProvider/src/com/android/providers/media/MediaScannerReceiver.java b/providers/MediaProvider/src/com/android/providers/media/MediaScannerReceiver.java index 7936782..65eff6d 100755 --- a/providers/MediaProvider/src/com/android/providers/media/MediaScannerReceiver.java +++ b/providers/MediaProvider/src/com/android/providers/media/MediaScannerReceiver.java @@ -117,7 +117,7 @@ public class MediaScannerReceiver extends BroadcastReceiver { for(int i = 0; i < list.length; i++) { Log.d(TAG, "i " + i + "list[i] "+ list[i]); - if(list[i].contains("extsd")){ + if(list[i].contains("sdcard")){ //Log.d(TAG, "extsd i " + i + "list[i] "+ list[i]); mExtsdList.add(list[i]); }else if(list[i].contains("usb")){ @@ -144,8 +144,8 @@ public class MediaScannerReceiver extends BroadcastReceiver { mHandler.sendMessage(msg); }else if (Intent.ACTION_MEDIA_SCANNER_SCAN_FILE.equals(action) && - path != null && (path.startsWith(externalStoragePath + "/") || path.startsWith("/mnt/extsd") || path.startsWith("/mnt/usbhost") - || path.startsWith("/storage/extsd") || path.startsWith("/storage/usbhost"))) { + path != null && (path.startsWith(externalStoragePath + "/") || path.startsWith("/mnt/sdcard") || path.startsWith("/mnt/usbhost") + || path.startsWith("/storage/sdcard") || path.startsWith("/storage/usbhost"))) { scanFile(context, path); Message msg = new Message(); @@ -228,13 +228,13 @@ public class MediaScannerReceiver extends BroadcastReceiver { case EVENT_ACTION_MEDIA_UNMOUNTED: Log.d(TAG, "EVENT_ACTION_MEDIA_UNMOUNTED"); - if (mPath.contains("extsd")){ + if (mPath.contains("sdcard")){ for(String extsd:mExtsdList) { if(Environment.MEDIA_MOUNTED.equals(mStorageManager.getVolumeState(extsd))){ - Log.d(TAG, "mount /mnt/extsd"); + Log.d(TAG, "mount /mnt/sdcard"); }else { - Log.d(TAG, "unmount /mnt/extsd"); + Log.d(TAG, "unmount /mnt/sdcard"); deleteMediaFile(mContext, mPath); // notify on media Uris as well as the files Uri mContext.getContentResolver().notifyChange( -- 2.7.4 |
device
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
From edfbded9fcf81a0ca70b27c3563647d0542d5bfb Mon Sep 17 00:00:00 2001 From: fantasy <591888356@qq.com> Date: Wed, 15 Aug 2018 10:14:24 +0800 Subject: [PATCH] exchange extsd and sdcard --- softwinner/astar-evb30/fstab.sun8i | 8 ++++---- softwinner/astar-evb30/init.sun8i.rc | 2 +- .../overlay/frameworks/base/core/res/res/xml/storage_list.xml | 4 ++-- softwinner/astar-evb30/recovery.fstab | 4 ++-- .../FileExplore/src/com/softwinner/explore/DevicePath.java | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/softwinner/astar-evb30/fstab.sun8i b/softwinner/astar-evb30/fstab.sun8i index f5b7b00..d540618 100755 --- a/softwinner/astar-evb30/fstab.sun8i +++ b/softwinner/astar-evb30/fstab.sun8i @@ -6,10 +6,10 @@ /dev/block/by-name/system /system ext4 ro wait /dev/block/by-name/cache /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,barrier=1 wait,check /dev/block/by-name/data /data ext4 noatime,nosuid,nodev,nomblk_io_submit,barrier=1,noauto_da_alloc wait,check,encryptable=/dev/block/by-name/metadata -/devices/virtual/block/nandk auto vfat defaults wait,check,noemulatedsd,voldmanaged=sdcard:auto -/devices/platform/sunxi-mmc.2/mmc_host auto vfat defaults wait,check,noemulatedsd,voldmanaged=sdcard:auto -/devices/platform/sunxi-mmc.0/mmc_host auto vfat defaults wait,check,voldmanaged=extsd:auto -/devices/platform/sunxi-mmc.1/mmc_host auto vfat defaults wait,check,voldmanaged=extsd:auto +/devices/virtual/block/nandk auto vfat defaults wait,check,noemulatedsd,voldmanaged=extsd:auto +/devices/platform/sunxi-mmc.2/mmc_host auto vfat defaults wait,check,noemulatedsd,voldmanaged=extsd:auto +/devices/platform/sunxi-mmc.0/mmc_host auto vfat defaults wait,check,voldmanaged=sdcard:auto +/devices/platform/sunxi-mmc.1/mmc_host auto vfat defaults wait,check,voldmanaged=sdcard:auto /devices/platform/sunxi-ehci.1 auto vfat defaults wait,check,voldmanaged=usbhost1:auto /devices/platform/sunxi_hcd_host0 auto vfat defaults wait,check,voldmanaged=usbhost1:auto /devices/platform/sunxi-ohci.1 auto vfat defaults wait,check,voldmanaged=usbhost1:auto diff --git a/softwinner/astar-evb30/init.sun8i.rc b/softwinner/astar-evb30/init.sun8i.rc index c4d8381..7ef20b9 100755 --- a/softwinner/astar-evb30/init.sun8i.rc +++ b/softwinner/astar-evb30/init.sun8i.rc @@ -2,7 +2,7 @@ import init.sun8i.usb.rc on init - export EXTERNAL_STORAGE /mnt/sdcard + export EXTERNAL_STORAGE /mnt/extsd mkdir /mnt/sdcard 0700 system system symlink /mnt/sdcard /sdcard symlink /mnt/sdcard /storage/sdcard0 diff --git a/softwinner/astar-evb30/overlay/frameworks/base/core/res/res/xml/storage_list.xml b/softwinner/astar-evb30/overlay/frameworks/base/core/res/res/xml/storage_list.xml index 51f02aa..d41cdf4 100755 --- a/softwinner/astar-evb30/overlay/frameworks/base/core/res/res/xml/storage_list.xml +++ b/softwinner/astar-evb30/overlay/frameworks/base/core/res/res/xml/storage_list.xml @@ -33,7 +33,7 @@ --> <StorageList xmlns:android="http://schemas.android.com/apk/res/android"> - <storage android:mountPoint="/mnt/sdcard" + <storage android:mountPoint="/mnt/extsd" android:storageDescription="@string/storage_internal" android:primary="true" android:removable="false" @@ -41,7 +41,7 @@ android:mtpReserve="100" android:allowMassStorage="true" android:maxFileSize="0"/> - <storage android:mountPoint="/mnt/extsd" + <storage android:mountPoint="/mnt/sdcard" android:storageDescription="@string/storage_sd_card" android:primary="false" android:removable="true" diff --git a/softwinner/astar-evb30/recovery.fstab b/softwinner/astar-evb30/recovery.fstab index 3c1cea5..e6ed9e7 100755 --- a/softwinner/astar-evb30/recovery.fstab +++ b/softwinner/astar-evb30/recovery.fstab @@ -11,5 +11,5 @@ /dev/block/by-name/misc /misc emmc defaults defaults /dev/block/by-name/recovery /recovery emmc defaults defaults /dev/block/by-name/cache /cache ext4 defaults defaults -/dev/block/by-name/UDISK /sdcard vfat defaults defaults -/dev/block/mmcblk0 /extsd vfat defaults defaults +/dev/block/by-name/UDISK /extsd vfat defaults defaults +/dev/block/mmcblk0 /sdcard vfat defaults defaults diff --git a/softwinner/polaris-common/prebuild/packages/FileExplore/src/com/softwinner/explore/DevicePath.java b/softwinner/polaris-common/prebuild/packages/FileExplore/src/com/softwinner/explore/DevicePath.java index 9b1beab..0a12892 100755 --- a/softwinner/polaris-common/prebuild/packages/FileExplore/src/com/softwinner/explore/DevicePath.java +++ b/softwinner/polaris-common/prebuild/packages/FileExplore/src/com/softwinner/explore/DevicePath.java @@ -40,7 +40,7 @@ public class DevicePath{ totalDevicesList.add(list[i]); if(list[i].equals(flash)){ flashList.add(list[i]); - }else if(list[i].contains("extsd")){ + }else if(list[i].contains("sdcard")){ sdcardList.add(list[i]); }else if(list[i].contains("usb")){ usbList.add(list[i]); -- 2.7.4 |
systemui
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
From 3ccd2d98bac65094e3b77f6c993a65c9ead7a862 Mon Sep 17 00:00:00 2001 From: fantasy <591888356@qq.com> Date: Wed, 15 Aug 2018 10:08:43 +0800 Subject: [PATCH] exchange extsd and sdcard --- .../SystemUI/src/com/android/systemui/usb/StorageNotification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/base/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index 80aa21d..fc5f994 100755 --- a/base/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/base/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -212,7 +212,7 @@ public class StorageNotification extends SystemUI { setMediaStorageNotification(R.string.usb_mounted_title, R.string.usb_mounted_message, com.android.internal.R.drawable.stat_notify_sdcard_prepare, true, false, null); - } else if (path.contains("extsd")) { + } else if (path.contains("sdcard")) { setMediaStorageNotification(R.string.sd_mounted_title, R.string.sd_mounted_message, com.android.internal.R.drawable.stat_notify_sdcard_prepare, true, false, null); -- 2.7.4 |
vold
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
From 27c92d90ae001b3471d642ae90be34ae47b987fe Mon Sep 17 00:00:00 2001 From: fantasy <591888356@qq.com> Date: Wed, 15 Aug 2018 10:12:36 +0800 Subject: [PATCH] exchange extsd and sdcard --- vold/DirectVolume.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vold/DirectVolume.cpp b/vold/DirectVolume.cpp index 8bdcdbf..9a9843d 100755 --- a/vold/DirectVolume.cpp +++ b/vold/DirectVolume.cpp @@ -241,9 +241,9 @@ int DirectVolume::handleBlockEvent(NetlinkEvent *evt) { char nodepath[255]; mPartsChangeFlag = 0; if (major == 179 || major == 259) { - if (!strncmp(getLabel(), "sdcard", strlen("sdcard")) && !strncmp(dp, "/devices/platform/sunxi-mmc.", strlen("/devices/platform/sunxi-mmc."))) { + if (!strncmp(getLabel(), "extsd", strlen("extsd")) && !strncmp(dp, "/devices/platform/sunxi-mmc.", strlen("/devices/platform/sunxi-mmc."))) { mPartsChangeFlag = 1; - } else if (!strncmp(getLabel(), "extsd", strlen("extsd")) && !strncmp(dp, "/devices/platform/sunxi-mmc.2", strlen("/devices/platform/sunxi-mmc.2"))) { + } else if (!strncmp(getLabel(), "sdcard", strlen("sdcard")) && !strncmp(dp, "/devices/platform/sunxi-mmc.2", strlen("/devices/platform/sunxi-mmc.2"))) { mPartsChangeFlag = 2; mOemPartMajor = major; mOemPartMinor = minor; @@ -478,7 +478,7 @@ void DirectVolume::handlePartitionRemoved(const char *devpath, NetlinkEvent *evt SLOGE("Failed to cleanup ASEC - unmount will probably fail!"); } - if (!strstr(getLabel(),"usb") && !strstr(getLabel(),"extsd")) { + if (!strstr(getLabel(),"usb") && !strstr(getLabel(),"sdcard")) { snprintf(msg, sizeof(msg), "Volume %s %s bad removal (%d:%d)", getLabel(), getFuseMountpoint(), major, minor); mVm->getBroadcaster()->sendBroadcast(ResponseCode::VolumeBadRemoval, -- 2.7.4 |
修改外置SD卡挂载路径
可以新建一个软链接,链接到旧路径 (未证实)