diff options
| author | Arne Coucheron <arco68@gmail.com> | 2017-11-02 00:57:33 +0100 |
|---|---|---|
| committer | doc HD <doc.divxm@gmail.com> | 2017-11-02 11:34:47 +0300 |
| commit | 337f08d926ae7ce45f885d3bd457f1ca0f67f862 (patch) | |
| tree | ca9137c808a3512641501873cba0a493aaedfa87 | |
| parent | 659af83ca650cf3a94d18dd7d070517a7f50dc12 (diff) | |
ril: Cleanup custom class
* Drop operators check
* Remove getImsRegistrationState override.
Already checked in system class.
* Remove getCellInfoList and setCellInfoListRate overrides.
Change-Id: Iac3306f122e942ca78a079f8578bbf91eeddc9c8
| -rw-r--r-- | ril/Operators.java | 140 | ||||
| -rw-r--r-- | ril/SerranoRIL.java | 81 |
2 files changed, 0 insertions, 221 deletions
diff --git a/ril/Operators.java b/ril/Operators.java deleted file mode 100644 index 522e0bf..0000000 --- a/ril/Operators.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2013-2016, The CyanogenMod Project - * Copyright (C) 2017, The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.telephony; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.util.Collections; -import java.util.Map; -import java.util.HashMap; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import android.os.Environment; -import android.telephony.Rlog; -import android.util.Xml; - -import com.android.internal.util.XmlUtils; - -public class Operators { - // Initialize list of Operator codes - // This will be taken care of when garbage collection starts. - private HashMap<String, String> initList() { - HashMap<String, String> init = new HashMap<String, String>(); - // Taken from spnOveride.java - FileReader spnReader; - final File spnFile = new File(Environment.getRootDirectory(), "etc/selective-spn-conf.xml"); - - try { - spnReader = new FileReader(spnFile); - } catch (FileNotFoundException e) { - Rlog.w("Operatorcheck", "Can not open " + - Environment.getRootDirectory() + "/etc/selective-spn-conf.xml"); - return init; - } - - try { - XmlPullParser parser = Xml.newPullParser(); - parser.setInput(spnReader); - - XmlUtils.beginDocument(parser, "spnOverrides"); - - while (true) { - XmlUtils.nextElement(parser); - - String name = parser.getName(); - if (!"spnOverride".equals(name)) { - break; - } - - String numeric = parser.getAttributeValue(null, "numeric"); - String data = parser.getAttributeValue(null, "spn"); - - init.put(numeric, data); - } - } catch (XmlPullParserException e) { - Rlog.w("Operatorcheck", "Exception in spn-conf parser " + e); - } catch (IOException e) { - Rlog.w("Operatorcheck", "Exception in spn-conf parser " + e); - } - return init; - } - - // This will stay persistant in memory when called - private static String stored = null; - private static String storedOperators = null; - - public static String operatorReplace(String response) { - // Sanity checking if the value is actually not equal to the range apn Numerics - // If it is null, check your ril class. - if(response == null || (5 != response.length() && response.length() != 6)) { - return response; - } - // This will check if the stored value is equal to other. - // This uses a technique called last known of good value along with sanity checking. - if(storedOperators != null && stored != null && stored.equals(response)) { - return storedOperators; - } - stored = response; - try { - // This will find out if it a number then it will catch it based on invalid chars. - Integer.parseInt(response); - } catch(NumberFormatException E) { - // Not a number, pass it along to stored operator until the next round. - storedOperators = response; - return storedOperators; - } - // This code will be taking care of when garbage collection start - Operators init = new Operators(); - Map<String, String> operators = init.initList(); - storedOperators = operators.containsKey(response) ? operators.get(response) : response; - return storedOperators; - } - - // This will not stay persistant in memory, this will be taken care of in garbage collection - // routine. - private Map<String, String> unOptOperators = null; - // Unoptimized version of operatorReplace for responseOperatorInfos this will provide a little - // more flexiblilty in a loop like situation. - // Same numbers of checks as before. This is for the search network functionality - public String unOptimizedOperatorReplace(String response) { - // Sanity checking if the value is actually not equal to the range apn numerics. - // if it is null, check your ril class. - if(response == null || - (5 != response.length() && response.length() != 6)) { - return response; - } - - try { - // This will find out if it a number then it will catch it based on invalid chars. - Integer.parseInt(response); - } catch(NumberFormatException E) { - // An illegal char is found i.e a word - return response; - } - - if (unOptOperators == null) { - unOptOperators = initList(); - } - - return unOptOperators.containsKey(response) ? unOptOperators.get(response) : response; - } -} diff --git a/ril/SerranoRIL.java b/ril/SerranoRIL.java index 2bef761..f150f9b 100644 --- a/ril/SerranoRIL.java +++ b/ril/SerranoRIL.java @@ -318,7 +318,6 @@ public class SerranoRIL extends RIL { /* Get those we're interested in */ case RIL_REQUEST_VOICE_REGISTRATION_STATE: case RIL_REQUEST_DATA_REGISTRATION_STATE: - case RIL_REQUEST_OPERATOR: rr = tr; break; }} catch (Throwable thr) { @@ -347,7 +346,6 @@ public class SerranoRIL extends RIL { switch (rr.mRequest) { case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p, false); break; case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseVoiceDataRegistrationState(p, true); break; - case RIL_REQUEST_OPERATOR: ret = operatorCheck(p); break; default: throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); } @@ -363,17 +361,6 @@ public class SerranoRIL extends RIL { } private Object - operatorCheck(Parcel p) { - String response[] = (String[])responseStrings(p); - for(int i=0; i<2; i++){ - if (response[i]!= null){ - response[i] = Operators.operatorReplace(response[i]); - } - } - return response; - } - - private Object responseVoiceDataRegistrationState(Parcel p, boolean data) { String response[] = (String[])responseStrings(p); if (isGSM){ @@ -479,41 +466,6 @@ public class SerranoRIL extends RIL { } } - // Workaround for Samsung CDMA "ring of death" bug: - // - // Symptom: As soon as the phone receives notice of an incoming call, an - // audible "old fashioned ring" is emitted through the earpiece and - // persists through the duration of the call, or until reboot if the call - // isn't answered. - // - // Background: The CDMA telephony stack implements a number of "signal info - // tones" that are locally generated by ToneGenerator and mixed into the - // voice call path in response to radio RIL_UNSOL_CDMA_INFO_REC requests. - // One of these tones, IS95_CONST_IR_SIG_IS54B_L, is requested by the - // radio just prior to notice of an incoming call when the voice call - // path is muted. CallNotifier is responsible for stopping all signal - // tones (by "playing" the TONE_CDMA_SIGNAL_OFF tone) upon receipt of a - // "new ringing connection", prior to unmuting the voice call path. - // - // Problem: CallNotifier's incoming call path is designed to minimize - // latency to notify users of incoming calls ASAP. Thus, - // SignalInfoTonePlayer requests are handled asynchronously by spawning a - // one-shot thread for each. Unfortunately the ToneGenerator API does - // not provide a mechanism to specify an ordering on requests, and thus, - // unexpected thread interleaving may result in ToneGenerator processing - // them in the opposite order that CallNotifier intended. In this case, - // playing the "signal off" tone first, followed by playing the "old - // fashioned ring" indefinitely. - // - // Solution: An API change to ToneGenerator is required to enable - // SignalInfoTonePlayer to impose an ordering on requests (i.e., drop any - // request that's older than the most recent observed). Such a change, - // or another appropriate fix should be implemented in AOSP first. - // - // Workaround: Intercept RIL_UNSOL_CDMA_INFO_REC requests from the radio, - // check for a signal info record matching IS95_CONST_IR_SIG_IS54B_L, and - // drop it so it's never seen by CallNotifier. If other signal tones are - // observed to cause this problem, they should be dropped here as well. @Override protected void notifyRegistrantsCdmaInfoRec(CdmaInformationRecords infoRec) { final int response = RIL_UNSOL_CDMA_INFO_REC; @@ -595,39 +547,6 @@ public class SerranoRIL extends RIL { } @Override - public void getCellInfoList(Message result) { - riljLog("getCellInfoList: not supported"); - if (result != null) { - CommandException ex = new CommandException( - CommandException.Error.REQUEST_NOT_SUPPORTED); - AsyncResult.forMessage(result, null, ex); - result.sendToTarget(); - } - } - - @Override - public void setCellInfoListRate(int rateInMillis, Message response) { - riljLog("setCellInfoListRate: not supported"); - if (response != null) { - CommandException ex = new CommandException( - CommandException.Error.REQUEST_NOT_SUPPORTED); - AsyncResult.forMessage(response, null, ex); - response.sendToTarget(); - } - } - - @Override - public void getImsRegistrationState(Message result) { - riljLog("getImsRegistrationState: not supported"); - if (result != null) { - CommandException ex = new CommandException( - CommandException.Error.REQUEST_NOT_SUPPORTED); - AsyncResult.forMessage(result, null, ex); - result.sendToTarget(); - } - } - - @Override public void setDataAllowed(boolean allowed, Message result) { if (SystemProperties.get("persist.radio.multisim.config").equals("dsds")) { int req = 123; |
