package com.huawei.hms.adapter.ui; import android.app.Activity; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.view.KeyEvent; import com.huawei.hms.activity.IBridgeActivityDelegate; import com.huawei.hms.adapter.sysobs.SystemManager; import com.huawei.hms.support.log.HMSLog; import com.huawei.hms.update.ui.NotInstalledHmsDialogHelper; /* loaded from: classes2.dex */ public class NotInstalledHmsAdapter implements IBridgeActivityDelegate { private static final Object c = new Object(); private static boolean d; private Activity a; private Dialog b; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static class a implements DialogInterface.OnCancelListener { private final Activity a; public a(Activity activity) { this.a = activity; } @Override // android.content.DialogInterface.OnCancelListener public void onCancel(DialogInterface dialogInterface) { HMSLog.i("NotInstalledHmsAdapter", ""); SystemManager.getInstance().notifyUpdateResult(13); this.a.finish(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static class b implements DialogInterface.OnClickListener { private final Activity a; public b(Activity activity) { this.a = activity; } @Override // android.content.DialogInterface.OnClickListener public void onClick(DialogInterface dialogInterface, int i) { HMSLog.i("NotInstalledHmsAdapter", ""); SystemManager.getInstance().notifyUpdateResult(30); this.a.finish(); } } private void a(Activity activity) { Dialog dialog = this.b; if (dialog != null && dialog.isShowing()) { this.b.setOnCancelListener(null); this.b.cancel(); } this.b = NotInstalledHmsDialogHelper.getDialogBuilder(activity).setPositiveButton(NotInstalledHmsDialogHelper.getConfirmResId(activity), new b(activity)).setOnCancelListener(new a(activity)).show(); } public static boolean getShowLock() { synchronized (c) { StringBuilder sb = new StringBuilder(" sIsShowingDialog: "); sb.append(d); HMSLog.i("NotInstalledHmsAdapter", sb.toString()); if (d) { return false; } d = true; return true; } } @Override // com.huawei.hms.activity.IBridgeActivityDelegate public int getRequestCode() { HMSLog.i("NotInstalledHmsAdapter", ""); return 0; } @Override // com.huawei.hms.activity.IBridgeActivityDelegate public void onBridgeActivityCreate(Activity activity) { HMSLog.i("NotInstalledHmsAdapter", ""); if (activity != null && !activity.isFinishing()) { this.a = activity; a(activity); } else { HMSLog.e("NotInstalledHmsAdapter", " activity is null or finishing"); } } @Override // com.huawei.hms.activity.IBridgeActivityDelegate public void onBridgeActivityDestroy() { HMSLog.i("NotInstalledHmsAdapter", ""); synchronized (c) { d = false; } } @Override // com.huawei.hms.activity.IBridgeActivityDelegate public boolean onBridgeActivityResult(int i, int i2, Intent intent) { HMSLog.i("NotInstalledHmsAdapter", ""); return false; } @Override // com.huawei.hms.activity.IBridgeActivityDelegate public void onBridgeConfigurationChanged() { HMSLog.i("NotInstalledHmsAdapter", ""); Activity activity = this.a; if (activity != null && !activity.isFinishing()) { a(this.a); } else { HMSLog.e("NotInstalledHmsAdapter", " mActivity is null or finishing"); } } @Override // com.huawei.hms.activity.IBridgeActivityDelegate public void onKeyUp(int i, KeyEvent keyEvent) { HMSLog.i("NotInstalledHmsAdapter", ""); } }