Offset 37, 15 lines modifiedOffset 37, 14 lines modified
37 import·android.app.PendingIntent$CanceledException;37 import·android.app.PendingIntent$CanceledException;
38 import·android.view.View;38 import·android.view.View;
39 import·android.content.pm.ResolveInfo;39 import·android.content.pm.ResolveInfo;
40 import·android.content.res.Configuration;40 import·android.content.res.Configuration;
41 import·android.content.res.Resources;41 import·android.content.res.Resources;
42 import·java.io.FileNotFoundException;42 import·java.io.FileNotFoundException;
43 import·android.os.ParcelFileDescriptor;43 import·android.os.ParcelFileDescriptor;
44 import·java.io.File; 
45 import·java.util.Objects;44 import·java.util.Objects;
46 import·com.google.android.textclassifier.LangIdModel$LanguageResult;45 import·com.google.android.textclassifier.LangIdModel$LanguageResult;
47 import·java.util.Map;46 import·java.util.Map;
48 import·android.util.ArrayMap;47 import·android.util.ArrayMap;
49 import·android.view.View$OnClickListener;48 import·android.view.View$OnClickListener;
50 import·android.app.PendingIntent;49 import·android.app.PendingIntent;
51 import·java.util.Collection;50 import·java.util.Collection;
Offset 55, 79 lines modifiedOffset 54, 93 lines modified
55 import·com.google.android.textclassifier.ActionsSuggestionsModel$ActionSuggestion;54 import·com.google.android.textclassifier.ActionsSuggestionsModel$ActionSuggestion;
56 import·android.view.textclassifier.ConversationActions$Request;55 import·android.view.textclassifier.ConversationActions$Request;
57 import·android.app.RemoteAction;56 import·android.app.RemoteAction;
58 import·android.content.Intent;57 import·android.content.Intent;
59 import·com.android.textclassifier.common.intent.LabeledIntent$Result;58 import·com.android.textclassifier.common.intent.LabeledIntent$Result;
60 import·com.google.common.collect.UnmodifiableIterator;59 import·com.google.common.collect.UnmodifiableIterator;
61 import·java.util.stream.Collector;60 import·java.util.stream.Collector;
62 import·java.util.function.Supplier; 
63 import·java.util.stream.Collectors;61 import·java.util.stream.Collectors;
64 import·java.util.function.Predicate;62 import·java.util.function.Predicate;
65 import·com.google.common.base.Function; 
66 import·android.os.Bundle;63 import·android.os.Bundle;
67 import·com.android.textclassifier.common.intent.LabeledIntent$TitleChooser;64 import·com.android.textclassifier.common.intent.LabeledIntent$TitleChooser;
68 import·com.android.textclassifier.common.intent.LabeledIntent;65 import·com.android.textclassifier.common.intent.LabeledIntent;
69 import·java.util.ArrayList;66 import·java.util.ArrayList;
70 import·com.google.common.collect.ImmutableList;67 import·com.google.common.collect.ImmutableList;
71 import·android.view.textclassifier.TextClassification$Builder;68 import·android.view.textclassifier.TextClassification$Builder;
72 import·android.view.textclassifier.TextClassification;69 import·android.view.textclassifier.TextClassification;
73 import·com.google.android.textclassifier.AnnotatorModel$ClassificationResult;70 import·com.google.android.textclassifier.AnnotatorModel$ClassificationResult;
74 import·java.util.List;71 import·java.util.List;
75 import·com.android.textclassifier.common.logging.ResultIdUtils;72 import·com.android.textclassifier.common.logging.ResultIdUtils;
76 import·com.google.common.base.Optional;73 import·com.google.common.base.Optional;
77 import·android.os.LocaleList;74 import·android.os.LocaleList;
78 import·com.android.textclassifier.common.base.TcLog;75 import·com.android.textclassifier.common.base.TcLog;
79 import·android.os.Looper;76 import·android.os.Looper;
 77 import·java.util.function.Supplier;
 78 import·java.util.function.Function;
80 import·com.google.common.base.Preconditions;79 import·com.google.common.base.Preconditions;
81 import·com.android.textclassifier.common.statsd.TextClassifierEventLogger;80 import·com.android.textclassifier.common.statsd.TextClassifierEventLogger;
82 import·com.android.textclassifier.common.intent.TemplateIntentFactory;81 import·com.android.textclassifier.common.intent.TemplateIntentFactory;
83 import·com.google.android.textclassifier.LangIdModel;82 import·com.google.android.textclassifier.LangIdModel;
84 import·com.android.textclassifier.common.statsd.GenerateLinksLogger;83 import·com.android.textclassifier.common.statsd.GenerateLinksLogger;
85 import·android.view.textclassifier.TextClassifier;84 import·android.view.textclassifier.TextClassifier;
86 import·android.content.Context;85 import·android.content.Context;
87 import·com.google.android.textclassifier.AnnotatorModel;86 import·com.google.android.textclassifier.AnnotatorModel;
88 import·com.google.android.textclassifier.ActionsSuggestionsModel;87 import·com.google.android.textclassifier.ActionsSuggestionsModel;
 88 import·java.io.File;
  
89 final·class·TextClassifierImpl89 final·class·TextClassifierImpl
90 {90 {
 91 ····private·static·final·File·ANNOTATOR_UPDATED_MODEL_FILE;
 92 ····private·static·final·File·FACTORY_MODEL_DIR;
 93 ····private·static·final·File·UPDATED_ACTIONS_MODEL;
 94 ····private·static·final·File·UPDATED_LANG_ID_MODEL_FILE;
91 ····private·ModelFileManager$ModelFile·actionModelInUse;95 ····private·ModelFileManager$ModelFile·actionModelInUse;
92 ····private·ActionsSuggestionsModel·actionsImpl;96 ····private·ActionsSuggestionsModel·actionsImpl;
 97 ····private·final·ModelFileManager·actionsModelFileManager;
93 ····private·AnnotatorModel·annotatorImpl;98 ····private·AnnotatorModel·annotatorImpl;
 99 ····private·final·ModelFileManager·annotatorModelFileManager;
94 ····private·ModelFileManager$ModelFile·annotatorModelInUse;100 ····private·ModelFileManager$ModelFile·annotatorModelInUse;
95 ····private·final·Context·context;101 ····private·final·Context·context;
96 ····private·final·TextClassifier·fallback;102 ····private·final·TextClassifier·fallback;
97 ····private·final·GenerateLinksLogger·generateLinksLogger;103 ····private·final·GenerateLinksLogger·generateLinksLogger;
98 ····private·LangIdModel·langIdImpl;104 ····private·LangIdModel·langIdImpl;
 105 ····private·final·ModelFileManager·langIdModelFileManager;
99 ····private·ModelFileManager$ModelFile·langIdModelInUse;106 ····private·ModelFileManager$ModelFile·langIdModelInUse;
100 ····private·final·Object·lock;107 ····private·final·Object·lock;
101 ····private·final·ModelFileManager·modelFileManager; 
102 ····private·final·TextClassifierSettings·settings;108 ····private·final·TextClassifierSettings·settings;
103 ····private·final·TemplateIntentFactory·templateIntentFactory;109 ····private·final·TemplateIntentFactory·templateIntentFactory;
104 ····private·final·TextClassifierEventLogger·textClassifierEventLogger;110 ····private·final·TextClassifierEventLogger·textClassifierEventLogger;
105 ····111 ····
106 ····TextClassifierImpl(final·Context·context,·final·TextClassifierSettings·textClassifierSettings,·final·ModelFileManager·modelFileManager)·{112 ····static·{
107 ········this(context,·textClassifierSettings,·modelFileManager,·TextClassifier.NO_OP);113 ········FACTORY_MODEL_DIR·=·new·File("/etc/textclassifier/");
 114 ········ANNOTATOR_UPDATED_MODEL_FILE·=·new·File("/data/misc/textclassifier/textclassifier.model");
 115 ········UPDATED_LANG_ID_MODEL_FILE·=·new·File("/data/misc/textclassifier/lang_id.model");
 116 ········UPDATED_ACTIONS_MODEL·=·new·File("/data/misc/textclassifier/actions_suggestions.model");
108 ····}117 ····}
109 ····118 ····
110 ····TextClassifierImpl(Context·context,·TextClassifierSettings·settings,·ModelFileManager·modelFileManager,·TextClassifier·fallback)·{119 ····TextClassifierImpl(final·Context·context,·final·TextClassifierSettings·textClassifierSettings)·{
 120 ········this(context,·textClassifierSettings,·TextClassifier.NO_OP);
 121 ····}
 122 ····
 123 ····TextClassifierImpl(Context·context,·TextClassifierSettings·settings,·TextClassifier·fallback)·{
111 ········this.lock·=·new·Object();124 ········this.lock·=·new·Object();
112 ········this.textClassifierEventLogger·=·new·TextClassifierEventLogger();125 ········this.textClassifierEventLogger·=·new·TextClassifierEventLogger();
113 ········Preconditions.checkNotNull((Object)context);126 ········Preconditions.checkNotNull((Object)context);
114 ········context·=·context;127 ········context·=·context;
115 ········this.context·=·context;128 ········this.context·=·context;
116 ········Preconditions.checkNotNull((Object)settings); 
117 ········settings·=·settings; 
118 ········this.settings·=·settings; 
119 ········Preconditions.checkNotNull((Object)modelFileManager); 
120 ········modelFileManager·=·modelFileManager; 
121 ········this.modelFileManager·=·modelFileManager; 
122 ········Preconditions.checkNotNull((Object)fallback);129 ········Preconditions.checkNotNull((Object)fallback);
123 ········fallback·=·fallback;130 ········fallback·=·fallback;
124 ········this.fallback·=·fallback;131 ········this.fallback·=·fallback;
125 ········this.generateLinksLogger·=·new·GenerateLinksLogger(this.settings.getGenerateLinksLogSampleRate());132 ········Preconditions.checkNotNull((Object)settings);
 133 ········settings·=·settings;
 134 ········this.settings·=·settings;
 135 ········this.generateLinksLogger·=·new·GenerateLinksLogger(settings.getGenerateLinksLogSampleRate());
 136 ········this.annotatorModelFileManager·=·new·ModelFileManager((Supplier)new·ModelFileManager$ModelFileSupplierImpl(TextClassifierImpl.FACTORY_MODEL_DIR,·"textclassifier\\.(.*)\\.model",·TextClassifierImpl.ANNOTATOR_UPDATED_MODEL_FILE,·(Function)-$$Lambda$jJq8RXuVdjYF3lPq-77PEw1NJLM.INSTANCE,·(Function)-$$Lambda$NxwbyZSxofZ4Z5SQhfXmtLQ1nxk.INSTANCE));
 137 ········this.langIdModelFileManager·=·new·ModelFileManager((Supplier)new·ModelFileManager$ModelFileSupplierImpl(TextClassifierImpl.FACTORY_MODEL_DIR,·"lang_id.model",·TextClassifierImpl.UPDATED_LANG_ID_MODEL_FILE,·(Function)-$$Lambda$0biFK4yZBmWN1EO2wtnXskzuEcE.INSTANCE,·(Function)-$$Lambda$TextClassifierImpl$GgWuU910BaKzzHu6MQGYGCHOgkg.INSTANCE));
 138 ········this.actionsModelFileManager·=·new·ModelFileManager((Supplier)new·ModelFileManager$ModelFileSupplierImpl(TextClassifierImpl.FACTORY_MODEL_DIR,·"actions_suggestions\\.(.*)\\.model",·TextClassifierImpl.UPDATED_ACTIONS_MODEL,·(Function)-$$Lambda$9N8WImc0VBjy2oxI_Gk5_Pbye_A.INSTANCE,·(Function)-$$Lambda$XeE_KI7QgMKzF9vYRSoFWAolyuA.INSTANCE));
126 ········this.templateIntentFactory·=·new·TemplateIntentFactory();139 ········this.templateIntentFactory·=·new·TemplateIntentFactory();
127 ····}140 ····}
128 ····141 ····
129 ····private·static·void·checkMainThread()·{142 ····private·static·void·checkMainThread()·{
130 ········if·(Looper.myLooper()·==·Looper.getMainLooper())·{143 ········if·(Looper.myLooper()·==·Looper.getMainLooper())·{
131 ············TcLog.e("TextClassifierImpl",·"TextClassifier·called·on·main·thread",·(Throwable)new·Exception());144 ············TcLog.e("TextClassifierImpl",·"TextClassifier·called·on·main·thread",·(Throwable)new·Exception());
132 ········}145 ········}
Offset 169, 15 lines modifiedOffset 182, 15 lines modified
169 ········ImmutableList·list;182 ········ImmutableList·list;
170 ········if·(annotatorModel$ClassificationResult·==·null)·{183 ········if·(annotatorModel$ClassificationResult·==·null)·{
171 ············list·=·ImmutableList.of();184 ············list·=·ImmutableList.of();
172 ········}185 ········}
173 ········else·{186 ········else·{
174 ············list·=·this.templateIntentFactory.create(annotatorModel$ClassificationResult.getRemoteActionTemplates());187 ············list·=·this.templateIntentFactory.create(annotatorModel$ClassificationResult.getRemoteActionTemplates());
175 ········}188 ········}
176 ········final·-$$Lambda$TextClassifierImpl$GPO8b-cUZbGymN45fgVNo11JSJ4·instance·=·-$$Lambda$TextClassifierImpl$GPO8b-cUZbGymN45fgVNo11JSJ4.INSTANCE;189 ········final·-$$Lambda$TextClassifierImpl$JRO8dEkAfMFOqu4-iyLbagDQA_o·instance·=·-$$Lambda$TextClassifierImpl$JRO8dEkAfMFOqu4-iyLbagDQA_o.INSTANCE;
177 ········final·ArrayList<Object>·list2·=·new·ArrayList<Object>();190 ········final·ArrayList<Object>·list2·=·new·ArrayList<Object>();
178 ········final·UnmodifiableIterator·iterator·=·list.iterator();191 ········final·UnmodifiableIterator·iterator·=·list.iterator();
179 ········int·n3·=·1;192 ········int·n3·=·1;
180 ········while·(((Iterator)iterator).hasNext())·{193 ········while·(((Iterator)iterator).hasNext())·{
181 ············final·LabeledIntent·labeledIntent·=·(LabeledIntent)((Iterator<LabeledIntent>)iterator).next();194 ············final·LabeledIntent·labeledIntent·=·(LabeledIntent)((Iterator<LabeledIntent>)iterator).next();
182 ············final·LabeledIntent$Result·resolve·=·labeledIntent.resolve(this.context,·(LabeledIntent$TitleChooser)instance);195 ············final·LabeledIntent$Result·resolve·=·labeledIntent.resolve(this.context,·(LabeledIntent$TitleChooser)instance);
183 ············if·(resolve·==·null)·{196 ············if·(resolve·==·null)·{
Offset 192, 21 lines modifiedOffset 205, 21 lines modified
192 ················setText.setOnClickListener(createIntentOnClickListener(createPendingIntent(this.context,·resolvedIntent,·labeledIntent.requestCode)));205 ················setText.setOnClickListener(createIntentOnClickListener(createPendingIntent(this.context,·resolvedIntent,·labeledIntent.requestCode)));
193 ················n3·=·0;206 ················n3·=·0;
194 ············}207 ············}
195 ············setText.addAction(remoteAction);208 ············setText.addAction(remoteAction);
196 ············list2.add(resolvedIntent);209 ············list2.add(resolvedIntent);
197 ········}210 ········}
198 ········final·Bundle·extras·=·new·Bundle();211 ········final·Bundle·extras·=·new·Bundle();
199 ········transform·=·transform.transform((Function)new·-$$Lambda$TextClassifierImpl$SO6kNnhgVauK__jmLEoCiyGozHw((ArrayList)list2));212 ········transform·=·transform.transform((com.google.common.base.Function)new·-$$Lambda$TextClassifierImpl$Qwks3xU-K0S5rmi-r5zY7rcmhrA((ArrayList)list2));
200 ········transform·=·(Optional)transform.or((Object)Optional.absent());213 ········transform·=·(Optional)transform.or((Object)Optional.absent());
201 ········if·(transform.isPresent())·{214 ········if·(transform.isPresent())·{
202 ············ExtrasUtils.putForeignLanguageExtra(extras,·(Bundle)transform.get());215 ············ExtrasUtils.putForeignLanguageExtra(extras,·(Bundle)transform.get());
203 ········}216 ········}
204 ········if·(list2.stream().anyMatch((Predicate<?·super·Object>)-$$Lambda$L_UQMPjXwBN0ch4zL2dD82nf9RI.INSTANCE))·{217 ········if·(list2.stream().anyMatch((Predicate<?·super·Object>)-$$Lambda$L_UQMPjXwBN0ch4zL2dD82nf9RI.INSTANCE))·{
205 ············ExtrasUtils.putActionsIntents(extras,·(ArrayList)(ArrayList)list2.stream().map((java.util.function.Function<?·super·Object,·?>)-$$Lambda$TextClassifierImpl$Lko6ClGZ6OU9F7efqKl9WVqP3kc.INSTANCE).collect(Collectors.toCollection((Supplier<ArrayList>)-$$Lambda$OGSS2qx6njxlnp0dnKb4lA3jnw8.INSTANCE)));218 ············ExtrasUtils.putActionsIntents(extras,·(ArrayList)(ArrayList)list2.stream().map((Function<?·super·Object,·?>)-$$Lambda$TextClassifierImpl$Lko6ClGZ6OU9F7efqKl9WVqP3kc.INSTANCE).collect(Collectors.toCollection((Supplier<ArrayList>)-$$Lambda$OGSS2qx6njxlnp0dnKb4lA3jnw8.INSTANCE)));
206 ········}219 ········}
207 ········ExtrasUtils.putEntities(extras,·array);220 ········ExtrasUtils.putEntities(extras,·array);
208 ········setText.setExtras(extras);221 ········setText.setExtras(extras);
209 ········return·setText.setId(this.createAnnotatorId(s,·n,·n2)).build();222 ········return·setText.setId(this.createAnnotatorId(s,·n,·n2)).build();
210 ····}223 ····}
211 ····224 ····
212 ····private·ConversationActions·createConversationActionResult(final·ConversationActions$Request·conversationActions$Request,·final·ActionsSuggestionsModel$ActionSuggestion[]·array)·{225 ····private·ConversationActions·createConversationActionResult(final·ConversationActions$Request·conversationActions$Request,·final·ActionsSuggestionsModel$ActionSuggestion[]·array)·{
Offset 235, 23 lines modifiedOffset 248, 23 lines modified
235 ········synchronized·(this.lock)·{248 ········synchronized·(this.lock)·{
236 ············return·new·ConversationActions(list2,·ActionsSuggestionsHelper.createResultId(this.context,·conversationActions$Request.getConversation(),·Optional.fromNullable((Object)this.actionModelInUse),·Optional.fromNullable((Object)this.annotatorModelInUse),·Optional.fromNullable((Object)this.langIdModelInUse)));249 ············return·new·ConversationActions(list2,·ActionsSuggestionsHelper.createResultId(this.context,·conversationActions$Request.getConversation(),·Optional.fromNullable((Object)this.actionModelInUse),·Optional.fromNullable((Object)this.annotatorModelInUse),·Optional.fromNullable((Object)this.langIdModelInUse)));
237 ········}250 ········}
238 ····}251 ····}
239 ····252 ····
240 ····private·static·View$OnClickListener·createIntentOnClickListener(final·PendingIntent·pendingIntent)·{253 ····private·static·View$OnClickListener·createIntentOnClickListener(final·PendingIntent·pendingIntent)·{
241 ········Preconditions.checkNotNull((Object)pendingIntent);254 ········Preconditions.checkNotNull((Object)pendingIntent);
242 ········return·(View$OnClickListener)new·-$$Lambda$TextClassifierImpl$2dNQE4N9CXjJ-oio8KtmeiaIZ_M(pendingIntent);255 ········return·(View$OnClickListener)new·-$$Lambda$TextClassifierImpl$wlF5Lmygug2HifzLlH779V8jReI(pendingIntent);
243 ····}256 ····}
244 ····257 ····
245 ····private·static·PendingIntent·createPendingIntent(final·Context·context,·final·Intent·intent,·final·int·n)·{258 ····private·static·PendingIntent·createPendingIntent(final·Context·context,·final·Intent·intent,·final·int·n)·{
246 ········return·PendingIntent.getActivity(context,·n,·intent,·134217728);259 ········return·PendingIntent.getActivity(context,·n,·intent,·134217728);
247 ····}260 ····}
248 ····261 ····
249 ····private·ImmutableList·detectLanguageTags(final·Optional·optional,·final·CharSequence·charSequence)·{262 ····private·ImmutableList·detectLanguageTags(final·Optional·optional,·final·CharSequence·charSequence)·{
250 ········return·(ImmutableList)optional.transform((Function)new·-$$Lambda$TextClassifierImpl$rAyJ3L-N3WE5epfPetkTw3MVoy4(this,·charSequence)).or((Object)ImmutableList.of());263 ········return·(ImmutableList)optional.transform((com.google.common.base.Function)new·-$$Lambda$TextClassifierImpl$AY5eoUbVCLXhR9opqmynv0zcSU0(this,·charSequence)).or((Object)ImmutableList.of());
251 ····}264 ····}
252 ····265 ····
253 ····private·static·EntityConfidence·detectLanguages(final·LangIdModel·langIdModel,·final·CharSequence·charSequence,·final·float·n)·{266 ····private·static·EntityConfidence·detectLanguages(final·LangIdModel·langIdModel,·final·CharSequence·charSequence,·final·float·n)·{
254 ········final·LangIdModel$LanguageResult[]·detectLanguages·=·langIdModel.detectLanguages(charSequence.toString());267 ········final·LangIdModel$LanguageResult[]·detectLanguages·=·langIdModel.detectLanguages(charSequence.toString());
255 ········final·ArrayMap·arrayMap·=·new·ArrayMap();268 ········final·ArrayMap·arrayMap·=·new·ArrayMap();
256 ········for·(int·length·=·detectLanguages.length,·i·=·0;·i·<·length;·++i)·{269 ········for·(int·length·=·detectLanguages.length,·i·=·0;·i·<·length;·++i)·{
257 ············final·LangIdModel$LanguageResult·langIdModel$LanguageResult·=·detectLanguages[i];270 ············final·LangIdModel$LanguageResult·langIdModel$LanguageResult·=·detectLanguages[i];
Offset 260, 34 lines modifiedOffset 273, 34 lines modified
260 ············}273 ············}
261 ········}274 ········}
262 ········return·new·EntityConfidence((Map)arrayMap);275 ········return·new·EntityConfidence((Map)arrayMap);
263 ····}276 ····}
264 ····277 ····
265 ····private·ActionsSuggestionsModel·getActionsImpl()·{278 ····private·ActionsSuggestionsModel·getActionsImpl()·{
266 ········synchronized·(this.lock)·{279 ········synchronized·(this.lock)·{
267 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("actions_suggestions",·LocaleList.getDefault());280 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.actionsModelFileManager.findBestModelFile(LocaleList.getDefault());
268 ············if·(bestModelFile·==·null)·{281 ············if·(bestModelFile·==·null)·{
269 ················return·null;282 ················return·null;
270 ············}283 ············}
271 ············Label_0244:·{284 ············Label_0237:·{
272 ················if·(this.actionsImpl·!=·null)·{285 ················if·(this.actionsImpl·!=·null)·{
273 ····················final·Object·o·=·this.actionModelInUse;286 ····················final·Object·o·=·this.actionModelInUse;
274 ····················if·(Objects.equals(o,·bestModelFile))·{287 ····················if·(Objects.equals(o,·bestModelFile))·{
275 ························break·Label_0244;288 ························break·Label_0237;
276 ····················}289 ····················}
277 ················}290 ················}
278 ················final·String·s·=·"TextClassifierImpl";291 ················final·String·s·=·"TextClassifierImpl";
279 ················final·StringBuilder·sb·=·new·StringBuilder();292 ················final·StringBuilder·sb·=·new·StringBuilder();
280 ················sb.append("Loading·");293 ················sb.append("Loading·");
281 ················sb.append(bestModelFile);294 ················sb.append(bestModelFile);
282 ················TcLog.d(s,·sb.toString());295 ················TcLog.d(s,·sb.toString());
283 ················final·Object·o·=·ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456);296 ················final·Object·o·=·ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456);
284 ················Label_0212:·{297 ················Label_0205:·{
285 ····················if·(o·!=·null)·{298 ····················if·(o·!=·null)·{
286 ························break·Label_0212;299 ························break·Label_0205;
287 ····················}300 ····················}
288 ····················final·String·s2·=·"TextClassifierImpl";301 ····················final·String·s2·=·"TextClassifierImpl";
289 ····················try·{302 ····················try·{
290 ························final·StringBuilder·sb2·=·new·StringBuilder();303 ························final·StringBuilder·sb2·=·new·StringBuilder();
291 ························sb2.append("Failed·to·read·the·model·file:·");304 ························sb2.append("Failed·to·read·the·model·file:·");
292 ························sb2.append(bestModelFile.getPath());305 ························sb2.append(bestModelFile.getPath());
293 ························TcLog.d(s2,·sb2.toString());306 ························TcLog.d(s2,·sb2.toString());
Offset 314, 61 lines modifiedOffset 327, 60 lines modified
314 ············}327 ············}
315 ············try·{328 ············try·{
316 ················list·=·LocaleList.getDefault();329 ················list·=·LocaleList.getDefault();
317 ················break·Label_0022;330 ················break·Label_0022;
318 ············}331 ············}
319 ············finally·{332 ············finally·{
320 ················//·monitorexit(lock)333 ················//·monitorexit(lock)
321 ················final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("annotator",·list);334 ············Label_0225_Outer:
322 ················//·iftrue(Label_0245:,·bestModelFile·==·null) 
323 ················//·iftrue(Label_0232:,·list·==·null) 
324 ················//·iftrue(Label_0236:,·this.annotatorImpl·!=·null·&&·Objects.equals((Object)this.annotatorModelInUse,·(Object)bestModelFile)) 
325 ············Label_0236: 
326 ················while·(true)·{335 ················while·(true)·{
327 ····················Block_4:·{336 ················Label_0229:
328 ························break·Block_4;337 ····················while·(true)·{
329 ························final·StringBuilder·sb;338 ························Label_0063:·{
330 ························Label_0245:·{339 ····························break·Label_0063;
331 ····························sb·=·new·StringBuilder();340 ····························final·StringBuilder·sb;
 341 ····························Label_0238:·{
 342 ································sb·=·new·StringBuilder();
 343 ····························}
 344 ····························sb.append("No·annotator·model·for·");
 345 ····························sb.append(list.toLanguageTags());
 346 ····························throw·new·FileNotFoundException(sb.toString());
 347 ····························maybeCloseAndLogError((ParcelFileDescriptor)list);
 348 ····························break·Label_0229;
332 ························}349 ························}
333 ························sb.append("No·annotator·model·for·"); 
334 ························sb.append(list.toLanguageTags()); 
335 ························throw·new·FileNotFoundException(sb.toString()); 
336 ························final·String·s·=·"TextClassifierImpl";350 ························final·String·s·=·"TextClassifierImpl";
337 ························final·StringBuilder·sb2·=·new·StringBuilder();351 ························final·StringBuilder·sb2·=·new·StringBuilder();
338 ························sb2.append("Loading·");352 ························sb2.append("Loading·");
 353 ························final·ModelFileManager$ModelFile·bestModelFile;
339 ························sb2.append(bestModelFile);354 ························sb2.append(bestModelFile);
340 ························TcLog.d(s,·sb2.toString());355 ························TcLog.d(s,·sb2.toString());
341 ························list·=·(LocaleList)ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456);356 ························list·=·(LocaleList)ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456);
342 ························while·(true)·{357 ························try·{
343 ····························Block_6:·{358 ····························this.annotatorImpl·=·new·AnnotatorModel(((ParcelFileDescriptor)list).getFd());
344 ································break·Block_6;359 ····························final·Optional·langIdImpl·=·this.getLangIdImpl();
345 ································maybeCloseAndLogError((ParcelFileDescriptor)list);360 ····························if·(langIdImpl.isPresent())·{
346 ································break·Label_0236;361 ································this.annotatorImpl.setLangIdModel((LangIdModel)langIdImpl.get());
347 ····························} 
348 ····························try·{ 
349 ································this.annotatorImpl·=·new·AnnotatorModel(((ParcelFileDescriptor)list).getFd()); 
350 ································final·Optional·langIdImpl·=·this.getLangIdImpl(); 
351 ································if·(langIdImpl.isPresent())·{ 
352 ····································this.annotatorImpl.setLangIdModel((LangIdModel)langIdImpl.get()); 
353 ································} 
354 ································this.annotatorModelInUse·=·bestModelFile; 
355 ····························} 
356 ····························finally·{ 
357 ································maybeCloseAndLogError((ParcelFileDescriptor)list); 
358 ····························}362 ····························}
359 ····························continue;363 ····························this.annotatorModelInUse·=·bestModelFile;
 364 ························}
 365 ························finally·{
 366 ····························maybeCloseAndLogError((ParcelFileDescriptor)list);
360 ························}367 ························}
 368 ························continue;
361 ····················}369 ····················}
362 ····················continue;370 ····················final·TextClassifierImpl·textClassifierImpl;
 371 ····················return·textClassifierImpl.annotatorImpl;
 372 ····················final·ModelFileManager$ModelFile·bestModelFile·=·this.annotatorModelFileManager.findBestModelFile(list);
 373 ····················continue·Label_0225_Outer;
363 ················}374 ················}
364 ················final·TextClassifierImpl·textClassifierImpl; 
365 ················//·monitorexit(lock) 
366 ················return·textClassifierImpl.annotatorImpl; 
367 ············}375 ············}
 376 ············//·iftrue(Label_0229:,·this.annotatorImpl·!=·null·&&·Objects.equals((Object)this.annotatorModelInUse,·(Object)bestModelFile))
 377 ············//·iftrue(Label_0225:,·list·==·null)
 378 ············//·monitorexit(lock)
 379 ············//·iftrue(Label_0238:,·bestModelFile·==·null)
368 ········}380 ········}
369 ····}381 ····}
370 ····382 ····
371 ····private·Collection·getEntitiesForHints(final·Collection·collection)·{383 ····private·Collection·getEntitiesForHints(final·Collection·collection)·{
372 ········final·boolean·contains·=·collection.contains("android.text_is_editable");384 ········final·boolean·contains·=·collection.contains("android.text_is_editable");
373 ········if·(contains·==·collection.contains("android.text_is_not_editable"))·{385 ········if·(contains·==·collection.contains("android.text_is_not_editable"))·{
374 ············return·this.settings.getEntityListDefault();386 ············return·this.settings.getEntityListDefault();
Offset 377, 21 lines modifiedOffset 389, 21 lines modified
377 ············return·this.settings.getEntityListEditable();389 ············return·this.settings.getEntityListEditable();
378 ········}390 ········}
379 ········return·this.settings.getEntityListNotEditable();391 ········return·this.settings.getEntityListNotEditable();
380 ····}392 ····}
381 ····393 ····
382 ····private·Optional·getLangIdImpl()·{394 ····private·Optional·getLangIdImpl()·{
383 ········synchronized·(this.lock)·{395 ········synchronized·(this.lock)·{
384 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("lang_id",·(LocaleList)null);396 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.langIdModelFileManager.findBestModelFile((LocaleList)null);
385 ············if·(bestModelFile·==·null)·{397 ············if·(bestModelFile·==·null)·{
386 ················return·Optional.absent();398 ················return·Optional.absent();
387 ············}399 ············}
388 ············Label_0188:·{400 ············Label_0194:·{
389 ················if·(this.langIdImpl·!=·null·&&·Objects.equals(this.langIdModelInUse,·bestModelFile))·{401 ················if·(this.langIdImpl·!=·null·&&·Objects.equals(this.langIdModelInUse,·bestModelFile))·{
390 ····················break·Label_0188;402 ····················break·Label_0194;
391 ················}403 ················}
392 ················final·String·s·=·"TextClassifierImpl";404 ················final·String·s·=·"TextClassifierImpl";
393 ················final·StringBuilder·sb·=·new·StringBuilder();405 ················final·StringBuilder·sb·=·new·StringBuilder();
394 ················sb.append("Loading·");406 ················sb.append("Loading·");
395 ················sb.append(bestModelFile);407 ················sb.append(bestModelFile);
396 ················TcLog.d(s,·sb.toString());408 ················TcLog.d(s,·sb.toString());
397 ················try·{409 ················try·{
Offset 465, 15 lines modifiedOffset 477, 15 lines modified
465 ········}477 ········}
466 ········catch·(IOException·ex)·{478 ········catch·(IOException·ex)·{
467 ············TcLog.e("TextClassifierImpl",·"Error·closing·file.",·(Throwable)ex);479 ············TcLog.e("TextClassifierImpl",·"Error·closing·file.",·(Throwable)ex);
468 ········}480 ········}
469 ····}481 ····}
470 ····482 ····
471 ····private·static·Optional·maybeCreateExtrasForTranslate(final·List·list,·final·LangIdModel·langIdModel)·{483 ····private·static·Optional·maybeCreateExtrasForTranslate(final·List·list,·final·LangIdModel·langIdModel)·{
472 ········final·Optional·first·=·FluentIterable.from((Iterable)list).filter((com.google.common.base.Predicate)-$$Lambda$rm5za8qxlTZUvnydaEE0tVLEw0A.INSTANCE).filter((com.google.common.base.Predicate)-$$Lambda$TextClassifierImpl$gY8JATzhlR_76-3FXEFdECxZ_Rg.INSTANCE).first();484 ········final·Optional·first·=·FluentIterable.from((Iterable)list).filter((com.google.common.base.Predicate)-$$Lambda$rm5za8qxlTZUvnydaEE0tVLEw0A.INSTANCE).filter((com.google.common.base.Predicate)-$$Lambda$TextClassifierImpl$_9AKIndHE_v2Sz1V8d6jhA82Gc4.INSTANCE).first();
473 ········if·(!first.isPresent())·{485 ········if·(!first.isPresent())·{
474 ············return·Optional.absent();486 ············return·Optional.absent();
475 ········}487 ········}
476 ········final·Pair·topLanguage·=·ExtrasUtils.getTopLanguage((Intent)first.get());488 ········final·Pair·topLanguage·=·ExtrasUtils.getTopLanguage((Intent)first.get());
477 ········if·(topLanguage·==·null)·{489 ········if·(topLanguage·==·null)·{
478 ············return·Optional.absent();490 ············return·Optional.absent();
479 ········}491 ········}
Offset 514, 15 lines modifiedOffset 526, 29 lines modified
514 ················ZonedDateTime·zonedDateTime;526 ················ZonedDateTime·zonedDateTime;
515 ················if·(textClassification$Request.getReferenceTime()·!=·null)·{527 ················if·(textClassification$Request.getReferenceTime()·!=·null)·{
516 ····················zonedDateTime·=·textClassification$Request.getReferenceTime();528 ····················zonedDateTime·=·textClassification$Request.getReferenceTime();
517 ················}529 ················}
518 ················else·{530 ················else·{
519 ····················zonedDateTime·=·ZonedDateTime.now(ZoneId.systemDefault());531 ····················zonedDateTime·=·ZonedDateTime.now(ZoneId.systemDefault());
520 ················}532 ················}
521 ················final·AnnotatorModel$ClassificationResult[]·classifyText·=·this.getAnnotatorImpl(textClassification$Request.getDefaultLocales()).classifyText(string,·textClassification$Request.getStartIndex(),·textClassification$Request.getEndIndex(),·AnnotatorModel$ClassificationOptions.builder().setReferenceTimeMsUtc(zonedDateTime.toInstant().toEpochMilli()).setReferenceTimezone(zonedDateTime.getZone().getId()).setLocales(concatenateLocales).setDetectedTextLanguageTags(String.join((CharSequence)",",·(Iterable<?·extends·CharSequence>)detectLanguageTags)).setAnnotationUsecase(AnnotatorModel$AnnotationUsecase.SMART.getValue()).setUserFamiliarLanguageTags(LocaleList.getDefault().toLanguageTags()).build(),·(Object)this.context,·this.getResourceLocalesString());533 ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textClassification$Request.getDefaultLocales());
 534 ················final·int·startIndex·=·textClassification$Request.getStartIndex();
 535 ················final·int·endIndex·=·textClassification$Request.getEndIndex();
 536 ················final·long·epochMilli;
 537 ················final·String·id;
 538 ················final·String·join;
 539 ················final·int·value;
 540 ················final·String·languageTags;
 541 ················final·AnnotatorModel$ClassificationOptions·annotatorModel$ClassificationOptions·=·new·AnnotatorModel$ClassificationOptions(epochMilli,·id,·concatenateLocales,·join,·value,·languageTags);
 542 ················epochMilli·=·zonedDateTime.toInstant().toEpochMilli();
 543 ················id·=·zonedDateTime.getZone().getId();
 544 ················join·=·String.join(",",·(Iterable<?·extends·CharSequence>)detectLanguageTags);
 545 ················value·=·AnnotatorModel$AnnotationUsecase.SMART.getValue();
 546 ················languageTags·=·LocaleList.getDefault().toLanguageTags();
 547 ················final·AnnotatorModel$ClassificationResult[]·classifyText·=·annotatorImpl.classifyText(string,·startIndex,·endIndex,·annotatorModel$ClassificationOptions,·(Object)this.context,·this.getResourceLocalesString());
522 ················if·(classifyText.length·>·0)·{548 ················if·(classifyText.length·>·0)·{
523 ····················return·this.createClassificationResult(classifyText,·string,·textClassification$Request.getStartIndex(),·textClassification$Request.getEndIndex(),·langIdImpl);549 ····················return·this.createClassificationResult(classifyText,·string,·textClassification$Request.getStartIndex(),·textClassification$Request.getEndIndex(),·langIdImpl);
524 ················}550 ················}
525 ············}551 ············}
526 ········}552 ········}
527 ········finally·{553 ········finally·{
528 ············final·Throwable·t;554 ············final·Throwable·t;
Offset 555, 15 lines modifiedOffset 581, 35 lines modified
555 ····void·dump(final·IndentingPrintWriter·indentingPrintWriter)·{581 ····void·dump(final·IndentingPrintWriter·indentingPrintWriter)·{
556 ········final·Object·lock·=·this.lock;582 ········final·Object·lock·=·this.lock;
557 ········//·monitorenter(lock)583 ········//·monitorenter(lock)
558 ········final·String·s·=·"TextClassifierImpl:";584 ········final·String·s·=·"TextClassifierImpl:";
559 ········try·{585 ········try·{
560 ············indentingPrintWriter.println(s);586 ············indentingPrintWriter.println(s);
561 ············indentingPrintWriter.increaseIndent();587 ············indentingPrintWriter.increaseIndent();
562 ············this.modelFileManager.dump(indentingPrintWriter);588 ············indentingPrintWriter.println("Annotator·model·file(s):");
 589 ············indentingPrintWriter.increaseIndent();
 590 ············final·UnmodifiableIterator·iterator·=·this.annotatorModelFileManager.listModelFiles().iterator();
 591 ············while·(((Iterator)iterator).hasNext())·{
 592 ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator).next()).toString());
 593 ············}
 594 ············indentingPrintWriter.decreaseIndent();
 595 ············indentingPrintWriter.println("LangID·model·file(s):");
 596 ············indentingPrintWriter.increaseIndent();
 597 ············final·UnmodifiableIterator·iterator2·=·this.langIdModelFileManager.listModelFiles().iterator();
 598 ············while·(((Iterator)iterator2).hasNext())·{
 599 ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator2).next()).toString());
 600 ············}
 601 ············indentingPrintWriter.decreaseIndent();
 602 ············indentingPrintWriter.println("Actions·model·file(s):");
 603 ············indentingPrintWriter.increaseIndent();
 604 ············final·UnmodifiableIterator·iterator3·=·this.actionsModelFileManager.listModelFiles().iterator();
 605 ············while·(((Iterator)iterator3).hasNext())·{
 606 ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator3).next()).toString());
 607 ············}
 608 ············indentingPrintWriter.decreaseIndent();
563 ············indentingPrintWriter.printPair("mFallback",·(Object)this.fallback);609 ············indentingPrintWriter.printPair("mFallback",·(Object)this.fallback);
564 ············indentingPrintWriter.decreaseIndent();610 ············indentingPrintWriter.decreaseIndent();
565 ············indentingPrintWriter.println();611 ············indentingPrintWriter.println();
566 ············this.settings.dump(indentingPrintWriter);612 ············this.settings.dump(indentingPrintWriter);
567 ········}613 ········}
568 ········finally·{614 ········finally·{
569 ········}615 ········}
Offset 575, 31 lines modifiedOffset 621, 39 lines modified
575 ········Preconditions.checkArgument(textLinks$Request.getText().length()·<=·this.getMaxGenerateLinksTextLength(),·"text.length()·cannot·be·greater·than·%s",·this.getMaxGenerateLinksTextLength());621 ········Preconditions.checkArgument(textLinks$Request.getText().length()·<=·this.getMaxGenerateLinksTextLength(),·"text.length()·cannot·be·greater·than·%s",·this.getMaxGenerateLinksTextLength());
576 ········checkMainThread();622 ········checkMainThread();
577 ········final·String·string·=·textLinks$Request.getText().toString();623 ········final·String·string·=·textLinks$Request.getText().toString();
578 ········final·TextLinks$Builder·textLinks$Builder·=·new·TextLinks$Builder(string);624 ········final·TextLinks$Builder·textLinks$Builder·=·new·TextLinks$Builder(string);
579 ········try·{625 ········try·{
580 ············final·long·currentTimeMillis·=·System.currentTimeMillis();626 ············final·long·currentTimeMillis·=·System.currentTimeMillis();
581 ············final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault());627 ············final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault());
582 ············Collection·entityTypes;628 ············Collection·collection;
583 ············if·(textLinks$Request.getEntityConfig()·!=·null)·{629 ············if·(textLinks$Request.getEntityConfig()·!=·null)·{
584 ················entityTypes·=·textLinks$Request.getEntityConfig().resolveEntityListModifications(this.getEntitiesForHints(textLinks$Request.getEntityConfig().getHints()));630 ················collection·=·textLinks$Request.getEntityConfig().resolveEntityListModifications(this.getEntitiesForHints(textLinks$Request.getEntityConfig().getHints()));
585 ············}631 ············}
586 ············else·{632 ············else·{
587 ················entityTypes·=·this.settings.getEntityListDefault();633 ················collection·=·this.settings.getEntityListDefault();
588 ············}634 ············}
589 ············final·String·concatenateLocales·=·concatenateLocales(textLinks$Request.getDefaultLocales());635 ············final·String·concatenateLocales·=·concatenateLocales(textLinks$Request.getDefaultLocales());
590 ············final·ImmutableList·detectLanguageTags·=·this.detectLanguageTags(this.getLangIdImpl(),·textLinks$Request.getText());636 ············final·ImmutableList·detectLanguageTags·=·this.detectLanguageTags(this.getLangIdImpl(),·textLinks$Request.getText());
591 ············final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textLinks$Request.getDefaultLocales());637 ············final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textLinks$Request.getDefaultLocales());
592 ············final·boolean·serializedEntityDataEnabled·=·ExtrasUtils.isSerializedEntityDataEnabled(textLinks$Request);638 ············final·boolean·serializedEntityDataEnabled·=·ExtrasUtils.isSerializedEntityDataEnabled(textLinks$Request);
593 ············final·AnnotatorModel$AnnotatedSpan[]·annotate·=·annotatorImpl.annotate(string,·AnnotatorModel$AnnotationOptions.builder().setReferenceTimeMsUtc(now.toInstant().toEpochMilli()).setReferenceTimezone(now.getZone().getId()).setLocales(concatenateLocales).setDetectedTextLanguageTags(String.join((CharSequence)",",·(Iterable<?·extends·CharSequence>)detectLanguageTags)).setEntityTypes(entityTypes).setAnnotationUsecase(AnnotatorModel$AnnotationUsecase.SMART.getValue()).setIsSerializedEntityDataEnabled(serializedEntityDataEnabled).build());639 ············final·AnnotatorModel$AnnotationOptions·annotatorModel$AnnotationOptions·=·new(com.google.android.textclassifier.AnnotatorModel$AnnotationOptions.class);
 640 ············final·long·epochMilli·=·now.toInstant().toEpochMilli();
 641 ············final·String·id·=·now.getZone().getId();
 642 ············final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)detectLanguageTags);
 643 ············final·int·value·=·AnnotatorModel$AnnotationUsecase.SMART.getValue();
 644 ············final·AnnotatorModel$AnnotationOptions·annotatorModel$AnnotationOptions2·=·annotatorModel$AnnotationOptions;
 645 ············final·long·n·=·currentTimeMillis;
 646 ············new·AnnotatorModel$AnnotationOptions(epochMilli,·id,·concatenateLocales,·join,·collection,·value,·serializedEntityDataEnabled);
 647 ············final·AnnotatorModel$AnnotatedSpan[]·annotate·=·annotatorImpl.annotate(string,·annotatorModel$AnnotationOptions2);
594 ············for·(int·length·=·annotate.length,·i·=·0;·i·<·length;·++i)·{648 ············for·(int·length·=·annotate.length,·i·=·0;·i·<·length;·++i)·{
595 ················final·AnnotatorModel$AnnotatedSpan·annotatorModel$AnnotatedSpan·=·annotate[i];649 ················final·AnnotatorModel$AnnotatedSpan·annotatorModel$AnnotatedSpan·=·annotate[i];
596 ················final·AnnotatorModel$ClassificationResult[]·classification·=·annotatorModel$AnnotatedSpan.getClassification();650 ················final·AnnotatorModel$ClassificationResult[]·classification·=·annotatorModel$AnnotatedSpan.getClassification();
597 ················if·(classification.length·!=·0)·{651 ················if·(classification.length·!=·0)·{
598 ····················if·(entityTypes.contains(classification[0].getCollection()))·{652 ····················if·(collection.contains(classification[0].getCollection()))·{
599 ························final·ArrayMap·arrayMap·=·new·ArrayMap();653 ························final·ArrayMap·arrayMap·=·new·ArrayMap();
600 ························for·(int·j·=·0;·j·<·classification.length;·++j)·{654 ························for·(int·j·=·0;·j·<·classification.length;·++j)·{
601 ····························((Map<String,·Float>)arrayMap).put(classification[j].getCollection(),·classification[j].getScore());655 ····························((Map<String,·Float>)arrayMap).put(classification[j].getCollection(),·classification[j].getScore());
602 ························}656 ························}
603 ························final·Bundle·bundle·=·new·Bundle();657 ························final·Bundle·bundle·=·new·Bundle();
604 ························if·(serializedEntityDataEnabled)·{658 ························if·(serializedEntityDataEnabled)·{
605 ····························ExtrasUtils.putEntities(bundle,·classification);659 ····························ExtrasUtils.putEntities(bundle,·classification);
Offset 615, 18 lines modifiedOffset 669, 18 lines modified
615 ················s·=·this.context.getPackageName();669 ················s·=·this.context.getPackageName();
616 ············}670 ············}
617 ············else·{671 ············else·{
618 ················s·=·textLinks$Request.getCallingPackageName();672 ················s·=·textLinks$Request.getCallingPackageName();
619 ············}673 ············}
620 ············final·String·s2·=·s;674 ············final·String·s2·=·s;
621 ············synchronized·(this.lock)·{675 ············synchronized·(this.lock)·{
622 ················final·Optional·transform·=·Optional.fromNullable((Object)this.annotatorModelInUse).transform((Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE);676 ················final·Optional·transform·=·Optional.fromNullable((Object)this.annotatorModelInUse).transform((com.google.common.base.Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE);
623 ················final·Optional·transform2·=·Optional.fromNullable((Object)this.langIdModelInUse).transform((Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE);677 ················final·Optional·transform2·=·Optional.fromNullable((Object)this.langIdModelInUse).transform((com.google.common.base.Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE);
624 ················//·monitorexit(this.lock)678 ················//·monitorexit(this.lock)
625 ················this.generateLinksLogger.logGenerateLinks(textLinks$Request.getText(),·build,·s2,·currentTimeMillis2·-·currentTimeMillis,·transform,·transform2);679 ················this.generateLinksLogger.logGenerateLinks(textLinks$Request.getText(),·build,·s2,·currentTimeMillis2·-·n,·transform,·transform2);
626 ················return·build;680 ················return·build;
627 ············}681 ············}
628 ········}682 ········}
629 ········finally·{683 ········finally·{
630 ············final·Throwable·t;684 ············final·Throwable·t;
631 ············TcLog.e("TextClassifierImpl",·"Error·getting·links·info.",·t);685 ············TcLog.e("TextClassifierImpl",·"Error·getting·links·info.",·t);
632 ············return·this.fallback.generateLinks(textLinks$Request);686 ············return·this.fallback.generateLinks(textLinks$Request);
Offset 653, 15 lines modifiedOffset 707, 15 lines modified
653 ········Preconditions.checkNotNull((Object)conversationActions$Request);707 ········Preconditions.checkNotNull((Object)conversationActions$Request);
654 ········checkMainThread();708 ········checkMainThread();
655 ········try·{709 ········try·{
656 ············final·ActionsSuggestionsModel·actionsImpl·=·this.getActionsImpl();710 ············final·ActionsSuggestionsModel·actionsImpl·=·this.getActionsImpl();
657 ············if·(actionsImpl·==·null)·{711 ············if·(actionsImpl·==·null)·{
658 ················return·this.fallback.suggestConversationActions(conversationActions$Request);712 ················return·this.fallback.suggestConversationActions(conversationActions$Request);
659 ············}713 ············}
660 ············final·ActionsSuggestionsModel$ConversationMessage[]·nativeMessages·=·ActionsSuggestionsHelper.toNativeMessages(conversationActions$Request.getConversation(),·(java.util.function.Function)new·-$$Lambda$TextClassifierImpl$8TEt_aVD6KfKHt3Yd93I5TAKLlc(this,·this.getLangIdImpl()));714 ············final·ActionsSuggestionsModel$ConversationMessage[]·nativeMessages·=·ActionsSuggestionsHelper.toNativeMessages(conversationActions$Request.getConversation(),·(Function)new·-$$Lambda$TextClassifierImpl$vIDgmWc1v5udtaerRtDyTyU4pws(this,·this.getLangIdImpl()));
661 ············if·(nativeMessages.length·==·0)·{715 ············if·(nativeMessages.length·==·0)·{
662 ················return·this.fallback.suggestConversationActions(conversationActions$Request);716 ················return·this.fallback.suggestConversationActions(conversationActions$Request);
663 ············}717 ············}
664 ············return·this.createConversationActionResult(conversationActions$Request,·actionsImpl.suggestActionsWithIntents(new·ActionsSuggestionsModel$Conversation(nativeMessages),·(ActionsSuggestionsModel$ActionSuggestionOptions)null,·(Object)this.context,·this.getResourceLocalesString(),·this.getAnnotatorImpl(LocaleList.getDefault())));718 ············return·this.createConversationActionResult(conversationActions$Request,·actionsImpl.suggestActionsWithIntents(new·ActionsSuggestionsModel$Conversation(nativeMessages),·(ActionsSuggestionsModel$ActionSuggestionOptions)null,·(Object)this.context,·this.getResourceLocalesString(),·this.getAnnotatorImpl(LocaleList.getDefault())));
665 ········}719 ········}
666 ········finally·{720 ········finally·{
667 ············final·Throwable·t;721 ············final·Throwable·t;
Offset 678, 21 lines modifiedOffset 732, 26 lines modified
678 ············final·int·n·=·textSelection$Request.getEndIndex()·-·textSelection$Request.getStartIndex();732 ············final·int·n·=·textSelection$Request.getEndIndex()·-·textSelection$Request.getStartIndex();
679 ············final·String·string·=·textSelection$Request.getText().toString();733 ············final·String·string·=·textSelection$Request.getText().toString();
680 ············if·(string.length()·>·0·&&·n·<=·this.settings.getSuggestSelectionMaxRangeLength())·{734 ············if·(string.length()·>·0·&&·n·<=·this.settings.getSuggestSelectionMaxRangeLength())·{
681 ················final·String·concatenateLocales·=·concatenateLocales(textSelection$Request.getDefaultLocales());735 ················final·String·concatenateLocales·=·concatenateLocales(textSelection$Request.getDefaultLocales());
682 ················final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)this.detectLanguageTags(this.getLangIdImpl(),·textSelection$Request.getText()));736 ················final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)this.detectLanguageTags(this.getLangIdImpl(),·textSelection$Request.getText()));
683 ················final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault());737 ················final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault());
684 ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textSelection$Request.getDefaultLocales());738 ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textSelection$Request.getDefaultLocales());
685 ················final·int[]·suggestSelection·=·annotatorImpl.suggestSelection(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex(),·AnnotatorModel$SelectionOptions.builder().setLocales(concatenateLocales).setDetectedTextLanguageTags(join).build());739 ················final·int[]·suggestSelection·=·annotatorImpl.suggestSelection(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex(),·new·AnnotatorModel$SelectionOptions(concatenateLocales,·join));
686 ················int·i·=·0;740 ················int·i·=·0;
687 ················final·int·n2·=·suggestSelection[0];741 ················final·int·n2·=·suggestSelection[0];
688 ················final·int·n3·=·suggestSelection[1];742 ················final·int·n3·=·suggestSelection[1];
689 ················if·(n2·<·n3·&&·n2·>=·0·&&·n3·<=·string.length()·&&·n2·<=·textSelection$Request.getStartIndex()·&&·n3·>=·textSelection$Request.getEndIndex())·{743 ················if·(n2·<·n3·&&·n2·>=·0·&&·n3·<=·string.length()·&&·n2·<=·textSelection$Request.getStartIndex()·&&·n3·>=·textSelection$Request.getEndIndex())·{
690 ····················final·TextSelection$Builder·textSelection$Builder·=·new·TextSelection$Builder(n2,·n3);744 ····················final·TextSelection$Builder·textSelection$Builder·=·new·TextSelection$Builder(n2,·n3);
691 ····················for·(AnnotatorModel$ClassificationResult[]·classifyText·=·annotatorImpl.classifyText(string,·n2,·n3,·AnnotatorModel$ClassificationOptions.builder().setReferenceTimeMsUtc(now.toInstant().toEpochMilli()).setReferenceTimezone(now.getZone().getId()).setLocales(concatenateLocales).setDetectedTextLanguageTags(join).setUserFamiliarLanguageTags(LocaleList.getDefault().toLanguageTags()).build(),·(Object)null,·(String)null);·i·<·classifyText.length;·++i)·{745 ····················final·long·epochMilli;
 746 ····················final·String·id;
 747 ····················final·AnnotatorModel$ClassificationOptions·annotatorModel$ClassificationOptions·=·new·AnnotatorModel$ClassificationOptions(epochMilli,·id,·concatenateLocales,·join);
 748 ····················epochMilli·=·now.toInstant().toEpochMilli();
 749 ····················id·=·now.getZone().getId();
 750 ····················for·(AnnotatorModel$ClassificationResult[]·classifyText·=·annotatorImpl.classifyText(string,·n2,·n3,·annotatorModel$ClassificationOptions,·(Object)null,·(String)null);·i·<·classifyText.length;·++i)·{
692 ························textSelection$Builder.setEntityType(classifyText[i].getCollection(),·classifyText[i].getScore());751 ························textSelection$Builder.setEntityType(classifyText[i].getCollection(),·classifyText[i].getScore());
693 ····················}752 ····················}
694 ····················return·textSelection$Builder.setId(this.createAnnotatorId(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex())).build();753 ····················return·textSelection$Builder.setId(this.createAnnotatorId(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex())).build();
695 ················}754 ················}
696 ················TcLog.d(s,·"Got·bad·indices·for·input·text.·Ignoring·result.");755 ················TcLog.d(s,·"Got·bad·indices·for·input·text.·Ignoring·result.");
697 ············}756 ············}
698 ········}757 ········}