Leave trigger intact during upgrade.

Change-Id: I55a93be5e1edd0f00c318d07363242388936aa63
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index b23effd..4566b0f 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -83,7 +83,6 @@
 import android.text.TextUtils;
 import android.text.format.DateUtils;
 import android.util.Log;
-import android.util.Slog;
 
 import java.io.File;
 import java.io.FileDescriptor;
@@ -1736,11 +1735,9 @@
 
         // Emulated external storage moved to user-specific paths
         if (fromVersion < 510 && Environment.isExternalStorageEmulated()) {
-            db.execSQL("DROP TRIGGER IF EXISTS files_cleanup");
-
             // File.fixSlashes() removes any trailing slashes
             final String externalStorage = Environment.getExternalStorageDirectory().toString();
-            Slog.d(TAG, "Adjusting external storage paths to: " + externalStorage);
+            Log.d(TAG, "Adjusting external storage paths to: " + externalStorage);
 
             final String[] tables = {
                     TABLE_FILES, TABLE_ALBUM_ART, TABLE_THUMBNAILS, TABLE_VIDEO_THUMBNAILS };
@@ -1748,13 +1745,6 @@
                 db.execSQL("UPDATE " + table + " SET " + "_data='" + externalStorage
                         + "'||SUBSTR(_data,17) WHERE _data LIKE '/storage/sdcard0/%';");
             }
-
-            if (!internal) {
-                db.execSQL("CREATE TRIGGER IF NOT EXISTS files_cleanup DELETE ON files " +
-                    "BEGIN " +
-                        "SELECT _OBJECT_REMOVED(old._id);" +
-                    "END");
-            }
         }
 
         sanityCheck(db, fromVersion);
diff --git a/src/com/android/providers/media/MtpService.java b/src/com/android/providers/media/MtpService.java
index 2d36b20..2d707b9 100644
--- a/src/com/android/providers/media/MtpService.java
+++ b/src/com/android/providers/media/MtpService.java
@@ -49,11 +49,11 @@
         if (mPtpMode) {
             // In PTP mode we support only primary storage
             final StorageVolume primary = StorageManager.getPrimaryVolume(mVolumes);
-            String path = primary.getPath();
+            final String path = primary.getPath();
             if (path != null) {
                 String state = mStorageManager.getVolumeState(path);
                 if (Environment.MEDIA_MOUNTED.equals(state)) {
-                    addStorageLocked(mVolumeMap.get(primary.getPath()));
+                    addStorageLocked(mVolumeMap.get(path));
                 }
             }
         } else {