am e9aa4b27
: Merge "Add additional debug for time zone handling." into jb-dev
* commit 'e9aa4b27af4fe68b999f906aea80847fa1f4b0d8': Add additional debug for time zone handling.
This commit is contained in:
@ -26,6 +26,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.TimeZone;
|
||||
import java.util.Date;
|
||||
@ -381,4 +382,22 @@ public class TimeUtils {
|
||||
}
|
||||
formatDuration(time-now, pw, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a System.currentTimeMillis() value to a time of day value like
|
||||
* that printed in logs. MM-DD HH:MM:SS.MMM
|
||||
*
|
||||
* @param millis since the epoch (1/1/1970)
|
||||
* @return String representation of the time.
|
||||
* @hide
|
||||
*/
|
||||
public static String logTimeOfDay(long millis) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
if (millis >= 0) {
|
||||
c.setTimeInMillis(millis);
|
||||
return String.format("%tm-%td %tH:%tM:%tS.%tL", c, c, c, c, c, c);
|
||||
} else {
|
||||
return Long.toString(millis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import android.os.AsyncResult;
|
||||
import android.os.Message;
|
||||
import android.os.SystemProperties;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TimeUtils;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@ -1224,21 +1225,6 @@ public abstract class DataConnection extends StateMachine {
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a System.currentTimeMillis() value to a time of day value.
|
||||
*
|
||||
* @param millis since the epoch (1/1/1970)
|
||||
* @return String representation of the time.
|
||||
*/
|
||||
private String timeMillisToTimeOfDay(long millis) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
if (millis >= 0) {
|
||||
c.setTimeInMillis(millis);
|
||||
return String.format("%tm-%td %tH:%tM:%tS.%tL", c, c, c, c, c, c);
|
||||
} else {
|
||||
return Long.toString(millis);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Dump the current state.
|
||||
*
|
||||
@ -1263,8 +1249,8 @@ public abstract class DataConnection extends StateMachine {
|
||||
pw.println(" mLinkProperties=" + mLinkProperties);
|
||||
pw.flush();
|
||||
pw.println(" mCapabilities=" + mCapabilities);
|
||||
pw.println(" createTime=" + timeMillisToTimeOfDay(createTime));
|
||||
pw.println(" lastFailTime=" + timeMillisToTimeOfDay(lastFailTime));
|
||||
pw.println(" createTime=" + TimeUtils.logTimeOfDay(createTime));
|
||||
pw.println(" lastFailTime=" + TimeUtils.logTimeOfDay(lastFailTime));
|
||||
pw.println(" lastFailCause=" + lastFailCause);
|
||||
pw.flush();
|
||||
pw.println(" mRetryOverride=" + mRetryOverride);
|
||||
|
@ -23,6 +23,7 @@ import android.os.Registrant;
|
||||
import android.os.RegistrantList;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SignalStrength;
|
||||
import android.util.TimeUtils;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@ -507,13 +508,15 @@ public abstract class ServiceStateTracker extends Handler {
|
||||
// Determine retVal
|
||||
boolean retVal = ((iccCardExist && (mcc != prevMcc)) || needToFixTimeZone);
|
||||
if (DBG) {
|
||||
long ctm = System.currentTimeMillis();
|
||||
log("shouldFixTimeZoneNow: retVal=" + retVal +
|
||||
" iccCard=" + iccCard +
|
||||
" iccCard.state=" + (iccCard == null ? "null" : iccCard.getState().toString()) +
|
||||
" iccCardExist=" + iccCardExist +
|
||||
" operatorNumeric=" + operatorNumeric + " mcc=" + mcc +
|
||||
" prevOperatorNumeric=" + prevOperatorNumeric + " prevMcc=" + prevMcc +
|
||||
" needToFixTimeZone=" + needToFixTimeZone);
|
||||
" needToFixTimeZone=" + needToFixTimeZone +
|
||||
" ltod=" + TimeUtils.logTimeOfDay(ctm));
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
@ -878,13 +878,19 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
|
||||
// For NITZ string without time zone,
|
||||
// need adjust time to reflect default time zone setting
|
||||
zone = TimeZone.getDefault();
|
||||
long tzOffset;
|
||||
tzOffset = zone.getOffset(System.currentTimeMillis());
|
||||
long ctm = System.currentTimeMillis();
|
||||
long tzOffset = zone.getOffset(ctm);
|
||||
if (DBG) {
|
||||
log("fixTimeZone: tzOffset=" + tzOffset + " ltod=" + TimeUtils.logTimeOfDay(ctm));
|
||||
}
|
||||
if (getAutoTime()) {
|
||||
setAndBroadcastNetworkSetTime(System.currentTimeMillis() - tzOffset);
|
||||
long adj = ctm - tzOffset;
|
||||
if (DBG) log("fixTimeZone: adj ltod=" + TimeUtils.logTimeOfDay(adj));
|
||||
setAndBroadcastNetworkSetTime(adj);
|
||||
} else {
|
||||
// Adjust the saved NITZ time to account for tzOffset.
|
||||
mSavedTime = mSavedTime - tzOffset;
|
||||
if (DBG) log("fixTimeZone: adj mSavedTime=" + mSavedTime);
|
||||
}
|
||||
if (DBG) log("fixTimeZone: using default TimeZone");
|
||||
} else if (isoCountryCode.equals("")) {
|
||||
|
@ -923,10 +923,16 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
zone = TimeZone.getDefault();
|
||||
// For NITZ string without timezone,
|
||||
// need adjust time to reflect default timezone setting
|
||||
long tzOffset;
|
||||
tzOffset = zone.getOffset(System.currentTimeMillis());
|
||||
long ctm = System.currentTimeMillis();
|
||||
long tzOffset = zone.getOffset(ctm);
|
||||
if (DBG) {
|
||||
log("pollStateDone: tzOffset=" + tzOffset + " ltod=" +
|
||||
TimeUtils.logTimeOfDay(ctm));
|
||||
}
|
||||
if (getAutoTime()) {
|
||||
setAndBroadcastNetworkSetTime(System.currentTimeMillis() - tzOffset);
|
||||
long adj = ctm - tzOffset;
|
||||
if (DBG) log("pollStateDone: adj ltod=" + TimeUtils.logTimeOfDay(adj));
|
||||
setAndBroadcastNetworkSetTime(adj);
|
||||
} else {
|
||||
// Adjust the saved NITZ time to account for tzOffset.
|
||||
mSavedTime = mSavedTime - tzOffset;
|
||||
|
Reference in New Issue
Block a user