• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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.messaging.util;
18 
19 
20 /**
21  * List of gservices keys and default values which are in use.
22  */
23 public final class BugleGservicesKeys {
BugleGservicesKeys()24     private BugleGservicesKeys() {}   // do not instantiate
25 
26     /**
27      * Whether to enable extra debugging features on the client. Default is
28      * {@value #ENABLE_DEBUGGING_FEATURES_DEFAULT}.
29      */
30     public static final String ENABLE_DEBUGGING_FEATURES
31             = "bugle_debugging";
32     public static final boolean ENABLE_DEBUGGING_FEATURES_DEFAULT
33             = false;
34 
35     /**
36      * Whether to enable saving extra logs. Default is {@value #ENABLE_LOG_SAVER_DEFAULT}.
37      */
38     public static final String ENABLE_LOG_SAVER = "bugle_logsaver";
39     public static final boolean ENABLE_LOG_SAVER_DEFAULT = false;
40 
41     /**
42      * Time in milliseconds of initial (attempt 1) resend backoff for failing messages
43      */
44     public static final String INITIAL_MESSAGE_RESEND_DELAY_MS = "bugle_resend_delay_in_millis";
45     public static final long INITIAL_MESSAGE_RESEND_DELAY_MS_DEFAULT = 5 * 1000L;
46 
47     /**
48      * Time in milliseconds of max resend backoff for failing messages
49      */
50     public static final String MAX_MESSAGE_RESEND_DELAY_MS = "bugle_max_resend_delay_in_millis";
51     public static final long MAX_MESSAGE_RESEND_DELAY_MS_DEFAULT = 2 * 60 * 60 * 1000L;
52 
53     /**
54      * Time in milliseconds of resend window for unsent messages
55      */
56     public static final String MESSAGE_RESEND_TIMEOUT_MS = "bugle_resend_timeout_in_millis";
57     public static final long MESSAGE_RESEND_TIMEOUT_MS_DEFAULT = 20 * 60 * 1000L;
58 
59     /**
60      * Time in milliseconds of download window for new mms notifications
61      */
62     public static final String MESSAGE_DOWNLOAD_TIMEOUT_MS = "bugle_download_timeout_in_millis";
63     public static final long MESSAGE_DOWNLOAD_TIMEOUT_MS_DEFAULT = 20 * 60 * 1000L;
64 
65     /**
66      * Time in milliseconds for SMS send timeout
67      */
68     public static final String SMS_SEND_TIMEOUT_IN_MILLIS = "bugle_sms_send_timeout";
69     public static final long SMS_SEND_TIMEOUT_IN_MILLIS_DEFAULT = 5 * 60 * 1000L;
70 
71     /**
72      * Keys to control the SMS sync batch size. The batch size is defined by the number
73      * of messages that incur local database change, e.g. importing messages and
74      * deleting messages.
75      *
76      * 1. The minimum size for a batch and
77      * 2. The maximum size for a batch.
78      * The first batch uses the minimum size for probing. Set this to a small number for the
79      * first sync batch to make sure the user sees SMS showing up in conversations quickly
80      * Use these two settings to limit the number of messages to sync in each batch.
81      * The minimum is to make sure we always make progress during sync. The maximum is
82      * to limit the sync batch size within a reasonable range (needs to fit in an intent).
83      * 3. The time limit controls the limit of time duration of a sync batch. We can
84      * not control this directly due to the batching nature of sync. So this provides
85      * heuristics. We may sometime exceeds the limit if our calculation is off due to
86      * whatever reasons. Keeping this low ensures responsiveness of the application.
87      * 4. The limit on number of total messages to scan in one batch.
88      */
89     public static final String SMS_SYNC_BATCH_SIZE_MIN =
90             "bugle_sms_sync_batch_size_min";
91     public static final int SMS_SYNC_BATCH_SIZE_MIN_DEFAULT = 80;
92     public static final String SMS_SYNC_BATCH_SIZE_MAX =
93             "bugle_sms_sync_batch_size_max";
94     public static final int SMS_SYNC_BATCH_SIZE_MAX_DEFAULT = 1000;
95     public static final String SMS_SYNC_BATCH_TIME_LIMIT_MILLIS =
96             "bugle_sms_sync_batch_time_limit";
97     public static final long SMS_SYNC_BATCH_TIME_LIMIT_MILLIS_DEFAULT = 400;
98     public static final String SMS_SYNC_BATCH_MAX_MESSAGES_TO_SCAN =
99             "bugle_sms_sync_batch_max_messages_to_scan";
100     public static final int SMS_SYNC_BATCH_MAX_MESSAGES_TO_SCAN_DEFAULT =
101             SMS_SYNC_BATCH_SIZE_MAX_DEFAULT * 4;
102 
103     /**
104      * Time in ms for sync to backoff from "now" to the latest message that will be sync'd.
105      *
106      * This controls the best case for how out of date the application will appear to be
107      * when bringing in changes made outside the application. It also represents a buffer
108      * to ensure that sync doesn't trigger based on changes made within the application.
109      */
110     public static final String SMS_SYNC_BACKOFF_TIME_MILLIS =
111             "bugle_sms_sync_backoff_time";
112     public static final long SMS_SYNC_BACKOFF_TIME_MILLIS_DEFAULT = 5000L;
113 
114     /**
115      * Just in case if we fall into a loop of full sync -> still not synchronized -> full sync ...
116      * This forces a backoff time so that we at most do full sync once a while (an hour by default)
117      */
118     public static final String SMS_FULL_SYNC_BACKOFF_TIME_MILLIS =
119             "bugle_sms_full_sync_backoff_time";
120     public static final long SMS_FULL_SYNC_BACKOFF_TIME_MILLIS_DEFAULT = 60 * 60 * 1000;
121 
122     /**
123      * Time duration to retain the most recent SMS messages for SMS storage purging
124      *
125      * Format:
126      *   <number>(w|m|y)
127      * Examples:
128      *   "1y" -- a year
129      *   "2w" -- two weeks
130      *   "6m" -- six months
131      */
132     public static final String SMS_STORAGE_PURGING_MESSAGE_RETAINING_DURATION =
133             "bugle_sms_storage_purging_message_retaining_duration";
134     public static final String SMS_STORAGE_PURGING_MESSAGE_RETAINING_DURATION_DEFAULT = "1m";
135 
136     /**
137      * MMS UA profile url.
138      *
139      * This is used on all Android devices running Hangout, so cannot just host the profile of the
140      * latest and greatest phones. However, if we're on KitKat or below we can't get the phone's
141      * UA profile and thus we need to send them the default url.
142      */
143     public static final String MMS_UA_PROFILE_URL =
144             "bugle_mms_uaprofurl";
145     public static final String MMS_UA_PROFILE_URL_DEFAULT =
146             "http://www.gstatic.com/android/sms/mms_ua_profile.xml";
147 
148     /**
149      * MMS apn mmsc
150      */
151     public static final String MMS_MMSC =
152             "bugle_mms_mmsc";
153 
154     /**
155      * MMS apn proxy ip address
156      */
157     public static final String MMS_PROXY_ADDRESS =
158             "bugle_mms_proxy_address";
159 
160     /**
161      * MMS apn proxy port
162      */
163     public static final String MMS_PROXY_PORT =
164             "bugle_mms_proxy_port";
165 
166     /**
167      * List of known SMS system messages that we will ignore (no deliver, no abort) so that the
168      * user doesn't see them and the appropriate app is able to handle them. We are delivering
169      * these as a \n delimited list of patterns, however we should eventually move to storing
170      * them with the per-carrier mms config xml file.
171      */
172     public static final String SMS_IGNORE_MESSAGE_REGEX =
173             "bugle_sms_ignore_message_regex";
174     public static final String SMS_IGNORE_MESSAGE_REGEX_DEFAULT = "";
175 
176     /**
177      * When receiving or importing an mms, limit the length of text to this limit. Huge blocks
178      * of text can cause the app to hang/ANR/or crash in native text code..
179      */
180     public static final String MMS_TEXT_LIMIT = "bugle_mms_text_limit";
181     public static final int MMS_TEXT_LIMIT_DEFAULT = 2000;
182 
183     /**
184      * Max number of attachments the user may add to a single message.
185      */
186     public static final String MMS_ATTACHMENT_LIMIT = "bugle_mms_attachment_limit";
187     public static final int MMS_ATTACHMENT_LIMIT_DEFAULT = 10;
188 
189     /**
190      * The max number of messages to show in a single conversation notification. We always show
191      * the most recent message. If this value is >1, we may also include prior messages as well.
192      */
193     public static final String MAX_MESSAGES_IN_CONVERSATION_NOTIFICATION =
194             "bugle_max_messages_in_conversation_notification";
195     public static final int MAX_MESSAGES_IN_CONVERSATION_NOTIFICATION_DEFAULT = 7;
196 
197     /**
198      * Time (in seconds) between notification ringing for incoming messages of the same
199      * conversation. We won't ding more often than this value for messages coming in at a high rate.
200      */
201     public static final String NOTIFICATION_TIME_BETWEEN_RINGS_SECONDS
202             = "bugle_notification_time_between_rings_seconds";
203     public static final int NOTIFICATION_TIME_BETWEEN_RINGS_SECONDS_DEFAULT = 10;
204 
205     /**
206      * The max number of messages to show in a single conversation notification, when a wearable
207      * device (i.e. smartwatch) is paired with the phone. Watches have a different UX model and
208      * less screen real estate, so we may want to optimize for that case. Note that if a wearable
209      * is paired, this value will apply to notifications as shown both on the watch and the phone.
210      */
211     public static final String MAX_MESSAGES_IN_CONVERSATION_NOTIFICATION_WITH_WEARABLE =
212             "bugle_max_messages_in_conversation_notification_with_wearable";
213     public static final int MAX_MESSAGES_IN_CONVERSATION_NOTIFICATION_WITH_WEARABLE_DEFAULT = 1;
214 
215     /**
216      * Regular expression to match against query.  If it matches then display
217      * the query plan for this query.
218      */
219     public static final String EXPLAIN_QUERY_PLAN_REGEXP = "bugle_query_plan_regexp";
220 
221     /**
222      * Whether asserts are fatal on user/userdebug builds.
223      * Default is {@value #ASSERTS_FATAL_DEFAULT}.
224      */
225     public static final String ASSERTS_FATAL = "bugle_asserts_fatal";
226     public static final boolean ASSERTS_FATAL_DEFAULT = false;
227 
228     /**
229      * Whether to use API for sending/downloading MMS (if present, true for L).
230      * Default is {@value #USE_MMS_API_IF_PRESENT_DEFAULT}.
231      */
232     public static final String USE_MMS_API_IF_PRESENT = "bugle_use_mms_api";
233     public static final boolean USE_MMS_API_IF_PRESENT_DEFAULT = true;
234 
235     /**
236      * Whether to always auto-complete email addresses for sending MMS. By default, Bugle starts
237      * to auto-complete after the user has typed the "@" character.
238      * Default is (@value ALWAYS_AUTOCOMPLETE_EMAIL_ADDRESS_DEFAULT}.
239      */
240     public static final String ALWAYS_AUTOCOMPLETE_EMAIL_ADDRESS =
241             "bugle_always_autocomplete_email_address";
242     public static final boolean ALWAYS_AUTOCOMPLETE_EMAIL_ADDRESS_DEFAULT = false;
243 
244     // We typically request an aspect ratio close the the screen size, but some cameras can be
245     // flaky and not work well in certain aspect ratios.  This allows us to guide the CameraManager
246     // to pick a more reliable aspect ratio.  The value is a float like 1.333f or 1.777f.  There is
247     // no hard coded default because the default is the screen aspect ratio.
248     public static final String CAMERA_ASPECT_RATIO = "bugle_camera_aspect_ratio";
249 
250     /**
251      * The recent time range within which we should check MMS WAP Push duplication
252      * If the value is 0, it signals that we should use old dedup algorithm for wap push
253      */
254     public static final String MMS_WAP_PUSH_DEDUP_TIME_LIMIT_SECS =
255             "bugle_mms_wap_push_dedup_time_limit_secs";
256     public static final long MMS_WAP_PUSH_DEDUP_TIME_LIMIT_SECS_DEFAULT = 7 * 24 * 3600; // 7 days
257 
258     /**
259      * Whether to use persistent, on-disk LogSaver
260      */
261     public static final String PERSISTENT_LOGSAVER = "bugle_persistent_logsaver";
262     public static final boolean PERSISTENT_LOGSAVER_DEFAULT = false;
263 
264     /**
265      * For in-memory LogSaver, what's the size of memory buffer in number of records
266      */
267     public static final String IN_MEMORY_LOGSAVER_RECORD_COUNT =
268             "bugle_in_memory_logsaver_record_count";
269     public static final int IN_MEMORY_LOGSAVER_RECORD_COUNT_DEFAULT = 500;
270 
271     /**
272      * For on-disk LogSaver, what's the size of file rotation set
273      */
274     public static final String PERSISTENT_LOGSAVER_ROTATION_SET_SIZE =
275             "bugle_persistent_logsaver_rotation_set_size";
276     public static final int PERSISTENT_LOGSAVER_ROTATION_SET_SIZE_DEFAULT = 8;
277 
278     /**
279      * For on-disk LogSaver, what's the byte limit of a single log file
280      */
281     public static final String PERSISTENT_LOGSAVER_FILE_LIMIT_BYTES =
282             "bugle_persistent_logsaver_file_limit";
283     public static final int PERSISTENT_LOGSAVER_FILE_LIMIT_BYTES_DEFAULT = 256 * 1024; // 256KB
284 
285     /**
286      * We concatenate all text parts in an MMS to form the message text. This specifies
287      * the separator between the combinated text parts. Default is ' ' (space).
288      */
289     public static final String MMS_TEXT_CONCAT_SEPARATOR = "bugle_mms_text_concat_separator";
290     public static final String MMS_TEXT_CONCAT_SEPARATOR_DEFAULT = " ";
291 
292     /**
293      * Whether to enable transcoding GIFs. We sometimes need to compress GIFs to make them small
294      * enough to send via MMS (which often limits messages to 1 MB in size).
295      */
296     public static final String ENABLE_GIF_TRANSCODING = "bugle_gif_transcoding";
297     public static final boolean ENABLE_GIF_TRANSCODING_DEFAULT = true;
298 }
299