WroldPass Free VPN v2.0.3版本的 MD5 值为:a0f41ee97c0f84f39f29d3a80e386a29
以下内容为反编译后的 Distribute.java 源代码,内容仅作参考
package com.microsoft.appcenter.distribute;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import defpackage.ru;
import defpackage.uj0;
import java.lang.ref.WeakReference;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.json.JSONException;
import org.json.JSONObject;
import org.vpndigger.R;
public class Distribute extends defpackage.e {
@SuppressLint({"StaticFieldLeak"})
public static Distribute E;
public boolean A;
public cl B;
public dl C;
public Boolean D;
public final Map<String, n10> f;
public Context g;
public String h;
public PackageInfo i;
public Activity j;
public String k;
public String l;
public String m;
public String n;
public String o;
public Object p;
public qj0 q;
public uf0 r;
public AlertDialog s;
public AlertDialog t;
public AlertDialog u;
public AlertDialog v;
public WeakReference<Activity> w = new WeakReference<>(null);
public kl x;
public vf0 y;
public boolean z;
public class a implements DialogInterface.OnCancelListener {
public final uf0 d;
public a(uf0 uf0Var) {
this.d = uf0Var;
}
@Override
public final void onCancel(DialogInterface dialogInterface) {
Distribute.this.B(this.d);
}
}
public class b implements DialogInterface.OnClickListener {
public final uf0 d;
public b(uf0 uf0Var) {
this.d = uf0Var;
}
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Intent intent;
Distribute distribute = Distribute.this;
uf0 uf0Var = this.d;
synchronized (distribute) {
if (distribute.j == null) {
s3.j("AppCenterDistribute", "The application is in background mode, the settings screen could not be opened.");
return;
}
if (Build.VERSION.SDK_INT >= 26) {
intent = new Intent("android.settings.MANAGE_UNKNOWN_APP_SOURCES");
intent.setData(Uri.parse("package:" + distribute.j.getPackageName()));
} else {
intent = new Intent("android.settings.SECURITY_SETTINGS");
}
try {
distribute.j.startActivity(intent);
} catch (ActivityNotFoundException unused) {
s3.j("AppCenterDistribute", "No way to navigate to secure settings on this device automatically");
if (uf0Var == distribute.r) {
distribute.A();
}
}
}
}
}
public class c implements DialogInterface.OnClickListener {
public c() {
}
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Distribute distribute = Distribute.this;
synchronized (distribute) {
if (distribute.v == dialogInterface) {
ik0.h("Distribute.update_setup_failed_package_hash", wf.b(distribute.i));
} else {
distribute.Q();
}
}
}
}
public class d implements DialogInterface.OnClickListener {
public d() {
}
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
String b;
Distribute distribute = Distribute.this;
synchronized (distribute) {
if (distribute.v == dialogInterface) {
try {
b = sx0.b();
} catch (URISyntaxException e) {
s3.f("AppCenterDistribute", "Could not append query parameter to url.", e);
}
sx0.j(b, distribute.j);
ik0.i("Distribute.update_setup_failed_package_hash");
ik0.i("Distribute.tester_app_update_setup_failed_message");
} else {
distribute.Q();
}
}
}
}
public class e implements DialogInterface.OnClickListener {
public final uf0 d;
public e(uf0 uf0Var) {
this.d = uf0Var;
}
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Distribute distribute = Distribute.this;
uf0 uf0Var = this.d;
synchronized (distribute) {
if (uf0Var == distribute.r) {
distribute.M();
} else {
distribute.Q();
}
}
}
}
public class f implements Runnable {
public f() {
}
@Override
public final void run() {
Distribute.this.L();
}
}
public class g implements ru.a {
public g() {
}
@Override
public final void a(URL url, Map<String, String> map) {
if (s3.a <= 2) {
String url2 = url.toString();
String str = Distribute.this.h;
String replaceAll = url2.replaceAll(str, zu.b(str));
s3.i("AppCenterDistribute", "Calling " + replaceAll + "...");
HashMap hashMap = new HashMap(map);
String str2 = (String) hashMap.get("x-api-token");
if (str2 != null) {
hashMap.put("x-api-token", zu.b(str2));
}
s3.i("AppCenterDistribute", "Headers: " + hashMap);
}
}
@Override
public final String b() {
return null;
}
}
public class h implements rj0 {
public final Object d;
public final String e;
public h(Object obj, String str) {
this.d = obj;
this.e = str;
}
@Override
public final void a(yu yuVar) {
try {
String str = yuVar.b;
Distribute.v(Distribute.this, this.d, str, uf0.a(str), this.e);
} catch (JSONException e) {
b(e);
}
}
@Override
public final void b(Exception exc) {
String str;
Distribute distribute = Distribute.this;
Object obj = this.d;
synchronized (distribute) {
if (distribute.p == obj) {
distribute.A();
if (!zu.c(exc)) {
if (exc instanceof wu) {
try {
str = new JSONObject(((wu) exc).d.b).getString("code");
} catch (JSONException e) {
if (s3.a <= 2) {
Log.v("AppCenterDistribute", "Cannot read the error as JSON", e);
}
str = null;
}
if (!"no_releases_for_user".equals(str) && !"not_found".equals(str)) {
s3.f("AppCenterDistribute", "Failed to check latest release (delete setup state)", exc);
ik0.i("Distribute.distribution_group_id");
ik0.i("Distribute.update_token");
ik0.i("Distribute.postpone_time");
cl clVar = distribute.B;
synchronized (clVar) {
clVar.a = null;
}
}
s3.g("AppCenterDistribute", "No release available to the current user.");
if (distribute.C != null && distribute.j != null) {
s3.d("AppCenterDistribute", "Calling listener.onNoReleaseAvailable.");
Objects.requireNonNull(distribute.C);
}
} else {
s3.f("AppCenterDistribute", "Failed to check latest release", exc);
}
}
}
}
}
}
public class i implements DialogInterface.OnClickListener {
public final uf0 d;
public i(uf0 uf0Var) {
this.d = uf0Var;
}
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Distribute.this.C(this.d);
}
}
public class j implements DialogInterface.OnClickListener {
public final uf0 d;
public j(uf0 uf0Var) {
this.d = uf0Var;
}
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Distribute.u(Distribute.this, this.d);
}
}
public class k implements DialogInterface.OnClickListener {
public final uf0 d;
public k(uf0 uf0Var) {
this.d = uf0Var;
}
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Distribute distribute = Distribute.this;
uf0 uf0Var = this.d;
Objects.requireNonNull(distribute);
try {
distribute.j.startActivity(new Intent("android.intent.action.VIEW", uf0Var.e));
} catch (ActivityNotFoundException e) {
s3.f("AppCenterDistribute", "Failed to navigate to release notes.", e);
}
}
}
public class l implements DialogInterface.OnClickListener {
public final uf0 d;
public l(uf0 uf0Var) {
this.d = uf0Var;
}
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Distribute.this.B(this.d);
}
}
public Distribute() {
HashMap hashMap = new HashMap();
this.f = hashMap;
hashMap.put("distributionStartSession", new aa0(1));
}
public static void J(int i2) {
Distribute distribute = getInstance();
synchronized (distribute) {
((lh) distribute.r()).b(new al(distribute, i2));
}
}
public static synchronized Distribute getInstance() {
Distribute distribute;
synchronized (Distribute.class) {
if (E == null) {
E = new Distribute();
}
distribute = E;
}
return distribute;
}
public static void u(Distribute distribute, uf0 uf0Var) {
synchronized (distribute) {
if (uf0Var == distribute.r) {
s3.d("AppCenterDistribute", "Postpone updates for a day.");
ik0.g("Distribute.postpone_time", System.currentTimeMillis());
distribute.A();
} else {
distribute.Q();
}
}
}
public static void v(Distribute distribute, Object obj, String str, uf0 uf0Var, String str2) {
boolean z;
synchronized (distribute) {
String d2 = ik0.d("Distribute.downloaded_release_hash");
if (!TextUtils.isEmpty(d2)) {
if (distribute.H(d2)) {
s3.d("AppCenterDistribute", "Successfully reported app update for downloaded release hash (" + d2 + "), removing from store..");
ik0.i("Distribute.downloaded_release_hash");
ik0.i("Distribute.downloaded_release_id");
} else {
s3.d("AppCenterDistribute", "Stored release hash doesn't match current installation, probably downloaded but not installed yet, keep in store");
}
}
if (distribute.p == obj) {
distribute.q = null;
if (str2 == null) {
distribute.K(uf0Var.j);
}
if (Build.VERSION.SDK_INT >= uf0Var.f) {
s3.d("AppCenterDistribute", "Check if latest release is more recent.");
PackageInfo packageInfo = distribute.i;
int i2 = packageInfo.versionCode;
int i3 = uf0Var.b;
if (i3 == i2) {
z = !uf0Var.i.equals(wf.b(packageInfo));
} else {
z = i3 > i2;
}
s3.d("AppCenterDistribute", "Latest release more recent=" + z);
if (!z) {
if (distribute.C != null && distribute.j != null) {
s3.d("AppCenterDistribute", "Calling listener.onNoReleaseAvailable.");
Objects.requireNonNull(distribute.C);
}
} else if (distribute.w(uf0Var)) {
if (distribute.r == null) {
distribute.Z(wf.n());
}
ik0.h("Distribute.release_details", str);
uf0 uf0Var2 = distribute.r;
if (uf0Var2 != null && uf0Var2.h) {
if (uf0Var2.a != uf0Var.a) {
s3.d("AppCenterDistribute", "Latest release is more recent than the previous mandatory.");
ik0.f("Distribute.download_state", 1);
} else {
s3.d("AppCenterDistribute", "The latest release is mandatory and already being processed.");
}
return;
}
distribute.Z(uf0Var);
s3.d("AppCenterDistribute", "Latest release is more recent.");
ik0.f("Distribute.download_state", 1);
if (distribute.j != null) {
distribute.U();
}
return;
}
} else {
s3.g("AppCenterDistribute", "This device is not compatible with the latest release.");
}
distribute.A();
}
}
}
public final synchronized void A() {
x();
ik0.i("Distribute.release_details");
ik0.i("Distribute.download_state");
this.q = null;
this.p = null;
this.s = null;
this.v = null;
this.t = null;
this.w.clear();
this.r = null;
vf0 vf0Var = this.y;
if (vf0Var != null) {
vf0Var.a();
}
this.A = true;
}
public final synchronized void B(uf0 uf0Var) {
if (uf0Var == this.r) {
A();
}
}
public final synchronized void C(uf0 uf0Var) {
if (uf0Var == this.r) {
if (yw.b(this.g)) {
s3.d("AppCenterDistribute", "Schedule download...");
M();
R();
qj0 qj0Var = this.q;
if (qj0Var != null) {
qj0Var.cancel();
}
} else {
T();
}
} else {
Q();
}
}
public final String D(String str) {
String string;
Context context = this.g;
ApplicationInfo applicationInfo = context.getApplicationInfo();
int i2 = applicationInfo.labelRes;
if (i2 == 0) {
string = String.valueOf(applicationInfo.nonLocalizedLabel);
} else {
string = context.getString(i2);
}
uf0 uf0Var = this.r;
return String.format(str, string, uf0Var.c, Integer.valueOf(uf0Var.b));
}
public final String E() {
return D(this.g.getString(R.string.appcenter_distribute_install_ready_message));
}
public final synchronized void F(String str, String str2) {
String str3;
s3.d("AppCenterDistribute", "Get latest release details...");
ru a2 = zu.a(this.g);
String b2 = wf.b(this.i);
if (str2 == null) {
str3 = "https://api.appcenter.ms/v0.1" + String.format("/public/sdk/apps/%s/releases/latest?release_hash=%s%s", this.h, b2, G(true, str));
} else {
str3 = "https://api.appcenter.ms/v0.1" + String.format("/sdk/apps/%s/releases/private/latest?release_hash=%s%s", this.h, b2, G(false, str));
}
String str4 = str3;
HashMap hashMap = new HashMap();
if (str2 != null) {
hashMap.put("x-api-token", str2);
}
Object obj = new Object();
this.p = obj;
this.q = ((vu) a2).w(str4, "GET", hashMap, new g(), new h(obj, str));
}
public final String G(boolean z, String str) {
s3.d("AppCenterDistribute", "Check if we need to report release installation..");
String d2 = ik0.d("Distribute.downloaded_release_hash");
String str2 = "";
if (!TextUtils.isEmpty(d2)) {
if (H(d2)) {
s3.d("AppCenterDistribute", "Current release was updated but not reported yet, reporting..");
if (z) {
str2 = "&install_id=" + xf.j();
}
return we0.b(str2, "&distribution_group_id=", str) + "&downloaded_release_id=" + ik0.b("Distribute.downloaded_release_id", 0);
}
s3.d("AppCenterDistribute", "New release was downloaded but not installed yet, skip reporting.");
return "";
}
s3.d("AppCenterDistribute", "Current release was already reported, skip reporting.");
return "";
}
public final boolean H(String str) {
if (this.i == null || TextUtils.isEmpty(str)) {
return false;
}
return wf.b(this.i).equals(str);
}
public final synchronized boolean I(uf0 uf0Var, Intent intent) {
Notification.Builder builder;
if (uf0Var != this.r) {
return true;
}
if (this.j == null && wf.k() != 3) {
s3.d("AppCenterDistribute", "Post a notification as the download finished in background.");
NotificationManager notificationManager = (NotificationManager) this.g.getSystemService("notification");
if (Build.VERSION.SDK_INT >= 26) {
notificationManager.createNotificationChannel(new NotificationChannel("appcenter.distribute", this.g.getString(R.string.appcenter_distribute_notification_category), 3));
builder = new Notification.Builder(this.g, "appcenter.distribute");
} else {
builder = new Notification.Builder(this.g);
}
builder.setTicker(this.g.getString(R.string.appcenter_distribute_install_ready_title)).setContentTitle(this.g.getString(R.string.appcenter_distribute_install_ready_title)).setContentText(E()).setSmallIcon(this.g.getApplicationInfo().icon).setContentIntent(PendingIntent.getActivities(this.g, 0, new Intent[]{intent}, 0));
builder.setStyle(new Notification.BigTextStyle().bigText(E()));
Notification build = builder.build();
build.flags |= 16;
notificationManager.notify(-355571511, build);
ik0.f("Distribute.download_state", 3);
this.z = false;
return true;
}
return false;
}
public final void K(String str) {
ik0.h("Distribute.distribution_group_id", str);
cl clVar = this.B;
synchronized (clVar) {
clVar.a = str;
}
synchronized (this) {
uj0.a c2 = uj0.b().c(System.currentTimeMillis());
if (c2 != null && c2.b != null) {
s(new zk(this));
return;
}
s3.d("AppCenterDistribute", "No sessions were logged before, ignore sending of the distribution start session log.");
}
}
public final synchronized void L() {
boolean z;
s3.d("AppCenterDistribute", "Resume distribute workflow...");
if (this.i == null || this.j == null || this.A || !f()) {
return;
}
if ((this.g.getApplicationInfo().flags & 2) == 2) {
s3.g("AppCenterDistribute", "Not checking for in-app updates in debuggable build.");
this.A = true;
} else if (yw.a(this.g)) {
s3.g("AppCenterDistribute", "Not checking in app updates as installed from a store.");
this.A = true;
} else if (this.k != null) {
s3.d("AppCenterDistribute", "Processing redirection parameters we kept in memory before onStarted");
String str = this.l;
if (str != null) {
W(this.k, str, this.m);
} else {
String str2 = this.n;
if (str2 != null) {
Y(this.k, str2);
}
}
String str3 = this.o;
if (str3 != null) {
X(this.k, str3);
}
this.k = null;
this.l = null;
this.m = null;
this.n = null;
this.o = null;
} else {
int k2 = wf.k();
if (this.r == null && k2 != 0) {
Z(wf.n());
uf0 uf0Var = this.r;
if (uf0Var != null && !uf0Var.h && x60.b(this.g).e() && k2 == 1) {
y();
}
}
if (k2 != 0 && k2 != 1 && !this.z) {
if (this.i.lastUpdateTime > ik0.c("Distribute.download_time", 0L)) {
s3.d("AppCenterDistribute", "Discarding previous download as application updated.");
y();
} else {
this.z = true;
M();
uf0 uf0Var2 = this.r;
if (uf0Var2 == null || !uf0Var2.h || k2 != 2) {
return;
}
}
}
uf0 uf0Var3 = this.r;
if (uf0Var3 != null) {
if (k2 == 4) {
S();
} else if (k2 == 2) {
M();
R();
} else if (this.t != null) {
C(uf0Var3);
} else {
kl klVar = this.x;
if (klVar != null) {
synchronized (klVar) {
z = klVar.e != -1;
}
if (!z) {
}
}
U();
}
if (k2 != 1 && k2 != 4) {
return;
}
}
if (ik0.d("Distribute.update_setup_failed_message") != null) {
s3.d("AppCenterDistribute", "In-app updates setup failure detected.");
V();
} else if (this.p != null) {
s3.i("AppCenterDistribute", "Already checking or checked latest release.");
} else {
ik0.d("Distribute.update_token");
F(ik0.d("Distribute.distribution_group_id"), null);
}
}
}
public final synchronized void M() {
kl klVar = this.x;
if (klVar != null) {
synchronized (klVar) {
klVar.g();
}
this.z = true;
}
}
public final void N() {
if (this.j != null) {
fu.a(new f());
} else {
s3.d("AppCenterDistribute", "Distribute workflow will be resumed on activity resume event.");
}
}
public final boolean O(Dialog dialog) {
if (dialog == null || !dialog.isShowing()) {
return true;
}
if (this.j == this.w.get()) {
s3.d("AppCenterDistribute", "Previous dialog is still being shown in the same activity.");
return false;
}
dialog.hide();
return true;
}
public final void P(Dialog dialog) {
dialog.show();
this.w = new WeakReference<>(this.j);
}
public final void Q() {
Toast.makeText(this.g, (int) R.string.appcenter_distribute_dialog_actioned_on_disabled_toast, 0).show();
}
public final synchronized void R() {
Activity activity = this.j;
if (activity == null) {
s3.j("AppCenterDistribute", "Could not display progress dialog in the background.");
return;
}
vf0 vf0Var = this.y;
if (vf0Var == null) {
return;
}
ProgressDialog f2 = vf0Var.f(activity);
if (f2 != null) {
P(f2);
}
}
public final synchronized void S() {
if (O(this.u)) {
uf0 uf0Var = this.r;
AlertDialog.Builder builder = new AlertDialog.Builder(this.j);
builder.setCancelable(false);
builder.setTitle(R.string.appcenter_distribute_install_ready_title);
builder.setMessage(E());
builder.setPositiveButton(R.string.appcenter_distribute_install, new e(uf0Var));
AlertDialog create = builder.create();
this.u = create;
P(create);
}
}
public final synchronized void T() {
if (O(this.t)) {
s3.d("AppCenterDistribute", "Show new unknown sources dialog.");
AlertDialog.Builder builder = new AlertDialog.Builder(this.j);
builder.setMessage(R.string.appcenter_distribute_unknown_sources_dialog_message);
uf0 uf0Var = this.r;
if (uf0Var.h) {
builder.setCancelable(false);
} else {
builder.setNegativeButton(17039360, new l(uf0Var));
builder.setOnCancelListener(new a(uf0Var));
}
builder.setPositiveButton(R.string.appcenter_distribute_unknown_sources_dialog_settings, new b(uf0Var));
AlertDialog create = builder.create();
this.t = create;
P(create);
}
}
public final synchronized void U() {
String string;
dl dlVar = this.C;
if (dlVar == null && this.D == null) {
this.D = Boolean.TRUE;
}
if (dlVar != null && this.j != this.w.get()) {
s3.d("AppCenterDistribute", "Calling listener.onReleaseAvailable.");
((w3) this.C).a(this.j, this.r);
this.w = new WeakReference<>(this.j);
this.D = Boolean.FALSE;
}
if (this.D.booleanValue()) {
if (!O(this.s)) {
return;
}
s3.d("AppCenterDistribute", "Show default update dialog.");
AlertDialog.Builder builder = new AlertDialog.Builder(this.j);
builder.setTitle(R.string.appcenter_distribute_update_dialog_title);
uf0 uf0Var = this.r;
if (uf0Var.h) {
string = this.g.getString(R.string.appcenter_distribute_update_dialog_message_mandatory);
} else {
string = this.g.getString(R.string.appcenter_distribute_update_dialog_message_optional);
}
builder.setMessage(D(string));
builder.setPositiveButton(R.string.appcenter_distribute_update_dialog_download, new i(uf0Var));
builder.setCancelable(false);
if (!uf0Var.h) {
builder.setNegativeButton(R.string.appcenter_distribute_update_dialog_postpone, new j(uf0Var));
}
if (!TextUtils.isEmpty(uf0Var.d) && uf0Var.e != null) {
builder.setNeutralButton(R.string.appcenter_distribute_update_dialog_view_release_notes, new k(uf0Var));
}
AlertDialog create = builder.create();
this.s = create;
P(create);
}
}
public final synchronized void V() {
if (O(this.v)) {
s3.d("AppCenterDistribute", "Show update setup failed dialog.");
AlertDialog.Builder builder = new AlertDialog.Builder(this.j);
builder.setCancelable(false);
builder.setTitle(R.string.appcenter_distribute_update_failed_dialog_title);
builder.setMessage(R.string.appcenter_distribute_update_failed_dialog_message);
builder.setPositiveButton(R.string.appcenter_distribute_update_failed_dialog_ignore, new c());
builder.setNegativeButton(R.string.appcenter_distribute_update_failed_dialog_reinstall, new d());
AlertDialog create = builder.create();
this.v = create;
P(create);
ik0.i("Distribute.update_setup_failed_message");
}
}
public final synchronized void W(String str, String str2, String str3) {
if (this.g == null) {
s3.d("AppCenterDistribute", "Redirection parameters received before onStart, keep them in memory.");
this.k = str;
this.m = str3;
this.l = str2;
} else if (str.equals(ik0.d("Distribute.request_id"))) {
if (str3 != null) {
ik0.h("Distribute.update_token", fg.e(this.g).b(str3));
} else {
ik0.i("Distribute.update_token");
}
ik0.i("Distribute.request_id");
K(str2);
s3.d("AppCenterDistribute", "Stored redirection parameters.");
y();
F(str2, str3);
} else {
s3.j("AppCenterDistribute", "Ignoring redirection parameters as requestId is invalid.");
}
}
public final synchronized void X(String str, String str2) {
if (this.g == null) {
s3.d("AppCenterDistribute", "Tester app update setup failed parameter received before onStart, keep it in memory.");
this.k = str;
this.o = str2;
} else if (str.equals(ik0.d("Distribute.request_id"))) {
s3.d("AppCenterDistribute", "Stored tester app update setup failed parameter.");
ik0.h("Distribute.tester_app_update_setup_failed_message", str2);
} else {
s3.j("AppCenterDistribute", "Ignoring redirection parameters as requestId is invalid.");
}
}
public final synchronized void Y(String str, String str2) {
if (this.g == null) {
s3.d("AppCenterDistribute", "Update setup failed parameter received before onStart, keep it in memory.");
this.k = str;
this.n = str2;
} else if (str.equals(ik0.d("Distribute.request_id"))) {
s3.d("AppCenterDistribute", "Stored update setup failed parameter.");
ik0.h("Distribute.update_setup_failed_message", str2);
} else {
s3.j("AppCenterDistribute", "Ignoring redirection parameters as requestId is invalid.");
}
}
public final synchronized void Z(uf0 uf0Var) {
kl klVar = this.x;
if (klVar != null) {
if (uf0Var == null || uf0Var.a != klVar.b.a) {
klVar.a();
}
this.x = null;
} else if (uf0Var == null) {
new kl(this.g, null, null).a();
}
vf0 vf0Var = this.y;
if (vf0Var != null) {
vf0Var.a();
this.y = null;
}
this.r = uf0Var;
if (uf0Var != null) {
Context context = this.g;
vf0 vf0Var2 = new vf0(context, uf0Var);
this.y = vf0Var2;
this.x = new kl(context, uf0Var, vf0Var2);
}
}
@Override
public final void a() {
if (this.d != null) {
s3.d("AppCenterDistribute", "Resetting workflow on entering foreground.");
if (wf.k() == 0 && this.p == null) {
this.A = false;
}
}
}
@Override
public final String c() {
return "Distribute";
}
@Override
public final synchronized void d(Context context, fa faVar, String str, String str2, boolean z) {
this.g = context;
this.h = str;
try {
this.i = context.getPackageManager().getPackageInfo(this.g.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e2) {
s3.f("AppCenterDistribute", "Could not get self package info.", e2);
}
super.d(context, faVar, str, str2, z);
}
@Override
public final Map<String, n10> i() {
return this.f;
}
@Override
public final synchronized void k(boolean z) {
try {
if (z) {
z();
cl clVar = new cl(ik0.d("Distribute.distribution_group_id"));
this.B = clVar;
((oh) this.d).b(clVar);
N();
} else {
this.A = false;
y();
ik0.i("Distribute.request_id");
ik0.i("Distribute.postpone_time");
ik0.i("Distribute.update_setup_failed_package_hash");
ik0.i("Distribute.update_setup_failed_message");
ik0.i("Distribute.tester_app_update_setup_failed_message");
((oh) this.d).i(this.B);
this.B = null;
}
} catch (Throwable th) {
throw th;
}
}
@Override
public final String n() {
return "group_distribute";
}
@Override
public final String o() {
return "AppCenterDistribute";
}
@Override
public final synchronized void onActivityPaused(Activity activity) {
this.j = null;
vf0 vf0Var = this.y;
if (vf0Var != null) {
vf0Var.a();
}
}
@Override
public final synchronized void onActivityResumed(Activity activity) {
this.j = activity;
if (this.d != null) {
L();
}
}
@Override
public final int p() {
return 1;
}
public final boolean w(uf0 uf0Var) {
if (uf0Var.h) {
s3.d("AppCenterDistribute", "Release is mandatory, ignoring any postpone action.");
return true;
}
long currentTimeMillis = System.currentTimeMillis();
long c2 = ik0.c("Distribute.postpone_time", 0L);
if (currentTimeMillis < c2) {
s3.d("AppCenterDistribute", "User clock has been changed in past, cleaning postpone state and showing dialog");
ik0.i("Distribute.postpone_time");
return true;
}
long j2 = c2 + 86400000;
if (currentTimeMillis < j2) {
StringBuilder b2 = x0.b("Optional updates are postponed until ");
b2.append(new Date(j2));
s3.d("AppCenterDistribute", b2.toString());
return false;
}
return true;
}
public final synchronized void x() {
if (wf.k() == 3) {
s3.d("AppCenterDistribute", "Delete notification");
((NotificationManager) this.g.getSystemService("notification")).cancel(-355571511);
}
}
public final synchronized void y() {
qj0 qj0Var = this.q;
if (qj0Var != null) {
qj0Var.cancel();
this.q = null;
}
this.p = null;
this.s = null;
this.t = null;
this.u = null;
this.v = null;
this.w.clear();
this.D = null;
this.z = false;
Z(null);
ik0.i("Distribute.release_details");
ik0.i("Distribute.download_state");
ik0.i("Distribute.download_time");
}
public final void z() {
String d2 = ik0.d("Distribute.downloaded_release_hash");
String d3 = ik0.d("Distribute.downloaded_distribution_group_id");
if (!H(d2) || TextUtils.isEmpty(d3) || d3.equals(ik0.d("Distribute.distribution_group_id"))) {
return;
}
s3.d("AppCenterDistribute", "Current group ID doesn't match the group ID of downloaded release, updating current group id=" + d3);
ik0.h("Distribute.distribution_group_id", d3);
ik0.i("Distribute.downloaded_distribution_group_id");
}
}