summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/TelephonyRegistry.java
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2014-07-10 13:01:52 -0700
committerWink Saville <wink@google.com>2014-07-10 20:02:43 +0000
commit47d8d1b0a8641a1c346da39f5052ae5aa845d117 (patch)
treece0f3d304155d73a5a07f612acce15acda8b7db4 /services/core/java/com/android/server/TelephonyRegistry.java
parentf924e9507b6fff0dcfd201892e6eec623dfc5f92 (diff)
downloadframeworks_base-47d8d1b0a8641a1c346da39f5052ae5aa845d117.zip
frameworks_base-47d8d1b0a8641a1c346da39f5052ae5aa845d117.tar.gz
frameworks_base-47d8d1b0a8641a1c346da39f5052ae5aa845d117.tar.bz2
Ignore hasService in updateTelephonySignalStrength
A possible reason for empty triangle is there is no service, I'm temporarily ignoring hasService in updateTelphonySignalStrength and adding more debug. Add logSSC to see history of Service State Changes. Bug: 16148026 Change-Id: Ia463997eac7b062653b3cef00570d3fffc115ad3
Diffstat (limited to 'services/core/java/com/android/server/TelephonyRegistry.java')
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java73
1 files changed, 68 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 88598c9..a19eb15 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -47,8 +47,10 @@ import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
import android.telephony.PreciseDisconnectCause;
import android.text.TextUtils;
+import android.text.format.Time;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.List;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -354,10 +356,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
int phoneId = SubscriptionManager.getPhoneId(subId);
r.events = events;
- if (true/*DBG*/) log("listen: set events record=" + r);
+ if (true/*DBG*/) log("listen: set events record=" + r + " subId=" + subId + " phoneId=" + phoneId);
+ toStringLogSSC("listen");
if (notifyNow && validatePhoneId(phoneId)) {
if ((events & PhoneStateListener.LISTEN_SERVICE_STATE) != 0) {
try {
+ log("listen: call onSSC state=" + mServiceState[phoneId]);
r.callback.onServiceStateChanged(
new ServiceState(mServiceState[phoneId]));
} catch (RemoteException ex) {
@@ -550,14 +554,17 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
subId = mDefaultSubId;
log("notifyServiceStateUsingSubId: using mDefaultSubId=" + mDefaultSubId);
}
- if (true/*VDBG*/) {
- log("notifyServiceStateUsingSubId: subId=" + subId
- + " state=" + state);
- }
synchronized (mRecords) {
int phoneId = SubscriptionManager.getPhoneId(subId);
+ if (true/*VDBG*/) {
+ log("notifyServiceStateUsingSubId: subId=" + subId + " phoneId=" + phoneId
+ + " state=" + state);
+ }
if (validatePhoneId(phoneId)) {
mServiceState[phoneId] = state;
+ logServiceStateChanged("notifyServiceStateUsingSubId", subId, phoneId, state);
+ toStringLogSSC("notifyServiceStateUsingSubId");
+
for (Record r : mRecords) {
log("notifyServiceStateUsingSubId: r.events=0x" + Integer.toHexString(r.events) + " r.subId=" + r.subId + " subId=" + subId + " state=" + state);
// FIXME: use DEFAULT_SUB_ID instead??
@@ -591,6 +598,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
if (true/*VDBG*/) {
log("notifySignalStrengthUsingSubId: subId=" + subId
+ " signalStrength=" + signalStrength);
+ toStringLogSSC("notifySignalStrengthUsingSubId");
}
synchronized (mRecords) {
int phoneId = SubscriptionManager.getPhoneId(subId);
@@ -1295,4 +1303,59 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
private static void log(String s) {
Rlog.d(TAG, s);
}
+
+ private static class LogSSC {
+ private Time mTime;
+ private String mS;
+ private long mSubId;
+ private int mPhoneId;
+ private ServiceState mState;
+
+ public void set(Time t, String s, long subId, int phoneId, ServiceState state) {
+ mTime = t; mS = s; mSubId = subId; mPhoneId = phoneId; mState = state;
+ }
+
+ @Override
+ public String toString() {
+ return mS + " " + mTime.toString() + " " + mSubId + " " + mPhoneId + " " + mState;
+ }
+ }
+
+ private LogSSC logSSC [] = new LogSSC[10];
+ private int next = 0;
+
+ private void logServiceStateChanged(String s, long subId, int phoneId, ServiceState state) {
+ if (logSSC == null || logSSC.length == 0) {
+ return;
+ }
+ if (logSSC[next] == null) {
+ logSSC[next] = new LogSSC();
+ }
+ Time t = new Time();
+ t.setToNow();
+ logSSC[next].set(t, s, subId, phoneId, state);
+ if (++next >= logSSC.length) {
+ next = 0;
+ }
+ }
+
+ private void toStringLogSSC(String prompt) {
+ if (logSSC == null || logSSC.length == 0 || (next == 0 && logSSC[next] == null)) {
+ log(prompt + ": logSSC is empty");
+ } else {
+ // There is at least one element
+ log(prompt + ": logSSC.length=" + logSSC.length + " next=" + next);
+ int i = next;
+ if (logSSC[i] == null) {
+ // logSSC is not full so back to the beginning
+ i = 0;
+ }
+ do {
+ log(logSSC[i].toString());
+ if (++i >= logSSC.length) {
+ i = 0;
+ }
+ } while (i != next);
+ }
+ }
}