• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


コミットメタ情報

リビジョン9372484065993cfdb9a48ddecc52d2ed911e8ce1 (tree)
日時2012-02-29 02:58:45
作者Amith Yamasani <yamasani@goog...>
コミッターXavier Ducrohet

ログメッセージ

Don't crash if there's no bluetooth functionality (such as in an emulator) do not merge.

Bug: 6079494

(cherry picked from commit 5fb53f36cb77c3d924b3fe5c305ce7d082ecdfb8)

Change-Id: Ia0d3a638f93c7c7923ce6e85f3555af0aeda96f9

変更サマリ

差分

--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -138,21 +138,26 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
138138 public void onResume() {
139139 // resume BluetoothEnabler before calling super.onResume() so we don't get
140140 // any onDeviceAdded() callbacks before setting up view in updateContent()
141- mBluetoothEnabler.resume();
141+ if (mBluetoothEnabler != null) {
142+ mBluetoothEnabler.resume();
143+ }
142144 super.onResume();
143145
144146 if (mDiscoverableEnabler != null) {
145147 mDiscoverableEnabler.resume();
146148 }
147149 getActivity().registerReceiver(mReceiver, mIntentFilter);
148-
149- updateContent(mLocalAdapter.getBluetoothState(), mActivityStarted);
150+ if (mLocalAdapter != null) {
151+ updateContent(mLocalAdapter.getBluetoothState(), mActivityStarted);
152+ }
150153 }
151154
152155 @Override
153156 public void onPause() {
154157 super.onPause();
155- mBluetoothEnabler.pause();
158+ if (mBluetoothEnabler != null) {
159+ mBluetoothEnabler.pause();
160+ }
156161 getActivity().unregisterReceiver(mReceiver);
157162 if (mDiscoverableEnabler != null) {
158163 mDiscoverableEnabler.pause();
@@ -161,6 +166,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
161166
162167 @Override
163168 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
169+ if (mLocalAdapter == null) return;
164170 boolean bluetoothIsEnabled = mLocalAdapter.getBluetoothState() == BluetoothAdapter.STATE_ON;
165171 boolean isDiscovering = mLocalAdapter.isDiscovering();
166172 int textId = isDiscovering ? R.string.bluetooth_searching_for_devices :
--- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
+++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
@@ -96,6 +96,7 @@ public abstract class DeviceListPreferenceFragment extends
9696 @Override
9797 public void onResume() {
9898 super.onResume();
99+ if (mLocalManager == null) return;
99100
100101 mLocalManager.setForegroundActivity(getActivity());
101102 mLocalManager.getEventManager().registerCallback(this);
@@ -106,6 +107,8 @@ public abstract class DeviceListPreferenceFragment extends
106107 @Override
107108 public void onPause() {
108109 super.onPause();
110+ if (mLocalManager == null) return;
111+
109112 removeAllDevices();
110113 mLocalManager.setForegroundActivity(null);
111114 mLocalManager.getEventManager().unregisterCallback(this);