KlteRIL: Handle RIL_UNSOL_NITZ_TIME_RECEIVED

* This fixes auto time zone
* This is related to how it was handled in the
  old SamsungQualcommRIL class (deprecated) but
  the Parcel is fixed rather than handling it
  directly in the RIL subclass
* This is done because after we handle it,
  it's still handled by processUnsolicited
  in the super class, which undoes our changes
* The extra "garbage" that is sent in the
  RIL_UNSOL_NITZ_TIME_RECEIVED parcel seems
  to be country MCC code for whatever reason

Change-Id: I70982873e6304d81794bdd03eb8d9a1c1d3f3a55
This commit is contained in:
Gabriele M 2017-04-18 20:13:40 -05:00 committed by Paul Keith
parent 02f25ecebc
commit a4fd548352

View file

@ -57,6 +57,24 @@ public class KlteRIL extends RIL {
mQANElements = 6;
}
private void
fixNitz(Parcel p) {
int dataPosition = p.dataPosition();
String nitz = p.readString();
long nitzReceiveTime = p.readLong();
String[] nitzParts = nitz.split(",");
if (nitzParts.length >= 4) {
// 0=date, 1=time+zone, 2=dst, 3(+)=garbage that confuses ServiceStateTracker
nitz = nitzParts[0] + "," + nitzParts[1] + "," + nitzParts[2];
p.setDataPosition(dataPosition);
p.writeString(nitz);
p.writeLong(nitzReceiveTime);
// The string is shorter now, drop the extra bytes
p.setDataSize(p.dataPosition());
}
}
@Override
public void
dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
@ -292,6 +310,9 @@ public class KlteRIL extends RIL {
int newResponse = response;
switch(response) {
case RIL_UNSOL_NITZ_TIME_RECEIVED:
fixNitz(p);
break;
case RIL_UNSOL_ON_SS_LL:
newResponse = RIL_UNSOL_ON_SS;
break;