导航菜单

页面标题

页面副标题

MX Player v1.97.8 - InstallCertActivityLauncher.java 源代码

正在查看: MX Player v1.97.8 应用的 InstallCertActivityLauncher.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.microsoft.identity.common.internal.broker;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import androidx.activity.result.ActivityResult;
import androidx.annotation.NonNull;
import com.microsoft.identity.common.PropertyBagUtil;
import com.microsoft.identity.common.internal.broker.InstallCertActivityLauncher;
import com.microsoft.identity.common.internal.logging.Logger;
import com.microsoft.identity.common.java.exception.ClientException;
import com.microsoft.identity.common.java.util.StringUtil;
import com.microsoft.identity.common.java.util.ported.LocalBroadcaster;
import com.microsoft.identity.common.java.util.ported.PropertyBag;

public final class InstallCertActivityLauncher extends pg0 {
    private static final String CERT_INSTALLATION_FAILED_WITH_EMPTY_RESPONSE = "Certificate installation failed with an empty response";
    private static final String INSTALL_CERT_BROADCAST_ALIAS = "install_cert_broadcast_alias";
    private static final String INSTALL_CERT_INTENT = "install_cert_intent";
    private static final String INSTALL_CERT_INTENT_STARTED = "broker_intent_started";
    private static final String TAG = "InstallCertActivityLauncher";
    final kg<Intent> installCertActivityResultLauncher;
    private Intent mInstallCertificateIntent;
    private Boolean mInstallCertificateIntentStarted;
    private Boolean mInstallCertificateResultReceived;

    public InstallCertActivityLauncher() {
        Boolean bool = Boolean.FALSE;
        this.mInstallCertificateIntentStarted = bool;
        this.mInstallCertificateResultReceived = bool;
        this.installCertActivityResultLauncher = registerForActivityResult(new ig(), new si1(this, 3));
    }

    public static void installCertificate(@NonNull Activity activity, @NonNull Intent intent, @NonNull IInstallCertCallback iInstallCertCallback, @NonNull String str, @NonNull String str2) {
        Intent intent2 = new Intent(activity, (Class<?>) InstallCertActivityLauncher.class);
        intent2.putExtra(INSTALL_CERT_INTENT, intent);
        registerCallbackAndParseResult(iInstallCertCallback, str, str2);
        activity.startActivity(intent2);
    }

    public void lambda$new$0(ActivityResult activityResult) {
        PropertyBag propertyBag;
        String h = z31.h(new StringBuilder(), TAG, "#installCertActivityResultLauncher");
        Logger.info(h, "Result received from Broker, Result code: " + activityResult.b);
        Intent intent = activityResult.c;
        if (intent == null || intent.getExtras() == null) {
            Logger.error(h, CERT_INSTALLATION_FAILED_WITH_EMPTY_RESPONSE, null);
            propertyBag = new PropertyBag();
        } else {
            propertyBag = PropertyBagUtil.fromBundle(intent.getExtras());
        }
        this.mInstallCertificateResultReceived = Boolean.TRUE;
        LocalBroadcaster.INSTANCE.broadcast(INSTALL_CERT_BROADCAST_ALIAS, propertyBag);
        finish();
    }

    public static void lambda$registerCallbackAndParseResult$1(String str, String str2, IInstallCertCallback iInstallCertCallback, PropertyBag propertyBag) {
        String str3 = (String) propertyBag.get(str);
        String str4 = (String) propertyBag.get(str2);
        if (!StringUtil.isNullOrEmpty(str4) || StringUtil.isNullOrEmpty(str3)) {
            if (StringUtil.isNullOrEmpty(str4)) {
                str4 = CERT_INSTALLATION_FAILED_WITH_EMPTY_RESPONSE;
            }
            iInstallCertCallback.onError(new ClientException("unknown_error", str4));
        } else {
            iInstallCertCallback.onSuccess(Boolean.parseBoolean(str3));
        }
        LocalBroadcaster.INSTANCE.unregisterCallback(INSTALL_CERT_BROADCAST_ALIAS);
    }

    private static void registerCallbackAndParseResult(@NonNull final IInstallCertCallback iInstallCertCallback, @NonNull final String str, @NonNull final String str2) {
        LocalBroadcaster.INSTANCE.registerCallback(INSTALL_CERT_BROADCAST_ALIAS, new LocalBroadcaster.IReceiverCallback() {
            @Override
            public final void onReceive(PropertyBag propertyBag) {
                InstallCertActivityLauncher.lambda$registerCallbackAndParseResult$1(str, str2, iInstallCertCallback, propertyBag);
            }
        });
    }

    public void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.m*/.onCreate(bundle);
        String h = z31.h(new StringBuilder(), TAG, ":onCreate");
        if (bundle != null) {
            this.mInstallCertificateIntent = (Intent) bundle.getParcelable(INSTALL_CERT_INTENT);
            this.mInstallCertificateIntentStarted = Boolean.valueOf(bundle.getBoolean(INSTALL_CERT_INTENT_STARTED));
            return;
        }
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            this.mInstallCertificateIntent = (Intent) extras.getParcelable(INSTALL_CERT_INTENT);
        } else {
            Logger.warn(h, "Extras is null.");
        }
    }

    public void onDestroy() {
        if (!this.mInstallCertificateResultReceived.booleanValue()) {
            Logger.error(TAG, "The activity is killed unexpectedly.", null);
            LocalBroadcaster.INSTANCE.broadcast(INSTALL_CERT_BROADCAST_ALIAS, new PropertyBag());
        }
        super.onDestroy();
    }

    public void onResume() {
        super/*androidx.fragment.app.m*/.onResume();
        if (this.mInstallCertificateIntentStarted.booleanValue()) {
            return;
        }
        this.mInstallCertificateIntentStarted = Boolean.TRUE;
        this.installCertActivityResultLauncher.a(this.mInstallCertificateIntent);
    }

    public void onSaveInstanceState(@NonNull Bundle bundle) {
        super/*ub3*/.onSaveInstanceState(bundle);
        bundle.putParcelable(INSTALL_CERT_INTENT, this.mInstallCertificateIntent);
        bundle.putBoolean(INSTALL_CERT_INTENT_STARTED, this.mInstallCertificateIntentStarted.booleanValue());
    }
}