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);
|
mMtp.setEnabled(false);
|
||||||
mPtp.setEnabled(false);
|
mPtp.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -134,22 +133,17 @@ public class UsbSettings extends SettingsPreferenceFragment {
|
|||||||
if (Utils.isMonkeyRunning()) {
|
if (Utils.isMonkeyRunning()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// temporary hack - using check boxes as radio buttons
|
|
||||||
// don't allow unchecking them
|
String function = "none";
|
||||||
if (preference instanceof CheckBoxPreference) {
|
if (preference == mMtp && mMtp.isChecked()) {
|
||||||
CheckBoxPreference checkBox = (CheckBoxPreference)preference;
|
function = UsbManager.USB_FUNCTION_MTP;
|
||||||
if (!checkBox.isChecked()) {
|
} else if (preference == mPtp && mPtp.isChecked()) {
|
||||||
checkBox.setChecked(true);
|
function = UsbManager.USB_FUNCTION_PTP;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mUsbManager.setCurrentFunction(function, true);
|
||||||
|
updateToggles(function);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user