package com.ifpdos.debugmenu.action;

import android.content.Context;
import android.util.Log;
import c.n.a;
import com.cvte.vman.VmanMiddleWare;
import com.ifpdos.debugmenu.R;
import com.ifpdos.debugmenu.action.base.ItemSwitchAction;
import d.f.a.s1.e;
import java.util.Locale;

/* JADX INFO: loaded from: classes.dex */
public class MicExternalSourceSwitchAction extends ItemSwitchAction {
    private static final String TAG = "MicExternalSourceSwitchAction";

    public MicExternalSourceSwitchAction(Context context) {
        super(context);
    }

    @Override // com.ifpdos.debugmenu.action.base.ItemSwitchAction
    public boolean isOn(Context context) {
        try {
            boolean otgMicState = VmanMiddleWare.getInstance().getAudioCtrl().getOtgMicState();
            Log.d(TAG, String.format(Locale.US, "getMicExternalSourceStatus[execute Method: SystemCtrl#getOtgMicState()], [获取结果为: %b], [获取到的阵列麦外部通道开关状态为: %s]", Boolean.valueOf(otgMicState), otgMicState ? "开启" : "关闭"));
            return otgMicState;
        } catch (Throwable th) {
            Log.e(TAG, "onSwitch: error[如需要该功能，需要检查vman的实现端依赖该接口定义对应的版本并做对应的接口实现]");
            th.printStackTrace();
            return false;
        }
    }

    @Override // com.ifpdos.debugmenu.action.base.ItemSwitchAction
    public void onSwitch(Context context, boolean z) {
        String str = z ? "开启" : "关闭";
        try {
            boolean otgMicState = VmanMiddleWare.getInstance().getAudioCtrl().setOtgMicState(z);
            Log.d(TAG, String.format(Locale.US, "setMicExternalSourceStatus[execute Method: SystemCtrl#setOtgMicState(boolean enable)], [设置阵列麦外部通道开关状态为: %s], [设置结果: %s]", str, otgMicState ? "成功" : "失败"));
            if (otgMicState) {
                a.V(R.string.str_facmenu_debug_mic_external_source_switch, R.string.str_facmenu_debug_mic_external_source_switch_notice, new e() { // from class: d.f.a.p1.t4
                    @Override // d.f.a.s1.e
                    public final void call() {
                        Log.d("MicExternalSourceSwitchAction", "onSwitch: Dialog Dismiss Called, System will reboot 1s later ...");
                        c.n.a.o();
                        c.n.a.N(1000L);
                    }
                });
            }
        } catch (Throwable th) {
            Log.e(TAG, "onSwitch: error[如需要该功能，需要检查vman的实现端依赖该接口定义对应的版本并做对应的接口实现]");
            th.printStackTrace();
        }
    }
}
