AdGuard v3.6.45版本的 MD5 值为:ce30a13dcef92cf942973fffcc6d20fb
以下内容为反编译后的 c.java 源代码,内容仅作参考
package com.adguard.android;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.preference.PreferenceManager;
import android.util.Pair;
import android.util.SparseArray;
import androidx.recyclerview.widget.ItemTouchHelper;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.joran.action.Action;
import com.adguard.android.a.h;
import com.adguard.android.a.n;
import com.adguard.android.a.r;
import com.adguard.android.api.dto.g;
import com.adguard.android.db.i;
import com.adguard.android.filtering.api.l;
import com.adguard.android.filtering.commons.DeviceName;
import com.adguard.android.filtering.filter.FilteringQuality;
import com.adguard.android.model.dns.DnsServerType;
import com.adguard.android.model.enums.StealthModeProtectionLevel;
import com.adguard.android.model.filters.FilterGroup;
import com.adguard.android.model.filters.e;
import com.adguard.android.model.settings.dto.deprecated.dnsinfo.DnsInfo;
import com.adguard.android.service.PreferencesService;
import com.adguard.android.service.f;
import com.adguard.dnslibs.proxy.DnsStamp;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.Range;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.d;
public class c {
public static final Map<String, String> f56a = new HashMap<String, String>() {
{
put("176.103.130.130", "94.140.14.14");
put("176.103.130.131", "94.140.15.15");
put("176.103.130.132", "94.140.14.15");
put("176.103.130.134", "94.140.15.16");
put("176.103.130.136", "94.140.14.140");
put("176.103.130.137", "94.140.14.141");
}
};
private static final org.slf4j.c b = d.a(c.class);
private final Context c;
private final PreferencesService d;
private final f e;
public c(Context context, PreferencesService preferencesService, f fVar) {
b.info("Creating UpgradeHelper instance for {}", context);
this.c = context;
this.d = preferencesService;
this.e = fVar;
}
public static int a(Range range, Range range2) {
int intValue = ((Integer) range.getMinimum()).intValue();
int intValue2 = ((Integer) range2.getMinimum()).intValue();
if (intValue == intValue2) {
return 0;
}
return intValue < intValue2 ? -1 : 1;
}
private static SparseArray<e> a(List<g> list, Map<Integer, Map<String, com.adguard.android.model.filters.f>> map) {
SparseArray<e> sparseArray = new SparseArray<>();
for (g gVar : list) {
int tagId = gVar.getTagId();
String keyword = gVar.getKeyword();
if (!StringUtils.isBlank(keyword) && !StringUtils.startsWith(keyword, "reference:")) {
e eVar = new e();
eVar.setTagId(tagId);
eVar.setKeyword(keyword);
eVar.setLocalizations(map.get(Integer.valueOf(tagId)));
sparseArray.append(eVar.getTagId(), eVar);
}
}
return sparseArray;
}
private com.adguard.android.a.g a() {
return new com.adguard.android.a.g(this.c, n.a(this.d.w()));
}
private com.adguard.android.model.dns.f a(com.adguard.android.model.dns.f fVar) {
DnsServerType type = fVar.getType();
int id = fVar.getId();
com.adguard.android.model.dns.e a2 = a().a(fVar.getProviderId());
if (a2 == null) {
return null;
}
List<com.adguard.android.model.dns.f> servers = a2.getServers();
if (CollectionUtils.isEmpty(servers)) {
return null;
}
for (com.adguard.android.model.dns.f fVar2 : servers) {
if (fVar2.getId() == id && fVar2.getType() == type) {
return fVar2;
}
}
return null;
}
private String a(String str) {
if (str.startsWith("sdns")) {
DnsStamp b2 = h.b(str);
if (b2 != null && b2.getServerAddr() != null) {
String a2 = a(b2.getServerAddr());
if (a2 == null) {
return null;
}
b2.setServerAddr(a2);
return b2.toString();
}
return null;
}
String[] split = str.split("://");
if (split.length != 0) {
boolean z = true & true;
if (split.length > 2) {
return str;
}
String[] split2 = split[split.length - 1].split("/");
if (split2.length == 0) {
return str;
}
String str2 = split2[0];
if (str2.contains(":")) {
return str;
}
return str.replace(str2, str2 + ":784");
}
return str;
}
private static String a(Map<String, Object> map) {
String str;
String str2;
DnsServerType a2;
if (map == null) {
return "";
}
boolean booleanValue = Boolean.valueOf(MapUtils.getString(map, "encrypted", null)).booleanValue();
String string = MapUtils.getString(map, "id");
String string2 = MapUtils.getString(map, Action.NAME_ATTRIBUTE);
String string3 = MapUtils.getString(map, "provider");
String string4 = MapUtils.getString(map, "serverType");
List list = (List) MapUtils.getObject(map, "upstreams", new ArrayList());
List list2 = (List) MapUtils.getObject(map, "address", new ArrayList());
String string5 = MapUtils.getString(map, "sdns", "");
if (StringUtils.isBlank(string5) && CollectionUtils.isEmpty(list) && CollectionUtils.isEmpty(list2)) {
return "";
}
if (string4 == null) {
if (!booleanValue && CollectionUtils.isNotEmpty(list2)) {
string4 = DnsServerType.REGULAR.toString();
} else if (string5 != null && (a2 = h.a(Collections.singletonList(string5))) != null) {
string4 = a2.toString();
}
}
String replace = "{\"id\":\"{0}\",\"name\":\"{1}\",\"provider\":{2},\"serverType\":\"{3}\",\"upstreams\":{4}}".replace("{0}", string).replace("{1}", string2);
if (string3 != null) {
str = "\"" + string3 + "\"";
} else {
str = "null";
}
String replace2 = replace.replace("{2}", str);
if (string4 == null) {
string4 = "null";
}
String replace3 = replace2.replace("{3}", string4);
if (CollectionUtils.isNotEmpty(list)) {
str2 = com.adguard.kit.h.c.a(list);
} else if (CollectionUtils.isNotEmpty(list2)) {
str2 = com.adguard.kit.h.c.a(list2);
} else {
str2 = "[\"" + string5 + "\"]";
}
return replace3.replace("{4}", (CharSequence) Objects.requireNonNull(str2));
}
private static List<com.adguard.android.model.filters.c> a(com.adguard.android.api.dto.e eVar, com.adguard.android.api.dto.d dVar) {
ArrayList arrayList = new ArrayList();
List<com.adguard.android.api.dto.b> filters = eVar.getFilters();
Map<Integer, Map<String, com.adguard.android.model.filters.f>> filters2 = dVar.getFilters();
SparseArray<e> a2 = a(eVar.getTags(), dVar.getTags());
for (com.adguard.android.api.dto.b bVar : filters) {
com.adguard.android.model.filters.c cVar = new com.adguard.android.model.filters.c();
cVar.setFilterId(bVar.getFilterId());
cVar.setDisplayOrder(bVar.getDisplayNumber());
cVar.setName(bVar.getName());
cVar.setDescription(bVar.getDescription());
cVar.setVersion(bVar.getVersion());
cVar.setGroup(FilterGroup.findByCode(bVar.getGroupId()));
cVar.setTimeUpdated(bVar.getTimeUpdated());
cVar.setSubscriptionUrl(bVar.getSubscriptionUrl());
cVar.setHomePage(bVar.getHomepage());
boolean z = true & true;
cVar.setTrusted(true);
Map<String, com.adguard.android.model.filters.f> map = filters2.get(Integer.valueOf(cVar.getFilterId()));
if (MapUtils.isNotEmpty(map)) {
cVar.setLocalizations(map);
}
ArrayList arrayList2 = new ArrayList();
if (CollectionUtils.isNotEmpty(bVar.getTags())) {
for (Integer num : bVar.getTags()) {
e eVar2 = a2.get(num.intValue());
if (eVar2 != null) {
arrayList2.add(eVar2);
}
}
}
cVar.setTags(arrayList2);
arrayList.add(cVar);
}
return arrayList;
}
private static List<Range<Integer>> a(List<Range<Integer>> list) {
Range between = Range.between(80, 5221);
Range between2 = Range.between(5299, 49151);
Range between3 = Range.between(0, 79);
Range between4 = Range.between(5222, 5298);
ArrayList arrayList = new ArrayList();
for (Range<Integer> range : list) {
if (!a(arrayList, range)) {
if (between.containsRange(range)) {
arrayList.add(between);
} else if (between2.containsRange(range)) {
arrayList.add(between2);
} else if (between3.containsRange(range) || between4.containsRange(range)) {
arrayList.add(range);
} else if (between3.isOverlappedBy(range)) {
if (between.isOverlappedBy(range)) {
if (!between4.isOverlappedBy(range)) {
arrayList.add(Range.between(range.getMinimum(), (Comparable) between.getMaximum()));
} else if (between2.isOverlappedBy(range)) {
arrayList.add(Range.between(range.getMinimum(), (Comparable) between2.getMaximum()));
} else {
arrayList.add(range);
}
}
} else if (between.isOverlappedBy(range)) {
if (between4.isOverlappedBy(range)) {
if (between2.isOverlappedBy(range)) {
arrayList.add(Range.between((Comparable) between.getMinimum(), (Comparable) between2.getMaximum()));
} else {
arrayList.add(Range.between((Comparable) between.getMinimum(), range.getMaximum()));
}
}
} else if (between4.isOverlappedBy(range) && between2.isOverlappedBy(range)) {
arrayList.add(Range.between(range.getMinimum(), (Comparable) between2.getMaximum()));
}
}
}
Collections.sort(arrayList, new Comparator() {
@Override
public final int compare(Object obj, Object obj2) {
int a2;
a2 = c.a((Range) obj, (Range) obj2);
return a2;
}
});
return arrayList;
}
private void a(SharedPreferences sharedPreferences) {
b.info("Start 'Strip tracking parameters list' migration");
String string = sharedPreferences.getString("stealth_mode_tracking_parameters_list", null);
if (StringUtils.isEmpty(string)) {
b.info("There are no custom tracking parameters, do nothing");
return;
}
List<String> a2 = com.adguard.commons.c.a.a(StringUtils.replace(string, " ", "\n"), "\n", true);
if (CollectionUtils.isEmpty(a2)) {
b.info("There are no custom tracking parameters, do nothing");
return;
}
ArrayList arrayList = new ArrayList();
for (String str : a2) {
arrayList.add("$removeparam=".concat(String.valueOf(str)));
}
List<com.adguard.android.model.filters.c> aO = this.d.aO();
int i = 10000;
for (com.adguard.android.model.filters.c cVar : aO) {
if (cVar.getFilterId() >= i) {
i = cVar.getFilterId() + 1;
}
}
boolean z = false;
if (this.d.au() && (this.d.at() != StealthModeProtectionLevel.CUSTOM || sharedPreferences.getBoolean("stealth_mode_strip_tracking_parameters", false))) {
z = true;
}
if (z) {
a(FilterGroup.CUSTOM);
}
com.adguard.android.model.filters.c cVar2 = new com.adguard.android.model.filters.c();
cVar2.setEnabled(z);
cVar2.setTrusted(true);
cVar2.setFilterId(i);
cVar2.setName(this.c.getString(R.l.tracking_params_filter));
cVar2.setGroup(FilterGroup.CUSTOM);
cVar2.setTimeUpdated(new Date());
aO.add(cVar2);
this.d.c(aO);
String join = StringUtils.join(arrayList, "\n");
b.debug("Creating custom filter with ID {}: {}", Integer.valueOf(i), join);
i.a(this.c).a(i, join);
}
private static void a(SharedPreferences sharedPreferences, String str) {
String string = sharedPreferences.getString(str, null);
if (StringUtils.isBlank(string)) {
return;
}
String b2 = b(string);
if (StringUtils.equals(string, b2)) {
return;
}
b.info("Replacing deprecated AdGuard DNS server {} with a new one {}", string, b2);
sharedPreferences.edit().putString(str, b2).commit();
}
private void a(SQLiteDatabase sQLiteDatabase, int i) {
if (i == 50) {
b.info("v3.0 upgrade: Migrate list of filter to the new schema");
HashSet hashSet = new HashSet();
try {
Cursor rawQuery = sQLiteDatabase.rawQuery("select filter_list_id from filter_lists where enabled = 1", null);
while (rawQuery.moveToNext()) {
hashSet.add(Integer.valueOf(rawQuery.getInt(0)));
}
b.info("Enabled filters: {}", hashSet);
if (CollectionUtils.isEmpty(hashSet)) {
b.info("All filters was disabled. Migration skip.");
if (rawQuery != null) {
rawQuery.close();
}
return;
}
HashSet hashSet2 = new HashSet();
List<com.adguard.android.model.filters.c> aO = this.d.aO();
for (com.adguard.android.model.filters.c cVar : aO) {
cVar.setEnabled(hashSet.contains(Integer.valueOf(cVar.getFilterId())));
if (cVar.isEnabled()) {
hashSet2.add(cVar.getGroup());
}
}
this.d.c(aO);
this.d.a(hashSet2);
b.info("v3.0 upgrade: Drop the filters table and the filters localization table");
sQLiteDatabase.execSQL("drop table if exists filter_lists");
sQLiteDatabase.execSQL("drop table if exists filters_localization");
if (rawQuery != null) {
rawQuery.close();
}
} catch (SQLiteException e) {
b.warn("Error migrate list of filter to the new schema\n", (Throwable) e);
}
}
if (i == 52) {
b.info("v3.0 upgrade: Mark existing filters as trusted");
List<com.adguard.android.model.filters.c> aO2 = this.d.aO();
for (com.adguard.android.model.filters.c cVar2 : aO2) {
cVar2.setTrusted(true);
}
this.d.c(aO2);
}
if (i == 71) {
b.info("Removing obsolete filters on upgrade to DB version 71");
HashSet hashSet3 = new HashSet();
Collections.addAll(hashSet3, 12, Integer.valueOf((int) ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION), 205, 209, 211, 116);
List<com.adguard.android.model.filters.c> aO3 = this.d.aO();
ArrayList arrayList = new ArrayList();
for (com.adguard.android.model.filters.c cVar3 : aO3) {
if (hashSet3.contains(Integer.valueOf(cVar3.getFilterId()))) {
b.warn("Removed filter with id {} from prefs", Integer.valueOf(cVar3.getFilterId()));
} else {
arrayList.add(cVar3);
}
}
this.d.c(arrayList);
}
}
private void a(FilterGroup filterGroup) {
Set<FilterGroup> f = this.d.f();
f.add(filterGroup);
this.d.a(f);
}
public static boolean a(com.adguard.android.model.filters.c cVar) {
return cVar.getFilterId() == 17;
}
private static boolean a(List<Range<Integer>> list, Range<Integer> range) {
for (Range<Integer> range2 : list) {
if (range2.containsRange(range)) {
return true;
}
}
return false;
}
private l[] a(int i) {
if (i == 55) {
return new l[]{new l("https://userscripts.adtidy.org/release/adguard-extra/1.0/adguard-extra.user.js", com.adguard.android.a.c.a(this.c, "userscripts/adguard-extra.source"), com.adguard.android.a.c.a(this.c, "userscripts/adguard-extra.meta"), true)};
}
if (i == 58) {
return new l[]{new l("https://userscripts.adtidy.org/release/disable-amp/1.0/disable-amp.user.js", com.adguard.android.a.c.a(this.c, "userscripts/disable-amp.source"), com.adguard.android.a.c.a(this.c, "userscripts/disable-amp.meta"), false)};
}
return null;
}
private static String b(String str) {
for (Map.Entry<String, String> entry : f56a.entrySet()) {
str = StringUtils.replace(str, entry.getKey(), entry.getValue());
}
return str;
}
private static String b(List<Range<Integer>> list) {
ArrayList arrayList = new ArrayList();
for (Range<Integer> range : list) {
int intValue = range.getMinimum().intValue();
int intValue2 = range.getMaximum().intValue();
arrayList.add(intValue == intValue2 ? String.format(Locale.US, "%d", Integer.valueOf(intValue)) : String.format(Locale.US, "%d:%d", Integer.valueOf(intValue), Integer.valueOf(intValue2)));
}
return StringUtils.join(arrayList, (char) CoreConstants.COMMA_CHAR);
}
private static String b(Map map) {
if (map == null || StringUtils.isNotBlank(MapUtils.getString(map, "upstreams"))) {
return null;
}
String string = MapUtils.getString(map, "id");
boolean booleanValue = MapUtils.getBoolean(map, "encrypted").booleanValue();
String string2 = MapUtils.getString(map, Action.NAME_ATTRIBUTE);
String string3 = MapUtils.getString(map, "sdns");
String replace = "{\"address\":{0},\"encrypted\":\"{1}\",\"id\":\"{2}\",\"name\":\"{3}\",\"sdns\":\"{4}\"}".replace("{0}", (com.adguard.kit.h.c.a((List) MapUtils.getObject(map, "address")) == null || booleanValue) ? "[]" : "[]").replace("{1}", String.valueOf(booleanValue)).replace("{2}", string);
if (string2 != null) {
string = string2;
}
String replace2 = replace.replace("{3}", string);
if (string3 == null) {
string3 = "null";
}
return replace2.replace("{4}", string3);
}
private void b() {
File filesDir = this.c.getFilesDir();
for (File file : FileUtils.listFiles(filesDir, (String[]) null, false)) {
String name = file.getName();
if (name.startsWith("filter_") && name.indexOf(46) < 0) {
file.renameTo(new File(filesDir, name + ".txt"));
}
}
}
private void b(SQLiteDatabase sQLiteDatabase, int i) {
l[] lVarArr;
b.info("Filling extensions table...");
try {
lVarArr = a(i);
} catch (IOException e) {
b.warn(e.getMessage(), (Throwable) e);
lVarArr = null;
}
if (lVarArr == null) {
return;
}
com.adguard.android.db.n nVar = new com.adguard.android.db.n(this.c);
boolean z = true;
for (l lVar : lVarArr) {
nVar.a(lVar, sQLiteDatabase);
}
}
public static boolean b(com.adguard.android.model.filters.c cVar) {
return cVar.getFilterId() == 17;
}
private static Pair<Boolean, List<Range<Integer>>> c(List<Range<Integer>> list) {
int size = list.size();
if (size < 2) {
return new Pair<>(Boolean.FALSE, list);
}
ArrayList arrayList = new ArrayList();
boolean z = false;
int i = 0;
while (true) {
if (i >= size - 1) {
break;
}
Range<Integer> range = list.get(i);
int i2 = i + 1;
Range<Integer> range2 = list.get(i2);
if (range.equals(range2)) {
if (i == size - 2) {
arrayList.add(range2);
} else {
continue;
i = i2;
}
}
if (range.isOverlappedBy(range2)) {
arrayList.add(Range.between(Integer.valueOf(NumberUtils.min(range.getMinimum().intValue(), range2.getMinimum().intValue())), Integer.valueOf(NumberUtils.max(range.getMaximum().intValue(), range2.getMaximum().intValue()))));
if (i < size - 2) {
for (int i3 = i + 2; i3 < size; i3++) {
arrayList.add(list.get(i3));
}
}
z = true;
} else {
arrayList.add(range);
if (i == size - 2) {
arrayList.add(range2);
}
i = i2;
}
}
return new Pair<>(Boolean.valueOf(z), arrayList);
}
public final void a(SQLiteDatabase sQLiteDatabase) {
for (int i = 55; i <= 81; i++) {
b(sQLiteDatabase, i);
}
}
public final void a(SQLiteDatabase sQLiteDatabase, int i, int i2) {
com.adguard.android.model.dns.f a2;
boolean z;
Map map;
Set<String> stringSet;
FilterGroup findByCode;
String str;
b.info("Database's rows, app preferences and another application modules related with database upgrading: from {} to {} versions", Integer.valueOf(i), Integer.valueOf(i2));
if (i < i2) {
for (int i3 = i + 1; i3 <= i2; i3++) {
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.c);
if (i3 == 32) {
b.info("v2.9R2 upgrade: user filter and whitelist conversion");
SharedPreferences.Editor edit = defaultSharedPreferences.edit();
if (defaultSharedPreferences.contains("user_rules")) {
Set<String> stringSet2 = defaultSharedPreferences.getStringSet("user_rules", new HashSet());
edit.remove("user_rules");
if (!stringSet2.isEmpty()) {
edit.putString("user_rules_string", StringUtils.join(stringSet2, "\n"));
b.info("{} user rules converted", Integer.valueOf(stringSet2.size()));
}
}
if (defaultSharedPreferences.contains("whitelist")) {
Set<String> stringSet3 = defaultSharedPreferences.getStringSet("whitelist", new HashSet());
edit.remove("whitelist");
if (!stringSet3.isEmpty()) {
edit.putString("whitelist_string", StringUtils.join(stringSet3, "\n"));
b.info("{} whitelist entries converted", Integer.valueOf(stringSet3.size()));
}
}
edit.commit();
}
if (i3 == 34) {
b.info("v2.10 upgrade: rework iptables");
if (this.d.r() && !this.d.s()) {
b.info("Transparent proxy configuration was used");
b.a(this.c).t.b(R.l.upgradeRequiresReboot);
}
}
if (i3 == 35) {
b.info("v3.0 upgrade: sets user rule list size and whitelist rule list size");
List<String> a3 = com.adguard.commons.c.a.a(this.d.g(), "\n");
List<String> a4 = com.adguard.commons.c.a.a(this.d.h(), "\n");
this.d.h(a3.size());
this.d.f(a4.size());
}
if (i3 == 38) {
String string = defaultSharedPreferences.getString("pref.https.domains.blacklist", null);
if (StringUtils.isNotBlank(string)) {
b.info("v2.11 upgrade: Save the new blacklist in the user preferences");
if (StringUtils.isNotBlank(string)) {
b.info("v2.11 upgrade: Save blacklist in to the user preferences: {}", string);
this.d.j(string);
}
}
String string2 = defaultSharedPreferences.getString("pref.https.domains.whitelist", null);
if (StringUtils.isNotBlank(string2)) {
b.info("v2.11 upgrade: Save the new whitelist in the user preferences");
Collection subtract = CollectionUtils.subtract(com.adguard.commons.c.a.a(string2, "\r\n"), com.adguard.android.filtering.api.a.a((String) null));
if (CollectionUtils.isNotEmpty(subtract)) {
b.info("v2.11 upgrade: Save the new domains into the whitelist: {}", subtract);
this.d.k(com.adguard.commons.d.d.a(subtract, (Collection<String>) null));
}
}
b.info("v2.11 upgrade: Remove pref.https.domains.blacklist and pref.https.domains.whitelist");
SharedPreferences.Editor edit2 = defaultSharedPreferences.edit();
edit2.remove("pref.https.domains.blacklist");
edit2.remove("pref.https.domains.whitelist");
edit2.apply();
}
if (i3 == 40) {
b.info("v2.12 upgrade: migrate DNSCrypt settings from v1 to v2");
Map map2 = (Map) com.adguard.kit.h.c.b(PreferenceManager.getDefaultSharedPreferences(this.c).getString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), null), Map.class);
if (map2 != null && MapUtils.getBooleanValue(map2, "encrypted") && !StringUtils.isNotBlank(MapUtils.getString(map2, "sdns"))) {
String a5 = h.a(map2);
if (a5 != null) {
map2.put("sdns", a5);
str = b(map2);
SharedPreferences.Editor edit3 = defaultSharedPreferences.edit();
edit3.putString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), str);
edit3.apply();
b.info("Old DNSCrypt custom server was replaced by new server with stamp: \n {}", a5);
} else {
str = null;
}
if (str != null) {
b.info("Old DNSCrypt server exists and was replaced by {}", str);
} else {
this.d.a((com.adguard.android.model.dns.f) null);
b.info("Current DNS server does not exists. Update to a system server.");
}
}
if (i3 != 41) {
b.info("v2.12 upgrade: purging old SSL certs cache");
String str2 = this.c.getFilesDir().getAbsolutePath() + "/certs";
File file = new File(str2);
if (file.exists()) {
FileUtils.deleteQuietly(file);
b.info("Removed the {}", str2);
}
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 41) {
b.info("v2.12 upgrade: Migrate filtering_quality");
FilteringQuality byCode = FilteringQuality.getByCode(defaultSharedPreferences.getInt("filtering_quality", 0));
if (byCode == null) {
byCode = FilteringQuality.FULL;
}
this.d.a(byCode);
}
if (i3 == 42) {
b.info("v2.12 upgrade: Migrate locale from es-rES to es");
if ("es-ES".equalsIgnoreCase(this.d.w())) {
this.e.a("es");
}
}
if (i3 == 49) {
b.info("v3.0 upgrade: Migrate selected DnsInfo");
Map map3 = (Map) com.adguard.kit.h.c.b(defaultSharedPreferences.getString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), null), Map.class);
Map map4 = (Map) com.adguard.kit.h.c.b(defaultSharedPreferences.getString("key_custom_dns_server", null), Map.class);
SharedPreferences.Editor edit4 = defaultSharedPreferences.edit();
ArrayList arrayList = new ArrayList();
if (map4 != null) {
String b2 = b(map4);
if (map3 == null || !StringUtils.equalsIgnoreCase(MapUtils.getString(map3, "id"), "custom")) {
arrayList.add(b2);
} else {
HashSet hashSet = new HashSet();
hashSet.add(b2);
edit4.putString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), b2);
edit4.remove(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString());
edit4.putStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), hashSet);
edit4.apply();
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
}
if (map3 != null && !StringUtils.equalsIgnoreCase(MapUtils.getString(map3, "id"), DnsInfo.SYSTEM_DNS_SERVER_ID)) {
String b3 = b(map3);
if (b3 != null) {
arrayList.add(b3);
edit4.putString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), b3);
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
HashSet hashSet2 = new HashSet(arrayList);
edit4.remove(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString());
edit4.putStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), hashSet2);
edit4.apply();
}
if (i3 == 50) {
b.info("v3.0 upgrade: Migrate filter_categories_enabled");
Set set = (Set) com.adguard.kit.h.c.b(defaultSharedPreferences.getString("filter_categories_enabled", null), Set.class);
b.info("Filter categories: {}", set);
HashSet hashSet3 = new HashSet();
if (CollectionUtils.isNotEmpty(set)) {
for (Object obj : set) {
if (obj instanceof String) {
FilterGroup findByName = FilterGroup.findByName((String) obj);
if (findByName != null) {
hashSet3.add(findByName);
}
} else if ((obj instanceof Integer) && (findByCode = FilterGroup.findByCode(((Integer) obj).intValue())) != null) {
hashSet3.add(findByCode);
}
}
}
if (CollectionUtils.isNotEmpty(hashSet3)) {
this.d.a(hashSet3);
}
SharedPreferences.Editor edit5 = defaultSharedPreferences.edit();
edit5.remove("filter_categories_enabled");
edit5.apply();
}
if (i3 == 51) {
b.info("v3.0 upgrade: Remove old battery statistics file");
File externalCacheDir = this.c.getExternalCacheDir();
if (externalCacheDir == null) {
externalCacheDir = this.c.getCacheDir();
}
File file2 = new File(externalCacheDir, "battery.dat");
if (file2.exists() && file2.delete()) {
b.info("Old battery statistics file was removed");
}
}
if (i3 == 53) {
b.info("v3.0 upgrade: Migrate DnsInfo scheme for new dnsproxy");
File file3 = FileUtils.getFile(this.c.getFilesDir(), "dnscrypt-proxy");
if (file3.exists() && file3.delete()) {
b.info("Old dnscrypt-proxy binary was removed");
}
File externalCacheDir2 = this.c.getExternalCacheDir();
if (externalCacheDir2 != null) {
File file4 = new File(externalCacheDir2, "log");
File file5 = new File(file4.getPath() + "/dnscrypt.log");
if (file5.exists() && FileUtils.deleteQuietly(file5)) {
z = true;
if (z) {
b.info("Old dnscrypt-proxy log file was removed");
}
map = (Map) com.adguard.kit.h.c.b(defaultSharedPreferences.getString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), null), Map.class);
SharedPreferences.Editor edit6 = defaultSharedPreferences.edit();
if (map != null) {
edit6.putString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), a(map));
}
stringSet = defaultSharedPreferences.getStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), new HashSet());
if (stringSet.size() != 0) {
edit6.commit();
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
} else {
HashSet hashSet4 = new HashSet();
for (String str3 : stringSet) {
Map map5 = (Map) com.adguard.kit.h.c.b(str3, Map.class);
if (map5 != null) {
hashSet4.add(a(map5));
}
}
edit6.putStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), hashSet4);
edit6.commit();
}
}
}
z = false;
if (z) {
}
map = (Map) com.adguard.kit.h.c.b(defaultSharedPreferences.getString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), null), Map.class);
SharedPreferences.Editor edit62 = defaultSharedPreferences.edit();
if (map != null) {
}
stringSet = defaultSharedPreferences.getStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), new HashSet());
if (stringSet.size() != 0) {
}
}
if (i3 == 54) {
b.info("v3.0 upgrade: Remove old dnsproxy log files");
File externalCacheDir3 = this.c.getExternalCacheDir();
if (externalCacheDir3 != null) {
File file6 = new File(externalCacheDir3, "log");
if (file6.exists()) {
FileUtils.deleteQuietly(new File(file6, "dnsproxy-output.log"));
for (int i4 = 1; i4 <= 5; i4++) {
FileUtils.deleteQuietly(new File(file6, String.format(Locale.US, "dnsproxy-output.%d.log", Integer.valueOf(i4))));
}
}
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 56) {
SharedPreferences.Editor edit7 = defaultSharedPreferences.edit();
edit7.remove("last_app_update_check_date");
edit7.remove("last_license_check_date");
if (defaultSharedPreferences.contains("auto_update_filters")) {
boolean z2 = defaultSharedPreferences.getBoolean("auto_update_filters", false);
edit7.remove("auto_update_filters");
edit7.putBoolean(PreferencesService.Options.KEY_ENABLE_AUTOMATIC_UPDATES.toString(), z2);
}
edit7.apply();
}
if (i3 == 60) {
try {
defaultSharedPreferences.getLong("pref.dns.blocking.type", com.adguard.android.filtering.api.a.k());
} catch (ClassCastException unused) {
SharedPreferences.Editor edit8 = defaultSharedPreferences.edit();
b.info("v3.1 upgrade: overwrite Integer preference for pref.dns.blocking.type with Long value");
Object obj2 = defaultSharedPreferences.getAll().get("pref.dns.blocking.type");
edit8.putLong("pref.dns.blocking.type", obj2 != null ? ((Number) obj2).longValue() : com.adguard.android.filtering.api.a.k());
edit8.apply();
}
}
if (i3 == 62) {
Set<String> stringSet4 = defaultSharedPreferences.getStringSet(PreferencesService.Options.KEY_DNS_FILTER_LIST.toString(), null);
if (!CollectionUtils.isEmpty(stringSet4)) {
HashMap hashMap = new HashMap();
for (String str4 : stringSet4) {
Integer a6 = com.adguard.commons.d.e.a(StringUtils.substringBetween(str4, "filterId\":", ",\""));
if (a6 != null) {
hashMap.put(a6, str4);
}
}
SharedPreferences.Editor edit9 = defaultSharedPreferences.edit();
edit9.putStringSet(PreferencesService.Options.KEY_DNS_FILTER_LIST.toString(), new HashSet(hashMap.values()));
edit9.commit();
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 64) {
if (defaultSharedPreferences.getInt(PreferencesService.Options.KEY_STEALTH_MODE_PROTECTION_LEVEL.toString(), -1) == -1 && defaultSharedPreferences.getBoolean(PreferencesService.Options.KEY_STEALTH_MODE_ENABLED.toString(), false)) {
b.info("v3.3 upgrade: set custom StealthModeProtectionLevel");
defaultSharedPreferences.edit().putInt(PreferencesService.Options.KEY_STEALTH_MODE_PROTECTION_LEVEL.toString(), StealthModeProtectionLevel.CUSTOM.getCode()).apply();
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 65) {
String string3 = defaultSharedPreferences.getString("pref.https.ignored.errors", null);
if (!StringUtils.isBlank(string3)) {
b.info("v3.4 upgrade: remove deprecated part of UnknownCaExceptions");
defaultSharedPreferences.edit().putString("pref.https.ignored.errors", StringUtils.remove(string3, StringUtils.substringBetween(string3, "{", "\"domains\""))).commit();
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 69) {
defaultSharedPreferences.edit().putString("pref.excluded.packages", defaultSharedPreferences.getString("pref.excluded.packages", com.adguard.android.filtering.api.a.h()) + "\ncom.adguard.vpn").commit();
}
if (i3 == 70) {
DnsInfo dnsInfo = (DnsInfo) com.adguard.kit.h.c.b(defaultSharedPreferences.getString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), null), DnsInfo.class);
Set<String> stringSet5 = defaultSharedPreferences.getStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), new HashSet());
b.info("v3.5 upgrade: migrate DnsInfo to Server");
ArrayList arrayList2 = new ArrayList();
if (stringSet5 != null) {
for (String str5 : stringSet5) {
DnsInfo dnsInfo2 = (DnsInfo) com.adguard.kit.h.c.b(str5, DnsInfo.class);
if (dnsInfo2 != null) {
arrayList2.add(dnsInfo2);
}
}
}
Pair<com.adguard.android.model.dns.f, List<com.adguard.android.model.dns.f>> a7 = com.adguard.android.model.settings.dto.a.a.a(dnsInfo, arrayList2, a());
com.adguard.android.model.dns.f fVar = (com.adguard.android.model.dns.f) a7.first;
if (fVar != null) {
defaultSharedPreferences.edit().putString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), com.adguard.kit.h.c.a(fVar)).commit();
}
List<com.adguard.android.model.dns.f> list = (List) a7.second;
if (CollectionUtils.isNotEmpty(list)) {
HashSet hashSet5 = new HashSet();
for (com.adguard.android.model.dns.f fVar2 : list) {
hashSet5.add(com.adguard.kit.h.c.a(fVar2));
}
defaultSharedPreferences.edit().putStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), hashSet5).commit();
}
}
if (i3 == 72) {
b.info("v3.5 upgrade: migrate duplicate DNS Servers");
Set<String> stringSet6 = defaultSharedPreferences.getStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), new HashSet());
if (!CollectionUtils.isEmpty(stringSet6)) {
ArrayList arrayList3 = new ArrayList();
for (String str6 : stringSet6) {
com.adguard.android.model.dns.f fVar3 = (com.adguard.android.model.dns.f) com.adguard.kit.h.c.b(str6, com.adguard.android.model.dns.f.class);
if (fVar3 != null) {
arrayList3.add(fVar3);
}
}
if (!CollectionUtils.isEmpty(arrayList3)) {
com.adguard.android.model.settings.dto.a.c cVar = com.adguard.android.model.settings.dto.a.c.f195a;
Pair<List<com.adguard.android.model.dns.f>, com.adguard.android.model.dns.f> a8 = com.adguard.android.model.settings.dto.a.c.a(arrayList3, (com.adguard.android.model.dns.f) com.adguard.kit.h.c.b(defaultSharedPreferences.getString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), null), com.adguard.android.model.dns.f.class));
HashSet hashSet6 = new HashSet();
for (com.adguard.android.model.dns.f fVar4 : (List) a8.first) {
hashSet6.add(com.adguard.kit.h.c.a(fVar4));
}
defaultSharedPreferences.edit().putStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), hashSet6).putString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), a8.second != null ? com.adguard.kit.h.c.a(a8.second) : null).commit();
}
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 73) {
String string4 = defaultSharedPreferences.getString("stealth_mode_tracking_parameters_list", null);
if (!StringUtils.isBlank(string4) && StringUtils.contains(string4, "$removeparam=")) {
b.info("v3.5 upgrade: migrate invalid strip tracking params");
ArrayList arrayList4 = new ArrayList();
for (String str7 : com.adguard.commons.c.a.a(string4, "\n")) {
if (StringUtils.startsWith(str7, "$removeparam=")) {
arrayList4.add(StringUtils.substringAfter(str7, "$removeparam="));
} else {
arrayList4.add(str7);
}
}
defaultSharedPreferences.edit().putString("stealth_mode_tracking_parameters_list", StringUtils.join(arrayList4, "\n")).commit();
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 74) {
b.info("v3.5 upgrade: release notes should be shown after app is updated");
defaultSharedPreferences.edit().putBoolean(PreferencesService.Options.KEY_SHOW_RELEASE_NOTES.toString(), true).commit();
}
if (i3 == 75) {
b.info("v3.5 upgrade: deprecated AdGuard DNS servers should be replaced with new ones");
a(defaultSharedPreferences, PreferencesService.Options.KEY_DNS_SERVER_INFO.toString());
a(defaultSharedPreferences, "pref.dns.fallback");
a(defaultSharedPreferences, "pref.dns.bootstrap");
Set<String> stringSet7 = defaultSharedPreferences.getStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), null);
if (!CollectionUtils.isEmpty(stringSet7)) {
HashSet hashSet7 = new HashSet();
for (String str8 : stringSet7) {
String b4 = b(str8);
if (!StringUtils.equals(str8, b4)) {
b.info("Replacing deprecated custom DNS server {} with a new one {}", str8, b4);
}
hashSet7.add(b(b4));
}
defaultSharedPreferences.edit().putStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), hashSet7).commit();
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 76) {
String string5 = defaultSharedPreferences.getString(PreferencesService.Options.KEY_WEBMASTER_ID.toString(), null);
b.info("v3.6 upgrade: update whitelist for aid {}", string5);
String b5 = com.adguard.android.filtering.api.a.b(string5);
if (StringUtils.isEmpty(b5)) {
b.info("There are no additional whitelist rules for current aid");
} else if (defaultSharedPreferences.contains(PreferencesService.Options.KEY_WHITELIST_STRING.toString())) {
List<String> a9 = com.adguard.commons.c.a.a(defaultSharedPreferences.getString(PreferencesService.Options.KEY_WHITELIST_STRING.toString(), ""), "\n");
a9.addAll(com.adguard.commons.c.a.a(b5, "\n"));
defaultSharedPreferences.edit().putString(PreferencesService.Options.KEY_WHITELIST_STRING.toString(), StringUtils.join(a9, "\n")).putInt(PreferencesService.Options.KEY_WHITE_LIST_SIZE.toString(), a9.size()).commit();
} else {
b.info("Whitelist has not been initialized before, no needs to update it");
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 77) {
b.info("v3.6 upgrade: release notes should be shown after app is updated");
defaultSharedPreferences.edit().putBoolean(PreferencesService.Options.KEY_SHOW_RELEASE_NOTES.toString(), true).commit();
}
if (i3 == 78) {
b.info("v3.6 upgrade: extend range of filtered ports");
String string6 = defaultSharedPreferences.getString("pref.filtered.ports", null);
if (!StringUtils.isEmpty(string6) && StringUtils.containsOnly(string6, "1234567890,:")) {
List<String> a10 = com.adguard.commons.c.a.a(string6, ",");
if (!a10.isEmpty()) {
ArrayList arrayList5 = new ArrayList();
for (String str9 : a10) {
String[] split = StringUtils.split(str9, (char) CoreConstants.COLON_CHAR);
int i5 = NumberUtils.toInt(split[0]);
arrayList5.add(Range.between(Integer.valueOf(i5), Integer.valueOf(split.length == 2 ? NumberUtils.toInt(split[1]) : i5)));
}
Pair<Boolean, List<Range<Integer>>> c = c(a(arrayList5));
boolean booleanValue = ((Boolean) c.first).booleanValue();
List list2 = (List) c.second;
while (booleanValue) {
Pair<Boolean, List<Range<Integer>>> c2 = c(list2);
booleanValue = ((Boolean) c2.first).booleanValue();
list2 = (List) c2.second;
}
defaultSharedPreferences.edit().putString("pref.filtered.ports", b(list2)).commit();
}
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 79) {
b.info("v3.6 upgrade: change a port for custom servers with the 'quic' schema to 784");
Set<String> stringSet8 = defaultSharedPreferences.getStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), null);
if (!CollectionUtils.isEmpty(stringSet8)) {
ArrayList<com.adguard.android.model.dns.f> arrayList6 = new ArrayList();
for (String str10 : stringSet8) {
com.adguard.android.model.dns.f fVar5 = (com.adguard.android.model.dns.f) com.adguard.kit.h.c.b(str10, com.adguard.android.model.dns.f.class);
if (fVar5 != null) {
arrayList6.add(fVar5);
}
}
for (com.adguard.android.model.dns.f fVar6 : arrayList6) {
if (fVar6.getType() != null && fVar6.getType() == DnsServerType.DOQ && fVar6.getUpstreams() != null) {
ArrayList arrayList7 = new ArrayList();
try {
for (String str11 : fVar6.getUpstreams()) {
arrayList7.add(a(str11));
}
fVar6.setUpstreams(arrayList7);
} catch (Exception e) {
b.error("The error occurred while updating upstreams", (Throwable) e);
}
}
}
HashSet hashSet8 = new HashSet();
for (com.adguard.android.model.dns.f fVar7 : arrayList6) {
if (com.adguard.kit.h.c.a(fVar7) != null) {
hashSet8.add(com.adguard.kit.h.c.a(fVar7));
}
}
defaultSharedPreferences.edit().putStringSet(PreferencesService.Options.KEY_CUSTOM_DNS_SERVERS_LIST.toString(), hashSet8).commit();
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 80) {
b.info("v3.6 upgrade: reducing IPv4 routes exclusions for Fujitsu devices");
if (!DeviceName.isProblematicForExcludedRoutesFujitsuModel() && !DeviceName.isExtremelyProblematicForExcludedRoutesFujitsuModel()) {
b.info("Current device is {}, do nothing", DeviceName.getFriendlyDeviceName());
} else if (defaultSharedPreferences.getString("pref.ipv4.routes.excluded", null) == null) {
b.info("The user did not change {} low-level setting, do nothing", "pref.ipv4.routes.excluded");
} else {
defaultSharedPreferences.edit().remove("pref.ipv4.routes.excluded").commit();
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
if (i3 == 81) {
b.info("Enabling URL Tracking protection filter");
if (!this.d.au()) {
b.info("Stealth mode is disabled, do nothing");
} else if (this.d.at() != StealthModeProtectionLevel.CUSTOM || defaultSharedPreferences.getBoolean("stealth_mode_strip_tracking_parameters", false)) {
List<com.adguard.android.model.filters.c> aO = this.d.aO();
if (CollectionUtils.isEmpty(aO)) {
b.info("There are no filters, do nothing");
} else {
com.adguard.android.model.filters.c cVar2 = (com.adguard.android.model.filters.c) IterableUtils.find(aO, new Predicate() {
@Override
public final boolean evaluate(Object obj3) {
boolean b6;
b6 = c.b((com.adguard.android.model.filters.c) obj3);
return b6;
}
});
if (cVar2 != null) {
if (cVar2.isEnabled()) {
b.info("URL tracking filter is already enabled, do nothing");
} else {
cVar2.setEnabled(true);
this.d.c(aO);
}
a(FilterGroup.PRIVACY);
} else {
com.adguard.android.model.filters.c cVar3 = (com.adguard.android.model.filters.c) IterableUtils.find(a(r.a(this.c), r.b(this.c)), new Predicate() {
@Override
public final boolean evaluate(Object obj3) {
boolean a11;
a11 = c.a((com.adguard.android.model.filters.c) obj3);
return a11;
}
});
if (cVar3 == null) {
b.warn("Failed to find URL Tracking filter in preset filters, do nothing");
} else {
cVar3.setEnabled(true);
aO.add(cVar3);
a(FilterGroup.PRIVACY);
this.d.c(aO);
}
}
}
} else {
b.info("'Strip tracking parameters' option is disabled, do nothing");
}
a(defaultSharedPreferences);
defaultSharedPreferences.edit().remove("stealth_mode_tracking_parameters_list").remove("stealth_mode_strip_tracking_parameters").commit();
}
if (i3 != 41) {
}
a(sQLiteDatabase, i3);
b(sQLiteDatabase, i3);
}
}
b();
com.adguard.android.model.dns.f fVar8 = (com.adguard.android.model.dns.f) com.adguard.kit.h.c.b(PreferenceManager.getDefaultSharedPreferences(this.c).getString(PreferencesService.Options.KEY_DNS_SERVER_INFO.toString(), null), com.adguard.android.model.dns.f.class);
if (fVar8 == null || (a2 = a(fVar8)) == null) {
return;
}
PreferenceManager.getDefaultSharedPreferences(this.c).edit().putString("key_dns_server_info", com.adguard.kit.h.c.a(a2)).apply();
}
}