1 /*
2  * Copyright (C) 2014 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.server.telecom;
18 
19 import android.content.ContentResolver;
20 import android.provider.DeviceConfig;
21 import android.provider.Settings;
22 import android.telecom.CallDiagnosticService;
23 import android.telecom.CallDiagnostics;
24 import android.telecom.CallRedirectionService;
25 import android.telephony.ims.ImsReasonInfo;
26 
27 import java.util.concurrent.TimeUnit;
28 
29 /**
30  * A helper class which serves only to make it easier to lookup timeout values. This class should
31  * never be instantiated, and only accessed through the {@link #get(String, long)} method.
32  *
33  * These methods are safe to call from any thread, including the UI thread.
34  */
35 public final class Timeouts {
36     public static class Adapter {
Adapter()37         public Adapter() {
38         }
39 
getCallScreeningTimeoutMillis(ContentResolver cr)40         public long getCallScreeningTimeoutMillis(ContentResolver cr) {
41             return Timeouts.getCallScreeningTimeoutMillis(cr);
42         }
43 
getCallBindBluetoothInCallServicesDelay(ContentResolver cr)44         public long getCallBindBluetoothInCallServicesDelay(ContentResolver cr) {
45             return Timeouts.getCallBindBluetoothInCallServicesDelay(cr);
46         }
47 
getCallRemoveUnbindInCallServicesDelay(ContentResolver cr)48         public long getCallRemoveUnbindInCallServicesDelay(ContentResolver cr) {
49             return Timeouts.getCallRemoveUnbindInCallServicesDelay(cr);
50         }
51 
getRetryBluetoothConnectAudioBackoffMillis(ContentResolver cr)52         public long getRetryBluetoothConnectAudioBackoffMillis(ContentResolver cr) {
53             return Timeouts.getRetryBluetoothConnectAudioBackoffMillis(cr);
54         }
55 
getBluetoothPendingTimeoutMillis(ContentResolver cr)56         public long getBluetoothPendingTimeoutMillis(ContentResolver cr) {
57             return Timeouts.getBluetoothPendingTimeoutMillis(cr);
58         }
59 
getEmergencyCallbackWindowMillis(ContentResolver cr)60         public long getEmergencyCallbackWindowMillis(ContentResolver cr) {
61             return Timeouts.getEmergencyCallbackWindowMillis(cr);
62         }
63 
getEmergencyCallTimeoutMillis(ContentResolver cr)64         public long getEmergencyCallTimeoutMillis(ContentResolver cr) {
65             return Timeouts.getEmergencyCallTimeoutMillis(cr);
66         }
67 
getEmergencyCallTimeoutRadioOffMillis(ContentResolver cr)68         public long getEmergencyCallTimeoutRadioOffMillis(ContentResolver cr) {
69             return Timeouts.getEmergencyCallTimeoutRadioOffMillis(cr);
70         }
71 
getUserDefinedCallRedirectionTimeoutMillis(ContentResolver cr)72         public long getUserDefinedCallRedirectionTimeoutMillis(ContentResolver cr) {
73             return Timeouts.getUserDefinedCallRedirectionTimeoutMillis(cr);
74         }
75 
getCarrierCallRedirectionTimeoutMillis(ContentResolver cr)76         public long getCarrierCallRedirectionTimeoutMillis(ContentResolver cr) {
77             return Timeouts.getCarrierCallRedirectionTimeoutMillis(cr);
78         }
79 
getPhoneAccountSuggestionServiceTimeout(ContentResolver cr)80         public long getPhoneAccountSuggestionServiceTimeout(ContentResolver cr) {
81             return Timeouts.getPhoneAccountSuggestionServiceTimeout(cr);
82         }
83 
getCallRecordingToneRepeatIntervalMillis(ContentResolver cr)84         public long getCallRecordingToneRepeatIntervalMillis(ContentResolver cr) {
85             return Timeouts.getCallRecordingToneRepeatIntervalMillis(cr);
86         }
87 
getCallDiagnosticServiceTimeoutMillis(ContentResolver cr)88         public long getCallDiagnosticServiceTimeoutMillis(ContentResolver cr) {
89             return Timeouts.getCallDiagnosticServiceTimeoutMillis(cr);
90         }
91 
getCallStartAppOpDebounceIntervalMillis()92         public long getCallStartAppOpDebounceIntervalMillis() {
93             return Timeouts.getCallStartAppOpDebounceIntervalMillis();
94         }
95 
getVoipCallTransitoryStateTimeoutMillis()96         public long getVoipCallTransitoryStateTimeoutMillis() {
97             return Timeouts.getVoipCallTransitoryStateTimeoutMillis();
98         }
99 
getVoipEmergencyCallTransitoryStateTimeoutMillis()100         public long getVoipEmergencyCallTransitoryStateTimeoutMillis() {
101             return Timeouts.getVoipEmergencyCallTransitoryStateTimeoutMillis();
102         }
103 
getNonVoipCallTransitoryStateTimeoutMillis()104         public long getNonVoipCallTransitoryStateTimeoutMillis() {
105             return Timeouts.getNonVoipCallTransitoryStateTimeoutMillis();
106         }
107 
getNonVoipEmergencyCallTransitoryStateTimeoutMillis()108         public long getNonVoipEmergencyCallTransitoryStateTimeoutMillis() {
109             return Timeouts.getNonVoipEmergencyCallTransitoryStateTimeoutMillis();
110         }
111 
getVoipCallIntermediateStateTimeoutMillis()112         public long getVoipCallIntermediateStateTimeoutMillis() {
113             return Timeouts.getVoipCallIntermediateStateTimeoutMillis();
114         }
115 
getVoipEmergencyCallIntermediateStateTimeoutMillis()116         public long getVoipEmergencyCallIntermediateStateTimeoutMillis() {
117             return Timeouts.getVoipEmergencyCallIntermediateStateTimeoutMillis();
118         }
119 
getNonVoipCallIntermediateStateTimeoutMillis()120         public long getNonVoipCallIntermediateStateTimeoutMillis() {
121             return Timeouts.getNonVoipCallIntermediateStateTimeoutMillis();
122         }
123 
getNonVoipEmergencyCallIntermediateStateTimeoutMillis()124         public long getNonVoipEmergencyCallIntermediateStateTimeoutMillis() {
125             return Timeouts.getNonVoipEmergencyCallIntermediateStateTimeoutMillis();
126         }
127 
getEmergencyCallTimeBeforeUserDisconnectThresholdMillis()128         public long getEmergencyCallTimeBeforeUserDisconnectThresholdMillis(){
129             return Timeouts.getEmergencyCallTimeBeforeUserDisconnectThresholdMillis();
130         }
131 
getEmergencyCallActiveTimeThresholdMillis()132         public long getEmergencyCallActiveTimeThresholdMillis(){
133             return Timeouts.getEmergencyCallActiveTimeThresholdMillis();
134         }
135 
getDaysBackToSearchEmergencyDiagnosticEntries()136         public int getDaysBackToSearchEmergencyDiagnosticEntries(){
137             return Timeouts.getDaysBackToSearchEmergencyDiagnosticEntries();
138         }
139     }
140 
141     /** A prefix to use for all keys so to not clobber the global namespace. */
142     private static final String PREFIX = "telecom.";
143 
144     /**
145      * threshold used to filter out ecalls that the user may have dialed by mistake
146      * It is used only when the disconnect cause is LOCAL by EmergencyDiagnosticLogger
147      */
148     private static final String EMERGENCY_CALL_TIME_BEFORE_USER_DISCONNECT_THRESHOLD_MILLIS =
149             "emergency_call_time_before_user_disconnect_threshold_millis";
150 
151     /**
152      * Returns the threshold used to detect ecalls that transition to active but only for a very
153      * short duration. These short duration active calls can result in Diagnostic data collection.
154      */
155     private static final String EMERGENCY_CALL_ACTIVE_TIME_THRESHOLD_MILLIS =
156             "emergency_call_active_time_threshold_millis";
157 
158     /**
159      * Time in Days that is used to filter out old dropbox entries for emergency call diagnostic
160      * data. Entries older than this are ignored
161      */
162     private static final String DAYS_BACK_TO_SEARCH_EMERGENCY_DROP_BOX_ENTRIES =
163             "days_back_to_search_emergency_drop_box_entries";
164 
165     /**
166      * A prefix to use for {@link DeviceConfig} for the transitory state timeout of
167      * VoIP Call, in millis.
168      */
169     private static final String TRANSITORY_STATE_VOIP_NORMAL_TIMEOUT_MILLIS =
170             "transitory_state_voip_normal_timeout_millis";
171 
172     /**
173      * A prefix to use for {@link DeviceConfig} for the transitory state timeout of
174      * VoIP emergency Call, in millis.
175      */
176     private static final String TRANSITORY_STATE_VOIP_EMERGENCY_TIMEOUT_MILLIS =
177             "transitory_state_voip_emergency_timeout_millis";
178 
179     /**
180      * A prefix to use for {@link DeviceConfig} for the transitory state timeout of
181      * non-VoIP call, in millis.
182      */
183     private static final String TRANSITORY_STATE_NON_VOIP_NORMAL_TIMEOUT_MILLIS =
184             "transitory_state_non_voip_normal_timeout_millis";
185 
186     /**
187      * A prefix to use for {@link DeviceConfig} for the transitory state timeout of
188      * non-VoIP emergency call, in millis.
189      */
190     private static final String TRANSITORY_STATE_NON_VOIP_EMERGENCY_TIMEOUT_MILLIS =
191             "transitory_state_non_voip_emergency_timeout_millis";
192 
193     /**
194      * A prefix to use for {@link DeviceConfig} for the intermediate state timeout of
195      * VoIP call, in millis.
196      */
197     private static final String INTERMEDIATE_STATE_VOIP_NORMAL_TIMEOUT_MILLIS =
198             "intermediate_state_voip_normal_timeout_millis";
199 
200     /**
201      * A prefix to use for {@link DeviceConfig} for the intermediate state timeout of
202      * VoIP emergency call, in millis.
203      */
204     private static final String INTERMEDIATE_STATE_VOIP_EMERGENCY_TIMEOUT_MILLIS =
205             "intermediate_state_voip_emergency_timeout_millis";
206 
207     /**
208      * A prefix to use for {@link DeviceConfig} for the intermediate state timeout of
209      * non-VoIP call, in millis.
210      */
211     private static final String INTERMEDIATE_STATE_NON_VOIP_NORMAL_TIMEOUT_MILLIS =
212             "intermediate_state_non_voip_normal_timeout_millis";
213 
214     /**
215      * A prefix to use for {@link DeviceConfig} for the intermediate state timeout of
216      * non-VoIP emergency call, in millis.
217      */
218     private static final String INTERMEDIATE_STATE_NON_VOIP_EMERGENCY_TIMEOUT_MILLIS =
219             "intermediate_state_non_voip_emergency_timeout_millis";
220 
Timeouts()221     private Timeouts() {
222     }
223 
224     /**
225      * Returns the timeout value from Settings or the default value if it hasn't been changed. This
226      * method is safe to call from any thread, including the UI thread.
227      *
228      * @param contentResolver The content resolved.
229      * @param key             Settings key to retrieve.
230      * @param defaultValue    Default value, in milliseconds.
231      * @return The timeout value from Settings or the default value if it hasn't been changed.
232      */
get(ContentResolver contentResolver, String key, long defaultValue)233     private static long get(ContentResolver contentResolver, String key, long defaultValue) {
234         return Settings.Secure.getLongForUser(contentResolver, PREFIX + key, defaultValue,
235                         contentResolver.getUserId());
236     }
237 
238     /**
239      * Returns the amount of time to wait before disconnecting a call that was canceled via
240      * NEW_OUTGOING_CALL broadcast. This timeout allows apps which repost the call using a gateway
241      * to reuse the existing call, preventing the call from causing a start->end->start jank in the
242      * in-call UI.
243      */
getNewOutgoingCallCancelMillis(ContentResolver contentResolver)244     public static long getNewOutgoingCallCancelMillis(ContentResolver contentResolver) {
245         return get(contentResolver, "new_outgoing_call_cancel_ms", 500L);
246     }
247 
248     /**
249      * Returns the maximum amount of time to wait before disconnecting a call that was canceled via
250      * NEW_OUTGOING_CALL broadcast. This prevents malicious or poorly configured apps from
251      * forever tying up the Telecom stack.
252      */
getMaxNewOutgoingCallCancelMillis(ContentResolver contentResolver)253     public static long getMaxNewOutgoingCallCancelMillis(ContentResolver contentResolver) {
254         return get(contentResolver, "max_new_outgoing_call_cancel_ms", 10000L);
255     }
256 
257     /**
258      * Returns the amount of time to play each DTMF tone after post dial continue.
259      * This timeout allows the current tone to play for a certain amount of time before either being
260      * interrupted by the next tone or terminated.
261      */
getDelayBetweenDtmfTonesMillis(ContentResolver contentResolver)262     public static long getDelayBetweenDtmfTonesMillis(ContentResolver contentResolver) {
263         return get(contentResolver, "delay_between_dtmf_tones_ms", 300L);
264     }
265 
266     /**
267      * Returns the amount of time to wait for an emergency call to be placed before routing to
268      * a different call service. A value of 0 or less means no timeout should be used.
269      */
getEmergencyCallTimeoutMillis(ContentResolver contentResolver)270     public static long getEmergencyCallTimeoutMillis(ContentResolver contentResolver) {
271         return get(contentResolver, "emergency_call_timeout_millis", 25000L /* 25 seconds */);
272     }
273 
274     /**
275      * Returns the amount of time to wait for an emergency call to be placed before routing to
276      * a different call service. This timeout is used only when the radio is powered off (for
277      * example in airplane mode). A value of 0 or less means no timeout should be used.
278      */
getEmergencyCallTimeoutRadioOffMillis(ContentResolver contentResolver)279     public static long getEmergencyCallTimeoutRadioOffMillis(ContentResolver contentResolver) {
280         return get(contentResolver, "emergency_call_timeout_radio_off_millis",
281                 60000L /* 1 minute */);
282     }
283 
getCallBindBluetoothInCallServicesDelay(ContentResolver contentResolver)284     public static long getCallBindBluetoothInCallServicesDelay(ContentResolver contentResolver) {
285         return get(contentResolver, "call_bind_bluetooth_in_call_services_delay",
286                 2000L /* 2 seconds */);
287     }
288 
289     /**
290      * Returns the amount of delay before unbinding the in-call services after all the calls
291      * are removed.
292      */
getCallRemoveUnbindInCallServicesDelay(ContentResolver contentResolver)293     public static long getCallRemoveUnbindInCallServicesDelay(ContentResolver contentResolver) {
294         return get(contentResolver, "call_remove_unbind_in_call_services_delay",
295                 2000L /* 2 seconds */);
296     }
297 
298     /**
299      * Returns the amount of time for which bluetooth is considered connected after requesting
300      * connection. This compensates for the amount of time it takes for the audio route to
301      * actually change to bluetooth.
302      */
getBluetoothPendingTimeoutMillis(ContentResolver contentResolver)303     public static long getBluetoothPendingTimeoutMillis(ContentResolver contentResolver) {
304         return get(contentResolver, "bluetooth_pending_timeout_millis", 5000L);
305     }
306 
307     /**
308      * Returns the amount of time to wait before retrying the connectAudio call. This is
309      * necessary to account for the HeadsetStateMachine sometimes not being ready when we want to
310      * connect to bluetooth audio immediately after a device connects.
311      */
getRetryBluetoothConnectAudioBackoffMillis(ContentResolver contentResolver)312     public static long getRetryBluetoothConnectAudioBackoffMillis(ContentResolver contentResolver) {
313         return get(contentResolver, "retry_bluetooth_connect_audio_backoff_millis", 500L);
314     }
315 
316     /**
317      * Returns the amount of time to wait for the phone account suggestion service to reply.
318      */
getPhoneAccountSuggestionServiceTimeout(ContentResolver contentResolver)319     public static long getPhoneAccountSuggestionServiceTimeout(ContentResolver contentResolver) {
320         return get(contentResolver, "phone_account_suggestion_service_timeout",
321                 5000L /* 5 seconds */);
322     }
323 
324     /**
325      * Returns the amount of time to wait for the call screening service to allow or disallow a
326      * call.
327      */
getCallScreeningTimeoutMillis(ContentResolver contentResolver)328     public static long getCallScreeningTimeoutMillis(ContentResolver contentResolver) {
329         return get(contentResolver, "call_screening_timeout", 5000L /* 5 seconds */);
330     }
331 
332     /**
333      * Returns the amount of time after an emergency call that incoming calls should be treated
334      * as potential emergency callbacks.
335      */
getEmergencyCallbackWindowMillis(ContentResolver contentResolver)336     public static long getEmergencyCallbackWindowMillis(ContentResolver contentResolver) {
337         return get(contentResolver, "emergency_callback_window_millis",
338                 TimeUnit.MILLISECONDS.convert(5, TimeUnit.MINUTES));
339     }
340 
341     /**
342      * Returns the amount of time for an user-defined {@link CallRedirectionService}.
343      *
344      * @param contentResolver The content resolver.
345      */
getUserDefinedCallRedirectionTimeoutMillis(ContentResolver contentResolver)346     public static long getUserDefinedCallRedirectionTimeoutMillis(ContentResolver contentResolver) {
347         return get(contentResolver, "user_defined_call_redirection_timeout",
348                 5000L /* 5 seconds */);
349     }
350 
351     /**
352      * Returns the amount of time for a carrier {@link CallRedirectionService}.
353      *
354      * @param contentResolver The content resolver.
355      */
getCarrierCallRedirectionTimeoutMillis(ContentResolver contentResolver)356     public static long getCarrierCallRedirectionTimeoutMillis(ContentResolver contentResolver) {
357         return get(contentResolver, "carrier_call_redirection_timeout", 5000L /* 5 seconds */);
358     }
359 
360     /**
361      * Returns the number of milliseconds between two plays of the call recording tone.
362      */
getCallRecordingToneRepeatIntervalMillis(ContentResolver contentResolver)363     public static long getCallRecordingToneRepeatIntervalMillis(ContentResolver contentResolver) {
364         return get(contentResolver, "call_recording_tone_repeat_interval", 15000L /* 15 seconds */);
365     }
366 
367     /**
368      * Returns the maximum amount of time a {@link CallDiagnosticService} is permitted to take to
369      * return back from {@link CallDiagnostics#onCallDisconnected(ImsReasonInfo)} and
370      * {@link CallDiagnostics#onCallDisconnected(int, int)}.
371      * @param contentResolver The resolver for the config option.
372      * @return The timeout in millis.
373      */
getCallDiagnosticServiceTimeoutMillis(ContentResolver contentResolver)374     public static long getCallDiagnosticServiceTimeoutMillis(ContentResolver contentResolver) {
375         return get(contentResolver, "call_diagnostic_service_timeout", 2000L /* 2 sec */);
376     }
377 
378     /**
379      * Returns the duration of time a VoIP call can be in a transitory state before Telecom will
380      * try to clean up the call.
381      * @return the state timeout in millis.
382      */
getVoipCallTransitoryStateTimeoutMillis()383     public static long getVoipCallTransitoryStateTimeoutMillis() {
384         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
385                 TRANSITORY_STATE_VOIP_NORMAL_TIMEOUT_MILLIS, 5000L);
386     }
387 
388 
389     /**
390      * Returns the threshold used to filter out ecalls that the user may have dialed by mistake
391      * It is used only when the disconnect cause is LOCAL by EmergencyDiagnosticLogger
392      * @return the threshold in milliseconds
393      */
getEmergencyCallTimeBeforeUserDisconnectThresholdMillis()394     public static long getEmergencyCallTimeBeforeUserDisconnectThresholdMillis() {
395         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
396                 EMERGENCY_CALL_TIME_BEFORE_USER_DISCONNECT_THRESHOLD_MILLIS, 20000L);
397     }
398 
399     /**
400      * Returns the threshold used to detect ecalls that transition to active but only for a very
401      * short duration. These short duration active calls can result in Diagnostic data collection.
402      * @return the threshold in milliseconds
403      */
getEmergencyCallActiveTimeThresholdMillis()404     public static long getEmergencyCallActiveTimeThresholdMillis() {
405         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
406                 EMERGENCY_CALL_ACTIVE_TIME_THRESHOLD_MILLIS, 15000L);
407     }
408 
409     /**
410      * Time in Days that is used to filter out old dropbox entries for emergency call diagnostic
411      * data. Entries older than this are ignored
412      */
getDaysBackToSearchEmergencyDiagnosticEntries()413     public static int getDaysBackToSearchEmergencyDiagnosticEntries() {
414         return DeviceConfig.getInt(DeviceConfig.NAMESPACE_TELEPHONY,
415                 DAYS_BACK_TO_SEARCH_EMERGENCY_DROP_BOX_ENTRIES, 30);
416     }
417 
418     /**
419      * Returns the duration of time an emergency VoIP call can be in a transitory state before
420      * Telecom will try to clean up the call.
421      * @return the state timeout in millis.
422      */
getVoipEmergencyCallTransitoryStateTimeoutMillis()423     public static long getVoipEmergencyCallTransitoryStateTimeoutMillis() {
424         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
425                 TRANSITORY_STATE_VOIP_EMERGENCY_TIMEOUT_MILLIS, 5000L);
426     }
427 
428     /**
429      * Returns the duration of time a non-VoIP call can be in a transitory state before Telecom
430      * will try to clean up the call.
431      * @return the state timeout in millis.
432      */
getNonVoipCallTransitoryStateTimeoutMillis()433     public static long getNonVoipCallTransitoryStateTimeoutMillis() {
434         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
435                 TRANSITORY_STATE_NON_VOIP_NORMAL_TIMEOUT_MILLIS, 10000L);
436     }
437 
438     /**
439      * Returns the duration of time an emergency non-VoIp call can be in a transitory state before
440      * Telecom will try to clean up the call.
441      * @return the state timeout in millis.
442      */
getNonVoipEmergencyCallTransitoryStateTimeoutMillis()443     public static long getNonVoipEmergencyCallTransitoryStateTimeoutMillis() {
444         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
445                 TRANSITORY_STATE_NON_VOIP_EMERGENCY_TIMEOUT_MILLIS, 10000L);
446     }
447 
448     /**
449      * Returns the duration of time a VoIP call can be in an intermediate state before Telecom will
450      * try to clean up the call.
451      * @return the state timeout in millis.
452      */
getVoipCallIntermediateStateTimeoutMillis()453     public static long getVoipCallIntermediateStateTimeoutMillis() {
454         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
455                 INTERMEDIATE_STATE_VOIP_NORMAL_TIMEOUT_MILLIS, 60000L);
456     }
457 
458     /**
459      * Returns the duration of time an emergency VoIP call can be in an intermediate state before
460      * Telecom will try to clean up the call.
461      * @return the state timeout in millis.
462      */
getVoipEmergencyCallIntermediateStateTimeoutMillis()463     public static long getVoipEmergencyCallIntermediateStateTimeoutMillis() {
464         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
465                 INTERMEDIATE_STATE_VOIP_EMERGENCY_TIMEOUT_MILLIS, 60000L);
466     }
467 
468     /**
469      * Returns the duration of time a non-VoIP call can be in an intermediate state before Telecom
470      * will try to clean up the call.
471      * @return the state timeout in millis.
472      */
getNonVoipCallIntermediateStateTimeoutMillis()473     public static long getNonVoipCallIntermediateStateTimeoutMillis() {
474         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
475                 INTERMEDIATE_STATE_NON_VOIP_NORMAL_TIMEOUT_MILLIS, 120000L);
476     }
477 
478     /**
479      * Returns the duration of time an emergency non-VoIP call can be in an intermediate state
480      * before Telecom will try to clean up the call.
481      * @return the state timeout in millis.
482      */
getNonVoipEmergencyCallIntermediateStateTimeoutMillis()483     public static long getNonVoipEmergencyCallIntermediateStateTimeoutMillis() {
484         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
485                 INTERMEDIATE_STATE_NON_VOIP_EMERGENCY_TIMEOUT_MILLIS, 60000L);
486     }
487 
getCallStartAppOpDebounceIntervalMillis()488     public static long getCallStartAppOpDebounceIntervalMillis() {
489         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_PRIVACY, "app_op_debounce_time", 250L);
490     }
491 
492     /**
493      * Returns the number of milliseconds for which the system should exempt the default dialer from
494      * power save restrictions due to the dialer needing to handle a missed call notification
495      * (update call log, check VVM, etc...).
496      */
getDialerMissedCallPowerSaveExemptionTimeMillis( ContentResolver contentResolver)497     public static long getDialerMissedCallPowerSaveExemptionTimeMillis(
498             ContentResolver contentResolver) {
499         return get(contentResolver, "dialer_missed_call_power_save_exemption_time_millis",
500                 30000L /*30 seconds*/);
501     }
502 }
503