Snap for 10243937 from 26119cf4471c3fb7b10bad40d66975487913eec4 to aml-frc-release

Change-Id: I2d862cf2ea7a9d53365161ef997fd68f70031917
diff --git a/src/com/android/providers/telephony/MmsProvider.java b/src/com/android/providers/telephony/MmsProvider.java
index 2ab9fc2..28c9074 100644
--- a/src/com/android/providers/telephony/MmsProvider.java
+++ b/src/com/android/providers/telephony/MmsProvider.java
@@ -926,15 +926,16 @@
                         uri.getPathSegments().get(1);
 
                 try {
+                    File canonicalFile = new File(path).getCanonicalFile();
                     String partsDirPath = getContext().getDir(PARTS_DIR_NAME, 0).getCanonicalPath();
-                    if (!new File(path).getCanonicalPath().startsWith(partsDirPath)) {
+                    if (!canonicalFile.getPath().startsWith(partsDirPath + '/')) {
                         EventLog.writeEvent(0x534e4554, "240685104",
                                 callerUid, (TAG + " update: path " + path +
                                         " does not start with " + partsDirPath));
                         return 0;
                     }
                     // Reset the file permission back to read for everyone but me.
-                    Os.chmod(path, 0644);
+                    Os.chmod(canonicalFile.getPath(), 0644);
                     if (LOCAL_LOGV) {
                         Log.d(TAG, "MmsProvider.update chmod is successful for path: " + path);
                     }