Refactor setCurrentFunction and setUsbDataUnlocked into one method

This allows us to get rid of an extraneous config switch and
simplify some code.

Test: Manually change usb configuration
Change-Id: Id78da530ff485ecd7a915056832eec1dd8c91954
(cherry picked from commit 5d36a177d9)
This commit is contained in:
Jerry Zhang
2016-10-12 14:42:56 -07:00
parent 363c529dc6
commit a1b60e629f
2 changed files with 6 additions and 11 deletions

View File

@@ -1704,11 +1704,10 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private void writeUsbConfigurationOption(Object newValue) {
UsbManager manager = (UsbManager)getActivity().getSystemService(Context.USB_SERVICE);
String function = newValue.toString();
manager.setCurrentFunction(function);
if (function.equals("none")) {
manager.setUsbDataUnlocked(false);
manager.setCurrentFunction(function, false);
} else {
manager.setUsbDataUnlocked(true);
manager.setCurrentFunction(function, true);
}
}