Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: device/battery/android/java/src/org/chromium/device/battery/BatteryStatusManager.java

Issue 2830843004: Update to newer Android Lint and suppress new Lint errors (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.annotation.SuppressLint;
7 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
8 import android.content.BroadcastReceiver; 9 import android.content.BroadcastReceiver;
9 import android.content.Context; 10 import android.content.Context;
10 import android.content.Intent; 11 import android.content.Intent;
11 import android.content.IntentFilter; 12 import android.content.IntentFilter;
12 import android.os.BatteryManager; 13 import android.os.BatteryManager;
13 import android.os.Build; 14 import android.os.Build;
14 import android.util.Log; 15 import android.util.Log;
15 16
16 import org.chromium.base.VisibleForTesting; 17 import org.chromium.base.VisibleForTesting;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 private boolean mEnabled; 52 private boolean mEnabled;
52 53
53 @VisibleForTesting 54 @VisibleForTesting
54 static class AndroidBatteryManagerWrapper { 55 static class AndroidBatteryManagerWrapper {
55 private final BatteryManager mBatteryManager; 56 private final BatteryManager mBatteryManager;
56 57
57 protected AndroidBatteryManagerWrapper(BatteryManager batteryManager) { 58 protected AndroidBatteryManagerWrapper(BatteryManager batteryManager) {
58 mBatteryManager = batteryManager; 59 mBatteryManager = batteryManager;
59 } 60 }
60 61
62 @SuppressLint("NewApi")
61 public int getIntProperty(int id) { 63 public int getIntProperty(int id) {
62 return mBatteryManager.getIntProperty(id); 64 return mBatteryManager.getIntProperty(id);
63 } 65 }
64 } 66 }
65 67
66 private BatteryStatusManager(Context context, BatteryStatusCallback callback , 68 private BatteryStatusManager(Context context, BatteryStatusCallback callback ,
67 boolean ignoreBatteryPresentState, 69 boolean ignoreBatteryPresentState,
68 @Nullable AndroidBatteryManagerWrapper batteryManager) { 70 @Nullable AndroidBatteryManagerWrapper batteryManager) {
69 mAppContext = context.getApplicationContext(); 71 mAppContext = context.getApplicationContext();
70 mCallback = callback; 72 mCallback = callback;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 185 }
184 } else { 186 } else {
185 if (averageCurrentMicroA < 0) { 187 if (averageCurrentMicroA < 0) {
186 double dischargeFromFullHours = batteryCapacityMicroAh / -averag eCurrentMicroA; 188 double dischargeFromFullHours = batteryCapacityMicroAh / -averag eCurrentMicroA;
187 batteryStatus.dischargingTime = 189 batteryStatus.dischargingTime =
188 Math.floor(remainingCapacityRatio * dischargeFromFullHou rs * 3600.0); 190 Math.floor(remainingCapacityRatio * dischargeFromFullHou rs * 3600.0);
189 } 191 }
190 } 192 }
191 } 193 }
192 } 194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698