diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java index 7056e03edefcc..1c3cb2eea4977 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java @@ -167,10 +167,9 @@ class QuickSettings { startSettingsActivity(intent); } private void startSettingsActivity(Intent intent) { - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); mBar.collapseAllPanels(true); mContext.startActivity(intent); - } private void addUserTiles(ViewGroup parent, LayoutInflater inflater) { @@ -310,23 +309,25 @@ class QuickSettings { parent.addView(airplaneTile); // Bluetooth - QuickSettingsTileView bluetoothTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - bluetoothTile.setContent(R.layout.quick_settings_tile_bluetooth, inflater); - bluetoothTile.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - startSettingsActivity(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS); - } - }); - mModel.addBluetoothTile(bluetoothTile, new QuickSettingsModel.RefreshCallback() { - @Override - public void refreshView(QuickSettingsTileView view, State state) { - TextView tv = (TextView) view.findViewById(R.id.bluetooth_textview); - tv.setCompoundDrawablesRelativeWithIntrinsicBounds(0, state.iconId, 0, 0); - } - }); - parent.addView(bluetoothTile); + if (mModel.deviceSupportsBluetooth()) { + QuickSettingsTileView bluetoothTile = (QuickSettingsTileView) + inflater.inflate(R.layout.quick_settings_tile, parent, false); + bluetoothTile.setContent(R.layout.quick_settings_tile_bluetooth, inflater); + bluetoothTile.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + startSettingsActivity(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS); + } + }); + mModel.addBluetoothTile(bluetoothTile, new QuickSettingsModel.RefreshCallback() { + @Override + public void refreshView(QuickSettingsTileView view, State state) { + TextView tv = (TextView) view.findViewById(R.id.bluetooth_textview); + tv.setCompoundDrawablesRelativeWithIntrinsicBounds(0, state.iconId, 0, 0); + } + }); + parent.addView(bluetoothTile); + } // Brightness QuickSettingsTileView brightnessTile = (QuickSettingsTileView) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java index 2318921c007db..aa40f3c90c436 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java @@ -258,6 +258,9 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); onBluetoothStateChange(adapter.isEnabled()); } + boolean deviceSupportsBluetooth() { + return (BluetoothAdapter.getDefaultAdapter() != null); + } // BluetoothController callback @Override public void onBluetoothStateChange(boolean on) {