Merge commit '616b281b' into merge-conflict-TelephonySignal-Strength-cleanup
[android/platform/frameworks/opt/telephony.git] / src / java / com / android / internal / telephony / cdma / CdmaServiceStateTracker.java
index 697ad73..5c91983 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -47,6 +47,8 @@ import android.os.SystemProperties;
 import android.provider.Settings;
 import android.provider.Settings.Secure;
 import android.provider.Settings.SettingNotFoundException;
+import android.telephony.CellInfo;
+import android.telephony.CellInfoCdma;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
 import android.telephony.cdma.CdmaCellLocation;
@@ -60,6 +62,7 @@ import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 import java.util.TimeZone;
 
 /**
@@ -157,15 +160,16 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
     };
 
     public CdmaServiceStateTracker(CDMAPhone phone) {
-        super(phone, phone.mCM);
+        this(phone, new CellInfoCdma());
+    }
+
+    protected CdmaServiceStateTracker(CDMAPhone phone, CellInfo cellInfo) {
+        super(phone, phone.mCM, cellInfo);
 
         this.phone = phone;
         cr = phone.getContext().getContentResolver();
-        ss = new ServiceState();
-        newSS = new ServiceState();
         cellLoc = new CdmaCellLocation();
         newCellLoc = new CdmaCellLocation();
-        mSignalStrength = new SignalStrength();
 
         mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(phone.getContext(), cm, this,
                 EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
@@ -180,7 +184,6 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
 
         cm.registerForVoiceNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED_CDMA, null);
         cm.setOnNITZTime(this, EVENT_NITZ_TIME, null);
-        cm.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null);
 
         cm.registerForCdmaPrlChanged(this, EVENT_CDMA_PRL_VERSION_CHANGED, null);
         phone.registerForEriFileLoaded(this, EVENT_ERI_FILE_LOADED, null);
@@ -199,6 +202,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
         setSignalStrengthDefaultValues();
     }
 
+    @Override
     public void dispose() {
         checkCorrectThread();
         // Unregister for all events.
@@ -208,12 +212,12 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
         phone.unregisterForEriFileLoaded(this);
         if (mIccCard != null) {mIccCard.unregisterForReady(this);}
         if (mIccRecords != null) {mIccRecords.unregisterForRecordsLoaded(this);}
-        cm.unSetOnSignalStrengthUpdate(this);
         cm.unSetOnNITZTime(this);
         cr.unregisterContentObserver(mAutoTimeObserver);
         cr.unregisterContentObserver(mAutoTimeZoneObserver);
         mCdmaSSM.dispose(this);
         cm.unregisterForCdmaPrlChanged(this);
+        super.dispose();
     }
 
     @Override
@@ -322,7 +326,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
                 return;
             }
             ar = (AsyncResult) msg.obj;
-            onSignalStrengthResult(ar, phone, false);
+            onSignalStrengthResult(ar, false);
             queueNextSignalStrengthPoll();
 
             break;
@@ -443,7 +447,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
             // so we don't have to ask it.
             dontPollSignalStrength = true;
 
-            onSignalStrengthResult(ar, phone, false);
+            onSignalStrengthResult(ar, false);
             break;
 
         case EVENT_RUIM_RECORDS_LOADED:
@@ -1070,6 +1074,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
         if (hasLocationChanged) {
             phone.notifyLocationChanged();
         }
+        // TODO: Add CdmaCellIdenity updating, see CdmaLteServiceStateTracker.
     }
 
     /**
@@ -1337,7 +1342,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
                 mZoneTime    = c.getTimeInMillis();
             }
             if (DBG) {
-                log("NITZ: tzOffset=" + tzOffset + " dst=" + dst + " zone=" + zone.getID() +
+                log("NITZ: tzOffset=" + tzOffset + " dst=" + dst + " zone=" +
+                        (zone!=null ? zone.getID() : "NULL") +
                         " iso=" + iso + " mGotCountryCode=" + mGotCountryCode +
                         " mNeedFixZone=" + mNeedFixZone);
             }
@@ -1691,6 +1697,14 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
         }
     }
 
+    /**
+     * @return all available cell information or null if none.
+     */
+    @Override
+    public List<CellInfo> getAllCellInfo() {
+        return null;
+    }
+
     @Override
     protected void log(String s) {
         Log.d(LOG_TAG, "[CdmaSST] " + s);