AdGuard v3.6.45版本的 MD5 值为:ce30a13dcef92cf942973fffcc6d20fb
以下内容为反编译后的 OrbotStarter.java 源代码,内容仅作参考
package com.adguard.android.orbot;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import androidx.work.WorkRequest;
import com.adguard.android.b;
import com.adguard.android.filtering.api.e;
import com.adguard.android.filtering.proxy.a;
public class OrbotStarter extends OrbotStatusReceiver implements Runnable {
private Context b;
private a c;
private boolean d = false;
private final Handler f199a = new Handler(Looper.getMainLooper());
private OrbotStarter(Context context, a aVar) {
this.b = context;
this.c = aVar;
}
public static Intent a(Context context) {
Intent intent = new Intent("org.torproject.android.intent.action.START");
intent.setPackage("org.torproject.android");
intent.putExtra("org.torproject.android.intent.extra.PACKAGE_NAME", context.getPackageName());
return intent;
}
public static void a(Context context, e eVar) {
if (eVar != null && eVar.isOrbotIntegration()) {
OrbotStarter orbotStarter = new OrbotStarter(context, eVar.getSettings());
if (a(orbotStarter.b, "org.torproject.android")) {
orbotStarter.b.registerReceiver(orbotStarter, new IntentFilter("org.torproject.android.intent.action.STATUS"));
orbotStarter.f199a.postDelayed(orbotStarter, WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS);
orbotStarter.b.sendBroadcast(a(orbotStarter.b));
return;
}
b.a(orbotStarter.b).t.k();
}
}
private static boolean a(Context context, String str) {
try {
context.getPackageManager().getPackageInfo(str, 1);
return true;
} catch (PackageManager.NameNotFoundException unused) {
return false;
}
}
public static Intent b(Context context) {
String str;
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse("market://details?id=org.torproject.android"));
for (ResolveInfo resolveInfo : context.getPackageManager().queryIntentActivities(intent, 0)) {
if (TextUtils.equals(resolveInfo.activityInfo.packageName, "org.fdroid.fdroid") || TextUtils.equals(resolveInfo.activityInfo.packageName, "com.android.vending")) {
str = resolveInfo.activityInfo.packageName;
break;
}
while (r5.hasNext()) {
}
}
str = null;
if (str == null) {
intent.setData(Uri.parse("https://f-droid.org/repository/browse/?fdid=org.torproject.android"));
} else {
intent.setPackage(str);
}
return intent;
}
public static boolean c(Context context) {
return a(context, "org.torproject.android");
}
@Override
public final void a() {
this.d = true;
this.b.unregisterReceiver(this);
}
@Override
public final void a(String str, int i) {
if (this.c.getProxyHost().equals(str) && this.c.getProxyPort() == i) {
return;
}
b a2 = b.a(this.b);
a2.t.l();
boolean z = true & false;
a2.v.a(false);
}
@Override
public void run() {
if (!this.d) {
b.a(this.b).t.m();
this.b.unregisterReceiver(this);
}
}
}