From a4fd5483522475cc18fb13e43e75c3ea93e9017b Mon Sep 17 00:00:00 2001 From: Gabriele M Date: Tue, 18 Apr 2017 20:13:40 -0500 Subject: [PATCH] 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 --- .../android/internal/telephony/KlteRIL.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ril/telephony/java/com/android/internal/telephony/KlteRIL.java b/ril/telephony/java/com/android/internal/telephony/KlteRIL.java index 6f8759d..4621b69 100644 --- a/ril/telephony/java/com/android/internal/telephony/KlteRIL.java +++ b/ril/telephony/java/com/android/internal/telephony/KlteRIL.java @@ -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;