Merge "Fix the logic to add suffix when copying." into nyc-dev

This commit is contained in:
Daichi Hirono
2016-03-22 01:34:58 +00:00
committed by Android (Google) Code Review

View File

@@ -360,8 +360,12 @@ public class MtpDocumentsProvider extends DocumentsProvider {
if (i == 0) {
infoUniqueName = info;
} else {
infoUniqueName = new MtpObjectInfo.Builder(info).setName(
baseName + " (" + i + ")." + extension).build();
String suffixedName = baseName + " (" + i + " )";
if (!extension.isEmpty()) {
suffixedName += "." + extension;
}
infoUniqueName =
new MtpObjectInfo.Builder(info).setName(suffixedName).build();
}
try {
objectHandle = mMtpManager.createDocument(