Offset 1, 67 lines modifiedOffset 1, 68 lines modified
  
1 package·com.android.textclassifier;1 package·com.android.textclassifier;
  
2 import·android.os.Build$VERSION;2 import·com.google.android.textclassifier.AnnotatorModel$ClassificationOptions;
3 import·android.view.textclassifier.TextSelection$Builder;3 import·android.view.textclassifier.TextSelection$Builder;
4 import·com.google.android.textclassifier.AnnotatorModel$SelectionOptions;4 import·com.google.android.textclassifier.AnnotatorModel$SelectionOptions;
5 import·android.view.textclassifier.TextSelection;5 import·android.view.textclassifier.TextSelection;
6 import·android.view.textclassifier.TextSelection$Request;6 import·android.view.textclassifier.TextSelection$Request;
7 import·android.view.textclassifier.ConversationActions;7 import·android.view.textclassifier.ConversationActions;
8 import·android.view.textclassifier.ConversationActions$Request;8 import·android.view.textclassifier.ConversationActions$Request;
9 import·com.android.textclassifier.common.statsd.SelectionEventConverter;9 import·com.android.textclassifier.common.statsd.SelectionEventConverter;
10 import·android.view.textclassifier.TextClassifierEvent;10 import·android.view.textclassifier.TextClassifierEvent;
 11 import·com.google.android.textclassifier.AnnotatorModel$ClassificationResult;
11 import·com.google.android.textclassifier.AnnotatorModel$AnnotatedSpan;12 import·com.google.android.textclassifier.AnnotatorModel$AnnotatedSpan;
12 import·android.view.textclassifier.TextClassifier$EntityConfig;13 import·android.view.textclassifier.TextClassifier$EntityConfig;
13 import·com.google.common.base.Function;14 import·com.google.common.base.Function;
14 import·android.os.Bundle;15 import·android.os.Bundle;
 16 import·com.google.android.textclassifier.AnnotatorModel$AnnotationUsecase;
15 import·com.google.android.textclassifier.AnnotatorModel$AnnotationOptions;17 import·com.google.android.textclassifier.AnnotatorModel$AnnotationOptions;
 18 import·java.time.ZonedDateTime;
 19 import·java.time.ZoneId;
16 import·android.view.textclassifier.TextLinks$Builder;20 import·android.view.textclassifier.TextLinks$Builder;
 21 import·com.google.common.base.Ascii;
17 import·android.view.textclassifier.TextLinks;22 import·android.view.textclassifier.TextLinks;
18 import·android.view.textclassifier.TextLinks$Request;23 import·android.view.textclassifier.TextLinks$Request;
19 import·android.view.textclassifier.TextClassificationContext;24 import·android.view.textclassifier.TextClassificationContext;
20 import·android.view.textclassifier.TextClassificationSessionId;25 import·android.view.textclassifier.TextClassificationSessionId;
21 import·com.android.textclassifier.utils.IndentingPrintWriter;26 import·com.android.textclassifier.utils.IndentingPrintWriter;
22 import·android.icu.util.ULocale;27 import·android.icu.util.ULocale;
23 import·android.view.textclassifier.TextLanguage$Builder;28 import·android.view.textclassifier.TextLanguage$Builder;
24 import·android.view.textclassifier.TextLanguage;29 import·android.view.textclassifier.TextLanguage;
25 import·android.view.textclassifier.TextLanguage$Request;30 import·android.view.textclassifier.TextLanguage$Request;
 31 import·android.view.textclassifier.TextClassification;
26 import·com.google.android.textclassifier.AnnotatorModel$AnnotationUsecase; 
27 import·com.google.android.textclassifier.AnnotatorModel$ClassificationOptions; 
28 import·java.time.ZonedDateTime; 
29 import·java.time.ZoneId; 
30 import·com.google.common.base.Ascii; 
31 import·android.view.textclassifier.TextClassification$Request;32 import·android.view.textclassifier.TextClassification$Request;
32 import·android.content.res.Configuration;33 import·android.content.res.Configuration;
33 import·android.content.res.Resources;34 import·android.content.res.Resources;
34 import·android.content.res.AssetFileDescriptor;35 import·android.content.res.AssetFileDescriptor;
35 import·com.google.android.textclassifier.LangIdModel$LanguageResult;36 import·com.google.android.textclassifier.LangIdModel$LanguageResult;
36 import·java.util.Collection;37 import·java.util.Collection;
37 import·java.util.Map;38 import·java.util.Map;
38 import·android.util.ArrayMap;39 import·android.util.ArrayMap;
39 import·android.view.textclassifier.TextClassification; 
40 import·com.google.android.textclassifier.AnnotatorModel$ClassificationResult; 
41 import·com.google.common.collect.ImmutableList;40 import·com.google.common.collect.ImmutableList;
42 import·java.util.Arrays;41 import·java.util.Arrays;
43 import·com.android.textclassifier.common.logging.ResultIdUtils;42 import·com.android.textclassifier.common.logging.ResultIdUtils;
44 import·com.google.common.base.Optional;43 import·com.google.common.base.Optional;
45 import·android.os.LocaleList;44 import·android.os.LocaleList;
46 import·android.util.Log;45 import·android.util.Log;
47 import·com.android.textclassifier.common.base.TcLog;46 import·com.android.textclassifier.common.base.TcLog;
48 import·android.os.Looper;47 import·android.os.Looper;
49 import·java.util.Objects;48 import·java.util.Objects;
50 import·java.util.List;49 import·java.util.List;
51 import·com.android.textclassifier.common.statsd.TextClassifierEventLogger;50 import·com.android.textclassifier.common.statsd.TextClassifierEventLogger;
52 import·com.android.textclassifier.common.intent.TemplateIntentFactory;51 import·com.android.textclassifier.common.intent.TemplateIntentFactory;
53 import·com.android.textclassifier.common.TextClassifierSettings;52 import·com.android.textclassifier.common.TextClassifierSettings;
 53 import·com.android.textclassifier.common.ModelFileManager;
54 import·com.google.android.textclassifier.LangIdModel;54 import·com.google.android.textclassifier.LangIdModel;
55 import·com.android.textclassifier.common.statsd.GenerateLinksLogger;55 import·com.android.textclassifier.common.statsd.GenerateLinksLogger;
56 import·android.content.Context;56 import·android.content.Context;
57 import·com.google.android.textclassifier.AnnotatorModel;57 import·com.google.android.textclassifier.AnnotatorModel;
58 import·com.google.android.textclassifier.ActionsSuggestionsModel;58 import·com.google.android.textclassifier.ActionsSuggestionsModel;
 59 import·com.android.textclassifier.common.ModelFileManager$ModelFile;
  
59 final·class·TextClassifierImpl60 final·class·TextClassifierImpl
60 {61 {
61 ····private·ModelFileManager$ModelFile·actionModelInUse;62 ····private·ModelFileManager$ModelFile·actionModelInUse;
62 ····private·ActionsSuggestionsModel·actionsImpl;63 ····private·ActionsSuggestionsModel·actionsImpl;
63 ····private·AnnotatorModel·annotatorImpl;64 ····private·AnnotatorModel·annotatorImpl;
64 ····private·ModelFileManager$ModelFile·annotatorModelInUse;65 ····private·ModelFileManager$ModelFile·annotatorModelInUse;
Offset 125, 499 lines modifiedOffset 126, 824 lines modified
125 ············a[n2]·=·i;126 ············a[n2]·=·i;
126 ············a[n]·=·j;127 ············a[n]·=·j;
127 ············a[3]·=·context.getPackageName();128 ············a[3]·=·context.getPackageName();
128 ············return·ResultIdUtils.createId(Arrays.hashCode(a),·(List)modelInfos);129 ············return·ResultIdUtils.createId(Arrays.hashCode(a),·(List)modelInfos);
129 ········}130 ········}
130 ····}131 ····}
131 ····132 ····
132 ····private·TextClassification·createClassificationResult(final·AnnotatorModel$ClassificationResult[]·p0,·final·String·p1,·final·int·p2,·final·int·p3,·final·LangIdModel·p4)·{133 ····private·ImmutableList·detectLanguageTags(final·LangIdModel·langIdModel,·final·CharSequence·charSequence)·{
 134 ········float·n;
 135 ········if·(this.settings.getLangIdThresholdOverride()·>=·0.0f)·{
 136 ············n·=·this.settings.getLangIdThresholdOverride();
 137 ········}
 138 ········else·{
 139 ············n·=·langIdModel.getLangIdThreshold();
 140 ········}
 141 ········final·LangIdModel$LanguageResult[]·detectLanguages·=·langIdModel.detectLanguages(charSequence.toString());
 142 ········final·ArrayMap·arrayMap·=·new·ArrayMap();
 143 ········for·(int·length·=·detectLanguages.length,·i·=·0;·i·<·length;·++i)·{
 144 ············final·LangIdModel$LanguageResult·langIdModel$LanguageResult·=·detectLanguages[i];
 145 ············if·(langIdModel$LanguageResult.getScore()·>=·n)·{
 146 ················arrayMap.put((Object)langIdModel$LanguageResult.getLanguage(),·(Object)langIdModel$LanguageResult.getScore());
 147 ············}
 148 ········}
 149 ········return·ImmutableList.copyOf((Collection)new·EntityConfidence((Map)arrayMap).getEntities());
 150 ····}
 151 ····
 152 ····private·AnnotatorModel·getAnnotatorImpl(LocaleList·default1)·{
 153 ········final·Object·lock·=·this.lock;
 154 ········//·monitorenter(lock)
 155 ········Label_0022:·{
 156 ············if·(default1·!=·null)·{
 157 ················break·Label_0022;
 158 ············}
 159 ············try·{
 160 ················default1·=·LocaleList.getDefault();
 161 ················break·Label_0022;
 162 ············}
 163 ············finally·{
 164 ················//·monitorexit(lock)
 165 ················Label_0202:·{
 166 ····················throw·new·IllegalStateException("Failed·to·find·the·best·annotator·model");
 167 ················}
 168 ················final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("annotator",·default1);
 169 ················//·iftrue(Label_0202:,·bestModelFile·==·null)
 170 ················//·iftrue(Label_0173:,·Objects.equals(a,·(Object)bestModelFile))
 171 ················while·(true)·{
 172 ····················Block_4:·{
 173 ························break·Block_4;
 174 ························Object·a·=·this.annotatorModelInUse;
 175 ························Label_0069:
 176 ························final·StringBuilder·sb·=·new·StringBuilder();
 177 ························sb.append("Loading·");
 178 ························sb.append(bestModelFile);
 179 ························final·String·string·=·sb.toString();
 180 ························final·boolean·enable_FULL_LOGGING·=·TcLog.ENABLE_FULL_LOGGING;
 181 ························Log.d("androidtc",·string);
 182 ························a·=·bestModelFile.open(this.context.getAssets());
 183 ························try·{
 184 ····························(this.annotatorImpl·=·new·AnnotatorModel((AssetFileDescriptor)a)).setLangIdModel(this.getLangIdImpl());
 185 ····························this.annotatorModelInUse·=·bestModelFile;
 186 ····························if·(a·!=·null)·{
 187 ································((AssetFileDescriptor)a).close();
 188 ····························}
 189 ····························Label_0173:
 190 ····························//·monitorexit(lock)
 191 ····························return·this.annotatorImpl;
 192 ························}
 193 ························finally·{
 194 ····························if·(a·!=·null)·{
 195 ································try·{
 196 ····································((AssetFileDescriptor)a).close();
 197 ································}
 198 ································finally·{
 199 ····································final·Throwable·t;
 200 ····································final·Throwable·exception;
 201 ····································t.addSuppressed(exception);
 202 ································}
 203 ····························}
 204 ························}
 205 ························throw·new·IllegalStateException("Failed·to·find·the·best·annotator·model");
 206 ····················}
 207 ····················continue;
 208 ················}
 209 ············}
 210 ············//·iftrue(Label_0069:,·this.annotatorImpl·==·null)
 211 ········}
 212 ····}
 213 ····
 214 ····private·LangIdModel·getLangIdImpl()·{
 215 ········synchronized·(this.lock)·{
 216 ············final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("lang_id",·(LocaleList)null);
 217 ············if·(bestModelFile·!=·null)·{
 218 ················Label_0147:·{
 219 ····················if·(this.langIdImpl·!=·null)·{
 220 ························final·Object·a·=·this.langIdModelInUse;
 221 ························if·(Objects.equals(a,·bestModelFile))·{
 222 ····························break·Label_0147;
 223 ························}
 224 ····················}
 225 ····················final·StringBuilder·sb·=·new·StringBuilder();
 226 ····················sb.append("Loading·");
 227 ····················sb.append(bestModelFile);
 228 ····················final·String·string·=·sb.toString();
 229 ····················final·boolean·enable_FULL_LOGGING·=·TcLog.ENABLE_FULL_LOGGING;
 230 ····················Log.d("androidtc",·string);
 231 ····················final·Object·a·=·bestModelFile.open(this.context.getAssets());
 232 ····················try·{
 233 ························this.langIdImpl·=·new·LangIdModel((AssetFileDescriptor)a);
 234 ························this.langIdModelInUse·=·bestModelFile;
 235 ························if·(a·!=·null)·{
 236 ····························((AssetFileDescriptor)a).close();
 237 ························}
 238 ························return·this.langIdImpl;
 239 ····················}
 240 ····················finally·{
 241 ························if·(a·!=·null)·{
 242 ····························try·{
 243 ································((AssetFileDescriptor)a).close();
 244 ····························}
 245 ····························finally·{
 246 ································final·Throwable·t;
 247 ································final·Throwable·exception;
 248 ································t.addSuppressed(exception);
 249 ····························}
 250 ························}
 251 ····················}
 252 ················}
 253 ············}
 254 ············throw·new·IllegalStateException("Failed·to·find·the·best·LangID·model.");
 255 ········}
 256 ····}
 257 ····
 258 ····private·String·getResourceLocalesString()·{
 259 ········try·{
 260 ············final·Context·context·=·this.context;
 261 ············try·{
 262 ················final·Resources·resources·=·context.getResources();
 263 ················try·{
 264 ····················final·Configuration·configuration·=·resources.getConfiguration();
 265 ····················try·{
 266 ························final·LocaleList·locales·=·configuration.getLocales();
 267 ························try·{
 268 ····························return·locales.toLanguageTags();
 269 ························}
 270 ························catch·(NullPointerException·ex)·{
 271 ····························return·LocaleList.getDefault().toLanguageTags();
 272 ························}
 273 ····················}
 274 ····················catch·(NullPointerException·ex2)·{}
 275 ················}
 276 ················catch·(NullPointerException·ex3)·{}
 277 ············}
 278 ············catch·(NullPointerException·ex4)·{}
 279 ········}
 280 ········catch·(NullPointerException·ex5)·{}
 281 ····}
 282 ····
 283 ····TextClassification·classifyText(final·TextClassification$Request·p0)·{
133 ········//·284 ········//·
134 ········//·This·method·could·not·be·decompiled.285 ········//·This·method·could·not·be·decompiled.
135 ········//·286 ········//·
136 ········//·Original·Bytecode:287 ········//·Original·Bytecode:
Offset 764, 195 lines modifiedOffset 1090, 14 lines modified
Offset 1079, 661 lines modifiedOffset 1224, 661 lines modified
Offset 1892, 43 lines modifiedOffset 2037, 23 lines modified