42 lines
1.1 KiB
Java
42 lines
1.1 KiB
Java
package com.huawei.hms.availableupdate;
|
|
|
|
import android.app.Activity;
|
|
import com.huawei.hms.support.log.HMSLog;
|
|
import java.lang.ref.WeakReference;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class c {
|
|
public static final c b = new c();
|
|
private WeakReference<Activity> a;
|
|
|
|
public boolean a(Activity activity) {
|
|
HMSLog.i("UpdateAdapterMgr", "onActivityCreate");
|
|
Activity a = a();
|
|
if (a != null && !a.isFinishing()) {
|
|
activity.finish();
|
|
HMSLog.i("UpdateAdapterMgr", "finish one");
|
|
return false;
|
|
}
|
|
this.a = new WeakReference<>(activity);
|
|
return true;
|
|
}
|
|
|
|
public void b(Activity activity) {
|
|
HMSLog.i("UpdateAdapterMgr", "onActivityDestroy");
|
|
Activity a = a();
|
|
if (activity == null || !activity.equals(a)) {
|
|
return;
|
|
}
|
|
HMSLog.i("UpdateAdapterMgr", "reset");
|
|
this.a = null;
|
|
}
|
|
|
|
private Activity a() {
|
|
WeakReference<Activity> weakReference = this.a;
|
|
if (weakReference == null) {
|
|
return null;
|
|
}
|
|
return weakReference.get();
|
|
}
|
|
}
|