Handle the case where USB_STATE intent is not received yet.

Call updateUsbConfigurationValues() when ACTION_USB_STATE intent
is not yet received so that mUsbConfiguration value is properly
initialized in this case.

BUG: 22163689
Change-Id: I2aeed43fc49e40c52cdc2bfc08d43081815b49d1
This commit is contained in:
Yasuhiro Matsuda
2015-07-22 21:36:23 +09:00
parent 423a891b38
commit 4a109b1d87

View File

@@ -552,7 +552,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
Bundle savedInstanceState) {
IntentFilter filter = new IntentFilter();
filter.addAction(UsbManager.ACTION_USB_STATE);
getActivity().registerReceiver(mUsbReceiver, filter);
if (getActivity().registerReceiver(mUsbReceiver, filter) == null) {
updateUsbConfigurationValues();
}
return super.onCreateView(inflater, container, savedInstanceState);
}