1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.telephony.qns;
18 
19 import static com.android.telephony.qns.QnsConstants.MIN_THRESHOLD_GAP;
20 import static com.android.telephony.qns.QnsConstants.POLICY_BAD;
21 import static com.android.telephony.qns.QnsConstants.POLICY_GOOD;
22 
23 import android.net.wifi.WifiInfo;
24 import android.os.PersistableBundle;
25 import android.telephony.SignalThresholdInfo;
26 import android.util.Log;
27 
28 import java.util.Arrays;
29 import java.util.HashMap;
30 
31 /**
32  * This class supports loading QnsConfigArray of Thresholds & Policies (Good, Bad ,Worst) values in
33  * case of cellular & (Good,Bad) in case of Wi-Fi Thresholds defined .
34  */
35 class QnsCarrierAnspSupportConfig {
36     /**
37      * List of 3 customized eutran(4g) RSRP thresholds to be considered for rove-in & rove-out in
38      * 4G(VoLTE registered) & in idle state.
39      *
40      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSRP}
41      *
42      * <p>3 threshold integers must be within the boundaries Note: In case of "worst" criteria is
43      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSRP_MIN_VALUE}
44      * {@link SignalThresholdInfo#SIGNAL_RSRP_MAX_VALUE}
45      *
46      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
47      *
48      * <UL>
49      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_RSRP_GOOD}"
50      *   <LI>"Bad: {@link QnsConstants#KEY_DEFAULT_THRESHOLD_RSRP_BAD}"
51      *   <LI>"Worst:65535"
52      * </UL>
53      *
54      * <p>This key is considered invalid if the format is violated. If the key not configured, a
55      * default value set will apply.
56      */
57     static final String KEY_IDLE_EUTRAN_RSRP_INT_ARRAY = "qns.idle_eutran_rsrp_int_array";
58 
59     /**
60      * List of 3 customized eutran(4g) RSRP thresholds to be considered for rove-in & rove-out in 4G
61      * (VoLTE) & in voice call state.
62      *
63      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSRP}
64      *
65      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
66      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSRP_MIN_VALUE}
67      * {@link SignalThresholdInfo#SIGNAL_RSRP_MAX_VALUE}
68      *
69      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
70      *
71      * <UL>
72      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_RSRP_GOOD}"
73      *   <LI>"Bad: {@link QnsConstants#KEY_DEFAULT_THRESHOLD_RSRP_BAD}"
74      *   <LI>"Worst:65535"
75      * </UL>
76      *
77      * <p>This key is considered invalid if the format is violated. If the key not configured, a
78      * default value set will apply.
79      */
80     static final String KEY_VOICE_EUTRAN_RSRP_INT_ARRAY = "qns.voice_eutran_rsrp_int_array";
81 
82     /**
83      * List of 3 customized eutran(4g) RSRP thresholds to be considered for rove-in & rove-out in 4G
84      * (VoLTE) & in video call state.
85      *
86      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSRP}
87      *
88      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
89      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSRP_MIN_VALUE}
90      * {@link SignalThresholdInfo#SIGNAL_RSRP_MAX_VALUE}
91      *
92      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
93      *
94      * <UL>
95      *   <LI>"Good:65535"
96      *   <LI>"Bad:65535"
97      *   <LI>"Worst:65535"
98      * </UL>
99      *
100      * <p>This key is considered invalid if the format is violated. If the key not configured, a
101      * default value set will apply.
102      */
103     static final String KEY_VIDEO_EUTRAN_RSRP_INT_ARRAY = "qns.video_eutran_rsrp_int_array";
104 
105     /**
106      * List of 3 customized eutran(4g) RSRQ thresholds to be considered for rove-in & rove-out in
107      * 4G(VoLTE registered) & in idle state.
108      *
109      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSRQ}
110      *
111      * <p>3 threshold integers must be within the boundaries Note: In case of "worst" criteria is
112      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSRQ_MIN_VALUE}
113      * {@link SignalThresholdInfo#SIGNAL_RSRQ_MAX_VALUE}
114      *
115      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
116      *
117      * <UL>
118      *   <LI>"Good:65535"
119      *   <LI>"Bad:65535"
120      *   <LI>"Worst:65535"
121      * </UL>
122      *
123      * <p>This key is considered invalid if the format is violated. If the key not configured, a
124      * default value set will apply.
125      */
126     static final String KEY_IDLE_EUTRAN_RSRQ_INT_ARRAY = "qns.idle_eutran_rsrq_int_array";
127 
128     /**
129      * List of 3 customized eutran(4g) RSRQ thresholds to be considered for rove-in & rove-out in
130      * 4G(VoLTE) & in Voice Call state.
131      *
132      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSRQ}
133      *
134      * <p>3 threshold integers must be within the boundaries Note: In case of "worst" criteria is
135      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSRQ_MIN_VALUE}
136      * {@link SignalThresholdInfo#SIGNAL_RSRQ_MAX_VALUE}
137      *
138      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
139      *
140      * <UL>
141      *   <LI>"Good:65535"
142      *   <LI>"Bad:65535"
143      *   <LI>"Worst:65535"
144      * </UL>
145      *
146      * <p>This key is considered invalid if the format is violated. If the key not configured, a
147      * default value set will apply.
148      */
149     static final String KEY_VOICE_EUTRAN_RSRQ_INT_ARRAY = "qns.voice_eutran_rsrq_int_array";
150 
151     /**
152      * List of 3 customized eutran(4g) RSRQ thresholds to be considered for rove-in & rove-out in
153      * 4G(VoLTE) & in Video Call state.
154      *
155      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSRQ}
156      *
157      * <p>3 threshold integers must be within the boundaries Note: In case of "worst" criteria is
158      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSRQ_MIN_VALUE}
159      * {@link SignalThresholdInfo#SIGNAL_RSRQ_MAX_VALUE}
160      *
161      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
162      *
163      * <UL>
164      *   <LI>"Good:65535"
165      *   <LI>"Bad:65535"
166      *   <LI>"Worst:65535"
167      * </UL>
168      *
169      * <p>This key is considered invalid if the format is violated. If the key not configured, a
170      * default value set will apply.
171      */
172     static final String KEY_VIDEO_EUTRAN_RSRQ_INT_ARRAY = "qns.video_eutran_rsrq_int_array";
173 
174     /**
175      * List of 3 customized eutran(4g) RSSNR thresholds to be considered for rove-in & rove-out in
176      * 4G(VoLTE registered) & in idle state.
177      *
178      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSSNR}
179      *
180      * <p>3 threshold integers must be within the boundaries Note: In case of "worst" criteria is
181      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSSNR_MIN_VALUE}
182      * {@link SignalThresholdInfo#SIGNAL_RSSNR_MAX_VALUE}
183      *
184      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
185      *
186      * <UL>
187      *   <LI>"Good:65535"
188      *   <LI>"Bad:65535"
189      *   <LI>"Worst:65535"
190      * </UL>
191      *
192      * <p>This key is considered invalid if the format is violated. If the key not configured, a
193      * default value set will apply.
194      */
195     static final String KEY_IDLE_EUTRAN_RSSNR_INT_ARRAY = "qns.idle_eutran_rssnr_int_array";
196 
197     /**
198      * List of 3 customized eutran(4g) RSSNR thresholds to be considered for rove-in & rove-out in
199      * 4G(VoLTE registered) & in Voice Call state.
200      *
201      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSSNR}
202      *
203      * <p>3 threshold integers must be within the boundaries Note: In case of "worst" criteria is
204      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSSNR_MIN_VALUE}
205      * {@link SignalThresholdInfo#SIGNAL_RSSNR_MAX_VALUE}
206      *
207      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
208      *
209      * <UL>
210      *   <LI>"Good:65535"
211      *   <LI>"Bad:65535"
212      *   <LI>"Worst:65535"
213      * </UL>
214      *
215      * <p>This key is considered invalid if the format is violated. If the key not configured, a
216      * default value set will apply.
217      */
218     static final String KEY_VOICE_EUTRAN_RSSNR_INT_ARRAY = "qns.voice_eutran_rssnr_int_array";
219 
220     /**
221      * List of 3 customized eutran(4g) RSSNR thresholds to be considered for rove-in & rove-out in
222      * 4G(VoLTE registered) & in Video Call state.
223      *
224      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSSNR}
225      *
226      * <p>3 threshold integers must be within the boundaries Note: In case of "worst" criteria is
227      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSSNR_MIN_VALUE}
228      * {@link SignalThresholdInfo#SIGNAL_RSSNR_MAX_VALUE}
229      *
230      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
231      *
232      * <UL>
233      *   <LI>"Good:65535"
234      *   <LI>"Bad:65535"
235      *   <LI>"Worst:65535"
236      * </UL>
237      *
238      * <p>This key is considered invalid if the format is violated. If the key not configured, a
239      * default value set will apply.
240      */
241     static final String KEY_VIDEO_EUTRAN_RSSNR_INT_ARRAY = "qns.video_eutran_rssnr_int_array";
242 
243     /**
244      * List of 3 customized ngran(5g) SSRSRP thresholds to be considered for rove-in & rove-out in
245      * 5g(VoNR registered) & in idle state.
246      *
247      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSRSRP}
248      *
249      * <p>3 threshold integers must be within the boundaries Note: In case of "worst" criteria is
250      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSRSRP_MIN_VALUE}
251      * {@link SignalThresholdInfo#SIGNAL_SSRSRP_MAX_VALUE}
252      *
253      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
254      *
255      * <UL>
256      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_SSRSRP_GOOD}"
257      *   <LI>"Bad: {@link QnsConstants#KEY_DEFAULT_THRESHOLD_SSRSRP_BAD}"
258      *   <LI>"Worst:65535"
259      * </UL>
260      *
261      * <p>This key is considered invalid if the format is violated. If the key not configured, a
262      * default value set will apply.
263      */
264     static final String KEY_IDLE_NGRAN_SSRSRP_INT_ARRAY = "qns.idle_ngran_ssrsrp_int_array";
265 
266     /**
267      * List of 3 customized ngran(5g) SSRSRP thresholds to be considered for rove-in & rove-out in
268      * 5g(VoNR) & in voice call state.
269      *
270      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSRSRP}
271      *
272      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
273      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSRSRP_MIN_VALUE}
274      * {@link SignalThresholdInfo#SIGNAL_SSRSRP_MAX_VALUE}
275      *
276      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
277      *
278      * <UL>
279      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_SSRSRP_GOOD}"
280      *   <LI>"Bad: {@link QnsConstants#KEY_DEFAULT_THRESHOLD_SSRSRP_BAD}"
281      *   <LI>"Worst:65535"
282      * </UL>
283      *
284      * <p>This key is considered invalid if the format is violated. If the key not configured, a
285      * default value set will apply.
286      */
287     static final String KEY_VOICE_NGRAN_SSRSRP_INT_ARRAY = "qns.voice_ngran_ssrsrp_int_array";
288 
289     /**
290      * List of 3 customized ngran(5g) SSRSRP thresholds to be considered for rove-in & rove-out in
291      * 5G (VoNR) & in video call state.
292      *
293      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSRSRP}
294      *
295      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
296      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSRSRP_MIN_VALUE}
297      * {@link SignalThresholdInfo#SIGNAL_SSRSRP_MAX_VALUE}
298      *
299      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
300      *
301      * <UL>
302      *   <LI>"Good:65535"
303      *   <LI>"Bad:65535"
304      *   <LI>"Worst:65535"
305      * </UL>
306      *
307      * <p>This key is considered invalid if the format is violated. If the key not configured, a
308      * default value set will apply.
309      */
310     static final String KEY_VIDEO_NGRAN_SSRSRP_INT_ARRAY = "qns.video_ngran_ssrsrp_int_array";
311 
312     /**
313      * List of 3 customized ngran(5g) SSRSRQ thresholds to be considered for rove-in & rove-out in
314      * 5G (VoNR) & in idle state.
315      *
316      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSRSRQ}
317      *
318      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
319      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSRSRQ_MIN_VALUE}
320      * {@link SignalThresholdInfo#SIGNAL_SSRSRQ_MAX_VALUE}
321      *
322      * <p>This key is considered invalid if the format is violated. If the key not configured, a
323      * default value set will apply. {@code 3 values defined by default(Good, Bad, Worst)}
324      *
325      * <UL>
326      *   <LI>"Good:65535"
327      *   <LI>"Bad:65535"
328      *   <LI>"Worst:65535"
329      * </UL>
330      *
331      * <p>This key is considered invalid if the format is violated. If the key not configured, a
332      * default value set will apply.
333      */
334     static final String KEY_IDLE_NGRAN_SSRSRQ_INT_ARRAY = "qns.idle_ngran_ssrsrq_int_array";
335 
336     /**
337      * List of 3 customized ngran(5g) SSRSRQ thresholds to be considered for rove-in & rove-out in
338      * 5G (VoNR) & in voice call state.
339      *
340      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSRSRQ}
341      *
342      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
343      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSRSRQ_MIN_VALUE}
344      * {@link SignalThresholdInfo#SIGNAL_SSRSRQ_MAX_VALUE}
345      *
346      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
347      *
348      * <UL>
349      *   <LI>"Good:65535"
350      *   <LI>"Bad:65535"
351      *   <LI>"Worst:65535"
352      * </UL>
353      *
354      * <p>This key is considered invalid if the format is violated. If the key not configured, a
355      * default value set will apply.
356      */
357     static final String KEY_VOICE_NGRAN_SSRSRQ_INT_ARRAY = "qns.voice_ngran_ssrsrq_int_array";
358 
359     /**
360      * List of 3 customized ngran(5g) SSRSRQ thresholds to be considered for rove-in & rove-out in
361      * 5G (VoNR) & in video call state.
362      *
363      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSRSRQ}
364      *
365      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
366      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSRSRQ_MIN_VALUE}
367      * {@link SignalThresholdInfo#SIGNAL_SSRSRQ_MAX_VALUE}
368      *
369      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
370      *
371      * <UL>
372      *   <LI>"Good:65535"
373      *   <LI>"Bad:65535"
374      *   <LI>"Worst:65535"
375      * </UL>
376      *
377      * <p>This key is considered invalid if the format is violated. If the key not configured, a
378      * default value set will apply.
379      */
380     static final String KEY_VIDEO_NGRAN_SSRSRQ_INT_ARRAY = "qns.video_ngran_ssrsrq_int_array";
381 
382     /**
383      * List of 3 customized ngran(5g) SSSINR thresholds to be considered for rove-in & rove-out in
384      * 5G (VoNR) & in idle state.
385      *
386      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSSINR}
387      *
388      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
389      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSSINR_MIN_VALUE}
390      * {@link SignalThresholdInfo#SIGNAL_SSSINR_MAX_VALUE}
391      *
392      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
393      *
394      * <UL>
395      *   <LI>"Good:65535"
396      *   <LI>"Bad:65535"
397      *   <LI>"Worst:65535"
398      * </UL>
399      *
400      * <p>This key is considered invalid if the format is violated. If the key not configured, a
401      * default value set will apply.
402      */
403     static final String KEY_IDLE_NGRAN_SSSINR_INT_ARRAY = "qns.idle_ngran_sssinr_int_array";
404 
405     /**
406      * List of 3 customized ngran(5g) SSSINR thresholds to be considered for rove-in & rove-out in
407      * 5G (VoNR) & in voice call state.
408      *
409      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSSINR}
410      *
411      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
412      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSSINR_MIN_VALUE}
413      * {@link SignalThresholdInfo#SIGNAL_SSSINR_MAX_VALUE}
414      *
415      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
416      *
417      * <UL>
418      *   <LI>"Good:65535"
419      *   <LI>"Bad:65535"
420      *   <LI>"Worst:65535"
421      * </UL>
422      *
423      * <p>This key is considered invalid if the format is violated. If the key not configured, a
424      * default value set will apply.
425      */
426     static final String KEY_VOICE_NGRAN_SSSINR_INT_ARRAY = "qns.voice_ngran_sssinr_int_array";
427 
428     /**
429      * List of 3 customized ngran(5g) SSSINR thresholds to be considered for rove-in & rove-out in
430      * 5G (VoNR) & in video call state.
431      *
432      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_SSSINR}
433      *
434      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
435      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_SSSINR_MIN_VALUE}
436      * {@link SignalThresholdInfo#SIGNAL_SSSINR_MAX_VALUE}
437      *
438      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
439      *
440      * <UL>
441      *   <LI>"Good:65535"
442      *   <LI>"Bad:65535"
443      *   <LI>"Worst:65535"
444      * </UL>
445      *
446      * <p>This key is considered invalid if the format is violated. If the key not configured, a
447      * default value set will apply.
448      */
449     static final String KEY_VIDEO_NGRAN_SSSINR_INT_ARRAY = "qns.video_ngran_sssinr_int_array";
450 
451     /**
452      * List of 3 customized utran(3g) RSCP thresholds to be considered for rove-in & rove-out in 3g
453      * (IMS registered) & in idle state.
454      *
455      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSCP}
456      *
457      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
458      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSCP_MIN_VALUE}
459      * {@link SignalThresholdInfo#SIGNAL_RSCP_MAX_VALUE}
460      *
461      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
462      *
463      * <UL>
464      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_RSCP_GOOD}"
465      *   <LI>"Bad: {@link QnsConstants#KEY_DEFAULT_THRESHOLD_RSCP_BAD}"
466      *   <LI>"Worst:65535"
467      * </UL>
468      *
469      * <p>This key is considered invalid if the format is violated. If the key not configured, a
470      * default value set will apply.
471      */
472     static final String KEY_IDLE_UTRAN_RSCP_INT_ARRAY = "qns.idle_utran_rscp_int_array";
473 
474     /**
475      * List of 3 customized utran(3g) RSCP thresholds to be considered for rove-in & rove-out in 3g
476      * (IMS registered) & in voice call(SRVCC) state.
477      *
478      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSCP}
479      *
480      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
481      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSCP_MIN_VALUE}
482      * {@link SignalThresholdInfo#SIGNAL_RSCP_MAX_VALUE}
483      *
484      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
485      *
486      * <UL>
487      *   <LI>"Good:65535"
488      *   <LI>"Bad:65535"
489      *   <LI>"Worst:65535"
490      * </UL>
491      *
492      * <p>This key is considered invalid if the format is violated. If the key not configured, a
493      * default value set will apply.
494      */
495     static final String KEY_VOICE_UTRAN_RSCP_INT_ARRAY = "qns.voice_utran_rscp_int_array";
496 
497     /**
498      * List of 3 customized utran(3g) RSCP thresholds to be considered for rove-in & rove-out in 3g
499      * (IMS registered) & in video call(SRVCC) state.
500      *
501      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSCP}
502      *
503      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
504      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSCP_MIN_VALUE}
505      * {@link SignalThresholdInfo#SIGNAL_RSCP_MAX_VALUE}
506      *
507      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
508      *
509      * <UL>
510      *   <LI>"Good:65535"
511      *   <LI>"Bad:65535"
512      *   <LI>"Worst:65535"
513      * </UL>
514      *
515      * <p>This key is considered invalid if the format is violated. If the key not configured, a
516      * default value set will apply.
517      */
518     static final String KEY_VIDEO_UTRAN_RSCP_INT_ARRAY = "qns.video_utran_rscp_int_array";
519 
520     /**
521      * List of 3 customized utran(3G) Ec/No threshold values which are considered for rove-in and
522      * rove-out in idle state.
523      *
524      * <p>3 threshold integers must be within the boundaries: Note: When a value is set to "65535",
525      * it means an invalid threshold value. {@link SignalThresholdInfo#SIGNAL_ECNO_MIN_VALUE} {@link
526      * SignalThresholdInfo#SIGNAL_ECNO_MAX_VALUE}
527      *
528      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
529      *
530      * <UL>
531      *   <LI>"Good:65535"
532      *   <LI>"Bad:65535"
533      *   <LI>"Worst:65535"
534      * </UL>
535      *
536      * <p>This key is considered invalid if the format is violated. If the key not configured, a
537      * default value will be applied.
538      */
539     static final String KEY_IDLE_UTRAN_ECNO_INT_ARRAY = "qns.idle_utran_ecno_int_array";
540 
541     /**
542      * List of 3 customized geran(2g) RSSI thresholds to be considered for rove-in & rove-out in 2g
543      * (IMS registered) & in idle state.
544      *
545      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSSI}
546      *
547      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
548      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSSI_MIN_VALUE}
549      * {@link SignalThresholdInfo#SIGNAL_RSSI_MAX_VALUE}
550      *
551      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
552      *
553      * <UL>
554      *   <LI>"Good:65535"
555      *   <LI>"Bad:65535"
556      *   <LI>"Worst:65535"
557      * </UL>
558      *
559      * <p>This key is considered invalid if the format is violated. If the key not configured, a
560      * default value set will apply.
561      */
562     static final String KEY_IDLE_GERAN_RSSI_INT_ARRAY = "qns.idle_geran_rssi_int_array";
563 
564     /**
565      * List of 3 customized geran(2g) RSSI thresholds to be considered for rove-in & rove-out in 2g
566      * (IMS registered) & in voice call state.
567      *
568      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSSI}
569      *
570      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
571      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSSI_MIN_VALUE}
572      * {@link SignalThresholdInfo#SIGNAL_RSSI_MAX_VALUE}
573      *
574      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
575      *
576      * <UL>
577      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_GERAN_RSSI_GOOD}"
578      *   <LI>"Bad: {@link QnsConstants#KEY_DEFAULT_THRESHOLD_GERAN_RSSI_BAD}"
579      *   <LI>"Worst:65535"
580      * </UL>
581      *
582      * <p>This key is considered invalid if the format is violated. If the key not configured, a
583      * default value set will apply.
584      */
585     static final String KEY_VOICE_GERAN_RSSI_INT_ARRAY = "qns.voice_geran_rssi_int_array";
586 
587     /**
588      * List of 3 customized geran(2g) RSSI thresholds to be considered for rove-in & rove-out in 2g
589      * (IMS registered) & in video call state.
590      *
591      * <p>Reference: {@link SignalThresholdInfo#SIGNAL_MEASUREMENT_TYPE_RSSI}
592      *
593      * <p>3 threshold integers must be within the boundaries: Note: In case of "worst" criteria is
594      * not relevant the same is set @ "65535" {@link SignalThresholdInfo#SIGNAL_RSSI_MIN_VALUE}
595      * {@link SignalThresholdInfo#SIGNAL_RSSI_MAX_VALUE}
596      *
597      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
598      *
599      * <UL>
600      *   <LI>"Good:65535"
601      *   <LI>"Bad:65535"
602      *   <LI>"Worst:65535"
603      * </UL>
604      *
605      * <p>This key is considered invalid if the format is violated. If the key not configured, a
606      * default value set will apply.
607      */
608     static final String KEY_VIDEO_GERAN_RSSI_INT_ARRAY = "qns.video_geran_rssi_int_array";
609 
610     /**
611      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
612      * (IMS registered) & in idle state.
613      *
614      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
615      * WifiInfo#MIN_RSSI}
616      *
617      * <p>{@code 2 values defined by default(Good, Bad)}
618      *
619      * <UL>
620      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_GOOD}"
621      *   <LI>"Bad:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_BAD}"
622      * </UL>
623      *
624      * <p>This key is considered invalid if the format is violated. If the key not configured, a
625      * default value set will apply.
626      */
627     static final String KEY_IDLE_WIFI_RSSI_INT_ARRAY = "qns.idle_wifi_rssi_int_array";
628 
629     /**
630      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
631      * (IMS registered) & in voice call state.
632      *
633      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
634      * WifiInfo#MIN_RSSI}
635      *
636      * <p>{@code 2 values defined by default(Good, Bad)}
637      *
638      * <UL>
639      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_GOOD}"
640      *   <LI>"Bad:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_BAD}"
641      * </UL>
642      *
643      * <p>This key is considered invalid if the format is violated. If the key not configured, a
644      * default value set will apply.
645      */
646     static final String KEY_VOICE_WIFI_RSSI_INT_ARRAY = "qns.voice_wifi_rssi_int_array";
647 
648     /**
649      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
650      * (IMS registered) & in video call state.
651      *
652      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
653      * WifiInfo#MIN_RSSI}
654      *
655      * <p>{@code 2 values defined by default(Good, Bad)}
656      *
657      * <UL>
658      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_GOOD}"
659      *   <LI>"Bad:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_BAD}"
660      * </UL>
661      *
662      * <p>This key is considered invalid if the format is violated. If the key not configured, a
663      * default value set will apply.
664      */
665     static final String KEY_VIDEO_WIFI_RSSI_INT_ARRAY = "qns.video_wifi_rssi_int_array";
666 
667     /**
668      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
669      * (IMS registered) & in idle state to be considered during Overriding with Wifi Pref settings.
670      *
671      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
672      * WifiInfo#MIN_RSSI}
673      *
674      * <p>{@code 2 values defined by default(Good, Bad)}
675      *
676      * <UL>
677      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_GOOD}"
678      *   <LI>"Bad:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_BAD}"
679      * </UL>
680      *
681      * <p>This key is considered invalid if the format is violated. If the key not configured, a
682      * default value set will apply.
683      */
684     static final String KEY_OVERRIDE_WIFI_PREF_IDLE_WIFI_RSSI_INT_ARRAY =
685             "qns.override_wifi_pref_idle_wifi_rssi_int_array";
686 
687     /**
688      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
689      * (IMS registered) & in voice call state to be considered during Overriding with Wifi Pref
690      * settings.
691      *
692      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
693      * WifiInfo#MIN_RSSI}
694      *
695      * <p>{@code 2 values defined by default(Good, Bad)}
696      *
697      * <UL>
698      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_GOOD}"
699      *   <LI>"Bad:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_BAD}"
700      * </UL>
701      *
702      * <p>This key is considered invalid if the format is violated. If the key not configured, a
703      * default value set will apply.
704      */
705     static final String KEY_OVERRIDE_WIFI_PREF_VOICE_WIFI_RSSI_INT_ARRAY =
706             "qns.override_wifi_pref_voice_wifi_rssi_int_array";
707 
708     /**
709      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
710      * (IMS registered) & in video call state to be considered during Overriding with Wifi Pref
711      * settings.
712      *
713      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
714      * WifiInfo#MIN_RSSI}
715      *
716      * <p>{@code 2 values defined by default(Good, Bad)}
717      *
718      * <UL>
719      *   <LI>"Good:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_GOOD}"
720      *   <LI>"Bad:{@link QnsConstants#KEY_DEFAULT_THRESHOLD_WIFI_RSSI_BAD}"
721      * </UL>
722      *
723      * <p>This key is considered invalid if the format is violated. If the key not configured, a
724      * default value set will apply.
725      */
726     static final String KEY_OVERRIDE_WIFI_PREF_VIDEO_WIFI_RSSI_INT_ARRAY =
727             "qns.override_wifi_pref_video_wifi_rssi_int_array";
728 
729     /**
730      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
731      * (IMS registered) & in idle state. Without cellular coverage, it sets the wifi rove-in &
732      * rove-out threshold of the UE.
733      *
734      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
735      * WifiInfo#MIN_RSSI}
736      *
737      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
738      *
739      * <UL>
740      *   <LI>"Good:65535"
741      *   <LI>"Bad:65535"
742      *   <LI>"Worst:65535"
743      * </UL>
744      *
745      * <p>This key is considered invalid if the format is violated. If the key not configured, a
746      * default value set will apply.
747      */
748     static final String KEY_IDLE_WIFI_RSSI_WITHOUT_CELLULAR_INT_ARRAY =
749             "qns.idle_wifi_rssi_without_cellular_int_array";
750 
751     /**
752      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
753      * (IMS registered) & in voice call state. Without cellular coverage, it sets the wifi rove-in &
754      * rove-out threshold of the UE.
755      *
756      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
757      * WifiInfo#MIN_RSSI}
758      *
759      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
760      *
761      * <UL>
762      *   <LI>"Good:65535"
763      *   <LI>"Bad:65535"
764      *   <LI>"Worst:65535"
765      * </UL>
766      *
767      * <p>This key is considered invalid if the format is violated. If the key not configured, a
768      * default value set will apply.
769      */
770     static final String KEY_VOICE_WIFI_RSSI_WITHOUT_CELLULAR_INT_ARRAY =
771             "qns.voice_wifi_rssi_without_cellular_int_array";
772 
773     /**
774      * List of 2 customized wifi RSSI thresholds to be considered for rove-in & rove-out in wifi
775      * (IMS registered) & in video call state. Without cellular coverage, it sets the wifi rove-in &
776      * rove-out threshold of the UE.
777      *
778      * <p>2 threshold integers must be within the boundaries: {@link WifiInfo#MIN_RSSI} {@link
779      * WifiInfo#MIN_RSSI}
780      *
781      * <p>{@code 3 values defined by default(Good, Bad, Worst)}
782      *
783      * <UL>
784      *   <LI>"Good:65535"
785      *   <LI>"Bad:65535"
786      *   <LI>"Worst:65535"
787      * </UL>
788      *
789      * <p>This key is considered invalid if the format is violated. If the key not configured, a
790      * default value set will apply.
791      */
792     static final String KEY_VIDEO_WIFI_RSSI_WITHOUT_CELLULAR_INT_ARRAY =
793             "qns.video_wifi_rssi_without_cellular_int_array";
794 
795     // Internal Policy Rule/keys Updates
796     static final String KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_HOME_STRING_ARRAY =
797             "qns.condition_rove_in_idle_wifi_pref_home_string_array";
798     static final String KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_HOME_STRING_ARRAY =
799             "qns.condition_rove_in_voice_wifi_pref_home_string_array";
800     static final String KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_HOME_STRING_ARRAY =
801             "qns.condition_rove_in_video_wifi_pref_home_string_array";
802     static final String KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_HOME_STRING_ARRAY =
803             "qns.condition_rove_in_idle_cell_pref_home_string_array";
804     static final String KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_HOME_STRING_ARRAY =
805             "qns.condition_rove_in_voice_cell_pref_home_string_array";
806     static final String KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_HOME_STRING_ARRAY =
807             "qns.condition_rove_in_video_cell_pref_home_string_array";
808     static final String KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_HOME_STRING_ARRAY =
809             "qns.condition_rove_out_idle_wifi_pref_home_string_array";
810     static final String KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_HOME_STRING_ARRAY =
811             "qns.condition_rove_out_voice_wifi_pref_home_string_array";
812     static final String KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_HOME_STRING_ARRAY =
813             "qns.condition_rove_out_video_wifi_pref_home_string_array";
814     static final String KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_HOME_STRING_ARRAY =
815             "qns.condition_rove_out_idle_cell_pref_home_string_array";
816     static final String KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_HOME_STRING_ARRAY =
817             "qns.condition_rove_out_voice_cell_pref_home_string_array";
818     static final String KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_HOME_STRING_ARRAY =
819             "qns.condition_rove_out_video_cell_pref_home_string_array";
820     static final String KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_ROAM_STRING_ARRAY =
821             "qns.condition_rove_in_idle_wifi_pref_roam_string_array";
822     static final String KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_ROAM_STRING_ARRAY =
823             "qns.condition_rove_in_voice_wifi_pref_roam_string_array";
824     static final String KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_ROAM_STRING_ARRAY =
825             "qns.condition_rove_in_video_wifi_pref_roam_string_array";
826     static final String KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_ROAM_STRING_ARRAY =
827             "qns.condition_rove_in_idle_cell_pref_roam_string_array";
828     static final String KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_ROAM_STRING_ARRAY =
829             "qns.condition_rove_in_voice_cell_pref_roam_string_array";
830     static final String KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_ROAM_STRING_ARRAY =
831             "qns.condition_rove_in_video_cell_pref_roam_string_array";
832     static final String KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_ROAM_STRING_ARRAY =
833             "qns.condition_rove_out_idle_wifi_pref_roam_string_array";
834     static final String KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_ROAM_STRING_ARRAY =
835             "qns.condition_rove_out_voice_wifi_pref_roam_string_array";
836     static final String KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_ROAM_STRING_ARRAY =
837             "qns.condition_rove_out_video_wifi_pref_roam_string_array";
838     static final String KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_ROAM_STRING_ARRAY =
839             "qns.condition_rove_out_idle_cell_pref_roam_string_array";
840     static final String KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_ROAM_STRING_ARRAY =
841             "qns.condition_rove_out_voice_cell_pref_roam_string_array";
842     static final String KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_ROAM_STRING_ARRAY =
843             "qns.condition_rove_out_video_cell_pref_roam_string_array";
844 
845     /**
846      * Define keys for extended policy rules. Different handover criteria based on whether
847      * hysteresis timer is running or not.
848      */
849     static final String KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
850             "qns.condition_rove_in_idle_wifi_pref_home_guarding_none_string_array";
851     static final String KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_HOME_GUARDING_WIFI_STRING_ARRAY =
852             "qns.condition_rove_in_idle_wifi_pref_home_guarding_wifi_string_array";
853     static final String KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
854             "qns.condition_rove_in_voice_wifi_pref_home_guarding_none_string_array";
855     static final String KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_HOME_GUARDING_WIFI_STRING_ARRAY =
856             "qns.condition_rove_in_voice_wifi_pref_home_guarding_wifi_string_array";
857     static final String KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
858             "qns.condition_rove_in_video_wifi_pref_home_guarding_none_string_array";
859     static final String KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_HOME_GUARDING_WIFI_STRING_ARRAY =
860             "qns.condition_rove_in_video_wifi_pref_home_guarding_wifi_string_array";
861     static final String KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
862             "qns.condition_rove_in_idle_cell_pref_home_guarding_none_string_array";
863     static final String KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_HOME_GUARDING_WIFI_STRING_ARRAY =
864             "qns.condition_rove_in_idle_cell_pref_home_guarding_wifi_string_array";
865     static final String KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
866             "qns.condition_rove_in_voice_cell_pref_home_guarding_none_string_array";
867     static final String KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_HOME_GUARDING_WIFI_STRING_ARRAY =
868             "qns.condition_rove_in_voice_cell_pref_home_guarding_wifi_string_array";
869     static final String KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
870             "qns.condition_rove_in_video_cell_pref_home_guarding_none_string_array";
871     static final String KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_HOME_GUARDING_WIFI_STRING_ARRAY =
872             "qns.condition_rove_in_video_cell_pref_home_guarding_wifi_string_array";
873     static final String KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
874             "qns.condition_rove_out_idle_wifi_pref_home_guarding_none_string_array";
875     static final String KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_HOME_GUARDING_CELL_STRING_ARRAY =
876             "qns.condition_rove_out_idle_wifi_pref_home_guarding_cell_string_array";
877     static final String KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
878             "qns.condition_rove_out_voice_wifi_pref_home_guarding_none_string_array";
879     static final String KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_HOME_GUARDING_CELL_STRING_ARRAY =
880             "qns.condition_rove_out_voice_wifi_pref_home_guarding_cell_string_array";
881     static final String KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
882             "qns.condition_rove_out_video_wifi_pref_home_guarding_none_string_array";
883     static final String KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_HOME_GUARDING_CELL_STRING_ARRAY =
884             "qns.condition_rove_out_video_wifi_pref_home_guarding_cell_string_array";
885     static final String KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
886             "qns.condition_rove_out_idle_cell_pref_home_guarding_none_string_array";
887     static final String KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_HOME_GUARDING_CELL_STRING_ARRAY =
888             "qns.condition_rove_out_idle_cell_pref_home_guarding_cell_string_array";
889     static final String KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
890             "qns.condition_rove_out_voice_cell_pref_home_guarding_none_string_array";
891     static final String KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_HOME_GUARDING_CELL_STRING_ARRAY =
892             "qns.condition_rove_out_voice_cell_pref_home_guarding_cell_string_array";
893     static final String KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY =
894             "qns.condition_rove_out_video_cell_pref_home_guarding_none_string_array";
895     static final String KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_HOME_GUARDING_CELL_STRING_ARRAY =
896             "qns.condition_rove_out_video_cell_pref_home_guarding_cell_string_array";
897     static final String KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
898             "qns.condition_rove_in_idle_wifi_pref_roam_guarding_none_string_array";
899     static final String KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY =
900             "qns.condition_rove_in_idle_wifi_pref_roam_guarding_wifi_string_array";
901     static final String KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
902             "qns.condition_rove_in_voice_wifi_pref_roam_guarding_none_string_array";
903     static final String KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY =
904             "qns.condition_rove_in_voice_wifi_pref_roam_guarding_wifi_string_array";
905     static final String KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
906             "qns.condition_rove_in_video_wifi_pref_roam_guarding_none_string_array";
907     static final String KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY =
908             "qns.condition_rove_in_video_wifi_pref_roam_guarding_wifi_string_array";
909     static final String KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
910             "qns.condition_rove_in_idle_cell_pref_roam_guarding_none_string_array";
911     static final String KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY =
912             "qns.condition_rove_in_idle_cell_pref_roam_guarding_wifi_string_array";
913     static final String KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
914             "qns.condition_rove_in_voice_cell_pref_roam_guarding_none_string_array";
915     static final String KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY =
916             "qns.condition_rove_in_voice_cell_pref_roam_guarding_wifi_string_array";
917     static final String KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
918             "qns.condition_rove_in_video_cell_pref_roam_guarding_none_string_array";
919     static final String KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY =
920             "qns.condition_rove_in_video_cell_pref_roam_guarding_wifi_string_array";
921     static final String KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
922             "qns.condition_rove_out_idle_wifi_pref_roam_guarding_none_string_array";
923     static final String KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_ROAM_GUARDING_CELL_STRING_ARRAY =
924             "qns.condition_rove_out_idle_wifi_pref_roam_guarding_cell_string_array";
925     static final String KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
926             "qns.condition_rove_out_voice_wifi_pref_roam_guarding_none_string_array";
927     static final String KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_ROAM_GUARDING_CELL_STRING_ARRAY =
928             "qns.condition_rove_out_voice_wifi_pref_roam_guarding_cell_string_array";
929     static final String KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
930             "qns.condition_rove_out_video_wifi_pref_roam_guarding_none_string_array";
931     static final String KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_ROAM_GUARDING_CELL_STRING_ARRAY =
932             "qns.condition_rove_out_video_wifi_pref_roam_guarding_cell_string_array";
933     static final String KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
934             "qns.condition_rove_out_idle_cell_pref_roam_guarding_none_string_array";
935     static final String KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_ROAM_GUARDING_CELL_STRING_ARRAY =
936             "qns.condition_rove_out_idle_cell_pref_roam_guarding_cell_string_array";
937     static final String KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
938             "qns.condition_rove_out_voice_cell_pref_roam_guarding_none_string_array";
939     static final String KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_ROAM_GUARDING_CELL_STRING_ARRAY =
940             "qns.condition_rove_out_voice_cell_pref_roam_guarding_cell_string_array";
941     static final String KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY =
942             "qns.condition_rove_out_video_cell_pref_roam_guarding_none_string_array";
943     static final String KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_ROAM_GUARDING_CELL_STRING_ARRAY =
944             "qns.condition_rove_out_video_cell_pref_roam_guarding_cell_string_array";
945 
946     private final HashMap<String, int[]> mQnsRatThresholdMap = new HashMap<>();
947 
948     private final HashMap<String, String[]> mQnsPolicyMap = new HashMap<>();
949     private final String mLogTag;
950 
951     static final String[] THRESHOLD_KEYS =
952             new String[] {
953                 KEY_IDLE_EUTRAN_RSRP_INT_ARRAY,
954                 KEY_VOICE_EUTRAN_RSRP_INT_ARRAY,
955                 KEY_VIDEO_EUTRAN_RSRP_INT_ARRAY,
956                 KEY_IDLE_EUTRAN_RSRQ_INT_ARRAY,
957                 KEY_VOICE_EUTRAN_RSRQ_INT_ARRAY,
958                 KEY_VIDEO_EUTRAN_RSRQ_INT_ARRAY,
959                 KEY_IDLE_EUTRAN_RSSNR_INT_ARRAY,
960                 KEY_VOICE_EUTRAN_RSSNR_INT_ARRAY,
961                 KEY_VIDEO_EUTRAN_RSSNR_INT_ARRAY,
962                 KEY_IDLE_NGRAN_SSRSRP_INT_ARRAY,
963                 KEY_VOICE_NGRAN_SSRSRP_INT_ARRAY,
964                 KEY_VIDEO_NGRAN_SSRSRP_INT_ARRAY,
965                 KEY_IDLE_NGRAN_SSRSRQ_INT_ARRAY,
966                 KEY_VOICE_NGRAN_SSRSRQ_INT_ARRAY,
967                 KEY_VIDEO_NGRAN_SSRSRQ_INT_ARRAY,
968                 KEY_IDLE_NGRAN_SSSINR_INT_ARRAY,
969                 KEY_VOICE_NGRAN_SSSINR_INT_ARRAY,
970                 KEY_VIDEO_NGRAN_SSSINR_INT_ARRAY,
971                 KEY_IDLE_UTRAN_RSCP_INT_ARRAY,
972                 KEY_VOICE_UTRAN_RSCP_INT_ARRAY,
973                 KEY_VIDEO_UTRAN_RSCP_INT_ARRAY,
974                 KEY_IDLE_UTRAN_ECNO_INT_ARRAY,
975                 KEY_IDLE_GERAN_RSSI_INT_ARRAY,
976                 KEY_VOICE_GERAN_RSSI_INT_ARRAY,
977                 KEY_VIDEO_GERAN_RSSI_INT_ARRAY,
978                 KEY_IDLE_WIFI_RSSI_INT_ARRAY,
979                 KEY_VOICE_WIFI_RSSI_INT_ARRAY,
980                 KEY_VIDEO_WIFI_RSSI_INT_ARRAY,
981                 KEY_OVERRIDE_WIFI_PREF_IDLE_WIFI_RSSI_INT_ARRAY,
982                 KEY_OVERRIDE_WIFI_PREF_VOICE_WIFI_RSSI_INT_ARRAY,
983                 KEY_OVERRIDE_WIFI_PREF_VIDEO_WIFI_RSSI_INT_ARRAY,
984                 KEY_IDLE_WIFI_RSSI_WITHOUT_CELLULAR_INT_ARRAY,
985                 KEY_VOICE_WIFI_RSSI_WITHOUT_CELLULAR_INT_ARRAY,
986                 KEY_VIDEO_WIFI_RSSI_WITHOUT_CELLULAR_INT_ARRAY
987             };
988 
989     /**
990      * Constructor to Slot & Context whose Access Network selection policy related support configs
991      * needs to be loaded, along with Other QNS Configurations on which the related Carrier Config
992      * ID to be loaded.
993      *
994      * @param slotIndex Constructor for initialising QnsCarrierAnspSupportConfig to current SlotID
995      */
QnsCarrierAnspSupportConfig(int slotIndex)996     QnsCarrierAnspSupportConfig(int slotIndex) {
997         mLogTag =
998                 QnsConstants.QNS_TAG
999                         + "_"
1000                         + QnsCarrierAnspSupportConfig.class.getSimpleName()
1001                         + "_"
1002                         + slotIndex;
1003     }
1004 
1005     /**
1006      * This method loads the Threshold Array & Policy Array rules for building Access Network
1007      * Selection policies
1008      *
1009      * @param bundleCarrier : Carrier config Manager (pb config) persistent bundle
1010      * @param bundleAsset : asset config (xml) persistent bundle
1011      */
loadQnsAnspSupportArray(PersistableBundle bundleCarrier, PersistableBundle bundleAsset)1012     void loadQnsAnspSupportArray(PersistableBundle bundleCarrier, PersistableBundle bundleAsset) {
1013         updateAnspThresholdArrayList(bundleCarrier, bundleAsset);
1014         updateAnspPolicyArrayList(bundleCarrier, bundleAsset);
1015     }
1016 
updateAnspThresholdArrayList( PersistableBundle bundleCarrier, PersistableBundle bundleAsset)1017     private void updateAnspThresholdArrayList(
1018             PersistableBundle bundleCarrier, PersistableBundle bundleAsset) {
1019 
1020         for (String key : THRESHOLD_KEYS) {
1021             int[] anspThresholdArray = QnsUtils.getConfig(bundleCarrier, bundleAsset, key);
1022             if (anspThresholdArray != null && anspThresholdArray.length > 1) {
1023                 anspThresholdArray = validateAndAdjustThresholdArray(anspThresholdArray, key);
1024             }
1025             mQnsRatThresholdMap.put(key, anspThresholdArray);
1026         }
1027     }
1028 
validateAndAdjustThresholdArray(int[] thresholds, String thresholdKey)1029     private int[] validateAndAdjustThresholdArray(int[] thresholds, String thresholdKey) {
1030         if (thresholds[POLICY_GOOD] != QnsCarrierConfigManager.QnsConfigArray.INVALID
1031                 && thresholds[POLICY_BAD] != QnsCarrierConfigManager.QnsConfigArray.INVALID
1032                 && thresholds[POLICY_GOOD] - thresholds[POLICY_BAD] < MIN_THRESHOLD_GAP) {
1033             if (thresholds[POLICY_GOOD] - thresholds[POLICY_BAD] < 0) {
1034                 Log.d(mLogTag, "invalid Thresholds for " + thresholdKey + " use default.");
1035                 return QnsUtils.getConfig(null, null, thresholdKey);
1036             } else if (thresholds[POLICY_GOOD] - thresholds[POLICY_BAD] < MIN_THRESHOLD_GAP) {
1037                 int currentGap = thresholds[POLICY_GOOD] - thresholds[POLICY_BAD];
1038                 int[] adjust = thresholds.clone();
1039                 for (int i = currentGap; i < MIN_THRESHOLD_GAP; i++) {
1040                     if ((i - currentGap) % 2 == 0) {
1041                         adjust[POLICY_GOOD]++;
1042                     } else {
1043                         adjust[POLICY_BAD]--;
1044                     }
1045                 }
1046                 Log.d(
1047                         mLogTag,
1048                         "Thresholds("
1049                                 + thresholdKey
1050                                 + ") gap is too small adjust:"
1051                                 + "["
1052                                 + thresholds[POLICY_GOOD]
1053                                 + "] > ["
1054                                 + adjust[POLICY_GOOD]
1055                                 + "]"
1056                                 + "["
1057                                 + thresholds[POLICY_BAD]
1058                                 + "] > ["
1059                                 + adjust[POLICY_BAD]
1060                                 + "]");
1061                 return adjust;
1062             }
1063         }
1064         return thresholds;
1065     }
1066 
updateAnspPolicyArrayList( PersistableBundle bundleCarrier, PersistableBundle bundleAsset)1067     private void updateAnspPolicyArrayList(
1068             PersistableBundle bundleCarrier, PersistableBundle bundleAsset) {
1069 
1070         String[] policyKeys =
1071                 new String[] {
1072                     KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_HOME_STRING_ARRAY,
1073                     KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_HOME_STRING_ARRAY,
1074                     KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_HOME_STRING_ARRAY,
1075                     KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_HOME_STRING_ARRAY,
1076                     KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_HOME_STRING_ARRAY,
1077                     KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_HOME_STRING_ARRAY,
1078                     KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_HOME_STRING_ARRAY,
1079                     KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_HOME_STRING_ARRAY,
1080                     KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_HOME_STRING_ARRAY,
1081                     KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_HOME_STRING_ARRAY,
1082                     KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_HOME_STRING_ARRAY,
1083                     KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_HOME_STRING_ARRAY,
1084                     KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_ROAM_STRING_ARRAY,
1085                     KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_ROAM_STRING_ARRAY,
1086                     KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_ROAM_STRING_ARRAY,
1087                     KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_ROAM_STRING_ARRAY,
1088                     KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_ROAM_STRING_ARRAY,
1089                     KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_ROAM_STRING_ARRAY,
1090                     KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_ROAM_STRING_ARRAY,
1091                     KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_ROAM_STRING_ARRAY,
1092                     KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_ROAM_STRING_ARRAY,
1093                     KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_ROAM_STRING_ARRAY,
1094                     KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_ROAM_STRING_ARRAY,
1095                     KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_ROAM_STRING_ARRAY,
1096                     KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1097                     KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_HOME_GUARDING_WIFI_STRING_ARRAY,
1098                     KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1099                     KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_HOME_GUARDING_WIFI_STRING_ARRAY,
1100                     KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1101                     KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_HOME_GUARDING_WIFI_STRING_ARRAY,
1102                     KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1103                     KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_HOME_GUARDING_WIFI_STRING_ARRAY,
1104                     KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1105                     KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_HOME_GUARDING_WIFI_STRING_ARRAY,
1106                     KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1107                     KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_HOME_GUARDING_WIFI_STRING_ARRAY,
1108                     KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1109                     KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_HOME_GUARDING_CELL_STRING_ARRAY,
1110                     KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1111                     KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_HOME_GUARDING_CELL_STRING_ARRAY,
1112                     KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1113                     KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_HOME_GUARDING_CELL_STRING_ARRAY,
1114                     KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1115                     KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_HOME_GUARDING_CELL_STRING_ARRAY,
1116                     KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1117                     KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_HOME_GUARDING_CELL_STRING_ARRAY,
1118                     KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_HOME_GUARDING_NONE_STRING_ARRAY,
1119                     KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_HOME_GUARDING_CELL_STRING_ARRAY,
1120                     KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1121                     KEY_CONDITION_ROVE_IN_IDLE_WIFI_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY,
1122                     KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1123                     KEY_CONDITION_ROVE_IN_VOICE_WIFI_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY,
1124                     KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1125                     KEY_CONDITION_ROVE_IN_VIDEO_WIFI_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY,
1126                     KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1127                     KEY_CONDITION_ROVE_IN_IDLE_CELL_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY,
1128                     KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1129                     KEY_CONDITION_ROVE_IN_VOICE_CELL_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY,
1130                     KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1131                     KEY_CONDITION_ROVE_IN_VIDEO_CELL_PREF_ROAM_GUARDING_WIFI_STRING_ARRAY,
1132                     KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1133                     KEY_CONDITION_ROVE_OUT_IDLE_WIFI_PREF_ROAM_GUARDING_CELL_STRING_ARRAY,
1134                     KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1135                     KEY_CONDITION_ROVE_OUT_VOICE_WIFI_PREF_ROAM_GUARDING_CELL_STRING_ARRAY,
1136                     KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1137                     KEY_CONDITION_ROVE_OUT_VIDEO_WIFI_PREF_ROAM_GUARDING_CELL_STRING_ARRAY,
1138                     KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1139                     KEY_CONDITION_ROVE_OUT_IDLE_CELL_PREF_ROAM_GUARDING_CELL_STRING_ARRAY,
1140                     KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1141                     KEY_CONDITION_ROVE_OUT_VOICE_CELL_PREF_ROAM_GUARDING_CELL_STRING_ARRAY,
1142                     KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_ROAM_GUARDING_NONE_STRING_ARRAY,
1143                     KEY_CONDITION_ROVE_OUT_VIDEO_CELL_PREF_ROAM_GUARDING_CELL_STRING_ARRAY,
1144                 };
1145         for (String key : policyKeys) {
1146             String[] anspPolicyArray = QnsUtils.getConfig(bundleCarrier, bundleAsset, key);
1147             mQnsPolicyMap.put(key, anspPolicyArray);
1148         }
1149     }
1150 
getAnspCarrierThreshold(String key)1151     int[] getAnspCarrierThreshold(String key) {
1152         return mQnsRatThresholdMap.get(key);
1153     }
1154 
getAnspCarrierPolicy(String key)1155     String[] getAnspCarrierPolicy(String key) {
1156         return mQnsPolicyMap.get(key);
1157     }
1158 
1159     /**
1160      * Check if Threshold config was Updated.
1161      *
1162      * @param configBundle : Carrier config Manager (pb config) persistent bundle
1163      * @param assetBundle : asset config (xml) persistent bundle
1164      * @return true/false
1165      */
checkQnsAnspConfigChange( PersistableBundle configBundle, PersistableBundle assetBundle)1166     synchronized boolean checkQnsAnspConfigChange(
1167             PersistableBundle configBundle, PersistableBundle assetBundle) {
1168         return isThresholdConfigChanged(configBundle, assetBundle);
1169     }
1170 
isThresholdConfigChanged( PersistableBundle configChangeBundle, PersistableBundle assetBundle)1171     private boolean isThresholdConfigChanged(
1172             PersistableBundle configChangeBundle, PersistableBundle assetBundle) {
1173         HashMap<String, int[]> qnsRatThresUpdatedMap = new HashMap<>();
1174 
1175         for (String key : THRESHOLD_KEYS) {
1176             int[] anspThresholdArray = QnsUtils.getConfig(configChangeBundle, assetBundle, key);
1177             qnsRatThresUpdatedMap.put(key, anspThresholdArray);
1178         }
1179 
1180         for (String k : mQnsRatThresholdMap.keySet()) {
1181             if (!Arrays.equals(mQnsRatThresholdMap.get(k), qnsRatThresUpdatedMap.get(k))) {
1182                 mQnsRatThresholdMap.putAll(qnsRatThresUpdatedMap);
1183                 return true;
1184             }
1185         }
1186 
1187         return false;
1188     }
1189 }
1190