OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.device.battery; | 5 package org.chromium.device.battery; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.util.Log; | 8 import android.util.Log; |
9 | 9 |
10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
11 import org.chromium.device.BatteryMonitor; | 11 import org.chromium.device.BatteryMonitor; |
12 import org.chromium.device.BatteryStatus; | 12 import org.chromium.device.BatteryStatus; |
13 import org.chromium.device.battery.BatteryStatusManager.BatteryStatusCallback; | 13 import org.chromium.device.battery.BatteryStatusManager.BatteryStatusCallback; |
14 import org.chromium.services.shell.InterfaceFactory; | 14 import org.chromium.services.service_manager.InterfaceFactory; |
15 | 15 |
16 import java.util.HashSet; | 16 import java.util.HashSet; |
17 | 17 |
18 /** | 18 /** |
19 * Factory that creates instances of BatteryMonitor implementations and notifies
them about battery | 19 * Factory that creates instances of BatteryMonitor implementations and notifies
them about battery |
20 * status changes. | 20 * status changes. |
21 */ | 21 */ |
22 public class BatteryMonitorFactory implements InterfaceFactory<BatteryMonitor> { | 22 public class BatteryMonitorFactory implements InterfaceFactory<BatteryMonitor> { |
23 static final String TAG = "BatteryMonitorFactory"; | 23 static final String TAG = "BatteryMonitorFactory"; |
24 | 24 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void unsubscribe(BatteryMonitorImpl monitor) { | 62 void unsubscribe(BatteryMonitorImpl monitor) { |
63 ThreadUtils.assertOnUiThread(); | 63 ThreadUtils.assertOnUiThread(); |
64 | 64 |
65 assert mSubscribedMonitors.contains(monitor); | 65 assert mSubscribedMonitors.contains(monitor); |
66 mSubscribedMonitors.remove(monitor); | 66 mSubscribedMonitors.remove(monitor); |
67 if (mSubscribedMonitors.isEmpty()) { | 67 if (mSubscribedMonitors.isEmpty()) { |
68 mManager.stop(); | 68 mManager.stop(); |
69 } | 69 } |
70 } | 70 } |
71 } | 71 } |
OLD | NEW |