Fix the logic to add suffix when copying.

Previously the logic add '.' even if the extension is empty.

BUG=27729309

Change-Id: I3fa4b09fea977b5c716ec5cbbbc7d9f4ab96db08
This commit is contained in:
Daichi Hirono
2016-03-18 18:29:56 +09:00
parent f9845b4ecf
commit 4f04fd358d

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(