Merge "Do nothing when choosing file transfer when in accessory mode"
This commit is contained in:
committed by
Android (Google) Code Review
commit
5709f7a083
@@ -115,7 +115,8 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
|
||||
public void onRadioButtonClicked(RadioButtonPreference preference) {
|
||||
final long function = UsbBackend.usbFunctionsFromString(preference.getKey());
|
||||
final long previousFunction = mUsbBackend.getCurrentFunctions();
|
||||
if (function != previousFunction && !Utils.isMonkeyRunning()) {
|
||||
if (function != previousFunction && !Utils.isMonkeyRunning()
|
||||
&& !shouldIgnoreClickEvent(function, previousFunction)) {
|
||||
mPreviousFunction = previousFunction;
|
||||
|
||||
//Update the UI in advance to make it looks smooth
|
||||
@@ -138,6 +139,11 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldIgnoreClickEvent(long function, long previousFunction) {
|
||||
return previousFunction == UsbManager.FUNCTION_ACCESSORY
|
||||
&& function == UsbManager.FUNCTION_MTP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Utils.isMonkeyRunning();
|
||||
|
||||
Reference in New Issue
Block a user