Loading src/com/android/settings/bluetooth/DevicePickerFragment.java +18 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment { private String mLaunchPackage; private String mLaunchClass; private boolean mStartScanOnResume; private boolean mDeviceSelected; @Override void addPreferencesForActivity() { Loading Loading @@ -103,12 +104,28 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment { public void onResume() { super.onResume(); addCachedDevices(); mDeviceSelected = false; if (mStartScanOnResume) { mLocalAdapter.startScanning(true); mStartScanOnResume = false; } } @Override public void onPause() { super.onPause(); /* Check if any device was selected, if no device selected * send ACTION_DEVICE_NOT_SELECTED intent, otherwise * don;t do anything */ if (!mDeviceSelected) { Intent intent = new Intent(BluetoothDevicePicker.ACTION_DEVICE_NOT_SELECTED); if (mLaunchPackage != null && mLaunchClass != null) { intent.setClassName(mLaunchPackage, mLaunchClass); } getActivity().sendBroadcast(intent); } } @Override void onDevicePreferenceClick(BluetoothDevicePreference btPreference) { mLocalAdapter.stopScanning(); Loading Loading @@ -144,6 +161,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment { } private void sendDevicePickedIntent(BluetoothDevice device) { mDeviceSelected = true; Intent intent = new Intent(BluetoothDevicePicker.ACTION_DEVICE_SELECTED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); if (mLaunchPackage != null && mLaunchClass != null) { Loading Loading
src/com/android/settings/bluetooth/DevicePickerFragment.java +18 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment { private String mLaunchPackage; private String mLaunchClass; private boolean mStartScanOnResume; private boolean mDeviceSelected; @Override void addPreferencesForActivity() { Loading Loading @@ -103,12 +104,28 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment { public void onResume() { super.onResume(); addCachedDevices(); mDeviceSelected = false; if (mStartScanOnResume) { mLocalAdapter.startScanning(true); mStartScanOnResume = false; } } @Override public void onPause() { super.onPause(); /* Check if any device was selected, if no device selected * send ACTION_DEVICE_NOT_SELECTED intent, otherwise * don;t do anything */ if (!mDeviceSelected) { Intent intent = new Intent(BluetoothDevicePicker.ACTION_DEVICE_NOT_SELECTED); if (mLaunchPackage != null && mLaunchClass != null) { intent.setClassName(mLaunchPackage, mLaunchClass); } getActivity().sendBroadcast(intent); } } @Override void onDevicePreferenceClick(BluetoothDevicePreference btPreference) { mLocalAdapter.stopScanning(); Loading Loading @@ -144,6 +161,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment { } private void sendDevicePickedIntent(BluetoothDevice device) { mDeviceSelected = true; Intent intent = new Intent(BluetoothDevicePicker.ACTION_DEVICE_SELECTED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); if (mLaunchPackage != null && mLaunchClass != null) { Loading