AlarmVoiceTypeActivity.java 源代码


package activity.setting;

import android.content.Intent;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import base.HiActivity;
import bean.MyCamera;
import com.hichip.callback.ICameraIOSessionCallback;
import com.hichip.callback.ICameraRPSAudioCallback;
import com.hichip.campro.R;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCamera;
import com.nineoldandroids.animation.AnimatorSet;
import com.nineoldandroids.animation.ObjectAnimator;
import com.xiaomi.mipush.sdk.Constants;
import common.ConstantCommand;
import common.HiDataValue;
import common.TitleView;
import custom.MyRecordView;
import java.io.File;
import java.util.Iterator;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import utils.DialogUtilsCamHiPro;
import utils.HiLogcatUtil;
import utils.HiTools;

public class AlarmVoiceTypeActivity extends HiActivity implements View.OnClickListener, ICameraRPSAudioCallback, ICameraIOSessionCallback {
    private static final int MY_PERMISSION_REQUEST_CODE = 10024;
    public static final int PERMISSIONS_REQUEST_FOR_AUDIO = 1;
    public static final int RECORD_TOO_SHORT = 102;
    protected static final int REQUEST_RECORDER = 110;
    public static boolean isOnLine = true;
    private AudioManager audioManager;
    private long endTime;
    private String filePath;
    private boolean isEquipmentHasAudio;
    private boolean isGetAudioFile;
    private boolean isPlaying;
    private boolean isRecording;
    private boolean isSendRecord;
    private ImageView iv_alarm;
    private ImageView iv_barking;
    private ImageView iv_custom;
    private File mAudioFile;
    private MyCamera mCamera;
    private ExecutorService mExecutorService;
    private String mFilePath;
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            super.handleMessage(message);
            int i = message.what;
            if (i != -1879048189) {
                if (i == 2) {
                    Log.e("==play_status==", "isPlaying==" + AlarmVoiceTypeActivity.this.isPlaying);
                    if (AlarmVoiceTypeActivity.this.isPlaying) {
                        AlarmVoiceTypeActivity.this.isPlaying = false;
                        AlarmVoiceTypeActivity.this.mCamera.stopPlayRecordAudio();
                        AlarmVoiceTypeActivity.this.mHandler.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                AlarmVoiceTypeActivity.this.record.setTouchAble(true);
                                AlarmVoiceTypeActivity.this.play.setTouchAble(true);
                            }
                        }, 500L);
                    }
                    boolean unused = AlarmVoiceTypeActivity.this.isSendRecord;
                    return;
                }
                if (i == 102) {
                    AlarmVoiceTypeActivity alarmVoiceTypeActivity = AlarmVoiceTypeActivity.this;
                    Toast.makeText(alarmVoiceTypeActivity, alarmVoiceTypeActivity.getString(R.string.mini_time_record_audio), 1).show();
                    Log.e("==touchAble==", AlarmVoiceTypeActivity.this.record.getTouchAble() + "---" + AlarmVoiceTypeActivity.this.play.getTouchAble());
                    return;
                }
                if (i == 5) {
                    AlarmVoiceTypeActivity alarmVoiceTypeActivity2 = AlarmVoiceTypeActivity.this;
                    Toast.makeText(alarmVoiceTypeActivity2, alarmVoiceTypeActivity2.getString(R.string.failed_record_audio), 1).show();
                    AlarmVoiceTypeActivity.this.play.setVisibility(8);
                    AlarmVoiceTypeActivity.this.mCamera.stopRecordingAudio();
                    AlarmVoiceTypeActivity.this.isRecording = false;
                    return;
                }
                if (i != 6) {
                    if (i != 7) {
                        return;
                    }
                    AlarmVoiceTypeActivity.this.dismissjuHuaDialog();
                    AlarmVoiceTypeActivity alarmVoiceTypeActivity3 = AlarmVoiceTypeActivity.this;
                    Toast.makeText(alarmVoiceTypeActivity3, alarmVoiceTypeActivity3.getString(R.string.send_audio_fail), 1).show();
                    return;
                }
                Log.e("==play_status==", "isPlaying==播放失败");
                AlarmVoiceTypeActivity alarmVoiceTypeActivity4 = AlarmVoiceTypeActivity.this;
                Toast.makeText(alarmVoiceTypeActivity4, alarmVoiceTypeActivity4.getString(R.string.play_audio_fail), 1).show();
                AlarmVoiceTypeActivity.this.mCamera.stopPlayRecordAudio();
                AlarmVoiceTypeActivity.this.isPlaying = false;
                AlarmVoiceTypeActivity.this.mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        AlarmVoiceTypeActivity.this.record.setTouchAble(true);
                        AlarmVoiceTypeActivity.this.play.setTouchAble(true);
                    }
                }, 500L);
                return;
            }
            if (message.arg2 == 0) {
                message.getData().getByteArray("data");
                int i2 = message.arg1;
                if (i2 != 16780) {
                    if (i2 != 16781) {
                        switch (i2) {
                            case 65601:
                                break;
                            case ConstantCommand.HI_P2P_GET_SOUNDFILE:
                                break;
                            default:
                                return;
                        }
                    }
                    AlarmVoiceTypeActivity.this.isGetAudioFile = false;
                    AlarmVoiceTypeActivity.this.dismissjuHuaDialog();
                    AlarmVoiceTypeActivity.this.isEquipmentHasAudio = true;
                    if (!new File(AlarmVoiceTypeActivity.this.filePath).exists()) {
                        Intent intent = new Intent();
                        intent.putExtra("mVoiceType", AlarmVoiceTypeActivity.this.mVoiceType);
                        AlarmVoiceTypeActivity.this.setResult(-1, intent);
                        AlarmVoiceTypeActivity alarmVoiceTypeActivity5 = AlarmVoiceTypeActivity.this;
                        alarmVoiceTypeActivity5.deleteFile(alarmVoiceTypeActivity5.mAudioFile);
                        AlarmVoiceTypeActivity.this.finish();
                        return;
                    }
                    new DialogUtilsCamHiPro(AlarmVoiceTypeActivity.this).title("").message(AlarmVoiceTypeActivity.this.getString(R.string.cover_audio)).cancelText(AlarmVoiceTypeActivity.this.getString(R.string.cancel)).sureText(AlarmVoiceTypeActivity.this.getString(R.string.sure)).setSureOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            AlarmVoiceTypeActivity.this.showjuHuaDialog();
                            AlarmVoiceTypeActivity.this.isSendRecord = true;
                            AlarmVoiceTypeActivity.this.mCamera.startSendRecordAudio(AlarmVoiceTypeActivity.this.filePath);
                        }
                    }).build().show();
                    return;
                }
                AlarmVoiceTypeActivity.this.dismissjuHuaDialog();
                AlarmVoiceTypeActivity alarmVoiceTypeActivity6 = AlarmVoiceTypeActivity.this;
                Toast.makeText(alarmVoiceTypeActivity6, alarmVoiceTypeActivity6.getString(R.string.send_audio_success), 1).show();
                AlarmVoiceTypeActivity.this.isSendRecord = false;
                Intent intent2 = new Intent();
                intent2.putExtra("mVoiceType", 2);
                AlarmVoiceTypeActivity.this.setResult(-1, intent2);
                AlarmVoiceTypeActivity alarmVoiceTypeActivity7 = AlarmVoiceTypeActivity.this;
                alarmVoiceTypeActivity7.deleteFile(alarmVoiceTypeActivity7.mAudioFile);
                AlarmVoiceTypeActivity.this.finish();
                return;
            }
            int i3 = message.arg1;
            if (i3 != 16780) {
                if (i3 != 16781) {
                    switch (i3) {
                        case 65601:
                            break;
                        case ConstantCommand.HI_P2P_GET_SOUNDFILE:
                            break;
                        default:
                            return;
                    }
                }
                AlarmVoiceTypeActivity.this.isEquipmentHasAudio = false;
                AlarmVoiceTypeActivity.this.isGetAudioFile = false;
                if (new File(AlarmVoiceTypeActivity.this.filePath).exists()) {
                    AlarmVoiceTypeActivity.this.isSendRecord = true;
                    AlarmVoiceTypeActivity.this.mCamera.startSendRecordAudio(AlarmVoiceTypeActivity.this.filePath);
                    return;
                } else {
                    AlarmVoiceTypeActivity.this.dismissjuHuaDialog();
                    AlarmVoiceTypeActivity alarmVoiceTypeActivity8 = AlarmVoiceTypeActivity.this;
                    Toast.makeText(alarmVoiceTypeActivity8, alarmVoiceTypeActivity8.getString(R.string.no_record_audio), 1).show();
                    return;
                }
            }
            AlarmVoiceTypeActivity.this.dismissjuHuaDialog();
            AlarmVoiceTypeActivity.this.isSendRecord = false;
            AlarmVoiceTypeActivity alarmVoiceTypeActivity9 = AlarmVoiceTypeActivity.this;
            Toast.makeText(alarmVoiceTypeActivity9, alarmVoiceTypeActivity9.getString(R.string.send_audio_fail), 1).show();
        }
    };
    private int mVoiceType;
    private MyRecordView play;
    private MyRecordView record;
    private RelativeLayout rl_alarm;
    private RelativeLayout rl_barking;
    private RelativeLayout rl_custom;
    private RelativeLayout rl_record_about;
    private long startTime;
    private TitleView title;
    TextView tv_application;

    @Override
    protected int setLayoutId() {
        return R.layout.activity_alarm_voice_type;
    }

    @Override
    protected void init(Bundle bundle) {
        getIntentData();
        initView();
        setOnListeners();
    }

    private void getIntentData() {
        this.mVoiceType = getIntent().getIntExtra("mVoiceType", 0);
        String stringExtra = getIntent().getStringExtra(HiDataValue.EXTRAS_KEY_UID);
        Iterator<MyCamera> it = HiDataValue.CameraList.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            MyCamera next = it.next();
            if (stringExtra.equals(next.getUid())) {
                this.mCamera = next;
                break;
            }
        }
        this.mCamera.registerRPSAudioListener(this);
        this.mCamera.registerIOSessionListener(this);
        this.mFilePath = HiDataValue.getAudioPath(this);
        this.filePath = this.mFilePath + "audioRecord.g711";
    }

    private void setOnListeners() {
        this.rl_alarm.setOnClickListener(this);
        this.rl_barking.setOnClickListener(this);
        this.rl_custom.setOnClickListener(this);
        this.tv_application.setOnClickListener(this);
        this.play.setOnClickListener(new MyRecordView.MyOnClickListener() {
            @Override
            public void onClick() {
                int i = (int) (((AlarmVoiceTypeActivity.this.endTime - AlarmVoiceTypeActivity.this.startTime) + 500) / 1000);
                if (AlarmVoiceTypeActivity.this.isPlaying) {
                    AlarmVoiceTypeActivity.this.stopPlay();
                } else {
                    if (i <= 0) {
                        return;
                    }
                    AlarmVoiceTypeActivity.this.isPlaying = true;
                    AlarmVoiceTypeActivity.this.mExecutorService.submit(new Runnable() {
                        @Override
                        public void run() {
                            AlarmVoiceTypeActivity.this.startPlay();
                        }
                    });
                    AlarmVoiceTypeActivity.this.play.startPlay(i, 20.0f);
                }
            }
        });
        this.record.setOnClickListener(new MyRecordView.MyOnClickListener() {
            @Override
            public void onClick() {
                if (AlarmVoiceTypeActivity.this.isPlaying) {
                    AlarmVoiceTypeActivity.this.stopPlay();
                }
            }
        });
        this.record.setOnLongClickListener(new MyRecordView.OnLongClickListener() {
            @Override
            public void onRecordFinishedListener() {
                if (AlarmVoiceTypeActivity.this.isRecording) {
                    AlarmVoiceTypeActivity.this.endTime = System.currentTimeMillis();
                    AlarmVoiceTypeActivity.this.mCamera.stopRecordingAudio();
                    AlarmVoiceTypeActivity.this.isRecording = false;
                    File file = new File(AlarmVoiceTypeActivity.this.filePath);
                    if (!file.exists() || AlarmVoiceTypeActivity.this.startTime == 0 || AlarmVoiceTypeActivity.this.endTime == 0 || AlarmVoiceTypeActivity.this.endTime - AlarmVoiceTypeActivity.this.startTime < 2000 || file.length() <= 0) {
                        AlarmVoiceTypeActivity.this.play.setVisibility(8);
                        AlarmVoiceTypeActivity.this.deleteFile(file);
                        AlarmVoiceTypeActivity alarmVoiceTypeActivity = AlarmVoiceTypeActivity.this;
                        Toast.makeText(alarmVoiceTypeActivity, alarmVoiceTypeActivity.getString(R.string.failed_record_audio), 1).show();
                        return;
                    }
                    AlarmVoiceTypeActivity.this.play.setVisibility(0);
                }
            }

            @Override
            public void onNoMinRecord(int i) {
                if (AlarmVoiceTypeActivity.this.isRecording) {
                    AlarmVoiceTypeActivity.this.mCamera.stopRecordingAudio();
                    AlarmVoiceTypeActivity.this.isRecording = false;
                    AlarmVoiceTypeActivity.this.play.setVisibility(8);
                    AlarmVoiceTypeActivity alarmVoiceTypeActivity = AlarmVoiceTypeActivity.this;
                    alarmVoiceTypeActivity.deleteFile(alarmVoiceTypeActivity.mAudioFile);
                    Message message = new Message();
                    message.what = 102;
                    AlarmVoiceTypeActivity.this.mHandler.sendMessage(message);
                }
            }

            @Override
            public void onLongClick() {
                if (AlarmVoiceTypeActivity.this.isPlaying) {
                    AlarmVoiceTypeActivity.this.stopPlay();
                }
                if (Build.VERSION.SDK_INT > 21) {
                    AlarmVoiceTypeActivity.this.permissionForM();
                } else {
                    AlarmVoiceTypeActivity.this.mExecutorService.submit(new Runnable() {
                        @Override
                        public void run() {
                            if (!AlarmVoiceTypeActivity.this.record.getTouchAble() || AlarmVoiceTypeActivity.this.isPlaying) {
                                return;
                            }
                            AlarmVoiceTypeActivity.this.startRecord();
                        }
                    });
                }
            }
        });
    }

    protected void startPlay() {
        String str = this.filePath;
        if (str == null) {
            return;
        }
        this.mCamera.startPlayRecordAudio(str);
    }

    public void permissionForM() {
        this.record.resetAnimation();
        this.record.cancelProgressAni();
        if (HiTools.HiPermission(this, this, -2, MY_PERMISSION_REQUEST_CODE)) {
            return;
        }
        startRecord();
    }

    protected void startRecord() {
        this.isRecording = true;
        this.mAudioFile = null;
        File file = new File(this.filePath);
        this.mAudioFile = file;
        file.getParentFile().mkdirs();
        try {
            deleteFile(this.mAudioFile);
            this.mAudioFile.createNewFile();
            this.mCamera.startRecordingAudio(this.filePath);
            this.startTime = System.currentTimeMillis();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void initView() {
        this.audioManager = (AudioManager) getSystemService("audio");
        this.mExecutorService = Executors.newSingleThreadExecutor();
        TitleView titleView = (TitleView) findViewById(R.id.title);
        this.title = titleView;
        titleView.setButton(0);
        this.title.setTitle(getString(R.string.alarm_sound_type_));
        this.title.setNavigationBarButtonListener(new TitleView.NavigationBarButtonListener() {
            @Override
            public void OnNavigationButtonClick(int i) {
                if (i != 0) {
                    return;
                }
                if (new File(AlarmVoiceTypeActivity.this.filePath).exists()) {
                    new DialogUtilsCamHiPro(AlarmVoiceTypeActivity.this).title("").message(AlarmVoiceTypeActivity.this.getString(R.string.give_up_record)).cancelText(AlarmVoiceTypeActivity.this.getString(R.string.cancel)).sureText(AlarmVoiceTypeActivity.this.getString(R.string.sure)).setSureOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            AlarmVoiceTypeActivity.this.finish();
                        }
                    }).build().show();
                } else {
                    AlarmVoiceTypeActivity.this.finish();
                }
            }
        });
        this.rl_record_about = (RelativeLayout) findViewById(R.id.rl_record_about);
        this.rl_barking = (RelativeLayout) findViewById(R.id.rl_barking);
        this.rl_alarm = (RelativeLayout) findViewById(R.id.rl_alarm);
        this.rl_custom = (RelativeLayout) findViewById(R.id.rl_custom);
        this.play = (MyRecordView) findViewById(R.id.play);
        this.record = (MyRecordView) findViewById(R.id.record);
        this.iv_alarm = (ImageView) findViewById(R.id.iv_alarm);
        this.iv_barking = (ImageView) findViewById(R.id.iv_barking);
        this.iv_custom = (ImageView) findViewById(R.id.iv_custom);
        int i = this.mVoiceType;
        if (i == 0) {
            this.iv_alarm.setVisibility(0);
            this.iv_barking.setVisibility(8);
            this.iv_custom.setVisibility(8);
        } else if (i == 1) {
            this.iv_alarm.setVisibility(8);
            this.iv_custom.setVisibility(8);
            this.iv_barking.setVisibility(0);
        } else {
            this.iv_alarm.setVisibility(8);
            this.iv_custom.setVisibility(0);
            this.iv_barking.setVisibility(8);
            this.record.setVisibility(0);
        }
        if (this.mCamera.getIsLiteOs()) {
            if (this.mCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SOUNDFILE)) {
                this.rl_custom.setVisibility(0);
                return;
            } else {
                this.rl_custom.setVisibility(8);
                return;
            }
        }
        if (this.mCamera.appGetCommandFunction(16780)) {
            this.rl_custom.setVisibility(0);
        } else {
            this.rl_custom.setVisibility(8);
        }
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i != 4) {
            if (i == 24) {
                this.audioManager.adjustStreamVolume(3, 1, 1);
                return true;
            }
            if (i == 25) {
                this.audioManager.adjustStreamVolume(3, -1, 1);
                return true;
            }
        } else if (new File(this.filePath).exists() && this.play.getVisibility() == 0) {
            new DialogUtilsCamHiPro(this).title("").message(getString(R.string.give_up_record)).cancelText(getString(R.string.cancel)).sureText(getString(R.string.sure)).setSureOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    AlarmVoiceTypeActivity.this.finish();
                }
            }).build().show();
        } else {
            finish();
        }
        return true;
    }

    private void handApplication() {
        int i = this.mVoiceType;
        if (i == 1 || i == 0) {
            Intent intent = new Intent();
            intent.putExtra("mVoiceType", this.mVoiceType);
            setResult(-1, intent);
            finish();
            return;
        }
        if (this.isRecording || this.isGetAudioFile) {
            return;
        }
        showjuHuaDialog();
        if (this.isPlaying) {
            stopPlay();
        }
        this.mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                AlarmVoiceTypeActivity.this.isGetAudioFile = true;
                if (AlarmVoiceTypeActivity.this.mCamera.getIsLiteOs()) {
                    AlarmVoiceTypeActivity.this.mCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SOUNDFILE, null);
                } else {
                    AlarmVoiceTypeActivity.this.mCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_TRANSFER_AUDIOFILE, null);
                }
            }
        }, 500L);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rl_alarm:
                if (this.mVoiceType == 0 || this.isRecording) {
                    return;
                }
                this.mVoiceType = 0;
                this.iv_barking.setVisibility(8);
                this.iv_custom.setVisibility(8);
                this.iv_alarm.setVisibility(0);
                this.record.setVisibility(8);
                this.play.setVisibility(8);
                stopPlay();
                return;
            case R.id.rl_barking:
                if (this.mVoiceType == 1 || this.isRecording) {
                    return;
                }
                this.mVoiceType = 1;
                this.iv_barking.setVisibility(0);
                this.iv_alarm.setVisibility(8);
                this.iv_custom.setVisibility(8);
                this.record.setVisibility(8);
                this.play.setVisibility(8);
                stopPlay();
                return;
            case R.id.rl_custom:
                if (this.mVoiceType == 2 || this.isRecording) {
                    return;
                }
                this.mVoiceType = 2;
                this.iv_barking.setVisibility(8);
                this.iv_alarm.setVisibility(8);
                this.iv_custom.setVisibility(0);
                this.record.setVisibility(0);
                if (new File(this.filePath).exists() && this.startTime != 0 && this.endTime != 0) {
                    this.play.setVisibility(0);
                }
                playAni(this.rl_record_about);
                return;
            case R.id.tv_application:
                handApplication();
                return;
            default:
                return;
        }
    }

    public void stopPlay() {
        this.mCamera.stopPlayRecordAudio();
        this.play.cancelPlayProgressAni();
        this.isPlaying = false;
        this.mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                AlarmVoiceTypeActivity.this.record.setTouchAble(true);
                AlarmVoiceTypeActivity.this.play.setTouchAble(true);
            }
        }, 500L);
    }

    @Override
    public void onPause() {
        super.onPause();
        stopPlay();
        if (this.isSendRecord) {
            this.mCamera.stopSendRecordAudio();
            this.isSendRecord = false;
        }
        if (this.isRecording) {
            this.endTime = System.currentTimeMillis();
            this.mCamera.stopRecordingAudio();
            this.isRecording = false;
            this.record.cancelProgressAni();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        ExecutorService executorService = this.mExecutorService;
        if (executorService != null) {
            executorService.shutdownNow();
        }
        MyCamera myCamera = this.mCamera;
        if (myCamera != null) {
            myCamera.unregisterRPSAudioListener(this);
            this.mCamera.unregisterIOSessionListener(this);
        }
        deleteFile(this.mAudioFile);
    }

    @Override
    public void callbackRPSAudioState(HiCamera hiCamera, int i, int i2, int i3, String str) {
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = i3;
        obtainMessage.obj = hiCamera;
        obtainMessage.arg1 = i;
        obtainMessage.arg2 = i2;
        this.mHandler.sendMessage(obtainMessage);
    }

    public void deleteFile(File file) {
        if (file == null) {
            file = new File(this.filePath);
        }
        if (file.isDirectory()) {
            for (File file2 : file.listFiles()) {
                deleteFile(file2);
            }
            return;
        }
        if (file.exists()) {
            file.delete();
        }
    }

    public void playAni(View view) {
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(ObjectAnimator.ofFloat(view, "Alpha", 0.0f, 1.0f));
        animatorSet.setDuration(500L);
        animatorSet.start();
    }

    @Override
    public void receiveIOCtrlData(HiCamera hiCamera, int i, byte[] bArr, int i2) {
        if (hiCamera != this.mCamera) {
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putByteArray("data", bArr);
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = HiDataValue.HANDLE_MESSAGE_RECEIVE_IOCTRL;
        obtainMessage.obj = hiCamera;
        obtainMessage.arg1 = i;
        obtainMessage.arg2 = i2;
        obtainMessage.setData(bundle);
        this.mHandler.sendMessage(obtainMessage);
    }

    @Override
    public void receiveSessionState(HiCamera hiCamera, int i) {
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = HiDataValue.HANDLE_MESSAGE_SESSION_STATE;
        obtainMessage.arg1 = i;
        obtainMessage.obj = hiCamera;
        this.mHandler.sendMessage(obtainMessage);
    }

    @Override
    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        boolean z = true;
        HiLogcatUtil.e("" + i);
        int length = strArr.length;
        for (int i2 = 0; i2 < length; i2++) {
            HiLogcatUtil.e(strArr.length + Constants.COLON_SEPARATOR + strArr[i2]);
        }
        for (int i3 : iArr) {
            HiLogcatUtil.e(iArr.length + Constants.COLON_SEPARATOR + i3);
        }
        if (i == MY_PERMISSION_REQUEST_CODE) {
            int length2 = iArr.length;
            int i4 = 0;
            while (true) {
                if (i4 >= length2) {
                    break;
                }
                if (iArr[i4] != 0) {
                    z = false;
                    break;
                }
                i4++;
            }
            if (z) {
                this.mFilePath = HiDataValue.getAudioPath(this);
                this.filePath = this.mFilePath + "audioRecord.g711";
                return;
            }
            HiTools.Hi_GoToSetting(strArr, this, this);
        }
    }
}