Offset 1, 10 lines modifiedOffset 1, 11 lines modified
  
1 package·com.android.textclassifier;1 package·com.android.textclassifier;
  
 2 import·java.util.Iterator;
2 import·android.view.textclassifier.TextSelection$Builder;3 import·android.view.textclassifier.TextSelection$Builder;
3 import·com.google.android.textclassifier.AnnotatorModel$SelectionOptions;4 import·com.google.android.textclassifier.AnnotatorModel$SelectionOptions;
4 import·android.view.textclassifier.TextSelection;5 import·android.view.textclassifier.TextSelection;
5 import·android.view.textclassifier.TextSelection$Request;6 import·android.view.textclassifier.TextSelection$Request;
6 import·com.google.android.textclassifier.ActionsSuggestionsModel$ConversationMessage;7 import·com.google.android.textclassifier.ActionsSuggestionsModel$ConversationMessage;
7 import·com.google.android.textclassifier.ActionsSuggestionsModel$ActionSuggestionOptions;8 import·com.google.android.textclassifier.ActionsSuggestionsModel$ActionSuggestionOptions;
8 import·com.google.android.textclassifier.ActionsSuggestionsModel$Conversation;9 import·com.google.android.textclassifier.ActionsSuggestionsModel$Conversation;
Offset 15, 14 lines modifiedOffset 16, 15 lines modified
15 import·com.android.textclassifier.common.statsd.SelectionEventConverter;16 import·com.android.textclassifier.common.statsd.SelectionEventConverter;
16 import·android.view.textclassifier.SelectionEvent;17 import·android.view.textclassifier.SelectionEvent;
17 import·com.google.android.textclassifier.AnnotatorModel$AnnotatedSpan;18 import·com.google.android.textclassifier.AnnotatorModel$AnnotatedSpan;
18 import·com.google.android.textclassifier.AnnotatorModel$AnnotationOptions;19 import·com.google.android.textclassifier.AnnotatorModel$AnnotationOptions;
19 import·android.view.textclassifier.TextLinks$Builder;20 import·android.view.textclassifier.TextLinks$Builder;
20 import·android.view.textclassifier.TextLinks;21 import·android.view.textclassifier.TextLinks;
21 import·android.view.textclassifier.TextLinks$Request;22 import·android.view.textclassifier.TextLinks$Request;
 23 import·com.google.common.collect.UnmodifiableIterator;
22 import·com.android.textclassifier.utils.IndentingPrintWriter;24 import·com.android.textclassifier.utils.IndentingPrintWriter;
23 import·android.icu.util.ULocale;25 import·android.icu.util.ULocale;
24 import·android.view.textclassifier.TextLanguage$Builder;26 import·android.view.textclassifier.TextLanguage$Builder;
25 import·android.view.textclassifier.TextLanguage;27 import·android.view.textclassifier.TextLanguage;
26 import·android.view.textclassifier.TextLanguage$Request;28 import·android.view.textclassifier.TextLanguage$Request;
27 import·com.google.android.textclassifier.AnnotatorModel$AnnotationUsecase;29 import·com.google.android.textclassifier.AnnotatorModel$AnnotationUsecase;
28 import·com.google.android.textclassifier.AnnotatorModel$ClassificationOptions;30 import·com.google.android.textclassifier.AnnotatorModel$ClassificationOptions;
Offset 38, 20 lines modifiedOffset 40, 18 lines modified
38 import·android.view.View;40 import·android.view.View;
39 import·android.content.pm.ResolveInfo;41 import·android.content.pm.ResolveInfo;
40 import·com.android.textclassifier.common.intent.LabeledIntent;42 import·com.android.textclassifier.common.intent.LabeledIntent;
41 import·android.content.res.Configuration;43 import·android.content.res.Configuration;
42 import·android.content.res.Resources;44 import·android.content.res.Resources;
43 import·java.io.FileNotFoundException;45 import·java.io.FileNotFoundException;
44 import·android.os.ParcelFileDescriptor;46 import·android.os.ParcelFileDescriptor;
45 import·java.io.File; 
46 import·java.util.Objects;47 import·java.util.Objects;
47 import·com.google.android.textclassifier.LangIdModel$LanguageResult;48 import·com.google.android.textclassifier.LangIdModel$LanguageResult;
48 import·java.util.Map;49 import·java.util.Map;
49 import·android.util.ArrayMap;50 import·android.util.ArrayMap;
50 import·com.google.common.base.Function; 
51 import·com.google.common.collect.ImmutableList;51 import·com.google.common.collect.ImmutableList;
52 import·android.content.Intent;52 import·android.content.Intent;
53 import·android.view.View$OnClickListener;53 import·android.view.View$OnClickListener;
54 import·android.app.PendingIntent;54 import·android.app.PendingIntent;
55 import·android.app.RemoteAction;55 import·android.app.RemoteAction;
56 import·com.android.textclassifier.common.intent.LabeledIntent$Result;56 import·com.android.textclassifier.common.intent.LabeledIntent$Result;
57 import·java.util.Collection;57 import·java.util.Collection;
Offset 66, 61 lines modifiedOffset 66, 77 lines modified
66 import·com.google.android.textclassifier.AnnotatorModel$ClassificationResult;66 import·com.google.android.textclassifier.AnnotatorModel$ClassificationResult;
67 import·java.util.List;67 import·java.util.List;
68 import·com.android.textclassifier.common.logging.ResultIdUtils;68 import·com.android.textclassifier.common.logging.ResultIdUtils;
69 import·com.google.common.base.Optional;69 import·com.google.common.base.Optional;
70 import·android.os.LocaleList;70 import·android.os.LocaleList;
71 import·com.android.textclassifier.common.base.TcLog;71 import·com.android.textclassifier.common.base.TcLog;
72 import·android.os.Looper;72 import·android.os.Looper;
 73 import·java.util.function.Supplier;
 74 import·java.util.function.Function;
73 import·com.google.common.base.Preconditions;75 import·com.google.common.base.Preconditions;
74 import·com.android.textclassifier.common.statsd.TextClassifierEventLogger;76 import·com.android.textclassifier.common.statsd.TextClassifierEventLogger;
75 import·com.android.textclassifier.common.intent.TemplateIntentFactory;77 import·com.android.textclassifier.common.intent.TemplateIntentFactory;
76 import·com.google.android.textclassifier.LangIdModel;78 import·com.google.android.textclassifier.LangIdModel;
77 import·com.android.textclassifier.common.statsd.GenerateLinksLogger;79 import·com.android.textclassifier.common.statsd.GenerateLinksLogger;
78 import·android.view.textclassifier.TextClassifier;80 import·android.view.textclassifier.TextClassifier;
79 import·android.content.Context;81 import·android.content.Context;
80 import·com.google.android.textclassifier.AnnotatorModel;82 import·com.google.android.textclassifier.AnnotatorModel;
81 import·com.google.android.textclassifier.ActionsSuggestionsModel;83 import·com.google.android.textclassifier.ActionsSuggestionsModel;
 84 import·java.io.File;
  
82 final·class·TextClassifierImpl85 final·class·TextClassifierImpl
83 {86 {
 87 ····private·static·final·File·ANNOTATOR_UPDATED_MODEL_FILE;
 88 ····private·static·final·File·FACTORY_MODEL_DIR;
 89 ····private·static·final·File·UPDATED_ACTIONS_MODEL;
 90 ····private·static·final·File·UPDATED_LANG_ID_MODEL_FILE;
84 ····private·ModelFileManager$ModelFile·actionModelInUse;91 ····private·ModelFileManager$ModelFile·actionModelInUse;
85 ····private·ActionsSuggestionsModel·actionsImpl;92 ····private·ActionsSuggestionsModel·actionsImpl;
 93 ····private·final·ModelFileManager·actionsModelFileManager;
86 ····private·AnnotatorModel·annotatorImpl;94 ····private·AnnotatorModel·annotatorImpl;
 95 ····private·final·ModelFileManager·annotatorModelFileManager;
87 ····private·ModelFileManager$ModelFile·annotatorModelInUse;96 ····private·ModelFileManager$ModelFile·annotatorModelInUse;
88 ····private·final·Context·context;97 ····private·final·Context·context;
89 ····private·final·TextClassifier·fallback;98 ····private·final·TextClassifier·fallback;
90 ····private·final·GenerateLinksLogger·generateLinksLogger;99 ····private·final·GenerateLinksLogger·generateLinksLogger;
91 ····private·LangIdModel·langIdImpl;100 ····private·LangIdModel·langIdImpl;
 101 ····private·final·ModelFileManager·langIdModelFileManager;
92 ····private·ModelFileManager$ModelFile·langIdModelInUse;102 ····private·ModelFileManager$ModelFile·langIdModelInUse;
93 ····private·final·Object·lock;103 ····private·final·Object·lock;
94 ····private·final·ModelFileManager·modelFileManager; 
95 ····private·final·TextClassifierSettings·settings;104 ····private·final·TextClassifierSettings·settings;
96 ····private·final·TemplateIntentFactory·templateIntentFactory;105 ····private·final·TemplateIntentFactory·templateIntentFactory;
97 ····private·final·TextClassifierEventLogger·textClassifierEventLogger;106 ····private·final·TextClassifierEventLogger·textClassifierEventLogger;
98 ····107 ····
99 ····TextClassifierImpl(final·Context·context,·final·TextClassifierSettings·textClassifierSettings,·final·ModelFileManager·modelFileManager)·{ 
100 ········this(context,·textClassifierSettings,·modelFileManager,·TextClassifier.NO_OP);108 ····static·{
 109 ········FACTORY_MODEL_DIR·=·new·File("/etc/textclassifier/");
 110 ········ANNOTATOR_UPDATED_MODEL_FILE·=·new·File("/data/misc/textclassifier/textclassifier.model");
 111 ········UPDATED_LANG_ID_MODEL_FILE·=·new·File("/data/misc/textclassifier/lang_id.model");
 112 ········UPDATED_ACTIONS_MODEL·=·new·File("/data/misc/textclassifier/actions_suggestions.model");
101 ····}113 ····}
102 ····114 ····
 115 ····TextClassifierImpl(final·Context·context,·final·TextClassifierSettings·textClassifierSettings)·{
 116 ········this(context,·textClassifierSettings,·TextClassifier.NO_OP);
 117 ····}
 118 ····
103 ····TextClassifierImpl(Context·context,·TextClassifierSettings·settings,·ModelFileManager·modelFileManager,·TextClassifier·fallback)·{119 ····TextClassifierImpl(Context·context,·TextClassifierSettings·settings,·TextClassifier·fallback)·{
104 ········this.lock·=·new·Object();120 ········this.lock·=·new·Object();
105 ········this.textClassifierEventLogger·=·new·TextClassifierEventLogger();121 ········this.textClassifierEventLogger·=·new·TextClassifierEventLogger();
106 ········Preconditions.checkNotNull((Object)context);122 ········Preconditions.checkNotNull((Object)context);
107 ········context·=·context;123 ········context·=·context;
108 ········this.context·=·context;124 ········this.context·=·context;
109 ········Preconditions.checkNotNull((Object)settings); 
110 ········settings·=·settings; 
111 ········this.settings·=·settings; 
112 ········Preconditions.checkNotNull((Object)modelFileManager); 
113 ········modelFileManager·=·modelFileManager; 
114 ········this.modelFileManager·=·modelFileManager; 
115 ········Preconditions.checkNotNull((Object)fallback);125 ········Preconditions.checkNotNull((Object)fallback);
116 ········fallback·=·fallback;126 ········fallback·=·fallback;
117 ········this.fallback·=·fallback;127 ········this.fallback·=·fallback;
 128 ········Preconditions.checkNotNull((Object)settings);
 129 ········settings·=·settings;
 130 ········this.settings·=·settings;
118 ········this.generateLinksLogger·=·new·GenerateLinksLogger(this.settings.getGenerateLinksLogSampleRate());131 ········this.generateLinksLogger·=·new·GenerateLinksLogger(settings.getGenerateLinksLogSampleRate());
 132 ········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));
 133 ········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));
 134 ········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));
119 ········this.templateIntentFactory·=·new·TemplateIntentFactory();135 ········this.templateIntentFactory·=·new·TemplateIntentFactory();
120 ····}136 ····}
121 ····137 ····
122 ····private·static·void·checkMainThread()·{138 ····private·static·void·checkMainThread()·{
123 ········if·(Looper.myLooper()·==·Looper.getMainLooper())·{139 ········if·(Looper.myLooper()·==·Looper.getMainLooper())·{
124 ············TcLog.e("TextClassifierImpl",·"TextClassifier·called·on·main·thread",·(Throwable)new·Exception());140 ············TcLog.e("TextClassifierImpl",·"TextClassifier·called·on·main·thread",·(Throwable)new·Exception());
125 ········}141 ········}
Offset 237, 15 lines modifiedOffset 253, 15 lines modified
237 ········//···165:·aload···········11253 ········//···165:·aload···········11
238 ········//···167:·invokevirtual···com/google/android/textclassifier/AnnotatorModel$ClassificationResult.getRemoteActionTemplates:()[Lcom/google/android/textclassifier/RemoteActionTemplate;254 ········//···167:·invokevirtual···com/google/android/textclassifier/AnnotatorModel$ClassificationResult.getRemoteActionTemplates:()[Lcom/google/android/textclassifier/RemoteActionTemplate;
239 ········//···170:·astore··········11255 ········//···170:·astore··········11
240 ········//···172:·aload···········7256 ········//···172:·aload···········7
241 ········//···174:·aload···········11257 ········//···174:·aload···········11
242 ········//···176:·invokevirtual···com/android/textclassifier/common/intent/TemplateIntentFactory.create:([Lcom/google/android/textclassifier/RemoteActionTemplate;)Lcom/google/common/collect/ImmutableList;258 ········//···176:·invokevirtual···com/android/textclassifier/common/intent/TemplateIntentFactory.create:([Lcom/google/android/textclassifier/RemoteActionTemplate;)Lcom/google/common/collect/ImmutableList;
243 ········//···179:·astore··········7259 ········//···179:·astore··········7
244 ········//···181:·getstatic·······com/android/textclassifier/-$$Lambda$TextClassifierImpl$GPO8b-cUZbGymN45fgVNo11JSJ4.INSTANCE:Lcom/android/textclassifier/-$$Lambda$TextClassifierImpl$GPO8b-cUZbGymN45fgVNo11JSJ4;260 ········//···181:·getstatic·······com/android/textclassifier/-$$Lambda$TextClassifierImpl$JRO8dEkAfMFOqu4-iyLbagDQA_o.INSTANCE:Lcom/android/textclassifier/-$$Lambda$TextClassifierImpl$JRO8dEkAfMFOqu4-iyLbagDQA_o;
245 ········//···184:·astore··········11261 ········//···184:·astore··········11
246 ········//···186:·new·············Ljava/util/ArrayList;262 ········//···186:·new·············Ljava/util/ArrayList;
247 ········//···189:·astore··········13263 ········//···189:·astore··········13
248 ········//···191:·aload···········13264 ········//···191:·aload···········13
249 ········//···193:·invokespecial···java/util/ArrayList.<init>:()V265 ········//···193:·invokespecial···java/util/ArrayList.<init>:()V
250 ········//···196:·aload···········7266 ········//···196:·aload···········7
251 ········//···198:·invokevirtual···com/google/common/collect/ImmutableList.iterator:()Lcom/google/common/collect/UnmodifiableIterator;267 ········//···198:·invokevirtual···com/google/common/collect/ImmutableList.iterator:()Lcom/google/common/collect/UnmodifiableIterator;
Offset 340, 19 lines modifiedOffset 356, 19 lines modified
340 ········//···397:·invokevirtual···java/util/ArrayList.add:(Ljava/lang/Object;)Z356 ········//···397:·invokevirtual···java/util/ArrayList.add:(Ljava/lang/Object;)Z
341 ········//···400:·pop············357 ········//···400:·pop············
342 ········//···401:·goto············210358 ········//···401:·goto············210
343 ········//···404:·new·············Landroid/os/Bundle;359 ········//···404:·new·············Landroid/os/Bundle;
344 ········//···407:·astore··········7360 ········//···407:·astore··········7
345 ········//···409:·aload···········7361 ········//···409:·aload···········7
346 ········//···411:·invokespecial···android/os/Bundle.<init>:()V362 ········//···411:·invokespecial···android/os/Bundle.<init>:()V
347 ········//···414:·new·············Lcom/android/textclassifier/-$$Lambda$TextClassifierImpl$SO6kNnhgVauK__jmLEoCiyGozHw;363 ········//···414:·new·············Lcom/android/textclassifier/-$$Lambda$TextClassifierImpl$Qwks3xU-K0S5rmi-r5zY7rcmhrA;
348 ········//···417:·astore··········10364 ········//···417:·astore··········10
349 ········//···419:·aload···········10365 ········//···419:·aload···········10
350 ········//···421:·aload···········13366 ········//···421:·aload···········13
351 ········//···423:·invokespecial···com/android/textclassifier/-$$Lambda$TextClassifierImpl$SO6kNnhgVauK__jmLEoCiyGozHw.<init>:(Ljava/util/ArrayList;)V367 ········//···423:·invokespecial···com/android/textclassifier/-$$Lambda$TextClassifierImpl$Qwks3xU-K0S5rmi-r5zY7rcmhrA.<init>:(Ljava/util/ArrayList;)V
352 ········//···426:·aload···········5368 ········//···426:·aload···········5
353 ········//···428:·aload···········10369 ········//···428:·aload···········10
354 ········//···430:·invokevirtual···com/google/common/base/Optional.transform:(Lcom/google/common/base/Function;)Lcom/google/common/base/Optional;370 ········//···430:·invokevirtual···com/google/common/base/Optional.transform:(Lcom/google/common/base/Function;)Lcom/google/common/base/Optional;
355 ········//···433:·astore··········5371 ········//···433:·astore··········5
356 ········//···435:·invokestatic····com/google/common/base/Optional.absent:()Lcom/google/common/base/Optional;372 ········//···435:·invokestatic····com/google/common/base/Optional.absent:()Lcom/google/common/base/Optional;
357 ········//···438:·astore··········10373 ········//···438:·astore··········10
358 ········//···440:·aload···········5374 ········//···440:·aload···········5
Offset 601, 23 lines modifiedOffset 617, 23 lines modified
601 ········synchronized·(this.lock)·{617 ········synchronized·(this.lock)·{
602 ············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)));618 ············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)));
603 ········}619 ········}
604 ····}620 ····}
605 ····621 ····
606 ····private·static·View$OnClickListener·createIntentOnClickListener(final·PendingIntent·pendingIntent)·{622 ····private·static·View$OnClickListener·createIntentOnClickListener(final·PendingIntent·pendingIntent)·{
607 ········Preconditions.checkNotNull((Object)pendingIntent);623 ········Preconditions.checkNotNull((Object)pendingIntent);
608 ········return·(View$OnClickListener)new·-$$Lambda$TextClassifierImpl$2dNQE4N9CXjJ-oio8KtmeiaIZ_M(pendingIntent);624 ········return·(View$OnClickListener)new·-$$Lambda$TextClassifierImpl$wlF5Lmygug2HifzLlH779V8jReI(pendingIntent);
609 ····}625 ····}
610 ····626 ····
611 ····private·static·PendingIntent·createPendingIntent(final·Context·context,·final·Intent·intent,·final·int·n)·{627 ····private·static·PendingIntent·createPendingIntent(final·Context·context,·final·Intent·intent,·final·int·n)·{
612 ········return·PendingIntent.getActivity(context,·n,·intent,·134217728);628 ········return·PendingIntent.getActivity(context,·n,·intent,·134217728);
613 ····}629 ····}
614 ····630 ····
615 ····private·ImmutableList·detectLanguageTags(final·Optional·optional,·final·CharSequence·charSequence)·{631 ····private·ImmutableList·detectLanguageTags(final·Optional·optional,·final·CharSequence·charSequence)·{
616 ········return·(ImmutableList)optional.transform((Function)new·-$$Lambda$TextClassifierImpl$rAyJ3L-N3WE5epfPetkTw3MVoy4(this,·charSequence)).or((Object)ImmutableList.of());632 ········return·(ImmutableList)optional.transform((com.google.common.base.Function)new·-$$Lambda$TextClassifierImpl$AY5eoUbVCLXhR9opqmynv0zcSU0(this,·charSequence)).or((Object)ImmutableList.of());
617 ····}633 ····}
618 ····634 ····
619 ····private·static·EntityConfidence·detectLanguages(final·LangIdModel·langIdModel,·final·CharSequence·charSequence,·final·float·n)·{635 ····private·static·EntityConfidence·detectLanguages(final·LangIdModel·langIdModel,·final·CharSequence·charSequence,·final·float·n)·{
620 ········final·LangIdModel$LanguageResult[]·detectLanguages·=·langIdModel.detectLanguages(charSequence.toString());636 ········final·LangIdModel$LanguageResult[]·detectLanguages·=·langIdModel.detectLanguages(charSequence.toString());
621 ········final·ArrayMap·arrayMap·=·new·ArrayMap();637 ········final·ArrayMap·arrayMap·=·new·ArrayMap();
622 ········for·(int·length·=·detectLanguages.length,·i·=·0;·i·<·length;·++i)·{638 ········for·(int·length·=·detectLanguages.length,·i·=·0;·i·<·length;·++i)·{
623 ············final·LangIdModel$LanguageResult·langIdModel$LanguageResult·=·detectLanguages[i];639 ············final·LangIdModel$LanguageResult·langIdModel$LanguageResult·=·detectLanguages[i];
Offset 626, 46 lines modifiedOffset 642, 46 lines modified
626 ············}642 ············}
627 ········}643 ········}
628 ········return·new·EntityConfidence((Map)arrayMap);644 ········return·new·EntityConfidence((Map)arrayMap);
629 ····}645 ····}
630 ····646 ····
631 ····private·ActionsSuggestionsModel·getActionsImpl()·{647 ····private·ActionsSuggestionsModel·getActionsImpl()·{
632 ········synchronized·(this.lock)·{648 ········synchronized·(this.lock)·{
633 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("actions_suggestions",·LocaleList.getDefault());649 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.actionsModelFileManager.findBestModelFile(LocaleList.getDefault());
634 ············if·(bestModelFile·==·null)·{650 ············if·(bestModelFile·==·null)·{
635 ················return·null;651 ················return·null;
636 ············}652 ············}
637 ············Label_0244:·{653 ············Label_0237:·{
638 ················if·(this.actionsImpl·!=·null)·{654 ················if·(this.actionsImpl·!=·null)·{
639 ····················final·Object·a·=·this.actionModelInUse;655 ····················final·Object·a·=·this.actionModelInUse;
640 ····················if·(Objects.equals(a,·bestModelFile))·{656 ····················if·(Objects.equals(a,·bestModelFile))·{
641 ························break·Label_0244;657 ························break·Label_0237;
642 ····················}658 ····················}
643 ················}659 ················}
644 ················final·String·s·=·"TextClassifierImpl";660 ················final·String·s·=·"TextClassifierImpl";
645 ················final·StringBuilder·sb·=·new·StringBuilder();661 ················final·StringBuilder·sb·=·new·StringBuilder();
646 ················sb.append("Loading·");662 ················sb.append("Loading·");
647 ················sb.append(bestModelFile);663 ················sb.append(bestModelFile);
648 ················TcLog.d(s,·sb.toString());664 ················TcLog.d(s,·sb.toString());
649 ················final·Object·a·=·ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456);665 ················final·Object·a·=·ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456);
650 ················Label_0212:·{666 ················Label_0205:·{
651 ····················if·(a·!=·null)·{667 ····················if·(a·!=·null)·{
652 ························break·Label_0212;668 ························break·Label_0205;
653 ····················}669 ····················}
654 ····················final·String·s2·=·"TextClassifierImpl";670 ····················final·String·s2·=·"TextClassifierImpl";
655 ····················try·{671 ····················try·{
656 ························final·StringBuilder·sb2·=·new·StringBuilder();672 ························final·StringBuilder·sb2·=·new·StringBuilder();
657 ························sb2.append("Failed·to·read·the·model·file:·");673 ························sb2.append("Failed·to·read·the·model·file:·");
658 ························sb2.append(bestModelFile.getPath());674 ························sb2.append(bestModelFile.getPath());
659 ························TcLog.d(s2,·sb2.toString());675 ························TcLog.d(s2,·sb2.toString());
660 ························return·null;676 ························return·null;
661 ························return·this.actionsImpl; 
662 ························this.actionsImpl·=·new·ActionsSuggestionsModel(((ParcelFileDescriptor)a).getFd());677 ························this.actionsImpl·=·new·ActionsSuggestionsModel(((ParcelFileDescriptor)a).getFd());
663 ························this.actionModelInUse·=·bestModelFile;678 ························this.actionModelInUse·=·bestModelFile;
664 ························maybeCloseAndLogError((ParcelFileDescriptor)a);679 ························maybeCloseAndLogError((ParcelFileDescriptor)a);
 680 ························return·this.actionsImpl;
665 ····················}681 ····················}
666 ····················finally·{682 ····················finally·{
667 ························maybeCloseAndLogError((ParcelFileDescriptor)a);683 ························maybeCloseAndLogError((ParcelFileDescriptor)a);
668 ····················}684 ····················}
669 ················}685 ················}
670 ············}686 ············}
671 ········}687 ········}
Offset 680, 61 lines modifiedOffset 696, 61 lines modified
680 ············}696 ············}
681 ············try·{697 ············try·{
682 ················list·=·LocaleList.getDefault();698 ················list·=·LocaleList.getDefault();
683 ················break·Label_0022;699 ················break·Label_0022;
684 ············}700 ············}
685 ············finally·{701 ············finally·{
686 ················//·monitorexit(lock)702 ················//·monitorexit(lock)
687 ················//·iftrue(Label_0236:,·this.annotatorImpl·!=·null·&&·Objects.equals((Object)this.annotatorModelInUse,·(Object)bestModelFile)) 
688 ················//·monitorexit(lock)703 ················//·monitorexit(lock)
689 ················//·iftrue(Label_0245:,·bestModelFile·==·null)704 ················//·iftrue(Label_0238:,·bestModelFile·==·null)
690 ················//·iftrue(Label_0232:,·list·==·null)705 ················//·iftrue(Label_0229:,·this.annotatorImpl·!=·null·&&·Objects.equals((Object)this.annotatorModelInUse,·(Object)bestModelFile))
691 ················while·(true)·{706 ················while·(true)·{
692 ····················ModelFileManager$ModelFile·bestModelFile·=·null;707 ····················ModelFileManager$ModelFile·bestModelFile·=·null;
693 ················Block_6:708 ················Label_0063:
694 ····················while·(true)·{709 ····················while·(true)·{
695 ····················Label_0070: 
696 ························while·(true)·{ 
697 ····························break·Label_0070; 
698 ····························final·TextClassifierImpl·textClassifierImpl;710 ························final·TextClassifierImpl·textClassifierImpl;
699 ····························return·textClassifierImpl.annotatorImpl;711 ························return·textClassifierImpl.annotatorImpl;
 712 ························bestModelFile·=·this.annotatorModelFileManager.findBestModelFile(list);
 713 ························Block_4:·{
 714 ····························break·Block_4;
700 ····························final·StringBuilder·sb;715 ····························final·StringBuilder·sb;
701 ····························Label_0245:·{716 ····························Label_0238:·{
702 ································sb·=·new·StringBuilder();717 ································sb·=·new·StringBuilder();
703 ····························}718 ····························}
704 ····························sb.append("No·annotator·model·for·");719 ····························sb.append("No·annotator·model·for·");
705 ····························sb.append(list.toLanguageTags());720 ····························sb.append(list.toLanguageTags());
706 ····························throw·new·FileNotFoundException(sb.toString());721 ····························throw·new·FileNotFoundException(sb.toString());
707 ····························bestModelFile·=·this.modelFileManager.findBestModelFile("annotator",·list); 
708 ····························continue; 
709 ························}722 ························}
710 ························final·String·s·=·"TextClassifierImpl"; 
711 ························final·StringBuilder·sb2·=·new·StringBuilder(); 
712 ························sb2.append("Loading·"); 
713 ························sb2.append(bestModelFile); 
714 ························TcLog.d(s,·sb2.toString()); 
715 ························list·=·(LocaleList)ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456); 
716 ························break·Block_6;723 ························break·Label_0063;
717 ························maybeCloseAndLogError((ParcelFileDescriptor)list); 
718 ························continue; 
719 ····················} 
720 ····················try·{724 ························try·{
721 ························this.annotatorImpl·=·new·AnnotatorModel(((ParcelFileDescriptor)list).getFd());725 ····························this.annotatorImpl·=·new·AnnotatorModel(((ParcelFileDescriptor)list).getFd());
722 ························final·Optional·langIdImpl·=·this.getLangIdImpl();726 ····························final·Optional·langIdImpl·=·this.getLangIdImpl();
723 ························if·(langIdImpl.isPresent())·{727 ····························if·(langIdImpl.isPresent())·{
724 ····························this.annotatorImpl.setLangIdModel((LangIdModel)langIdImpl.get());728 ································this.annotatorImpl.setLangIdModel((LangIdModel)langIdImpl.get());
 729 ····························}
 730 ····························this.annotatorModelInUse·=·bestModelFile;
725 ························}731 ························}
726 ························this.annotatorModelInUse·=·bestModelFile; 
727 ····················} 
728 ····················finally·{732 ························finally·{
729 ························maybeCloseAndLogError((ParcelFileDescriptor)list);733 ····························maybeCloseAndLogError((ParcelFileDescriptor)list);
 734 ························}
 735 ························Label_0225:·{
 736 ····························maybeCloseAndLogError((ParcelFileDescriptor)list);
 737 ························}
 738 ························continue;
730 ····················}739 ····················}
 740 ····················final·String·s·=·"TextClassifierImpl";
 741 ····················final·StringBuilder·sb2·=·new·StringBuilder();
 742 ····················sb2.append("Loading·");
 743 ····················sb2.append(bestModelFile);
 744 ····················TcLog.d(s,·sb2.toString());
 745 ····················list·=·(LocaleList)ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456);
731 ····················continue;746 ····················continue;
732 ················}747 ················}
733 ············}748 ············}
 749 ············//·iftrue(Label_0225:,·list·==·null)
734 ········}750 ········}
735 ····}751 ····}
736 ····752 ····
737 ····private·Collection·getEntitiesForHints(final·Collection·collection)·{753 ····private·Collection·getEntitiesForHints(final·Collection·collection)·{
738 ········final·boolean·contains·=·collection.contains("android.text_is_editable");754 ········final·boolean·contains·=·collection.contains("android.text_is_editable");
739 ········if·(contains·==·collection.contains("android.text_is_not_editable"))·{755 ········if·(contains·==·collection.contains("android.text_is_not_editable"))·{
740 ············return·this.settings.getEntityListDefault();756 ············return·this.settings.getEntityListDefault();
Offset 743, 21 lines modifiedOffset 759, 21 lines modified
743 ············return·this.settings.getEntityListEditable();759 ············return·this.settings.getEntityListEditable();
744 ········}760 ········}
745 ········return·this.settings.getEntityListNotEditable();761 ········return·this.settings.getEntityListNotEditable();
746 ····}762 ····}
747 ····763 ····
748 ····private·Optional·getLangIdImpl()·{764 ····private·Optional·getLangIdImpl()·{
749 ········synchronized·(this.lock)·{765 ········synchronized·(this.lock)·{
750 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("lang_id",·(LocaleList)null);766 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.langIdModelFileManager.findBestModelFile((LocaleList)null);
751 ············if·(bestModelFile·==·null)·{767 ············if·(bestModelFile·==·null)·{
752 ················return·Optional.absent();768 ················return·Optional.absent();
753 ············}769 ············}
754 ············Label_0188:·{770 ············Label_0194:·{
755 ················if·(this.langIdImpl·!=·null·&&·Objects.equals(this.langIdModelInUse,·bestModelFile))·{771 ················if·(this.langIdImpl·!=·null·&&·Objects.equals(this.langIdModelInUse,·bestModelFile))·{
756 ····················break·Label_0188;772 ····················break·Label_0194;
757 ················}773 ················}
758 ················final·String·s·=·"TextClassifierImpl";774 ················final·String·s·=·"TextClassifierImpl";
759 ················final·StringBuilder·sb·=·new·StringBuilder();775 ················final·StringBuilder·sb·=·new·StringBuilder();
760 ················sb.append("Loading·");776 ················sb.append("Loading·");
761 ················sb.append(bestModelFile);777 ················sb.append(bestModelFile);
762 ················TcLog.d(s,·sb.toString());778 ················TcLog.d(s,·sb.toString());
763 ················try·{779 ················try·{
Offset 831, 15 lines modifiedOffset 847, 15 lines modified
831 ········}847 ········}
832 ········catch·(IOException·ex)·{848 ········catch·(IOException·ex)·{
833 ············TcLog.e("TextClassifierImpl",·"Error·closing·file.",·(Throwable)ex);849 ············TcLog.e("TextClassifierImpl",·"Error·closing·file.",·(Throwable)ex);
834 ········}850 ········}
835 ····}851 ····}
836 ····852 ····
837 ····private·static·Optional·maybeCreateExtrasForTranslate(final·List·list,·final·LangIdModel·langIdModel)·{853 ····private·static·Optional·maybeCreateExtrasForTranslate(final·List·list,·final·LangIdModel·langIdModel)·{
838 ········final·Optional·first·=·FluentIterable.from((Iterable)list).filter((Predicate)-$$Lambda$rm5za8qxlTZUvnydaEE0tVLEw0A.INSTANCE).filter((Predicate)-$$Lambda$TextClassifierImpl$gY8JATzhlR_76-3FXEFdECxZ_Rg.INSTANCE).first();854 ········final·Optional·first·=·FluentIterable.from((Iterable)list).filter((Predicate)-$$Lambda$rm5za8qxlTZUvnydaEE0tVLEw0A.INSTANCE).filter((Predicate)-$$Lambda$TextClassifierImpl$_9AKIndHE_v2Sz1V8d6jhA82Gc4.INSTANCE).first();
839 ········if·(!first.isPresent())·{855 ········if·(!first.isPresent())·{
840 ············return·Optional.absent();856 ············return·Optional.absent();
841 ········}857 ········}
842 ········final·Pair·topLanguage·=·ExtrasUtils.getTopLanguage((Intent)first.get());858 ········final·Pair·topLanguage·=·ExtrasUtils.getTopLanguage((Intent)first.get());
843 ········if·(topLanguage·==·null)·{859 ········if·(topLanguage·==·null)·{
844 ············return·Optional.absent();860 ············return·Optional.absent();
845 ········}861 ········}
Offset 880, 15 lines modifiedOffset 896, 29 lines modified
880 ················ZonedDateTime·zonedDateTime;896 ················ZonedDateTime·zonedDateTime;
881 ················if·(textClassification$Request.getReferenceTime()·!=·null)·{897 ················if·(textClassification$Request.getReferenceTime()·!=·null)·{
882 ····················zonedDateTime·=·textClassification$Request.getReferenceTime();898 ····················zonedDateTime·=·textClassification$Request.getReferenceTime();
883 ················}899 ················}
884 ················else·{900 ················else·{
885 ····················zonedDateTime·=·ZonedDateTime.now(ZoneId.systemDefault());901 ····················zonedDateTime·=·ZonedDateTime.now(ZoneId.systemDefault());
886 ················}902 ················}
887 ················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());903 ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textClassification$Request.getDefaultLocales());
 904 ················final·int·startIndex·=·textClassification$Request.getStartIndex();
 905 ················final·int·endIndex·=·textClassification$Request.getEndIndex();
 906 ················final·long·epochMilli;
 907 ················final·String·id;
 908 ················final·String·join;
 909 ················final·int·value;
 910 ················final·String·languageTags;
 911 ················final·AnnotatorModel$ClassificationOptions·annotatorModel$ClassificationOptions·=·new·AnnotatorModel$ClassificationOptions(epochMilli,·id,·concatenateLocales,·join,·value,·languageTags);
 912 ················epochMilli·=·zonedDateTime.toInstant().toEpochMilli();
 913 ················id·=·zonedDateTime.getZone().getId();
 914 ················join·=·String.join(",",·(Iterable<?·extends·CharSequence>)detectLanguageTags);
 915 ················value·=·AnnotatorModel$AnnotationUsecase.SMART.getValue();
 916 ················languageTags·=·LocaleList.getDefault().toLanguageTags();
 917 ················final·AnnotatorModel$ClassificationResult[]·classifyText·=·annotatorImpl.classifyText(string,·startIndex,·endIndex,·annotatorModel$ClassificationOptions,·(Object)this.context,·this.getResourceLocalesString());
888 ················if·(classifyText.length·>·0)·{918 ················if·(classifyText.length·>·0)·{
889 ····················return·this.createClassificationResult(classifyText,·string,·textClassification$Request.getStartIndex(),·textClassification$Request.getEndIndex(),·langIdImpl);919 ····················return·this.createClassificationResult(classifyText,·string,·textClassification$Request.getStartIndex(),·textClassification$Request.getEndIndex(),·langIdImpl);
890 ················}920 ················}
891 ············}921 ············}
892 ········}922 ········}
893 ········finally·{923 ········finally·{
894 ············final·Throwable·t;924 ············final·Throwable·t;
Offset 921, 15 lines modifiedOffset 951, 35 lines modified
921 ····void·dump(final·IndentingPrintWriter·indentingPrintWriter)·{951 ····void·dump(final·IndentingPrintWriter·indentingPrintWriter)·{
922 ········final·Object·lock·=·this.lock;952 ········final·Object·lock·=·this.lock;
923 ········//·monitorenter(lock)953 ········//·monitorenter(lock)
924 ········final·String·s·=·"TextClassifierImpl:";954 ········final·String·s·=·"TextClassifierImpl:";
925 ········try·{955 ········try·{
926 ············indentingPrintWriter.println(s);956 ············indentingPrintWriter.println(s);
927 ············indentingPrintWriter.increaseIndent();957 ············indentingPrintWriter.increaseIndent();
928 ············this.modelFileManager.dump(indentingPrintWriter);958 ············indentingPrintWriter.println("Annotator·model·file(s):");
 959 ············indentingPrintWriter.increaseIndent();
 960 ············final·UnmodifiableIterator·iterator·=·this.annotatorModelFileManager.listModelFiles().iterator();
 961 ············while·(((Iterator)iterator).hasNext())·{
 962 ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator).next()).toString());
 963 ············}
 964 ············indentingPrintWriter.decreaseIndent();
 965 ············indentingPrintWriter.println("LangID·model·file(s):");
 966 ············indentingPrintWriter.increaseIndent();
 967 ············final·UnmodifiableIterator·iterator2·=·this.langIdModelFileManager.listModelFiles().iterator();
 968 ············while·(((Iterator)iterator2).hasNext())·{
 969 ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator2).next()).toString());
 970 ············}
 971 ············indentingPrintWriter.decreaseIndent();
 972 ············indentingPrintWriter.println("Actions·model·file(s):");
 973 ············indentingPrintWriter.increaseIndent();
 974 ············final·UnmodifiableIterator·iterator3·=·this.actionsModelFileManager.listModelFiles().iterator();
 975 ············while·(((Iterator)iterator3).hasNext())·{
 976 ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator3).next()).toString());
 977 ············}
 978 ············indentingPrintWriter.decreaseIndent();
929 ············indentingPrintWriter.printPair("mFallback",·(Object)this.fallback);979 ············indentingPrintWriter.printPair("mFallback",·(Object)this.fallback);
930 ············indentingPrintWriter.decreaseIndent();980 ············indentingPrintWriter.decreaseIndent();
931 ············indentingPrintWriter.println();981 ············indentingPrintWriter.println();
932 ············this.settings.dump(indentingPrintWriter);982 ············this.settings.dump(indentingPrintWriter);
933 ········}983 ········}
934 ········finally·{984 ········finally·{
935 ········}985 ········}
Offset 941, 31 lines modifiedOffset 991, 39 lines modified
941 ········Preconditions.checkArgument(textLinks$Request.getText().length()·<=·this.getMaxGenerateLinksTextLength(),·"text.length()·cannot·be·greater·than·%s",·this.getMaxGenerateLinksTextLength());991 ········Preconditions.checkArgument(textLinks$Request.getText().length()·<=·this.getMaxGenerateLinksTextLength(),·"text.length()·cannot·be·greater·than·%s",·this.getMaxGenerateLinksTextLength());
942 ········checkMainThread();992 ········checkMainThread();
943 ········final·String·string·=·textLinks$Request.getText().toString();993 ········final·String·string·=·textLinks$Request.getText().toString();
944 ········final·TextLinks$Builder·textLinks$Builder·=·new·TextLinks$Builder(string);994 ········final·TextLinks$Builder·textLinks$Builder·=·new·TextLinks$Builder(string);
945 ········try·{995 ········try·{
946 ············final·long·currentTimeMillis·=·System.currentTimeMillis();996 ············final·long·currentTimeMillis·=·System.currentTimeMillis();
947 ············final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault());997 ············final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault());
948 ············Collection·entityTypes;998 ············Collection·collection;
949 ············if·(textLinks$Request.getEntityConfig()·!=·null)·{999 ············if·(textLinks$Request.getEntityConfig()·!=·null)·{
950 ················entityTypes·=·textLinks$Request.getEntityConfig().resolveEntityListModifications(this.getEntitiesForHints(textLinks$Request.getEntityConfig().getHints()));1000 ················collection·=·textLinks$Request.getEntityConfig().resolveEntityListModifications(this.getEntitiesForHints(textLinks$Request.getEntityConfig().getHints()));
951 ············}1001 ············}
952 ············else·{1002 ············else·{
953 ················entityTypes·=·this.settings.getEntityListDefault();1003 ················collection·=·this.settings.getEntityListDefault();
954 ············}1004 ············}
955 ············final·String·concatenateLocales·=·concatenateLocales(textLinks$Request.getDefaultLocales());1005 ············final·String·concatenateLocales·=·concatenateLocales(textLinks$Request.getDefaultLocales());
956 ············final·ImmutableList·detectLanguageTags·=·this.detectLanguageTags(this.getLangIdImpl(),·textLinks$Request.getText());1006 ············final·ImmutableList·detectLanguageTags·=·this.detectLanguageTags(this.getLangIdImpl(),·textLinks$Request.getText());
957 ············final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textLinks$Request.getDefaultLocales());1007 ············final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textLinks$Request.getDefaultLocales());
958 ············final·boolean·serializedEntityDataEnabled·=·ExtrasUtils.isSerializedEntityDataEnabled(textLinks$Request);1008 ············final·boolean·serializedEntityDataEnabled·=·ExtrasUtils.isSerializedEntityDataEnabled(textLinks$Request);
959 ············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());1009 ············final·AnnotatorModel$AnnotationOptions·annotatorModel$AnnotationOptions·=·new(com.google.android.textclassifier.AnnotatorModel$AnnotationOptions.class);
 1010 ············final·long·epochMilli·=·now.toInstant().toEpochMilli();
 1011 ············final·String·id·=·now.getZone().getId();
 1012 ············final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)detectLanguageTags);
 1013 ············final·int·value·=·AnnotatorModel$AnnotationUsecase.SMART.getValue();
 1014 ············final·AnnotatorModel$AnnotationOptions·annotatorModel$AnnotationOptions2·=·annotatorModel$AnnotationOptions;
 1015 ············final·long·n·=·currentTimeMillis;
 1016 ············new·AnnotatorModel$AnnotationOptions(epochMilli,·id,·concatenateLocales,·join,·collection,·value,·serializedEntityDataEnabled);
 1017 ············final·AnnotatorModel$AnnotatedSpan[]·annotate·=·annotatorImpl.annotate(string,·annotatorModel$AnnotationOptions2);
960 ············for·(int·length·=·annotate.length,·i·=·0;·i·<·length;·++i)·{1018 ············for·(int·length·=·annotate.length,·i·=·0;·i·<·length;·++i)·{
961 ················final·AnnotatorModel$AnnotatedSpan·annotatorModel$AnnotatedSpan·=·annotate[i];1019 ················final·AnnotatorModel$AnnotatedSpan·annotatorModel$AnnotatedSpan·=·annotate[i];
962 ················final·AnnotatorModel$ClassificationResult[]·classification·=·annotatorModel$AnnotatedSpan.getClassification();1020 ················final·AnnotatorModel$ClassificationResult[]·classification·=·annotatorModel$AnnotatedSpan.getClassification();
963 ················if·(classification.length·!=·0)·{1021 ················if·(classification.length·!=·0)·{
964 ····················if·(entityTypes.contains(classification[0].getCollection()))·{1022 ····················if·(collection.contains(classification[0].getCollection()))·{
965 ························final·ArrayMap·arrayMap·=·new·ArrayMap();1023 ························final·ArrayMap·arrayMap·=·new·ArrayMap();
966 ························for·(int·j·=·0;·j·<·classification.length;·++j)·{1024 ························for·(int·j·=·0;·j·<·classification.length;·++j)·{
967 ····························((Map<String,·Float>)arrayMap).put(classification[j].getCollection(),·classification[j].getScore());1025 ····························((Map<String,·Float>)arrayMap).put(classification[j].getCollection(),·classification[j].getScore());
968 ························}1026 ························}
969 ························final·Bundle·bundle·=·new·Bundle();1027 ························final·Bundle·bundle·=·new·Bundle();
970 ························if·(serializedEntityDataEnabled)·{1028 ························if·(serializedEntityDataEnabled)·{
971 ····························ExtrasUtils.putEntities(bundle,·classification);1029 ····························ExtrasUtils.putEntities(bundle,·classification);
Offset 981, 18 lines modifiedOffset 1039, 18 lines modified
981 ················s·=·this.context.getPackageName();1039 ················s·=·this.context.getPackageName();
982 ············}1040 ············}
983 ············else·{1041 ············else·{
984 ················s·=·textLinks$Request.getCallingPackageName();1042 ················s·=·textLinks$Request.getCallingPackageName();
985 ············}1043 ············}
986 ············final·String·s2·=·s;1044 ············final·String·s2·=·s;
987 ············synchronized·(this.lock)·{1045 ············synchronized·(this.lock)·{
988 ················final·Optional·transform·=·Optional.fromNullable((Object)this.annotatorModelInUse).transform((Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE);1046 ················final·Optional·transform·=·Optional.fromNullable((Object)this.annotatorModelInUse).transform((com.google.common.base.Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE);
989 ················final·Optional·transform2·=·Optional.fromNullable((Object)this.langIdModelInUse).transform((Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE);1047 ················final·Optional·transform2·=·Optional.fromNullable((Object)this.langIdModelInUse).transform((com.google.common.base.Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE);
990 ················//·monitorexit(this.lock)1048 ················//·monitorexit(this.lock)
991 ················this.generateLinksLogger.logGenerateLinks(textLinks$Request.getText(),·build,·s2,·currentTimeMillis2·-·currentTimeMillis,·transform,·transform2);1049 ················this.generateLinksLogger.logGenerateLinks(textLinks$Request.getText(),·build,·s2,·currentTimeMillis2·-·n,·transform,·transform2);
992 ················return·build;1050 ················return·build;
993 ············}1051 ············}
994 ········}1052 ········}
995 ········finally·{1053 ········finally·{
996 ············final·Throwable·t;1054 ············final·Throwable·t;
997 ············TcLog.e("TextClassifierImpl",·"Error·getting·links·info.",·t);1055 ············TcLog.e("TextClassifierImpl",·"Error·getting·links·info.",·t);
998 ············return·this.fallback.generateLinks(textLinks$Request);1056 ············return·this.fallback.generateLinks(textLinks$Request);
Offset 1019, 15 lines modifiedOffset 1077, 15 lines modified
1019 ········Preconditions.checkNotNull((Object)conversationActions$Request);1077 ········Preconditions.checkNotNull((Object)conversationActions$Request);
1020 ········checkMainThread();1078 ········checkMainThread();
1021 ········try·{1079 ········try·{
1022 ············final·ActionsSuggestionsModel·actionsImpl·=·this.getActionsImpl();1080 ············final·ActionsSuggestionsModel·actionsImpl·=·this.getActionsImpl();
1023 ············if·(actionsImpl·==·null)·{1081 ············if·(actionsImpl·==·null)·{
1024 ················return·this.fallback.suggestConversationActions(conversationActions$Request);1082 ················return·this.fallback.suggestConversationActions(conversationActions$Request);
1025 ············}1083 ············}
1026 ············final·ActionsSuggestionsModel$ConversationMessage[]·nativeMessages·=·ActionsSuggestionsHelper.toNativeMessages(conversationActions$Request.getConversation(),·(java.util.function.Function)new·-$$Lambda$TextClassifierImpl$8TEt_aVD6KfKHt3Yd93I5TAKLlc(this,·this.getLangIdImpl()));1084 ············final·ActionsSuggestionsModel$ConversationMessage[]·nativeMessages·=·ActionsSuggestionsHelper.toNativeMessages(conversationActions$Request.getConversation(),·(Function)new·-$$Lambda$TextClassifierImpl$vIDgmWc1v5udtaerRtDyTyU4pws(this,·this.getLangIdImpl()));
1027 ············if·(nativeMessages.length·==·0)·{1085 ············if·(nativeMessages.length·==·0)·{
1028 ················return·this.fallback.suggestConversationActions(conversationActions$Request);1086 ················return·this.fallback.suggestConversationActions(conversationActions$Request);
1029 ············}1087 ············}
1030 ············return·this.createConversationActionResult(conversationActions$Request,·actionsImpl.suggestActionsWithIntents(new·ActionsSuggestionsModel$Conversation(nativeMessages),·(ActionsSuggestionsModel$ActionSuggestionOptions)null,·(Object)this.context,·this.getResourceLocalesString(),·this.getAnnotatorImpl(LocaleList.getDefault())));1088 ············return·this.createConversationActionResult(conversationActions$Request,·actionsImpl.suggestActionsWithIntents(new·ActionsSuggestionsModel$Conversation(nativeMessages),·(ActionsSuggestionsModel$ActionSuggestionOptions)null,·(Object)this.context,·this.getResourceLocalesString(),·this.getAnnotatorImpl(LocaleList.getDefault())));
1031 ········}1089 ········}
1032 ········finally·{1090 ········finally·{
1033 ············final·Throwable·t;1091 ············final·Throwable·t;
Offset 1044, 21 lines modifiedOffset 1102, 26 lines modified
1044 ············final·int·n·=·textSelection$Request.getEndIndex()·-·textSelection$Request.getStartIndex();1102 ············final·int·n·=·textSelection$Request.getEndIndex()·-·textSelection$Request.getStartIndex();
1045 ············final·String·string·=·textSelection$Request.getText().toString();1103 ············final·String·string·=·textSelection$Request.getText().toString();
1046 ············if·(string.length()·>·0·&&·n·<=·this.settings.getSuggestSelectionMaxRangeLength())·{1104 ············if·(string.length()·>·0·&&·n·<=·this.settings.getSuggestSelectionMaxRangeLength())·{
1047 ················final·String·concatenateLocales·=·concatenateLocales(textSelection$Request.getDefaultLocales());1105 ················final·String·concatenateLocales·=·concatenateLocales(textSelection$Request.getDefaultLocales());
1048 ················final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)this.detectLanguageTags(this.getLangIdImpl(),·textSelection$Request.getText()));1106 ················final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)this.detectLanguageTags(this.getLangIdImpl(),·textSelection$Request.getText()));
1049 ················final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault());1107 ················final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault());
1050 ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textSelection$Request.getDefaultLocales());1108 ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textSelection$Request.getDefaultLocales());
1051 ················final·int[]·suggestSelection·=·annotatorImpl.suggestSelection(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex(),·AnnotatorModel$SelectionOptions.builder().setLocales(concatenateLocales).setDetectedTextLanguageTags(join).build());1109 ················final·int[]·suggestSelection·=·annotatorImpl.suggestSelection(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex(),·new·AnnotatorModel$SelectionOptions(concatenateLocales,·join));
1052 ················int·i·=·0;1110 ················int·i·=·0;
1053 ················final·int·n2·=·suggestSelection[0];1111 ················final·int·n2·=·suggestSelection[0];
1054 ················final·int·n3·=·suggestSelection[1];1112 ················final·int·n3·=·suggestSelection[1];
1055 ················if·(n2·<·n3·&&·n2·>=·0·&&·n3·<=·string.length()·&&·n2·<=·textSelection$Request.getStartIndex()·&&·n3·>=·textSelection$Request.getEndIndex())·{1113 ················if·(n2·<·n3·&&·n2·>=·0·&&·n3·<=·string.length()·&&·n2·<=·textSelection$Request.getStartIndex()·&&·n3·>=·textSelection$Request.getEndIndex())·{
1056 ····················final·TextSelection$Builder·textSelection$Builder·=·new·TextSelection$Builder(n2,·n3);1114 ····················final·TextSelection$Builder·textSelection$Builder·=·new·TextSelection$Builder(n2,·n3);
1057 ····················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)·{1115 ····················final·long·epochMilli;
 1116 ····················final·String·id;
 1117 ····················final·AnnotatorModel$ClassificationOptions·annotatorModel$ClassificationOptions·=·new·AnnotatorModel$ClassificationOptions(epochMilli,·id,·concatenateLocales,·join);
 1118 ····················epochMilli·=·now.toInstant().toEpochMilli();
 1119 ····················id·=·now.getZone().getId();
 1120 ····················for·(AnnotatorModel$ClassificationResult[]·classifyText·=·annotatorImpl.classifyText(string,·n2,·n3,·annotatorModel$ClassificationOptions,·(Object)null,·(String)null);·i·<·classifyText.length;·++i)·{
1058 ························textSelection$Builder.setEntityType(classifyText[i].getCollection(),·classifyText[i].getScore());1121 ························textSelection$Builder.setEntityType(classifyText[i].getCollection(),·classifyText[i].getScore());
1059 ····················}1122 ····················}
1060 ····················return·textSelection$Builder.setId(this.createAnnotatorId(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex())).build();1123 ····················return·textSelection$Builder.setId(this.createAnnotatorId(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex())).build();
1061 ················}1124 ················}
1062 ················TcLog.d(s,·"Got·bad·indices·for·input·text.·Ignoring·result.");1125 ················TcLog.d(s,·"Got·bad·indices·for·input·text.·Ignoring·result.");
1063 ············}1126 ············}
1064 ········}1127 ········}