Start collecting mobile radio activity from the radio.
Hook in to the new radio API to find out when the radio is active and use that to track its state in batter stats. We also still have the data being tracked from the kernel's emulation, and continue to use that if we don't get data from the radio. Currently this monitoring is turned off until some issues in the radio can be fixed that are providing bad data. Also add a new API to get estimated drain and charge times. Change-Id: Ifc4900fabb8f848f9cda361dce698664ea75f175
This commit is contained in:
@@ -20,6 +20,7 @@ import android.net.LocalSocket;
|
|||||||
import android.net.LocalSocketAddress;
|
import android.net.LocalSocketAddress;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@@ -59,6 +60,8 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
|
|
||||||
private final PowerManager.WakeLock mWakeLock;
|
private final PowerManager.WakeLock mWakeLock;
|
||||||
|
|
||||||
|
private final Looper mLooper;
|
||||||
|
|
||||||
private INativeDaemonConnectorCallbacks mCallbacks;
|
private INativeDaemonConnectorCallbacks mCallbacks;
|
||||||
private Handler mCallbackHandler;
|
private Handler mCallbackHandler;
|
||||||
|
|
||||||
@@ -74,6 +77,13 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
|
|
||||||
NativeDaemonConnector(INativeDaemonConnectorCallbacks callbacks, String socket,
|
NativeDaemonConnector(INativeDaemonConnectorCallbacks callbacks, String socket,
|
||||||
int responseQueueSize, String logTag, int maxLogSize, PowerManager.WakeLock wl) {
|
int responseQueueSize, String logTag, int maxLogSize, PowerManager.WakeLock wl) {
|
||||||
|
this(callbacks, socket, responseQueueSize, logTag, maxLogSize, wl,
|
||||||
|
FgThread.get().getLooper());
|
||||||
|
}
|
||||||
|
|
||||||
|
NativeDaemonConnector(INativeDaemonConnectorCallbacks callbacks, String socket,
|
||||||
|
int responseQueueSize, String logTag, int maxLogSize, PowerManager.WakeLock wl,
|
||||||
|
Looper looper) {
|
||||||
mCallbacks = callbacks;
|
mCallbacks = callbacks;
|
||||||
mSocket = socket;
|
mSocket = socket;
|
||||||
mResponseQueue = new ResponseQueue(responseQueueSize);
|
mResponseQueue = new ResponseQueue(responseQueueSize);
|
||||||
@@ -81,6 +91,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
if (mWakeLock != null) {
|
if (mWakeLock != null) {
|
||||||
mWakeLock.setReferenceCounted(true);
|
mWakeLock.setReferenceCounted(true);
|
||||||
}
|
}
|
||||||
|
mLooper = looper;
|
||||||
mSequenceNumber = new AtomicInteger(0);
|
mSequenceNumber = new AtomicInteger(0);
|
||||||
TAG = logTag != null ? logTag : "NativeDaemonConnector";
|
TAG = logTag != null ? logTag : "NativeDaemonConnector";
|
||||||
mLocalLog = new LocalLog(maxLogSize);
|
mLocalLog = new LocalLog(maxLogSize);
|
||||||
@@ -88,7 +99,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mCallbackHandler = new Handler(FgThread.get().getLooper(), this);
|
mCallbackHandler = new Handler(mLooper, this);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user