diff options
| author | 2018-02-05 21:16:23 +0000 | |
|---|---|---|
| committer | 2018-02-05 21:16:23 +0000 | |
| commit | 367358ec364d9aca36b305879672f7c26db27469 (patch) | |
| tree | b608f08902b03be90c22e6342ae5af102e469f13 | |
| parent | 62d8fc2594d7fc5a151b9edc501a70196a702ac2 (diff) | |
| parent | c2d6544e049cf11f4a0923558fb7c71f2b90219c (diff) | |
Merge "fix bluetooth puller + bluetooth adapter may be lost, in which case we should try to get it again"
| -rw-r--r-- | services/core/java/com/android/server/stats/StatsCompanionService.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java index f498cdd85ee8..c280739f2e1a 100644 --- a/services/core/java/com/android/server/stats/StatsCompanionService.java +++ b/services/core/java/com/android/server/stats/StatsCompanionService.java @@ -113,7 +113,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { new StatFs(Environment.getRootDirectory().getAbsolutePath()); private final StatFs mStatFsTemp = new StatFs(Environment.getDownloadCacheDirectory().getAbsolutePath()); - private final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); public StatsCompanionService(Context context) { super(); @@ -677,12 +676,13 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } private synchronized BluetoothActivityEnergyInfo pullBluetoothData() { + final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter != null) { - SynchronousResultReceiver bluetoothReceiver = null; - bluetoothReceiver = new SynchronousResultReceiver("bluetooth"); + SynchronousResultReceiver bluetoothReceiver = new SynchronousResultReceiver("bluetooth"); adapter.requestControllerActivityEnergyInfo(bluetoothReceiver); return awaitControllerInfo(bluetoothReceiver); } else { + Slog.e(TAG, "Failed to get bluetooth adapter!"); return null; } } |