summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/CountryDetectorService.java
diff options
context:
space:
mode:
authorMakoto Onuki <omakoto@google.com>2011-12-13 14:02:32 -0800
committerMakoto Onuki <omakoto@google.com>2011-12-13 14:02:32 -0800
commitd73b79bb314dde86cf8ff9300fefc133b31841d1 (patch)
treea53994afb14a9a58be2a5088aa903fbe7495ff71 /services/java/com/android/server/CountryDetectorService.java
parent19a06fe93cccb4b1dd224b8456969821a19b07ef (diff)
Cherry-picking Id45abeba and Ia065dec6 for MR1
------------------------------------------------------- MCC detection fixes for CountryDetector - Don't get and cache phone tpe at the initialization time. At this point TelephonyManager is probably not ready yet. - Refresh MCC whenever we get the service state changed callback, even when the state hasn't actually changed, in order to make sure we get refresh country properly when MCC changes. - Also remove the initialization of mPhoneStateListener, which prevented us from registering phone state listener properly. - Also fix tests which were already failing. Bug 5670680 ------------------------------------------------------- Add logging to country detector logic This is for debugging purposes to verify the effects of change Id45abeba1b1e843053ac2c946861b439ca568de4. Bug: 5670680 Change-Id: I238d953484e2c8135f7dac70fce8662c8300a286
Diffstat (limited to 'services/java/com/android/server/CountryDetectorService.java')
-rw-r--r--services/java/com/android/server/CountryDetectorService.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/services/java/com/android/server/CountryDetectorService.java b/services/java/com/android/server/CountryDetectorService.java
index 3081ebefd05a..ab61a3c003b8 100644
--- a/services/java/com/android/server/CountryDetectorService.java
+++ b/services/java/com/android/server/CountryDetectorService.java
@@ -16,6 +16,8 @@
package com.android.server;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.util.HashMap;
import com.android.server.location.ComprehensiveCountryDetector;
@@ -30,6 +32,8 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Process;
import android.os.RemoteException;
+import android.util.PrintWriterPrinter;
+import android.util.Printer;
import android.util.Slog;
/**
@@ -75,7 +79,7 @@ public class CountryDetectorService extends ICountryDetector.Stub implements Run
}
}
- private final static String TAG = "CountryDetectorService";
+ private final static String TAG = "CountryDetector";
private final HashMap<IBinder, Receiver> mReceivers;
private final Context mContext;
@@ -201,4 +205,20 @@ public class CountryDetectorService extends ICountryDetector.Stub implements Run
boolean isSystemReady() {
return mSystemReady;
}
+
+ @Override
+ protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
+ try {
+ final Printer p = new PrintWriterPrinter(fout);
+ p.println("CountryDetectorService state:");
+ p.println(" Number of listeners=" + mReceivers.keySet().size());
+ if (mCountryDetector == null) {
+ p.println(" ComprehensiveCountryDetector not initialized");
+ } else {
+ p.println(" " + mCountryDetector.toString());
+ }
+ } catch (Exception e) {
+ Slog.e(TAG, "Failed to dump CountryDetectorService: ", e);
+ }
+ }
}