Offset 1, 14 lines modifiedOffset 1, 10 lines modified
  
1 package·com.android.textclassifier.common;1 package·com.android.textclassifier.common;
  
2 import·java.util.Iterator; 
3 import·android.provider.DeviceConfig$Properties; 
4 import·android.text.TextUtils; 
5 import·com.google.common.collect.ImmutableList$Builder; 
6 import·com.google.common.base.Splitter;2 import·com.google.common.base.Splitter;
7 import·com.android.textclassifier.utils.IndentingPrintWriter;3 import·com.android.textclassifier.utils.IndentingPrintWriter;
8 import·java.util.Collections;4 import·java.util.Collections;
9 import·java.util.Arrays;5 import·java.util.Arrays;
10 import·java.util.List;6 import·java.util.List;
11 import·java.util.concurrent.TimeUnit;7 import·java.util.concurrent.TimeUnit;
12 import·com.google.common.collect.ImmutableList;8 import·com.google.common.collect.ImmutableList;
Offset 18, 29 lines modifiedOffset 14, 26 lines modified
18 ····private·static·final·ImmutableList·CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES;14 ····private·static·final·ImmutableList·CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES;
19 ····private·static·final·TextClassifierSettings$IDeviceConfig·DEFAULT_DEVICE_CONFIG;15 ····private·static·final·TextClassifierSettings$IDeviceConfig·DEFAULT_DEVICE_CONFIG;
20 ····static·final·String·ENTITY_LIST_DEFAULT·=·"entity_list_default";16 ····static·final·String·ENTITY_LIST_DEFAULT·=·"entity_list_default";
21 ····private·static·final·ImmutableList·ENTITY_LIST_DEFAULT_VALUE;17 ····private·static·final·ImmutableList·ENTITY_LIST_DEFAULT_VALUE;
22 ····static·final·String·LANG_ID_CONTEXT_SETTINGS·=·"lang_id_context_settings";18 ····static·final·String·LANG_ID_CONTEXT_SETTINGS·=·"lang_id_context_settings";
23 ····private·static·final·float[]·LANG_ID_CONTEXT_SETTINGS_DEFAULT;19 ····private·static·final·float[]·LANG_ID_CONTEXT_SETTINGS_DEFAULT;
24 ····static·final·String·LANG_ID_THRESHOLD_OVERRIDE·=·"lang_id_threshold_override";20 ····static·final·String·LANG_ID_THRESHOLD_OVERRIDE·=·"lang_id_threshold_override";
25 ····public·static·final·String·MANIFEST_DOWNLOAD_MAX_ATTEMPTS·=·"manifest_download_max_attempts"; 
26 ····public·static·final·String·MANIFEST_URL_TEMPLATE·=·"manifest_url_%s_%s";21 ····public·static·final·String·MANIFEST_URL_TEMPLATE·=·"manifest_url_%s_%s";
27 ····static·final·String·MODEL_DOWNLOAD_BACKOFF_DELAY_IN_MILLIS·=·"model_download_backoff_delay_in_millis";22 ····static·final·String·MODEL_DOWNLOAD_BACKOFF_DELAY_IN_MILLIS·=·"model_download_backoff_delay_in_millis";
28 ····private·static·final·long·MODEL_DOWNLOAD_BACKOFF_DELAY_IN_MILLIS_DEFAULT·=·0L; 
29 ····public·static·final·String·MODEL_DOWNLOAD_MANAGER_ENABLED·=·"model_download_manager_enabled";23 ····public·static·final·String·MODEL_DOWNLOAD_MANAGER_ENABLED·=·"model_download_manager_enabled";
30 ····static·final·String·MODEL_DOWNLOAD_WORKER_MAX_ATTEMPTS·=·"model_download_worker_max_attempts";24 ····static·final·String·MODEL_DOWNLOAD_MAX_ATTEMPTS·=·"model_download_max_attempts";
31 ····public·static·final·String·MODEL_URL_BLOCKLIST·=·"model_url_blocklist"; 
32 ····public·static·final·String·MODEL_URL_BLOCKLIST_SEPARATOR·=·","; 
33 ····static·final·String·SUGGEST_SELECTION_MAX_RANGE_LENGTH·=·"suggest_selection_max_range_length";25 ····static·final·String·SUGGEST_SELECTION_MAX_RANGE_LENGTH·=·"suggest_selection_max_range_length";
34 ····static·final·String·TEMPLATE_INTENT_FACTORY_ENABLED·=·"template_intent_factory_enabled";26 ····static·final·String·TEMPLATE_INTENT_FACTORY_ENABLED·=·"template_intent_factory_enabled";
35 ····private·final·TextClassifierSettings$IDeviceConfig·deviceConfig;27 ····private·final·TextClassifierSettings$IDeviceConfig·deviceConfig;
36 ····28 ····
37 ····static·{29 ····static·{
38 ········ENTITY_LIST_DEFAULT_VALUE·=·ImmutableList.of((Object)"address",·(Object)"email",·(Object)"phone",·(Object)"url",·(Object)"date",·(Object)"datetime",·(Object)"flight");30 ········ENTITY_LIST_DEFAULT_VALUE·=·ImmutableList.of((Object)"address",·(Object)"email",·(Object)"phone",·(Object)"url",·(Object)"date",·(Object)"datetime",·(Object)"flight");
39 ········CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES·=·ImmutableList.of((Object)"text_reply",·(Object)"create_reminder",·(Object)"call_phone",·(Object)"open_url",·(Object)"send_email",·(Object)"send_sms",·(Object)"track_flight",·(Object)"view_calendar",·(Object)"view_map",·(Object)"add_contact",·(Object)"copy");31 ········CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES·=·ImmutableList.of((Object)"text_reply",·(Object)"create_reminder",·(Object)"call_phone",·(Object)"open_url",·(Object)"send_email",·(Object)"send_sms",·(Object)"track_flight",·(Object)"view_calendar",·(Object)"view_map",·(Object)"add_contact",·(Object)"copy");
 32 ········TimeUnit.HOURS.toMillis(1L);
40 ········final·float[]·array;33 ········final·float[]·array;
41 ········final·float[]·lang_ID_CONTEXT_SETTINGS_DEFAULT·=·array·=·new·float[3];34 ········final·float[]·lang_ID_CONTEXT_SETTINGS_DEFAULT·=·array·=·new·float[3];
42 ········array[0]·=·20.0f;35 ········array[0]·=·20.0f;
43 ········array[1]·=·1.0f;36 ········array[1]·=·1.0f;
44 ········array[2]·=·0.4f;37 ········array[2]·=·0.4f;
45 ········LANG_ID_CONTEXT_SETTINGS_DEFAULT·=·lang_ID_CONTEXT_SETTINGS_DEFAULT;38 ········LANG_ID_CONTEXT_SETTINGS_DEFAULT·=·lang_ID_CONTEXT_SETTINGS_DEFAULT;
46 ········DEFAULT_DEVICE_CONFIG·=·(TextClassifierSettings$IDeviceConfig)new·TextClassifierSettings$1();39 ········DEFAULT_DEVICE_CONFIG·=·(TextClassifierSettings$IDeviceConfig)new·TextClassifierSettings$1();
Offset 87, 28 lines modifiedOffset 80, 28 lines modified
87 ········final·ImmutableList·conversation_ACTIONS_TYPES_DEFAULT_VALUES·=·TextClassifierSettings.CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES;80 ········final·ImmutableList·conversation_ACTIONS_TYPES_DEFAULT_VALUES·=·TextClassifierSettings.CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES;
88 ········final·String·s7·=·"in_app_conversation_action_types_default";81 ········final·String·s7·=·"in_app_conversation_action_types_default";
89 ········indentingPrintWriter.printPair(s7,·(Object)this.getDeviceConfigStringList(s7,·(List)conversation_ACTIONS_TYPES_DEFAULT_VALUES));82 ········indentingPrintWriter.printPair(s7,·(Object)this.getDeviceConfigStringList(s7,·(List)conversation_ACTIONS_TYPES_DEFAULT_VALUES));
90 ········Object·a·=·TextClassifierSettings.LANG_ID_CONTEXT_SETTINGS_DEFAULT;83 ········Object·a·=·TextClassifierSettings.LANG_ID_CONTEXT_SETTINGS_DEFAULT;
91 ········final·TextClassifierSettings$IDeviceConfig·deviceConfig4·=·this.deviceConfig;84 ········final·TextClassifierSettings$IDeviceConfig·deviceConfig4·=·this.deviceConfig;
92 ········String·s8·=·"lang_id_context_settings";85 ········String·s8·=·"lang_id_context_settings";
93 ········final·String·string·=·deviceConfig4.getString(s,·s8,·(String)null);86 ········final·String·string·=·deviceConfig4.getString(s,·s8,·(String)null);
94 ········Label_0370:·{87 ········Label_0376:·{
95 ············if·(string·==·null)·{88 ············if·(string·==·null)·{
96 ················break·Label_0370;89 ················break·Label_0376;
97 ············}90 ············}
98 ············final·List·splitToList·=·Splitter.onPattern(":").splitToList((CharSequence)string);91 ············final·List·splitToList·=·Splitter.onPattern(":").splitToList((CharSequence)string);
99 ············if·(splitToList.size()·!=·((TextClassifierSettings$IDeviceConfig)a).length)·{92 ············if·(splitToList.size()·!=·((TextClassifierSettings$IDeviceConfig)a).length)·{
100 ················break·Label_0370;93 ················break·Label_0376;
101 ············}94 ············}
102 ············final·float[]·array·=·new·float[splitToList.size()];95 ············final·float[]·array·=·new·float[splitToList.size()];
103 ············int·n2·=·0;96 ············int·n2·=·0;
104 ············while·(true)·{97 ············while·(true)·{
105 ················Label_0367:·{98 ················Label_0373:·{
106 ····················if·(n2·>=·splitToList.size())·{99 ····················if·(n2·>=·splitToList.size())·{
107 ························break·Label_0367;100 ························break·Label_0373;
108 ····················}101 ····················}
109 ····················final·List·list·=·splitToList;102 ····················final·List·list·=·splitToList;
110 ····················try·{103 ····················try·{
111 ························final·String·value·=·list.get(n2);104 ························final·String·value·=·list.get(n2);
112 ························try·{105 ························try·{
113 ····························final·String·s9·=·(String)value;106 ····························final·String·s9·=·(String)value;
114 ····························try·{107 ····························try·{
Offset 143, 35 lines modifiedOffset 136, 23 lines modified
143 ································a·=·((TextClassifierSettings)o).deviceConfig;136 ································a·=·((TextClassifierSettings)o).deviceConfig;
144 ································final·String·s13·=·"translate_in_classification_enabled";137 ································final·String·s13·=·"translate_in_classification_enabled";
145 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getBoolean(s,·s13,·(boolean)(n·!=·0));138 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getBoolean(s,·s13,·(boolean)(n·!=·0));
146 ································indentingPrintWriter.printPair(s13,·a);139 ································indentingPrintWriter.printPair(s13,·a);
147 ································a·=·((TextClassifierSettings)o).isModelDownloadManagerEnabled();140 ································a·=·((TextClassifierSettings)o).isModelDownloadManagerEnabled();
148 ································indentingPrintWriter.printPair("model_download_manager_enabled",·a);141 ································indentingPrintWriter.printPair("model_download_manager_enabled",·a);
149 ································a·=·((TextClassifierSettings)o).deviceConfig;142 ································a·=·((TextClassifierSettings)o).deviceConfig;
150 ································final·String·s14·=·"model_download_worker_max_attempts";143 ································final·String·s14·=·"model_download_max_attempts";
151 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getInt(s,·s14,·5);144 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getInt(s,·s14,·5);
152 ································indentingPrintWriter.printPair(s14,·a);145 ································indentingPrintWriter.printPair(s14,·a);
153 ································a·=·((TextClassifierSettings)o).deviceConfig; 
154 ································final·String·s15·=·"manifest_download_max_attempts"; 
155 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getInt(s,·s15,·3); 
156 ································indentingPrintWriter.printPair(s15,·a); 
157 ································a·=·((TextClassifierSettings)o).deviceConfig; 
158 ································final·String·s16·=·"manifest_download_requires_charging"; 
159 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getBoolean(s,·s16,·false); 
160 ································indentingPrintWriter.printPair(s16,·a); 
161 ································a·=·((TextClassifierSettings)o).deviceConfig; 
162 ································final·String·s17·=·"manifest_download_requires_device_idle"; 
163 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getBoolean(s,·s17,·false); 
164 ································indentingPrintWriter.printPair(s17,·a); 
165 ································indentingPrintWriter.decreaseIndent();146 ································indentingPrintWriter.decreaseIndent();
166 ································a·=·((TextClassifierSettings)o).deviceConfig;147 ································a·=·((TextClassifierSettings)o).deviceConfig;
167 ································final·String·s18·=·"textclassifier_api_log_sample_rate";148 ································final·String·s15·=·"textclassifier_api_log_sample_rate";
168 ································n·=·10;149 ································n·=·10;
169 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getInt(s,·s18,·n);150 ································a·=·((TextClassifierSettings$IDeviceConfig)a).getInt(s,·s15,·n);
170 ································indentingPrintWriter.printPair(s18,·a);151 ································indentingPrintWriter.printPair(s15,·a);
171 ································o·=·((TextClassifierSettings)o).deviceConfig;152 ································o·=·((TextClassifierSettings)o).deviceConfig;
172 ································a·=·"session_id_to_context_cache_size";153 ································a·=·"session_id_to_context_cache_size";
173 ································o·=·((TextClassifierSettings$IDeviceConfig)o).getInt(s,·(String)a,·n);154 ································o·=·((TextClassifierSettings$IDeviceConfig)o).getInt(s,·(String)a,·n);
174 ································indentingPrintWriter.printPair((String)a,·o);155 ································indentingPrintWriter.printPair((String)a,·o);
175 ································indentingPrintWriter.decreaseIndent();156 ································indentingPrintWriter.decreaseIndent();
176 ································return;157 ································return;
177 ································a·=·array;158 ································a·=·array;
Offset 215, 64 lines modifiedOffset 196, 14 lines modified
215 ········return·this.getDeviceConfigStringList("in_app_conversation_action_types_default",·(List)TextClassifierSettings.CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES);196 ········return·this.getDeviceConfigStringList("in_app_conversation_action_types_default",·(List)TextClassifierSettings.CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES);
216 ····}197 ····}
217 ····198 ····
218 ····public·float·getLangIdThresholdOverride()·{199 ····public·float·getLangIdThresholdOverride()·{
219 ········return·this.deviceConfig.getFloat("textclassifier",·"lang_id_threshold_override",·-1.0f);200 ········return·this.deviceConfig.getFloat("textclassifier",·"lang_id_threshold_override",·-1.0f);
220 ····}201 ····}
221 ····202 ····
222 ····public·ImmutableList·getLanguageTagsForManifestURL(String·format)·{ 
223 ········format·=·String.format("manifest_url_%s_%s",·format,·""); 
224 ········final·DeviceConfig$Properties·properties·=·this.deviceConfig.getProperties("textclassifier",·new·String[0]); 
225 ········final·int·$r8$clinit·=·ImmutableList.$r8$clinit; 
226 ········final·ImmutableList$Builder·immutableList$Builder·=·new·ImmutableList$Builder(); 
227 ········for·(final·String·s·:·properties.getKeyset())·{ 
228 ············if·(!s.startsWith(format))·{ 
229 ················continue; 
230 ············} 
231 ············if·(TextUtils.isEmpty((CharSequence)properties.getString(s,·(String)null)))·{ 
232 ················continue; 
233 ············} 
234 ············immutableList$Builder.add((Object)s.substring(format.length())); 
235 ········} 
236 ········return·immutableList$Builder.build(); 
237 ····} 
238 ···· 
239 ····public·int·getManifestDownloadMaxAttempts()·{ 
240 ········return·this.deviceConfig.getInt("textclassifier",·"manifest_download_max_attempts",·3); 
241 ····} 
242 ···· 
243 ····public·String·getManifestDownloadRequiredNetworkType()·{ 
244 ········return·this.deviceConfig.getString("textclassifier",·"manifest_download_required_network_type",·"UNMETERED"); 
245 ····} 
246 ···· 
247 ····public·boolean·getManifestDownloadRequiresCharging()·{ 
248 ········return·this.deviceConfig.getBoolean("textclassifier",·"manifest_download_requires_charging",·false); 
249 ····} 
250 ···· 
251 ····public·boolean·getManifestDownloadRequiresDeviceIdle()·{ 
252 ········return·this.deviceConfig.getBoolean("textclassifier",·"manifest_download_requires_device_idle",·false); 
253 ····} 
254 ···· 
255 ····public·String·getManifestURL(String·format,·final·String·s)·{ 
256 ········format·=·String.format("manifest_url_%s_%s",·format,·s); 
257 ········return·this.deviceConfig.getString("textclassifier",·format,·""); 
258 ····} 
259 ···· 
260 ····public·long·getModelDownloadBackoffDelayInMillis()·{ 
261 ········return·this.deviceConfig.getLong("textclassifier",·"model_download_backoff_delay_in_millis",·TextClassifierSettings.MODEL_DOWNLOAD_BACKOFF_DELAY_IN_MILLIS_DEFAULT); 
262 ····} 
263 ···· 
264 ····public·int·getModelDownloadWorkerMaxAttempts()·{ 
265 ········return·this.deviceConfig.getInt("textclassifier",·"model_download_worker_max_attempts",·5); 
266 ····} 
267 ···· 
268 ····public·ImmutableList·getModelUrlBlocklist()·{ 
269 ········return·ImmutableList.copyOf(Splitter.on(",").split((CharSequence)this.deviceConfig.getString("textclassifier",·"model_url_blocklist",·""))); 
270 ····} 
271 ···· 
272 ····public·List·getNotificationConversationActionTypes()·{203 ····public·List·getNotificationConversationActionTypes()·{
273 ········return·this.getDeviceConfigStringList("notification_conversation_action_types_default",·(List)TextClassifierSettings.CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES);204 ········return·this.getDeviceConfigStringList("notification_conversation_action_types_default",·(List)TextClassifierSettings.CONVERSATION_ACTIONS_TYPES_DEFAULT_VALUES);
274 ····}205 ····}
275 ····206 ····
276 ····public·int·getSessionIdToContextCacheSize()·{207 ····public·int·getSessionIdToContextCacheSize()·{
277 ········return·this.deviceConfig.getInt("textclassifier",·"session_id_to_context_cache_size",·10);208 ········return·this.deviceConfig.getInt("textclassifier",·"session_id_to_context_cache_size",·10);
278 ····}209 ····}