| | | |
Offset 9, 378 lines modified | Offset 9, 155 lines modified |
9 | ········Lcom/android/textclassifier/ModelFileManager$ModelFile;, | 9 | ········Lcom/android/textclassifier/ModelFileManager$ModelFile;, |
10 | ········Lcom/android/textclassifier/ModelFileManager$ModelFileSupplierImpl; | 10 | ········Lcom/android/textclassifier/ModelFileManager$ModelFileSupplierImpl; |
11 | ····} | 11 | ····} |
12 | .end·annotation | 12 | .end·annotation |
| |
| |
13 | #·instance·fields | 13 | #·instance·fields |
| 14 | .field·private·final·modelFileSupplier:Ljava/util/function/Supplier; |
14 | .field·private·final·downloadModelDir:Ljava/io/File; | |
| |
15 | .field·private·final·modelFileSuppliers:Lcom/google/common/collect/ImmutableMap; | |
16 | ····.annotation·system·Ldalvik/annotation/Signature; | 15 | ····.annotation·system·Ldalvik/annotation/Signature; |
17 | ········value·=·{ | 16 | ········value·=·{ |
18 | ············"Lcom/google/common/collect/ImmutableMap<", | |
19 | ············"Ljava/lang/String;", | |
20 | ············"Ljava/util/function/Supplier<", | 17 | ············"Ljava/util/function/Supplier<", |
21 | ············"Lcom/google/common/collect/ImmutableList<", | 18 | ············"Lcom/google/common/collect/ImmutableList<", |
22 | ············"Lcom/android/textclassifier/ModelFileManager$ModelFile;", | 19 | ············"Lcom/android/textclassifier/ModelFileManager$ModelFile;", |
23 | ············">;>;>;" | 20 | ············">;>;" |
24 | ········} | 21 | ········} |
25 | ····.end·annotation | 22 | ····.end·annotation |
26 | .end·field | 23 | .end·field |
| |
| |
27 | #·direct·methods | 24 | #·direct·methods |
| 25 | .method·public·constructor·<init>(Ljava/util/function/Supplier;)V |
28 | .method·public·constructor·<init>(Landroid/content/Context;Lcom/android/textclassifier/TextClassifierSettings;)V | |
29 | ····.locals·4 | |
| |
30 | ····.line·68 | |
31 | ····invoke-direct·{p0},·Ljava/lang/Object;-><init>()V | |
| |
32 | ····.line·69 | |
33 | ····invoke-static·{p1},·Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; | |
| |
34 | ····.line·70 | |
35 | ····invoke-static·{p2},·Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; | |
| |
36 | ····.line·71 | |
37 | ····new-instance·v0,·Ljava/io/File; | |
| |
38 | ····invoke-virtual·{p1},·Landroid/content/Context;->getFilesDir()Ljava/io/File; | |
| |
39 | ····move-result-object·p1 | |
| |
40 | ····const-string·v1,·"textclassifier/downloads/models/" | |
| |
41 | ····invoke-direct·{v0,·p1,·v1},·Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V | |
| |
42 | ····iput-object·v0,·p0,·Lcom/android/textclassifier/ModelFileManager;->downloadModelDir:Ljava/io/File; | |
| |
43 | ····.line·72 | |
44 | ····invoke-virtual·{v0},·Ljava/io/File;->exists()Z | |
| |
45 | ····move-result·p1 | |
| |
46 | ····if-nez·p1,·:cond_0 | |
| |
47 | ····.line·73 | |
48 | ····iget-object·p1,·p0,·Lcom/android/textclassifier/ModelFileManager;->downloadModelDir:Ljava/io/File; | |
| |
49 | ····invoke-virtual·{p1},·Ljava/io/File;->mkdirs()Z | |
| |
50 | ····.line·77 | |
51 | ····:cond_0 | |
52 | ····invoke-static·{},·Lcom/google/common/collect/ImmutableMap;->builder()Lcom/google/common/collect/ImmutableMap$Builder; | |
| |
53 | ····move-result-object·p1 | |
| |
54 | ····.line·78 | |
55 | ····invoke-static·{},·Lcom/android/textclassifier/ModelFileManager$ModelFile$ModelType;->values()Lcom/google/common/collect/ImmutableList; | |
| |
56 | ····move-result-object·v0 | |
| |
57 | ····invoke-virtual·{v0},·Lcom/google/common/collect/ImmutableList;->iterator()Lcom/google/common/collect/UnmodifiableIterator; | |
| |
58 | ····move-result-object·v0 | |
| |
59 | ····:goto_0 | |
60 | ····invoke-interface·{v0},·Ljava/util/Iterator;->hasNext()Z | |
| |
61 | ····move-result·v1 | |
| |
62 | ····if-eqz·v1,·:cond_1 | |
| |
63 | ····invoke-interface·{v0},·Ljava/util/Iterator;->next()Ljava/lang/Object; | |
| |
64 | ····move-result-object·v1 | |
| |
65 | ····check-cast·v1,·Ljava/lang/String; | |
| |
66 | ····.line·79 | |
67 | ····new-instance·v2,·Lcom/android/textclassifier/ModelFileManager$ModelFileSupplierImpl; | |
| |
68 | ····iget-object·v3,·p0,·Lcom/android/textclassifier/ModelFileManager;->downloadModelDir:Ljava/io/File; | |
| |
69 | ····invoke-direct·{v2,·p2,·v1,·v3},·Lcom/android/textclassifier/ModelFileManager$ModelFileSupplierImpl;-><init>(Lcom/android/textclassifier/TextClassifierSettings;Ljava/lang/String;Ljava/io/File;)V | |
| |
70 | ····invoke-virtual·{p1,·v1,·v2},·Lcom/google/common/collect/ImmutableMap$Builder;->put(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableMap$Builder; | |
| |
71 | ····goto·:goto_0 | |
| |
72 | ····.line·82 | |
73 | ····:cond_1 | |
74 | ····invoke-virtual·{p1},·Lcom/google/common/collect/ImmutableMap$Builder;->build()Lcom/google/common/collect/ImmutableMap; | |
| |
75 | ····move-result-object·p1 | |
| |
76 | ····iput-object·p1,·p0,·Lcom/android/textclassifier/ModelFileManager;->modelFileSuppliers:Lcom/google/common/collect/ImmutableMap; | |
| |
77 | ····return-void | |
78 | .end·method | |
| |
79 | .method·constructor·<init>(Ljava/io/File;Lcom/google/common/collect/ImmutableMap;)V | |
80 | ····.locals·0 | 26 | ····.locals·0 |
81 | ····.annotation·system·Ldalvik/annotation/Signature; | 27 | ····.annotation·system·Ldalvik/annotation/Signature; |
82 | ········value·=·{ | 28 | ········value·=·{ |
83 | ············"(", | 29 | ············"(", |
84 | ············"Ljava/io/File;", | |
85 | ············"Lcom/google/common/collect/ImmutableMap<", | |
86 | ············"Ljava/lang/String;", | |
87 | ············"Ljava/util/function/Supplier<", | 30 | ············"Ljava/util/function/Supplier<", |
88 | ············"Lcom/google/common/collect/ImmutableList<", | 31 | ············"Lcom/google/common/collect/ImmutableList<", |
89 | ············"Lcom/android/textclassifier/ModelFileManager$ModelFile;", | 32 | ············"Lcom/android/textclassifier/ModelFileManager$ModelFile;", |
90 | ············">;>;>;)V" | 33 | ············">;>;)V" |
91 | ········} | 34 | ········} |
92 | ····.end·annotation | 35 | ····.end·annotation |
| |
93 | ····.line·88 | 36 | ····.line·51 |
94 | ····invoke-direct·{p0},·Ljava/lang/Object;-><init>()V | 37 | ····invoke-direct·{p0},·Ljava/lang/Object;-><init>()V |
| |
95 | ····.line·89 | 38 | ····.line·52 |
96 | ····invoke-static·{p1},·Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; | 39 | ····invoke-static·{p1},·Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; |
| |
97 | ····check-cast·p1,·Ljava/io/File; | 40 | ····check-cast·p1,·Ljava/util/function/Supplier; |
| |
98 | ····iput-object·p1,·p0,·Lcom/android/textclassifier/ModelFileManager;->downloadModelDir:Ljava/io/File; | 41 | ····iput-object·p1,·p0,·Lcom/android/textclassifier/ModelFileManager;->modelFileSupplier:Ljava/util/function/Supplier; |
| |
99 | ····.line·90 | |
100 | ····invoke-static·{p2},·Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; | |
| |
101 | ····check-cast·p2,·Lcom/google/common/collect/ImmutableMap; | |
| |
102 | ····iput-object·p2,·p0,·Lcom/android/textclassifier/ModelFileManager;->modelFileSuppliers:Lcom/google/common/collect/ImmutableMap; | |
| |
103 | ····return-void | 42 | ····return-void |
104 | .end·method | 43 | .end·method |
| |
| |
105 | #·virtual·methods | 44 | #·virtual·methods |
106 | .method·public·dump(Lcom/android/textclassifier/utils/IndentingPrintWriter;)V | 45 | .method·public·findBestModelFile(Landroid/os/LocaleList;)Lcom/android/textclassifier/ModelFileManager$ModelFile; |
107 | ····.locals·4 | 46 | ····.locals·3 |
| |
108 | ····const-string·v0,·"ModelFileManager:" | |
| |
109 | ····.line·153 | |
110 | ····invoke-virtual·{p1,·v0},·Lcom/android/textclassifier/utils/IndentingPrintWriter;->println(Ljava/lang/String;)Lcom/android/textclassifier/utils/IndentingPrintWriter; | |
| |
111 | ····.line·154 | |
112 | ····invoke-virtual·{p1},·Lcom/android/textclassifier/utils/IndentingPrintWriter;->increaseIndent()Lcom/android/textclassifier/utils/IndentingPrintWriter; | |
| |
113 | ····.line·155 | |
114 | ····invoke-static·{},·Lcom/android/textclassifier/ModelFileManager$ModelFile$ModelType;->values()Lcom/google/common/collect/ImmutableList; | |
| |
115 | ····move-result-object·v0 | |
| |
116 | ····invoke-virtual·{v0},·Lcom/google/common/collect/ImmutableList;->iterator()Lcom/google/common/collect/UnmodifiableIterator; | |
| |
117 | ····move-result-object·v0 | |
| |
118 | ····:goto_0 | |
119 | ····invoke-interface·{v0},·Ljava/util/Iterator;->hasNext()Z | |
| |
120 | ····move-result·v1 | |
| |
121 | ····if-eqz·v1,·:cond_1 | |
| |
122 | ····invoke-interface·{v0},·Ljava/util/Iterator;->next()Ljava/lang/Object; | |
| |
123 | ····move-result-object·v1 | |
| |
124 | ····check-cast·v1,·Ljava/lang/String; | 47 | ····if-eqz·p1,·:cond_1 |
| |
125 | ····.line·156 | 48 | ····.line·67 |
126 | ····new-instance·v2,·Ljava/lang/StringBuilder; | |
| |
127 | ····invoke-direct·{v2},·Ljava/lang/StringBuilder;-><init>()V | |
| |
128 | ····invoke-virtual·{v2,·v1},·Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
| |
129 | ····const-string·v3,·"·model·file(s):" | |
| |
130 | ····invoke-virtual·{v2,·v3},·Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
| |
131 | ····invoke-virtual·{v2},·Ljava/lang/StringBuilder;->toString()Ljava/lang/String; | |
| |
132 | ····move-result-object·v2 | |
| |
133 | ····invoke-virtual·{p1,·v2},·Lcom/android/textclassifier/utils/IndentingPrintWriter;->println(Ljava/lang/String;)Lcom/android/textclassifier/utils/IndentingPrintWriter; | |
| |
134 | ····.line·157 | |
135 | ····invoke-virtual·{p1},·Lcom/android/textclassifier/utils/IndentingPrintWriter;->increaseIndent()Lcom/android/textclassifier/utils/IndentingPrintWriter; | |
| |
136 | ····.line·158 | |
137 | ····invoke-virtual·{p0,·v1},·Lcom/android/textclassifier/ModelFileManager;->listModelFiles(Ljava/lang/String;)Lcom/google/common/collect/ImmutableList; | |
| |
138 | ····move-result-object·v1 | |
| |
139 | ····invoke-virtual·{v1},·Lcom/google/common/collect/ImmutableList;->iterator()Lcom/google/common/collect/UnmodifiableIterator; | |
| |
140 | ····move-result-object·v1 | |
| |
141 | ····:goto_1 | |
142 | ····invoke-interface·{v1},·Ljava/util/Iterator;->hasNext()Z | |
| |
143 | ····move-result·v2 | |
| |
144 | ····if-eqz·v2,·:cond_0 | |
| |
145 | ····invoke-interface·{v1},·Ljava/util/Iterator;->next()Ljava/lang/Object; | |
| |
146 | ····move-result-object·v2 | |
| |
147 | ····check-cast·v2,·Lcom/android/textclassifier/ModelFileManager$ModelFile; | |
| |
148 | ····.line·159 | |
149 | ····invoke-virtual·{v2},·Lcom/android/textclassifier/ModelFileManager$ModelFile;->toString()Ljava/lang/String; | |
| |
150 | ····move-result-object·v2 | |
| |
151 | ····invoke-virtual·{p1,·v2},·Lcom/android/textclassifier/utils/IndentingPrintWriter;->println(Ljava/lang/String;)Lcom/android/textclassifier/utils/IndentingPrintWriter; | |
| |
152 | ····goto·:goto_1 | |
| |
153 | ····.line·161 | |
154 | ····:cond_0 | |
155 | ····invoke-virtual·{p1},·Lcom/android/textclassifier/utils/IndentingPrintWriter;->decreaseIndent()Lcom/android/textclassifier/utils/IndentingPrintWriter; | |
| |
156 | ····goto·:goto_0 | |
| |
157 | ····.line·163 | |
158 | ····:cond_1 | |
159 | ····invoke-virtual·{p1},·Lcom/android/textclassifier/utils/IndentingPrintWriter;->decreaseIndent()Lcom/android/textclassifier/utils/IndentingPrintWriter; | |
| |
160 | ····return-void | |
161 | .end·method | |
| |
162 | .method·public·findBestModelFile(Ljava/lang/String;Landroid/os/LocaleList;)Lcom/android/textclassifier/ModelFileManager$ModelFile; | |
163 | ····.locals·2 | |
| |
164 | ····if-eqz·p2,·:cond_1 | |
| |
165 | ····.line·116 | |
166 | ····invoke-virtual·{p2},·Landroid/os/LocaleList;->isEmpty()Z | 49 | ····invoke-virtual·{p1},·Landroid/os/LocaleList;->isEmpty()Z |
| |
167 | ····move-result·v0 | 50 | ····move-result·v0 |
| |
168 | ····if-eqz·v0,·:cond_0 | 51 | ····if-eqz·v0,·:cond_0 |
| |
169 | ····goto·:goto_0 | 52 | ····goto·:goto_0 |
| |
170 | ····.line·118 | 53 | ····.line·69 |
171 | ····:cond_0 | 54 | ····:cond_0 |
172 | ····invoke-virtual·{p2},·Landroid/os/LocaleList;->toLanguageTags()Ljava/lang/String; | 55 | ····invoke-virtual·{p1},·Landroid/os/LocaleList;->toLanguageTags()Ljava/lang/String; |
| |
173 | ····move-result-object·p2 | 56 | ····move-result-object·p1 |
| |
174 | ····goto·:goto_1 | 57 | ····goto·:goto_1 |
| |
175 | ····.line·117 | 58 | ····.line·68 |
176 | ····:cond_1 | 59 | ····:cond_1 |
177 | ····:goto_0 | 60 | ····:goto_0 |
178 | ····invoke-static·{},·Landroid/os/LocaleList;->getDefault()Landroid/os/LocaleList; | 61 | ····invoke-static·{},·Landroid/os/LocaleList;->getDefault()Landroid/os/LocaleList; |
| |
179 | ····move-result-object·p2 | 62 | ····move-result-object·p1 |
| |
180 | ····invoke-virtual·{p2},·Landroid/os/LocaleList;->toLanguageTags()Ljava/lang/String; | 63 | ····invoke-virtual·{p1},·Landroid/os/LocaleList;->toLanguageTags()Ljava/lang/String; |
| |
181 | ····move-result-object·p2 | 64 | ····move-result-object·p1 |
| |
182 | ····.line·119 | 65 | ····.line·70 |
183 | ····:goto_1 | 66 | ····:goto_1 |
184 | ····invoke-static·{p2},·Ljava/util/Locale$LanguageRange;->parse(Ljava/lang/String;)Ljava/util/List; | 67 | ····invoke-static·{p1},·Ljava/util/Locale$LanguageRange;->parse(Ljava/lang/String;)Ljava/util/List; |
| |
185 | ····move-result-object·p2 | 68 | ····move-result-object·p1 |
| |
186 | ····const/4·v0,·0x0 | 69 | ····const/4·v0,·0x0 |
| |
187 | ····.line·122 | 70 | ····.line·73 |
188 | ····invoke-virtual·{p0,·p1},·Lcom/android/textclassifier/ModelFileManager;->listModelFiles(Ljava/lang/String;)Lcom/google/common/collect/ImmutableList; | 71 | ····invoke-virtual·{p0},·Lcom/android/textclassifier/ModelFileManager;->listModelFiles()Lcom/google/common/collect/ImmutableList; |
| |
189 | ····move-result-object·p0 | 72 | ····move-result-object·p0 |
| |
190 | ····invoke-virtual·{p0},·Lcom/google/common/collect/ImmutableList;->iterator()Lcom/google/common/collect/UnmodifiableIterator; | 73 | ····invoke-virtual·{p0},·Lcom/google/common/collect/ImmutableList;->iterator()Lcom/google/common/collect/UnmodifiableIterator; |
| |
191 | ····move-result-object·p0 | 74 | ····move-result-object·p0 |
| |
192 | ····:cond_2 | 75 | ····:cond_2 |
193 | ····:goto_2 | 76 | ····:goto_2 |
194 | ····invoke-interface·{p0},·Ljava/util/Iterator;->hasNext()Z | 77 | ····invoke-interface·{p0},·Ljava/util/Iterator;->hasNext()Z |
| |
195 | ····move-result·p1 | 78 | ····move-result·v1 |
| |
196 | ····if-eqz·p1,·:cond_3 | 79 | ····if-eqz·v1,·:cond_3 |
| |
197 | ····invoke-interface·{p0},·Ljava/util/Iterator;->next()Ljava/lang/Object; | 80 | ····invoke-interface·{p0},·Ljava/util/Iterator;->next()Ljava/lang/Object; |
| |
198 | ····move-result-object·p1 | 81 | ····move-result-object·v1 |
| |
199 | ····check-cast·p1,·Lcom/android/textclassifier/ModelFileManager$ModelFile; | 82 | ····check-cast·v1,·Lcom/android/textclassifier/ModelFileManager$ModelFile; |
| |
200 | ····.line·123 | 83 | ····.line·74 |
201 | ····invoke-virtual·{p1,·p2},·Lcom/android/textclassifier/ModelFileManager$ModelFile;->isAnyLanguageSupported(Ljava/util/List;)Z | 84 | ····invoke-virtual·{v1,·p1},·Lcom/android/textclassifier/ModelFileManager$ModelFile;->isAnyLanguageSupported(Ljava/util/List;)Z |
| |
202 | ····move-result·v1 | 85 | ····move-result·v2 |
| |
203 | ····if-eqz·v1,·:cond_2 | 86 | ····if-eqz·v2,·:cond_2 |
| |
204 | ····.line·124 | 87 | ····.line·75 |
205 | ····invoke-virtual·{p1,·v0},·Lcom/android/textclassifier/ModelFileManager$ModelFile;->isPreferredTo(Lcom/android/textclassifier/ModelFileManager$ModelFile;)Z | 88 | ····invoke-virtual·{v1,·v0},·Lcom/android/textclassifier/ModelFileManager$ModelFile;->isPreferredTo(Lcom/android/textclassifier/ModelFileManager$ModelFile;)Z |
| |
206 | ····move-result·v1 | 89 | ····move-result·v2 |
| |
207 | ····if-eqz·v1,·:cond_2 | 90 | ····if-eqz·v2,·:cond_2 |
| |
208 | ····move-object·v0,·p1 | 91 | ····move-object·v0,·v1 |
| |
209 | ····goto·:goto_2 | 92 | ····goto·:goto_2 |
| |
210 | ····:cond_3 | 93 | ····:cond_3 |
211 | ····return-object·v0 | 94 | ····return-object·v0 |
212 | .end·method | 95 | .end·method |
| |
213 | .method·public·listModelFiles(Ljava/lang/String;)Lcom/google/common/collect/ImmutableList; | 96 | .method·public·listModelFiles()Lcom/google/common/collect/ImmutableList; |
214 | ····.locals·1 | 97 | ····.locals·0 |
215 | ····.annotation·system·Ldalvik/annotation/Signature; | 98 | ····.annotation·system·Ldalvik/annotation/Signature; |
216 | ········value·=·{ | 99 | ········value·=·{ |
217 | ············"(", | 100 | ············"()", |
218 | ············"Ljava/lang/String;", | |
219 | ············")", | |
220 | ············"Lcom/google/common/collect/ImmutableList<", | 101 | ············"Lcom/google/common/collect/ImmutableList<", |
221 | ············"Lcom/android/textclassifier/ModelFileManager$ModelFile;", | 102 | ············"Lcom/android/textclassifier/ModelFileManager$ModelFile;", |
222 | ············">;" | 103 | ············">;" |
223 | ········} | 104 | ········} |
224 | ····.end·annotation | 105 | ····.end·annotation |
| |
225 | ····.line·99 | 106 | ····.line·57 |
226 | ····iget-object·v0,·p0,·Lcom/android/textclassifier/ModelFileManager;->modelFileSuppliers:Lcom/google/common/collect/ImmutableMap; | |
| |
227 | ····invoke-virtual·{v0,·p1},·Lcom/google/common/collect/ImmutableMap;->containsKey(Ljava/lang/Object;)Z | |
| |
228 | ····move-result·v0 | |
| |
229 | ····if-eqz·v0,·:cond_0 | |
| |
230 | ····.line·100 | |
231 | ····iget-object·p0,·p0,·Lcom/android/textclassifier/ModelFileManager;->modelFileSuppliers:Lcom/google/common/collect/ImmutableMap; | 107 | ····iget-object·p0,·p0,·Lcom/android/textclassifier/ModelFileManager;->modelFileSupplier:Ljava/util/function/Supplier; |
| |
232 | ····invoke-virtual·{p0,·p1},·Lcom/google/common/collect/ImmutableMap;->get(Ljava/lang/Object;)Ljava/lang/Object; | |
| |
233 | ····move-result-object·p0 | |
| |
234 | ····check-cast·p0,·Ljava/util/function/Supplier; | |
| |
235 | ····invoke-interface·{p0},·Ljava/util/function/Supplier;->get()Ljava/lang/Object; | 108 | ····invoke-interface·{p0},·Ljava/util/function/Supplier;->get()Ljava/lang/Object; |
| |
236 | ····move-result-object·p0 | 109 | ····move-result-object·p0 |
| |
237 | ····check-cast·p0,·Lcom/google/common/collect/ImmutableList; | 110 | ····check-cast·p0,·Lcom/google/common/collect/ImmutableList; |
| |
238 | ····return-object·p0 | 111 | ····return-object·p0 |
| |
239 | ····.line·102 | |
240 | ····:cond_0 | |
241 | ····invoke-static·{},·Lcom/google/common/collect/ImmutableList;->of()Lcom/google/common/collect/ImmutableList; | |
| |
242 | ····move-result-object·p0 | |
| |
243 | ····return-object·p0 | |
244 | .end·method | 112 | .end·method |