diff options
author | xiaochao <xiaochao.huang@intel.com> | 2013-02-01 14:12:56 +0800 |
---|---|---|
committer | Bo Huang <bo.b.huang@intel.com> | 2014-12-02 23:07:18 +0800 |
commit | 07ac056d22b7281b38bb323283f046e720e4a15b (patch) | |
tree | f469db2235396dd9e6fc34dea3191bf5bd1da1b9 | |
parent | 1646ab9f8650d341af3e976a1afead8b79365bdc (diff) | |
download | android_packages_providers_MediaProvider-07ac056d22b7281b38bb323283f046e720e4a15b.tar.gz android_packages_providers_MediaProvider-07ac056d22b7281b38bb323283f046e720e4a15b.tar.bz2 android_packages_providers_MediaProvider-07ac056d22b7281b38bb323283f046e720e4a15b.zip |
MediaProvider: When insert files to "internal.db",
Don't notify MTP.
Steps to Reproduce:
1. Connect DUT to Win7 PC via USB cable.
2. Do Factory reset, don't unplug the USB cable during the reset.
->DUT will reboot automatically after factory reset.
3. After DUT enters the system, transfer some files to the DUT by MTP or
take some photos by Camera.
Expected Results:
Read DUT files normally on Win7 PC.
Actual Results:
The files transferred by MTP are named as "Local Disk" on the PC.
And the photos token by Camera can not be showed.
After file is inserted into "internal.db", don't notify MTP. If notify,
PC will get no data from DUT because MtpServer will only query
file's info from "external.db" and after PC gets no data so many
times, it won't send "GetObjectPropList" request to DUT, that will
cause "Local Disk" showed on the PC side.
Change-Id: I6cb364158dbda8b267bdfbf6663d0682f7d4d6cb
Signed-off-by: xiaochao <xiaochao.huang@intel.com>
Signed-off-by: Bo Huang <bo.b.huang@intel.com>
-rwxr-xr-x | src/com/android/providers/media/MediaProvider.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java index 4e67ed8d..da6eeb65 100755 --- a/src/com/android/providers/media/MediaProvider.java +++ b/src/com/android/providers/media/MediaProvider.java @@ -2858,7 +2858,11 @@ public class MediaProvider extends ContentProvider { } // Notify MTP (outside of successful transaction) - notifyMtp(notifyRowIds); + if (uri != null) { + if (uri.toString().startsWith("content://media/external/")) { + notifyMtp(notifyRowIds); + } + } getContext().getContentResolver().notifyChange(uri, null); return numInserted; @@ -2870,7 +2874,11 @@ public class MediaProvider extends ContentProvider { ArrayList<Long> notifyRowIds = new ArrayList<Long>(); Uri newUri = insertInternal(uri, match, initialValues, notifyRowIds); - notifyMtp(notifyRowIds); + if (uri != null) { + if (uri.toString().startsWith("content://media/external/")) { + notifyMtp(notifyRowIds); + } + } // do not signal notification for MTP objects. // we will signal instead after file transfer is successful. |