If we have an existing file in the destination directory, which has the same name with the source file, adding suffix number is DocumentsProvider's responsibility. Because MTP does not provide a way to check existance of files with given name, the logic is implemented as try-and error strategy. The CL lets If we MtpDocumentsProvider assume we have a file that shares the same name with the source file if it failed to invoke MtpDevice#sendObjectInfo. In this case MtpDocumentsProvider retry to invoke sendObjectInfo with new name with suffix number. BUG=26991190 Change-Id: I223ac5031f079bc91eb27709b0356f621a1ed55b
29 lines
903 B
Java
29 lines
903 B
Java
/*
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.mtp;
|
|
|
|
import java.io.IOException;
|
|
|
|
/**
|
|
* Exception thrown when the device is busy and the requested operation cannon be completed.
|
|
*/
|
|
class BusyDeviceException extends IOException {
|
|
BusyDeviceException() {
|
|
super("The MTP device is busy.");
|
|
}
|
|
}
|