Allow disabling both MTP and PTP.
Require that MTP and PTP are mutually exclusive when enabled, but allow them to be both disabled. Users can enable them again under Storage menu item in Settings. Bug: 6518257 Change-Id: I43419fa619ce2c62dd5e8c14d6c645d24fd8943a
This commit is contained in:
@@ -123,7 +123,6 @@ public class UsbSettings extends SettingsPreferenceFragment {
|
||||
mMtp.setEnabled(false);
|
||||
mPtp.setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,22 +133,17 @@ public class UsbSettings extends SettingsPreferenceFragment {
|
||||
if (Utils.isMonkeyRunning()) {
|
||||
return true;
|
||||
}
|
||||
// temporary hack - using check boxes as radio buttons
|
||||
// don't allow unchecking them
|
||||
if (preference instanceof CheckBoxPreference) {
|
||||
CheckBoxPreference checkBox = (CheckBoxPreference)preference;
|
||||
if (!checkBox.isChecked()) {
|
||||
checkBox.setChecked(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (preference == mMtp) {
|
||||
mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_MTP, true);
|
||||
updateToggles(UsbManager.USB_FUNCTION_MTP);
|
||||
} else if (preference == mPtp) {
|
||||
mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_PTP, true);
|
||||
updateToggles(UsbManager.USB_FUNCTION_PTP);
|
||||
|
||||
String function = "none";
|
||||
if (preference == mMtp && mMtp.isChecked()) {
|
||||
function = UsbManager.USB_FUNCTION_MTP;
|
||||
} else if (preference == mPtp && mPtp.isChecked()) {
|
||||
function = UsbManager.USB_FUNCTION_PTP;
|
||||
}
|
||||
|
||||
mUsbManager.setCurrentFunction(function, true);
|
||||
updateToggles(function);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user