Loading res/values/cm_strings.xml +5 −1 Original line number Diff line number Diff line Loading @@ -813,10 +813,14 @@ two in order to insert additional control points. \'Remove\' deletes the selecte <string name="status_bar_style_hidden">Hidden</string> <string name="status_bar_battery_show_percent_title">Show battery status percent</string> <!-- development shortcut --> <!-- Development shortcut --> <string name="development_shortcut_title">Development shortcut</string> <string name="development_shortcut_summary">Enable \'wipe data\' and \'force close\' options in notification area and recent apps list</string> <!-- USB Mass Storage --> <string name="usb_mass_storage_title">Mass storage (UMS)</string> <string name="usb_mass_storage_summary">Lets you transfer any files between your computer and your SD card by mounting it as a flash device</string> <!-- WhisperPush --> <string name="whisperpush_title">WhisperPush</string> <string name="whisperpush_registration_title">Register</string> Loading res/xml/usb_settings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -32,4 +32,10 @@ android:summary="@string/usb_ptp_summary" /> <CheckBoxPreference android:key="usb_mass_storage" android:title="@string/usb_mass_storage_title" android:summary="@string/usb_mass_storage_summary" /> </PreferenceScreen> src/com/android/settings/deviceinfo/Memory.java +1 −2 Original line number Diff line number Diff line Loading @@ -177,8 +177,7 @@ public class Memory extends SettingsPreferenceFragment { public void onPrepareOptionsMenu(Menu menu) { final MenuItem usb = menu.findItem(R.id.storage_usb); UserManager um = (UserManager)getActivity().getSystemService(Context.USER_SERVICE); boolean usbItemVisible = !isMassStorageEnabled() && !um.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER); boolean usbItemVisible = !um.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER); usb.setVisible(usbItemVisible); } Loading src/com/android/settings/deviceinfo/UsbSettings.java +22 −10 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.content.IntentFilter; import android.hardware.usb.UsbManager; import android.os.Bundle; import android.os.UserManager; import android.os.storage.StorageManager; import android.os.storage.StorageVolume; import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceScreen; Loading @@ -41,10 +43,14 @@ public class UsbSettings extends SettingsPreferenceFragment { private static final String KEY_MTP = "usb_mtp"; private static final String KEY_PTP = "usb_ptp"; private static final String KEY_MASS_STORAGE = "usb_mass_storage"; private UsbManager mUsbManager; private StorageManager storageManager; private StorageVolume[] storageVolumes; private CheckBoxPreference mMtp; private CheckBoxPreference mPtp; private CheckBoxPreference mUms; private boolean mUsbAccessoryMode; private final BroadcastReceiver mStateReceiver = new BroadcastReceiver() { Loading @@ -68,11 +74,16 @@ public class UsbSettings extends SettingsPreferenceFragment { mMtp = (CheckBoxPreference)root.findPreference(KEY_MTP); mPtp = (CheckBoxPreference)root.findPreference(KEY_PTP); mUms = (CheckBoxPreference)root.findPreference(KEY_MASS_STORAGE); if (!storageVolumes[0].allowMassStorage()) { root.removePreference(mUms); } UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); if (um.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER)) { mMtp.setEnabled(false); mPtp.setEnabled(false); mUms.setEnabled(false); } return root; Loading @@ -82,6 +93,8 @@ public class UsbSettings extends SettingsPreferenceFragment { public void onCreate(Bundle icicle) { super.onCreate(icicle); mUsbManager = (UsbManager)getSystemService(Context.USB_SERVICE); storageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE); storageVolumes = storageManager.getVolumeList(); } @Override Loading @@ -104,30 +117,27 @@ public class UsbSettings extends SettingsPreferenceFragment { } private void updateToggles(String function) { if (UsbManager.USB_FUNCTION_MTP.equals(function)) { mMtp.setChecked(true); mPtp.setChecked(false); } else if (UsbManager.USB_FUNCTION_PTP.equals(function)) { mMtp.setChecked(false); mPtp.setChecked(true); } else { mMtp.setChecked(false); mPtp.setChecked(false); } mMtp.setChecked(UsbManager.USB_FUNCTION_MTP.equals(function)); mPtp.setChecked(UsbManager.USB_FUNCTION_PTP.equals(function)); mUms.setChecked(UsbManager.USB_FUNCTION_MASS_STORAGE.equals(function)); UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); if (um.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER)) { Log.e(TAG, "USB is locked down"); mMtp.setEnabled(false); mPtp.setEnabled(false); mUms.setEnabled(false); } else if (!mUsbAccessoryMode) { //Enable MTP and PTP switch while USB is not in Accessory Mode, otherwise disable it Log.e(TAG, "USB Normal Mode"); mMtp.setEnabled(true); mPtp.setEnabled(true); mUms.setEnabled(true); } else { Log.e(TAG, "USB Accessory Mode"); mMtp.setEnabled(false); mPtp.setEnabled(false); mUms.setEnabled(false); } } Loading @@ -151,6 +161,8 @@ public class UsbSettings extends SettingsPreferenceFragment { function = UsbManager.USB_FUNCTION_MTP; } else if (preference == mPtp && mPtp.isChecked()) { function = UsbManager.USB_FUNCTION_PTP; } else if (preference == mUms && mUms.isChecked()) { function = UsbManager.USB_FUNCTION_MASS_STORAGE; } mUsbManager.setCurrentFunction(function, true); Loading Loading
res/values/cm_strings.xml +5 −1 Original line number Diff line number Diff line Loading @@ -813,10 +813,14 @@ two in order to insert additional control points. \'Remove\' deletes the selecte <string name="status_bar_style_hidden">Hidden</string> <string name="status_bar_battery_show_percent_title">Show battery status percent</string> <!-- development shortcut --> <!-- Development shortcut --> <string name="development_shortcut_title">Development shortcut</string> <string name="development_shortcut_summary">Enable \'wipe data\' and \'force close\' options in notification area and recent apps list</string> <!-- USB Mass Storage --> <string name="usb_mass_storage_title">Mass storage (UMS)</string> <string name="usb_mass_storage_summary">Lets you transfer any files between your computer and your SD card by mounting it as a flash device</string> <!-- WhisperPush --> <string name="whisperpush_title">WhisperPush</string> <string name="whisperpush_registration_title">Register</string> Loading
res/xml/usb_settings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -32,4 +32,10 @@ android:summary="@string/usb_ptp_summary" /> <CheckBoxPreference android:key="usb_mass_storage" android:title="@string/usb_mass_storage_title" android:summary="@string/usb_mass_storage_summary" /> </PreferenceScreen>
src/com/android/settings/deviceinfo/Memory.java +1 −2 Original line number Diff line number Diff line Loading @@ -177,8 +177,7 @@ public class Memory extends SettingsPreferenceFragment { public void onPrepareOptionsMenu(Menu menu) { final MenuItem usb = menu.findItem(R.id.storage_usb); UserManager um = (UserManager)getActivity().getSystemService(Context.USER_SERVICE); boolean usbItemVisible = !isMassStorageEnabled() && !um.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER); boolean usbItemVisible = !um.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER); usb.setVisible(usbItemVisible); } Loading
src/com/android/settings/deviceinfo/UsbSettings.java +22 −10 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.content.IntentFilter; import android.hardware.usb.UsbManager; import android.os.Bundle; import android.os.UserManager; import android.os.storage.StorageManager; import android.os.storage.StorageVolume; import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceScreen; Loading @@ -41,10 +43,14 @@ public class UsbSettings extends SettingsPreferenceFragment { private static final String KEY_MTP = "usb_mtp"; private static final String KEY_PTP = "usb_ptp"; private static final String KEY_MASS_STORAGE = "usb_mass_storage"; private UsbManager mUsbManager; private StorageManager storageManager; private StorageVolume[] storageVolumes; private CheckBoxPreference mMtp; private CheckBoxPreference mPtp; private CheckBoxPreference mUms; private boolean mUsbAccessoryMode; private final BroadcastReceiver mStateReceiver = new BroadcastReceiver() { Loading @@ -68,11 +74,16 @@ public class UsbSettings extends SettingsPreferenceFragment { mMtp = (CheckBoxPreference)root.findPreference(KEY_MTP); mPtp = (CheckBoxPreference)root.findPreference(KEY_PTP); mUms = (CheckBoxPreference)root.findPreference(KEY_MASS_STORAGE); if (!storageVolumes[0].allowMassStorage()) { root.removePreference(mUms); } UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); if (um.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER)) { mMtp.setEnabled(false); mPtp.setEnabled(false); mUms.setEnabled(false); } return root; Loading @@ -82,6 +93,8 @@ public class UsbSettings extends SettingsPreferenceFragment { public void onCreate(Bundle icicle) { super.onCreate(icicle); mUsbManager = (UsbManager)getSystemService(Context.USB_SERVICE); storageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE); storageVolumes = storageManager.getVolumeList(); } @Override Loading @@ -104,30 +117,27 @@ public class UsbSettings extends SettingsPreferenceFragment { } private void updateToggles(String function) { if (UsbManager.USB_FUNCTION_MTP.equals(function)) { mMtp.setChecked(true); mPtp.setChecked(false); } else if (UsbManager.USB_FUNCTION_PTP.equals(function)) { mMtp.setChecked(false); mPtp.setChecked(true); } else { mMtp.setChecked(false); mPtp.setChecked(false); } mMtp.setChecked(UsbManager.USB_FUNCTION_MTP.equals(function)); mPtp.setChecked(UsbManager.USB_FUNCTION_PTP.equals(function)); mUms.setChecked(UsbManager.USB_FUNCTION_MASS_STORAGE.equals(function)); UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); if (um.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER)) { Log.e(TAG, "USB is locked down"); mMtp.setEnabled(false); mPtp.setEnabled(false); mUms.setEnabled(false); } else if (!mUsbAccessoryMode) { //Enable MTP and PTP switch while USB is not in Accessory Mode, otherwise disable it Log.e(TAG, "USB Normal Mode"); mMtp.setEnabled(true); mPtp.setEnabled(true); mUms.setEnabled(true); } else { Log.e(TAG, "USB Accessory Mode"); mMtp.setEnabled(false); mPtp.setEnabled(false); mUms.setEnabled(false); } } Loading @@ -151,6 +161,8 @@ public class UsbSettings extends SettingsPreferenceFragment { function = UsbManager.USB_FUNCTION_MTP; } else if (preference == mPtp && mPtp.isChecked()) { function = UsbManager.USB_FUNCTION_PTP; } else if (preference == mUms && mUms.isChecked()) { function = UsbManager.USB_FUNCTION_MASS_STORAGE; } mUsbManager.setCurrentFunction(function, true); Loading