Proper fix for zero signal strength and no_service. Fixes #2176141
Track phone service state changes and use a separate timer for out-of-service
since the hunting can timeout on some devices.
Store the timeout value in the config.xml, as it is device/network specific.
Settings App will also change to use the hunting duration to compute the cost
of zero signal.
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index a49a27a0..b706c5c 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -130,6 +130,7 @@
private static final String MISC_DATA = "m";
private static final String SCREEN_BRIGHTNESS_DATA = "br";
private static final String SIGNAL_STRENGTH_TIME_DATA = "sgt";
+ private static final String SIGNAL_SCANNING_TIME_DATA = "sst";
private static final String SIGNAL_STRENGTH_COUNT_DATA = "sgc";
private static final String DATA_CONNECTION_TIME_DATA = "dct";
private static final String DATA_CONNECTION_COUNT_DATA = "dcc";
@@ -440,6 +441,15 @@
long batteryRealtime, int which);
/**
+ * Returns the time in microseconds that the phone has been trying to
+ * acquire a signal.
+ *
+ * {@hide}
+ */
+ public abstract long getPhoneSignalScanningTime(
+ long batteryRealtime, int which);
+
+ /**
* Returns the number of times the phone has entered the given signal strength.
*
* {@hide}
@@ -823,6 +833,8 @@
args[i] = getPhoneSignalStrengthTime(i, batteryRealtime, which) / 1000;
}
dumpLine(pw, 0 /* uid */, category, SIGNAL_STRENGTH_TIME_DATA, args);
+ dumpLine(pw, 0 /* uid */, category, SIGNAL_SCANNING_TIME_DATA,
+ getPhoneSignalScanningTime(batteryRealtime, which) / 1000);
for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
args[i] = getPhoneSignalStrengthCount(i, which);
}
@@ -1130,7 +1142,13 @@
}
if (!didOne) sb.append("No activity");
pw.println(sb.toString());
-
+
+ sb.setLength(0);
+ sb.append(prefix);
+ sb.append(" Signal scanning time: ");
+ formatTimeMs(sb, getPhoneSignalScanningTime(batteryRealtime, which) / 1000);
+ pw.println(sb.toString());
+
sb.setLength(0);
sb.append(prefix);
sb.append(" Radio types: ");