导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - MediaController.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 MediaController.java JAVA 源代码文件

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


package im.amwhusedvt.messenger;

import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.media.AudioManager;
import android.media.AudioRecord;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.net.Uri;
import android.os.Build;
import android.os.PowerManager;
import android.provider.MediaStore;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.TextureView;
import android.view.View;
import android.widget.FrameLayout;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import im.amwhusedvt.messenger.-$;
import im.amwhusedvt.messenger.audioinfo.AudioInfo;
import im.amwhusedvt.messenger.video.MP4Builder;
import im.amwhusedvt.messenger.voip.VoIPService;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.ui.ChatActivity;
import im.amwhusedvt.ui.PhotoViewer;
import im.amwhusedvt.ui.actionbar.AlertDialog;
import im.amwhusedvt.ui.actionbar.BaseFragment;
import im.amwhusedvt.ui.components.PipRoundVideoView;
import im.amwhusedvt.ui.components.VideoPlayer;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;

public class MediaController implements AudioManager.OnAudioFocusChangeListener, NotificationCenter$NotificationCenterDelegate, SensorEventListener {
    private static final int AUDIO_FOCUSED = 2;
    private static final int AUDIO_NO_FOCUS_CAN_DUCK = 1;
    private static final int AUDIO_NO_FOCUS_NO_DUCK = 0;
    private static volatile MediaController Instance = null;
    public static final String MIME_TYPE = "video/avc";
    private static final int PROCESSOR_TYPE_INTEL = 2;
    private static final int PROCESSOR_TYPE_MTK = 3;
    private static final int PROCESSOR_TYPE_OTHER = 0;
    private static final int PROCESSOR_TYPE_QCOM = 1;
    private static final int PROCESSOR_TYPE_SEC = 4;
    private static final int PROCESSOR_TYPE_TI = 5;
    private static final float VOLUME_DUCK = 0.2f;
    private static final float VOLUME_NORMAL = 1.0f;
    public static AlbumEntry allMediaAlbumEntry;
    public static ArrayList<AlbumEntry> allMediaAlbums;
    public static ArrayList<AlbumEntry> allPhotoAlbums;
    public static AlbumEntry allPhotosAlbumEntry;
    public static AlbumEntry allVideosAlbumEntry;
    private static Runnable broadcastPhotosRunnable;
    private static final String[] projectionPhotos;
    private static final String[] projectionVideo;
    private static Runnable refreshGalleryRunnable;
    private Sensor accelerometerSensor;
    private boolean accelerometerVertical;
    private boolean allowStartRecord;
    private int audioFocus;
    private AudioInfo audioInfo;
    private VideoPlayer audioPlayer;
    private AudioRecord audioRecorder;
    private Activity baseActivity;
    private boolean callInProgress;
    private boolean cancelCurrentVideoConversion;
    private int countLess;
    private AspectRatioFrameLayout currentAspectRatioFrameLayout;
    private float currentAspectRatioFrameLayoutRatio;
    private boolean currentAspectRatioFrameLayoutReady;
    private int currentAspectRatioFrameLayoutRotation;
    private float currentPlaybackSpeed;
    private int currentPlaylistNum;
    private TextureView currentTextureView;
    private FrameLayout currentTextureViewContainer;
    private boolean downloadingCurrentMessage;
    private ExternalObserver externalObserver;
    private View feedbackView;
    private ByteBuffer fileBuffer;
    private DispatchQueue fileEncodingQueue;
    private BaseFragment flagSecureFragment;
    private boolean forceLoopCurrentPlaylist;
    private HashMap<String, MessageObject> generatingWaveform;
    private MessageObject goingToShowMessageObject;
    private float[] gravity;
    private float[] gravityFast;
    private Sensor gravitySensor;
    private int hasAudioFocus;
    private boolean ignoreOnPause;
    private boolean ignoreProximity;
    private boolean inputFieldHasText;
    private InternalObserver internalObserver;
    private boolean isDrawingWasReady;
    private boolean isPaused;
    private int lastChatAccount;
    private long lastChatEnterTime;
    private long lastChatLeaveTime;
    private ArrayList<Long> lastChatVisibleMessages;
    private long lastMediaCheckTime;
    private int lastMessageId;
    private long lastProgress;
    private float lastProximityValue;
    private TLRPC.EncryptedChat lastSecretChat;
    private long lastTimestamp;
    private TLRPC.User lastUser;
    private float[] linearAcceleration;
    private Sensor linearSensor;
    private String[] mediaProjections;
    private PipRoundVideoView pipRoundVideoView;
    private int pipSwitchingState;
    private boolean playMusicAgain;
    private boolean playerWasReady;
    private MessageObject playingMessageObject;
    private ArrayList<MessageObject> playlist;
    private float previousAccValue;
    private Timer progressTimer;
    private final Object progressTimerSync;
    private boolean proximityHasDifferentValues;
    private Sensor proximitySensor;
    private boolean proximityTouched;
    private PowerManager.WakeLock proximityWakeLock;
    private ChatActivity raiseChat;
    private boolean raiseToEarRecord;
    private int raisedToBack;
    private int raisedToTop;
    private int raisedToTopSign;
    private int recordBufferSize;
    private ArrayList<ByteBuffer> recordBuffers;
    private long recordDialogId;
    private DispatchQueue recordQueue;
    private MessageObject recordReplyingMessageObject;
    private Runnable recordRunnable;
    private short[] recordSamples;
    private Runnable recordStartRunnable;
    private long recordStartTime;
    private long recordTimeCount;
    private TLRPC.TL_document recordingAudio;
    private File recordingAudioFile;
    private int recordingCurrentAccount;
    private int recordingGuid;
    private boolean resumeAudioOnFocusGain;
    private long samplesCount;
    private float seekToProgressPending;
    private int sendAfterDone;
    private boolean sendAfterDoneNotify;
    private int sendAfterDoneScheduleDate;
    private SensorManager sensorManager;
    private boolean sensorsStarted;
    private Runnable setLoadingRunnable;
    private ArrayList<MessageObject> shuffledPlaylist;
    private int startObserverToken;
    private StopMediaObserverRunnable stopMediaObserverRunnable;
    private final Object sync;
    private long timeSinceRaise;
    private boolean useFrontSpeaker;
    private boolean videoConvertFirstWrite;
    private ArrayList<MessageObject> videoConvertQueue;
    private final Object videoConvertSync;
    private VideoPlayer videoPlayer;
    private final Object videoQueueSync;
    private ArrayList<MessageObject> voiceMessagesPlaylist;
    private SparseArray<MessageObject> voiceMessagesPlaylistMap;
    private boolean voiceMessagesPlaylistUnread;

    static void access$000(MediaController mediaController, int i, boolean z, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$000(MediaController mediaController, boolean z, float f, String str, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$000(MediaController mediaController, boolean z, int i, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$100(MediaController mediaController, float f, short s, int i, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$100(MediaController mediaController, int i, float f, short s, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$100(MediaController mediaController, int i, boolean z, short s, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$1000(MediaController mediaController, short s, boolean z, int i, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$1000(MediaController mediaController, boolean z, char c, int i, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$1000(MediaController mediaController, boolean z, short s, char c, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$1100(MediaController mediaController, String str, byte b, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$1100(MediaController mediaController, String str, char c, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1100(MediaController mediaController, String str, float f, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1200(MediaController mediaController, int i, boolean z, int i2, byte b, short s, int i3, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$1200(MediaController mediaController, int i, boolean z, int i2, String str, short s, byte b, int i3) {
        double d = (42 * 210) + 210;
    }

    static void access$1200(MediaController mediaController, int i, boolean z, int i2, short s, int i3, String str, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1300(MediaController mediaController, String str, byte b, boolean z, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$1300(MediaController mediaController, String str, short s, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1300(MediaController mediaController, short s, String str, byte b, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$1400(MediaController mediaController, byte b, char c, String str, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$1400(MediaController mediaController, char c, int i, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$1400(MediaController mediaController, String str, int i, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1500(MediaController mediaController, char c, String str, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1500(MediaController mediaController, boolean z, char c, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$1500(MediaController mediaController, boolean z, String str, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1600(MediaController mediaController, byte b, float f, short s, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$1600(MediaController mediaController, float f, boolean z, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1600(MediaController mediaController, short s, byte b, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$1700(MediaController mediaController, ByteBuffer byteBuffer, int i, float f, byte b, short s, int i2) {
        double d = (42 * 210) + 210;
    }

    static void access$1700(MediaController mediaController, ByteBuffer byteBuffer, int i, float f, int i2, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$1700(MediaController mediaController, ByteBuffer byteBuffer, int i, int i2, short s, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1800(MediaController mediaController, float f, int i, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1800(MediaController mediaController, int i, float f, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$1800(MediaController mediaController, int i, boolean z, byte b, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$1802(MediaController mediaController, long j, String str, boolean z, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$1802(MediaController mediaController, long j, short s, boolean z, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$1802(MediaController mediaController, long j, boolean z, short s, String str, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$1900(MediaController mediaController, Uri uri, float f, int i, boolean z, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$1900(MediaController mediaController, Uri uri, float f, boolean z, int i, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$1900(MediaController mediaController, Uri uri, boolean z, float f, int i, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$200(MediaController mediaController, float f, short s, int i, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$200(MediaController mediaController, int i, float f, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$200(MediaController mediaController, short s, byte b, float f, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$2000(byte b, int i, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$2000(float f, byte b, int i, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$2000(short s, byte b, int i, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$2002(Runnable runnable, int i, String str, short s, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2002(Runnable runnable, int i, short s, String str, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2002(Runnable runnable, int i, short s, boolean z, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$2100(MediaController mediaController, char c, String str, boolean z, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$2100(MediaController mediaController, boolean z, String str, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$2100(MediaController mediaController, boolean z, short s, char c, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$2200(MediaController mediaController, float f, char c, int i, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2200(MediaController mediaController, int i, float f, boolean z, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$2200(MediaController mediaController, int i, boolean z, char c, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$2202(MediaController mediaController, InternalObserver internalObserver, float f, String str, short s, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2202(MediaController mediaController, InternalObserver internalObserver, short s, float f, String str, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2202(MediaController mediaController, InternalObserver internalObserver, short s, float f, boolean z, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$2300(MediaController mediaController, float f, boolean z, char c, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$2300(MediaController mediaController, int i, char c, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2300(MediaController mediaController, boolean z, float f, int i, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$2302(MediaController mediaController, ExternalObserver externalObserver, int i, short s, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2302(MediaController mediaController, ExternalObserver externalObserver, boolean z, float f, short s, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$2302(MediaController mediaController, ExternalObserver externalObserver, boolean z, int i, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$2400(MediaController mediaController, byte b, char c, boolean z, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$2400(MediaController mediaController, char c, String str, byte b, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2400(MediaController mediaController, String str, byte b, boolean z, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$2500(MediaController mediaController, byte b, char c, boolean z, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$2500(MediaController mediaController, byte b, float f, char c, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2500(MediaController mediaController, char c, byte b, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$2600(MediaController mediaController, byte b, char c, float f, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$2600(MediaController mediaController, int i, char c, byte b, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$2600(MediaController mediaController, int i, float f, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$2700(MediaController mediaController, byte b, char c, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$2700(MediaController mediaController, char c, String str, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$2700(MediaController mediaController, String str, byte b, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$2800(MediaController mediaController, char c, short s, float f, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$2800(MediaController mediaController, float f, char c, int i, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$2800(MediaController mediaController, short s, int i, char c, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$2802(MediaController mediaController, float f, int i, String str, short s, float f2) {
        double d = (42 * 210) + 210;
    }

    static void access$2802(MediaController mediaController, float f, int i, short s, float f2, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$2802(MediaController mediaController, float f, String str, int i, short s, float f2) {
        double d = (42 * 210) + 210;
    }

    static void access$2900(MediaController mediaController, boolean z, int i, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$2900(MediaController mediaController, boolean z, int i, String str, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$2900(MediaController mediaController, boolean z, String str, int i, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$2902(MediaController mediaController, long j, byte b, short s, boolean z, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$2902(MediaController mediaController, long j, int i, boolean z, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$2902(MediaController mediaController, long j, boolean z, byte b, int i, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$300(MediaController mediaController, float f, short s, byte b, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$300(MediaController mediaController, int i, byte b, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$300(MediaController mediaController, short s, byte b, float f, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$3100(MediaController mediaController, MessageObject messageObject, int[] iArr, boolean z, boolean z2, int i, float f, short s, String str, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$3100(MediaController mediaController, MessageObject messageObject, int[] iArr, boolean z, boolean z2, int i, String str, char c, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$3100(MediaController mediaController, MessageObject messageObject, int[] iArr, boolean z, boolean z2, int i, short s, String str, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$3200(MediaController mediaController, byte b, float f, boolean z, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3200(MediaController mediaController, byte b, boolean z, String str, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$3200(MediaController mediaController, boolean z, byte b, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3202(MediaController mediaController, int i, char c, short s, int i2, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3202(MediaController mediaController, int i, String str, short s, char c, int i2) {
        double d = (42 * 210) + 210;
    }

    static void access$3202(MediaController mediaController, int i, short s, char c, String str, int i2) {
        double d = (42 * 210) + 210;
    }

    static void access$3300(MediaController mediaController, byte b, char c, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3300(MediaController mediaController, byte b, String str, char c, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$3300(MediaController mediaController, char c, float f, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3302(MediaController mediaController, float f, String str, short s, byte b, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$3302(MediaController mediaController, float f, boolean z, String str, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$3302(MediaController mediaController, float f, boolean z, String str, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$3400(MediaController mediaController, int i, boolean z, char c, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3400(MediaController mediaController, String str, boolean z, int i, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$3400(MediaController mediaController, boolean z, String str, char c, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$3500(MediaController mediaController, char c, String str, int i, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$3500(MediaController mediaController, int i, String str, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$3500(MediaController mediaController, String str, int i, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$3502(MediaController mediaController, boolean z, char c, short s, String str, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$3502(MediaController mediaController, boolean z, float f, short s, char c, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3502(MediaController mediaController, boolean z, short s, String str, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$3600(MediaController mediaController, int i, short s, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$3600(MediaController mediaController, int i, boolean z, short s, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$3600(MediaController mediaController, boolean z, short s, int i, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$3700(MediaController mediaController, short s, float f, byte b, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$3700(MediaController mediaController, short s, boolean z, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$3700(MediaController mediaController, boolean z, short s, byte b, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$3702(MediaController mediaController, int i, byte b, float f, char c, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3702(MediaController mediaController, int i, char c, byte b, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$3702(MediaController mediaController, int i, String str, byte b, char c, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$3800(MediaController mediaController, byte b, float f, char c, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$3800(MediaController mediaController, float f, short s, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$3800(MediaController mediaController, short s, byte b, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$3900(MediaController mediaController, char c, int i, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$3900(MediaController mediaController, int i, short s, char c, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$3900(MediaController mediaController, short s, char c, int i, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$400(MediaController mediaController, byte b, float f, String str, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$400(MediaController mediaController, byte b, String str, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$400(MediaController mediaController, String str, boolean z, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$4000(MediaController mediaController, byte b, String str, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$4000(MediaController mediaController, String str, byte b, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$4000(MediaController mediaController, String str, float f, byte b, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$4002(MediaController mediaController, PipRoundVideoView pipRoundVideoView, byte b, short s, boolean z, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$4002(MediaController mediaController, PipRoundVideoView pipRoundVideoView, boolean z, byte b, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$4002(MediaController mediaController, PipRoundVideoView pipRoundVideoView, boolean z, float f, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$402(MediaController mediaController, long j, int i, boolean z, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$402(MediaController mediaController, long j, int i, boolean z, String str, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$402(MediaController mediaController, long j, String str, byte b, boolean z, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$4100(MediaController mediaController, float f, boolean z, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$4100(MediaController mediaController, short s, char c, boolean z, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$4100(MediaController mediaController, boolean z, short s, char c, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$4200(MediaController mediaController, boolean z, char c, String str, float f, boolean z2) {
        double d = (42 * 210) + 210;
    }

    static void access$4200(MediaController mediaController, boolean z, char c, String str, boolean z2, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$4200(MediaController mediaController, boolean z, String str, boolean z2, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$4300(MediaController mediaController, MessageObject messageObject, byte b, char c, short s, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$4300(MediaController mediaController, MessageObject messageObject, short s, byte b, String str, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$4300(MediaController mediaController, MessageObject messageObject, short s, char c, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$4400(MediaController mediaController, float f, char c, String str, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$4400(MediaController mediaController, String str, float f, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$4400(MediaController mediaController, short s, String str, char c, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$4500(MediaController mediaController, byte b, char c, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$4500(MediaController mediaController, char c, short s, byte b, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$4500(MediaController mediaController, short s, byte b, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$4602(MediaController mediaController, boolean z, float f, String str, char c, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$4602(MediaController mediaController, boolean z, float f, String str, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$4602(MediaController mediaController, boolean z, String str, short s, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$500(MediaController mediaController, short s, float f, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$500(MediaController mediaController, short s, String str, byte b, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$500(MediaController mediaController, short s, String str, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$600(MediaController mediaController, byte b, short s, char c, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$600(MediaController mediaController, char c, int i, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$600(MediaController mediaController, int i, char c, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$700(MediaController mediaController, int i, String str, short s, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$700(MediaController mediaController, int i, String str, boolean z, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$700(MediaController mediaController, int i, short s, boolean z, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$800(MediaController mediaController, boolean z, int i, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$800(MediaController mediaController, boolean z, String str, byte b, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$800(MediaController mediaController, boolean z, String str, int i, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$900(MediaController mediaController, int i, boolean z, float f, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$900(MediaController mediaController, short s, float f, int i, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$900(MediaController mediaController, short s, boolean z, float f, int i) {
        double d = (42 * 210) + 210;
    }

    private static void broadcastNewPhotos(int i, ArrayList arrayList, ArrayList arrayList2, Integer num, AlbumEntry albumEntry, AlbumEntry albumEntry2, AlbumEntry albumEntry3, int i2, short s, char c, String str, boolean z) {
        double d = (42 * 210) + 210;
    }

    private static void broadcastNewPhotos(int i, ArrayList arrayList, ArrayList arrayList2, Integer num, AlbumEntry albumEntry, AlbumEntry albumEntry2, AlbumEntry albumEntry3, int i2, short s, String str, char c, boolean z) {
        double d = (42 * 210) + 210;
    }

    private static void broadcastNewPhotos(int i, ArrayList arrayList, ArrayList arrayList2, Integer num, AlbumEntry albumEntry, AlbumEntry albumEntry2, AlbumEntry albumEntry3, int i2, short s, boolean z, char c, String str) {
        double d = (42 * 210) + 210;
    }

    private void buildShuffledPlayList(float f, boolean z, int i, short s) {
        double d = (42 * 210) + 210;
    }

    private void buildShuffledPlayList(boolean z, short s, float f, int i) {
        double d = (42 * 210) + 210;
    }

    private void buildShuffledPlayList(boolean z, short s, int i, float f) {
        double d = (42 * 210) + 210;
    }

    private void checkAudioFocus(MessageObject messageObject, char c, short s, byte b, int i) {
        double d = (42 * 210) + 210;
    }

    private void checkAudioFocus(MessageObject messageObject, char c, short s, int i, byte b) {
        double d = (42 * 210) + 210;
    }

    private void checkAudioFocus(MessageObject messageObject, short s, int i, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    private void checkConversionCanceled(char c, boolean z, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    private void checkConversionCanceled(short s, byte b, char c, boolean z) {
        double d = (42 * 210) + 210;
    }

    private void checkConversionCanceled(short s, char c, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void checkGallery(char c, String str, short s, int i) {
        double d = (42 * 210) + 210;
    }

    public static void checkGallery(char c, short s, String str, int i) {
        double d = (42 * 210) + 210;
    }

    public static void checkGallery(short s, int i, String str, char c) {
        double d = (42 * 210) + 210;
    }

    private void checkIsNextMusicFileDownloaded(int i, String str, float f, boolean z, short s) {
        double d = (42 * 210) + 210;
    }

    private void checkIsNextMusicFileDownloaded(int i, String str, boolean z, short s, float f) {
        double d = (42 * 210) + 210;
    }

    private void checkIsNextMusicFileDownloaded(int i, boolean z, float f, short s, String str) {
        double d = (42 * 210) + 210;
    }

    private void checkIsNextVoiceFileDownloaded(int i, byte b, String str, short s, float f) {
        double d = (42 * 210) + 210;
    }

    private void checkIsNextVoiceFileDownloaded(int i, byte b, short s, String str, float f) {
        double d = (42 * 210) + 210;
    }

    private void checkIsNextVoiceFileDownloaded(int i, short s, float f, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    private void checkScreenshots(ArrayList arrayList, char c, short s, boolean z, String str) {
        double d = (42 * 210) + 210;
    }

    private void checkScreenshots(ArrayList arrayList, short s, String str, boolean z, char c) {
        double d = (42 * 210) + 210;
    }

    private void checkScreenshots(ArrayList arrayList, boolean z, short s, String str, char c) {
        double d = (42 * 210) + 210;
    }

    private void convertVideo(MessageObject messageObject, char c, short s, String str, int i) {
        double d = (42 * 210) + 210;
    }

    private void convertVideo(MessageObject messageObject, int i, String str, short s, char c) {
        double d = (42 * 210) + 210;
    }

    private void convertVideo(MessageObject messageObject, short s, int i, String str, char c) {
        double d = (42 * 210) + 210;
    }

    public static void copyFileToCache(Uri uri, String str, byte b, boolean z, float f, String str2) {
        double d = (42 * 210) + 210;
    }

    public static void copyFileToCache(Uri uri, String str, String str2, boolean z, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void copyFileToCache(Uri uri, String str, boolean z, byte b, float f, String str2) {
        double d = (42 * 210) + 210;
    }

    private void didWriteData(MessageObject messageObject, File file, boolean z, long j, boolean z2, byte b, char c, boolean z3, int i) {
        double d = (42 * 210) + 210;
    }

    private void didWriteData(MessageObject messageObject, File file, boolean z, long j, boolean z2, char c, int i, boolean z3, byte b) {
        double d = (42 * 210) + 210;
    }

    private void didWriteData(MessageObject messageObject, File file, boolean z, long j, boolean z2, int i, char c, boolean z3, byte b) {
        double d = (42 * 210) + 210;
    }

    private void findTrack(MediaExtractor mediaExtractor, boolean z, byte b, boolean z2, float f, char c) {
        double d = (42 * 210) + 210;
    }

    private void findTrack(MediaExtractor mediaExtractor, boolean z, boolean z2, byte b, float f, char c) {
        double d = (42 * 210) + 210;
    }

    private void findTrack(MediaExtractor mediaExtractor, boolean z, boolean z2, float f, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    public static void getFileName(Uri uri, char c, String str, int i, short s) {
        double d = (42 * 210) + 210;
    }

    public static void getFileName(Uri uri, short s, int i, String str, char c) {
        double d = (42 * 210) + 210;
    }

    public static void getFileName(Uri uri, short s, String str, int i, char c) {
        double d = (42 * 210) + 210;
    }

    public static void getInstance(byte b, boolean z, short s, String str) {
        double d = (42 * 210) + 210;
    }

    public static void getInstance(String str, boolean z, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    public static void getInstance(short s, boolean z, String str, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void isGif(Uri uri, int i, String str, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void isGif(Uri uri, int i, short s, String str, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void isGif(Uri uri, String str, short s, byte b, int i) {
        double d = (42 * 210) + 210;
    }

    private void isNearToSensor(float f, short s, char c, byte b, boolean z) {
        double d = (42 * 210) + 210;
    }

    private void isNearToSensor(float f, short s, boolean z, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    private void isNearToSensor(float f, boolean z, char c, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    public static native int isOpusFile(String str);

    private static void isRecognizedFormat(int i, byte b, float f, String str, int i2) {
        double d = (42 * 210) + 210;
    }

    private static void isRecognizedFormat(int i, byte b, int i2, String str, float f) {
        double d = (42 * 210) + 210;
    }

    private static void isRecognizedFormat(int i, String str, float f, int i2, byte b) {
        double d = (42 * 210) + 210;
    }

    private void isSamePlayingMessage(MessageObject messageObject, byte b, int i, String str, short s) {
        double d = (42 * 210) + 210;
    }

    private void isSamePlayingMessage(MessageObject messageObject, short s, byte b, int i, String str) {
        double d = (42 * 210) + 210;
    }

    private void isSamePlayingMessage(MessageObject messageObject, short s, String str, byte b, int i) {
        double d = (42 * 210) + 210;
    }

    public static void isWebp(Uri uri, int i, short s, boolean z, float f) {
        double d = (42 * 210) + 210;
    }

    public static void isWebp(Uri uri, int i, boolean z, float f, short s) {
        double d = (42 * 210) + 210;
    }

    public static void isWebp(Uri uri, boolean z, int i, short s, float f) {
        double d = (42 * 210) + 210;
    }

    static void lambda$broadcastNewPhotos$29(int i, ArrayList arrayList, ArrayList arrayList2, Integer num, AlbumEntry albumEntry, AlbumEntry albumEntry2, AlbumEntry albumEntry3, char c, String str, short s, float f) {
        double d = (42 * 210) + 210;
    }

    static void lambda$broadcastNewPhotos$29(int i, ArrayList arrayList, ArrayList arrayList2, Integer num, AlbumEntry albumEntry, AlbumEntry albumEntry2, AlbumEntry albumEntry3, String str, char c, short s, float f) {
        double d = (42 * 210) + 210;
    }

    static void lambda$broadcastNewPhotos$29(int i, ArrayList arrayList, ArrayList arrayList2, Integer num, AlbumEntry albumEntry, AlbumEntry albumEntry2, AlbumEntry albumEntry3, String str, short s, char c, float f) {
        double d = (42 * 210) + 210;
    }

    static void lambda$checkGallery$0(int i, float f, short s, char c, int i2) {
        double d = (42 * 210) + 210;
    }

    static void lambda$checkGallery$0(int i, int i2, float f, char c, short s) {
        double d = (42 * 210) + 210;
    }

    static void lambda$checkGallery$0(int i, int i2, float f, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$loadGalleryPhotosAlbums$28(int i, String str, short s, char c, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void lambda$loadGalleryPhotosAlbums$28(int i, short s, String str, boolean z, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$loadGalleryPhotosAlbums$28(int i, boolean z, String str, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$24(AlertDialog alertDialog, int i, String str, short s, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$24(AlertDialog alertDialog, int i, String str, boolean z, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$24(AlertDialog alertDialog, int i, short s, boolean z, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$25(AlertDialog alertDialog, byte b, int i, float f, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$25(AlertDialog alertDialog, char c, int i, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$25(AlertDialog alertDialog, float f, int i, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$27(PhotoEntry photoEntry, PhotoEntry photoEntry2, byte b, String str, float f, int i) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$27(PhotoEntry photoEntry, PhotoEntry photoEntry2, int i, byte b, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$27(PhotoEntry photoEntry, PhotoEntry photoEntry2, String str, byte b, float f, int i) {
        double d = (42 * 210) + 210;
    }

    static void lambda$playMessage$10(MessageObject messageObject, File file, float f, char c, String str, short s) {
        double d = (42 * 210) + 210;
    }

    static void lambda$playMessage$10(MessageObject messageObject, File file, float f, char c, short s, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$playMessage$10(MessageObject messageObject, File file, float f, short s, String str, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$playMessage$11(MessageObject messageObject, File file, byte b, short s, String str, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void lambda$playMessage$11(MessageObject messageObject, File file, short s, byte b, String str, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void lambda$playMessage$11(MessageObject messageObject, File file, boolean z, String str, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void lambda$saveFile$23(boolean[] zArr, DialogInterface dialogInterface, short s, String str, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void lambda$saveFile$23(boolean[] zArr, DialogInterface dialogInterface, short s, boolean z, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$saveFile$23(boolean[] zArr, DialogInterface dialogInterface, boolean z, short s, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$saveFile$26(int i, String str, File file, boolean[] zArr, AlertDialog alertDialog, String str2, int i2, char c, boolean z, String str3) {
        double d = (42 * 210) + 210;
    }

    static void lambda$saveFile$26(int i, String str, File file, boolean[] zArr, AlertDialog alertDialog, String str2, String str3, int i2, boolean z, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$saveFile$26(int i, String str, File file, boolean[] zArr, AlertDialog alertDialog, String str2, boolean z, char c, int i2, String str3) {
        double d = (42 * 210) + 210;
    }

    public static void loadGalleryPhotosAlbums(int i, byte b, boolean z, short s, String str) {
        double d = (42 * 210) + 210;
    }

    public static void loadGalleryPhotosAlbums(int i, boolean z, byte b, short s, String str) {
        double d = (42 * 210) + 210;
    }

    public static void loadGalleryPhotosAlbums(int i, boolean z, String str, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    private void playNextMessageWithoutOrder(boolean z, float f, int i, boolean z2, String str) {
        double d = (42 * 210) + 210;
    }

    private void playNextMessageWithoutOrder(boolean z, int i, boolean z2, float f, String str) {
        double d = (42 * 210) + 210;
    }

    private void playNextMessageWithoutOrder(boolean z, String str, int i, boolean z2, float f) {
        double d = (42 * 210) + 210;
    }

    private void processMediaObserver(Uri uri, char c, short s, byte b, float f) {
        double d = (42 * 210) + 210;
    }

    private void processMediaObserver(Uri uri, char c, short s, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    private void processMediaObserver(Uri uri, float f, char c, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    private void readAndWriteTracks(MessageObject messageObject, MediaExtractor mediaExtractor, MP4Builder mP4Builder, MediaCodec.BufferInfo bufferInfo, long j, long j2, File file, boolean z, char c, boolean z2, short s, String str) {
        double d = (42 * 210) + 210;
    }

    private void readAndWriteTracks(MessageObject messageObject, MediaExtractor mediaExtractor, MP4Builder mP4Builder, MediaCodec.BufferInfo bufferInfo, long j, long j2, File file, boolean z, String str, boolean z2, char c, short s) {
        double d = (42 * 210) + 210;
    }

    private void readAndWriteTracks(MessageObject messageObject, MediaExtractor mediaExtractor, MP4Builder mP4Builder, MediaCodec.BufferInfo bufferInfo, long j, long j2, File file, boolean z, short s, char c, boolean z2, String str) {
        double d = (42 * 210) + 210;
    }

    public static void saveFile(String str, Context context, int i, String str2, String str3, int i2, boolean z, short s, String str4) {
        double d = (42 * 210) + 210;
    }

    public static void saveFile(String str, Context context, int i, String str2, String str3, String str4, short s, boolean z, int i2) {
        double d = (42 * 210) + 210;
    }

    public static void saveFile(String str, Context context, int i, String str2, String str3, boolean z, int i2, String str4, short s) {
        double d = (42 * 210) + 210;
    }

    public static void selectCodec(String str, byte b, boolean z, String str2, short s) {
        double d = (42 * 210) + 210;
    }

    public static void selectCodec(String str, String str2, short s, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void selectCodec(String str, boolean z, String str2, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void selectColorFormat(MediaCodecInfo mediaCodecInfo, String str, byte b, int i, short s, char c) {
        double d = (42 * 210) + 210;
    }

    public static void selectColorFormat(MediaCodecInfo mediaCodecInfo, String str, char c, short s, int i, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void selectColorFormat(MediaCodecInfo mediaCodecInfo, String str, int i, short s, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    private void setPlayerVolume(String str, boolean z, char c, short s) {
        double d = (42 * 210) + 210;
    }

    private void setPlayerVolume(short s, String str, boolean z, char c) {
        double d = (42 * 210) + 210;
    }

    private void setPlayerVolume(short s, boolean z, String str, char c) {
        double d = (42 * 210) + 210;
    }

    private void setUseFrontSpeaker(boolean z, int i, float f, char c, short s) {
        double d = (42 * 210) + 210;
    }

    private void setUseFrontSpeaker(boolean z, int i, short s, char c, float f) {
        double d = (42 * 210) + 210;
    }

    private void setUseFrontSpeaker(boolean z, short s, float f, int i, char c) {
        double d = (42 * 210) + 210;
    }

    private void startAudioAgain(boolean z, char c, float f, String str, short s) {
        double d = (42 * 210) + 210;
    }

    private void startAudioAgain(boolean z, char c, short s, String str, float f) {
        double d = (42 * 210) + 210;
    }

    private void startAudioAgain(boolean z, String str, short s, float f, char c) {
        double d = (42 * 210) + 210;
    }

    private void startProgressTimer(MessageObject messageObject, char c, byte b, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    private void startProgressTimer(MessageObject messageObject, float f, byte b, char c, boolean z) {
        double d = (42 * 210) + 210;
    }

    private void startProgressTimer(MessageObject messageObject, boolean z, float f, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    private native int startRecord(String str);

    private void startVideoConvertFromQueue(byte b, int i, String str, short s) {
        double d = (42 * 210) + 210;
    }

    private void startVideoConvertFromQueue(byte b, int i, short s, String str) {
        double d = (42 * 210) + 210;
    }

    private void startVideoConvertFromQueue(int i, String str, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    private void stopProgressTimer(float f, int i, String str, char c) {
        double d = (42 * 210) + 210;
    }

    private void stopProgressTimer(float f, String str, int i, char c) {
        double d = (42 * 210) + 210;
    }

    private void stopProgressTimer(int i, char c, float f, String str) {
        double d = (42 * 210) + 210;
    }

    private native void stopRecord();

    private void stopRecordingInternal(int i, boolean z, int i2, char c, float f, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    private void stopRecordingInternal(int i, boolean z, int i2, float f, char c, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    private void stopRecordingInternal(int i, boolean z, int i2, float f, char c, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    private void updateVideoState(MessageObject messageObject, int[] iArr, boolean z, boolean z2, int i, boolean z3, byte b, char c, int i2) {
        double d = (42 * 210) + 210;
    }

    private void updateVideoState(MessageObject messageObject, int[] iArr, boolean z, boolean z2, int i, boolean z3, char c, int i2, byte b) {
        double d = (42 * 210) + 210;
    }

    private void updateVideoState(MessageObject messageObject, int[] iArr, boolean z, boolean z2, int i, boolean z3, int i2, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    public native int writeFrame(ByteBuffer byteBuffer, int i);

    public native byte[] getWaveform(String str);

    public native byte[] getWaveform2(short[] sArr, int i);

    static long access$1400(MediaController x0) {
        if ((21 + 8) % 8 <= 0) {
        }
        return x0.recordStartTime;
    }

    static long access$1800(MediaController x0) {
        if ((18 + 16) % 16 <= 0) {
        }
        return x0.recordTimeCount;
    }

    static long access$2900(MediaController x0) {
        if ((15 + 1) % 1 <= 0) {
        }
        return x0.lastProgress;
    }

    static long access$400(MediaController x0) {
        if ((11 + 29) % 29 <= 0) {
        }
        return x0.samplesCount;
    }

    static {
        if ((1 + 8) % 8 <= 0) {
        }
        String[] strArr = new String[6];
        strArr[0] = "_id";
        strArr[1] = "bucket_id";
        strArr[2] = "bucket_display_name";
        strArr[3] = "_data";
        strArr[4] = Build.VERSION.SDK_INT > 28 ? "date_modified" : "datetaken";
        strArr[5] = "orientation";
        projectionPhotos = strArr;
        String[] strArr2 = new String[6];
        strArr2[0] = "_id";
        strArr2[1] = "bucket_id";
        strArr2[2] = "bucket_display_name";
        strArr2[3] = "_data";
        strArr2[4] = Build.VERSION.SDK_INT <= 28 ? "datetaken" : "date_modified";
        strArr2[5] = "duration";
        projectionVideo = strArr2;
        allMediaAlbums = new ArrayList<>();
        allPhotoAlbums = new ArrayList<>();
    }

    public static void checkGallery() {
        AlbumEntry albumEntry;
        if ((13 + 13) % 13 <= 0) {
        }
        if (Build.VERSION.SDK_INT < 24 || (albumEntry = allPhotosAlbumEntry) == null) {
            return;
        }
        int prevSize = albumEntry.photos.size();
        Utilities.globalQueue.postRunnable(new -$.Lambda.MediaController.I_WVVlo8SYNiUoS9ZwfQaJ4LaVM(prevSize), 2000L);
    }

    static void lambda$checkGallery$0(int r12) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaController.lambda$checkGallery$0(int):void");
    }

    public static MediaController getInstance() {
        if ((27 + 14) % 14 <= 0) {
        }
        MediaController localInstance = Instance;
        if (localInstance == null) {
            synchronized (MediaController.class) {
                localInstance = Instance;
                if (localInstance == null) {
                    MediaController mediaController = new MediaController();
                    localInstance = mediaController;
                    Instance = mediaController;
                }
            }
        }
        return localInstance;
    }

    public MediaController() {
        if ((8 + 22) % 22 <= 0) {
        }
        this.videoConvertSync = new Object();
        this.lastTimestamp = 0L;
        this.lastProximityValue = -100.0f;
        this.gravity = new float[3];
        this.gravityFast = new float[3];
        this.linearAcceleration = new float[3];
        this.audioFocus = 0;
        this.videoConvertQueue = new ArrayList<>();
        this.videoQueueSync = new Object();
        this.cancelCurrentVideoConversion = false;
        this.videoConvertFirstWrite = true;
        this.generatingWaveform = new HashMap<>();
        this.isPaused = false;
        this.audioPlayer = null;
        this.currentPlaybackSpeed = VOLUME_NORMAL;
        this.lastProgress = 0L;
        this.progressTimer = null;
        this.progressTimerSync = new Object();
        this.playlist = new ArrayList<>();
        this.shuffledPlaylist = new ArrayList<>();
        this.setLoadingRunnable = new 1(this);
        this.recordingGuid = -1;
        this.recordSamples = new short[1024];
        this.sync = new Object();
        this.recordBuffers = new ArrayList<>();
        this.recordBufferSize = 1280;
        this.recordRunnable = new Runnable() {
            @Override
            public void run() {
                throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaController.AnonymousClass2.run():void");
            }

            public void lambda$run$1$MediaController$2(ByteBuffer finalBuffer, boolean flush) {
                if ((25 + 4) % 4 <= 0) {
                }
                while (finalBuffer.hasRemaining()) {
                    int oldLimit = -1;
                    if (finalBuffer.remaining() > MediaController.this.fileBuffer.remaining()) {
                        oldLimit = finalBuffer.limit();
                        finalBuffer.limit(MediaController.this.fileBuffer.remaining() + finalBuffer.position());
                    }
                    MediaController.this.fileBuffer.put(finalBuffer);
                    if (MediaController.this.fileBuffer.position() == MediaController.this.fileBuffer.limit() || flush) {
                        MediaController mediaController = MediaController.this;
                        if (mediaController.writeFrame(mediaController.fileBuffer, !flush ? MediaController.this.fileBuffer.limit() : finalBuffer.position()) != 0) {
                            MediaController.this.fileBuffer.rewind();
                            MediaController mediaController2 = MediaController.this;
                            mediaController2.recordTimeCount = MediaController.access$1800(mediaController2) + ((MediaController.this.fileBuffer.limit() / 2) / 16);
                        }
                    }
                    if (oldLimit != -1) {
                        finalBuffer.limit(oldLimit);
                    }
                }
                MediaController.this.recordQueue.postRunnable(new -$.Lambda.MediaController.2.93tH16BmjN5EwaZ4Kio2kmyVaHc(this, finalBuffer));
            }

            public void lambda$null$0$MediaController$2(ByteBuffer finalBuffer) {
                MediaController.this.recordBuffers.add(finalBuffer);
            }

            public void lambda$run$2$MediaController$2(double amplitude) {
                if ((19 + 5) % 5 <= 0) {
                }
                NotificationCenter.getInstance(MediaController.this.recordingCurrentAccount).postNotificationName(NotificationCenter.recordProgressChanged, new Object[]{Integer.valueOf(MediaController.this.recordingGuid), Long.valueOf(System.currentTimeMillis() - MediaController.access$1400(MediaController.this)), Double.valueOf(amplitude)});
            }
        };
        DispatchQueue dispatchQueue = new DispatchQueue("recordQueue");
        this.recordQueue = dispatchQueue;
        dispatchQueue.setPriority(10);
        DispatchQueue dispatchQueue2 = new DispatchQueue("fileEncodingQueue");
        this.fileEncodingQueue = dispatchQueue2;
        dispatchQueue2.setPriority(10);
        this.recordQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                MediaController.this.lambda$new$1$MediaController();
            }
        });
        Utilities.globalQueue.postRunnable(new -$.Lambda.MediaController.auyfVGc4cpZNmibUTcwQalzOCJk(this));
        this.fileBuffer = ByteBuffer.allocateDirect(1920);
        AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.4rP59jR84HGRCCCZ5ighIWqgJy8(this));
        String[] strArr = new String[7];
        strArr[0] = "_data";
        strArr[1] = "_display_name";
        strArr[2] = "bucket_display_name";
        strArr[3] = Build.VERSION.SDK_INT > 28 ? "date_modified" : "datetaken";
        strArr[4] = "title";
        strArr[5] = "width";
        strArr[6] = "height";
        this.mediaProjections = strArr;
        ContentResolver contentResolver = ApplicationLoader.applicationContext.getContentResolver();
        try {
            contentResolver.registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, true, new GalleryObserverExternal(this));
        } catch (Exception e) {
            FileLog.e(e);
        }
        try {
            contentResolver.registerContentObserver(MediaStore.Images.Media.INTERNAL_CONTENT_URI, true, new GalleryObserverInternal(this));
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        try {
            contentResolver.registerContentObserver(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, true, new GalleryObserverExternal(this));
        } catch (Exception e3) {
            FileLog.e(e3);
        }
        try {
            contentResolver.registerContentObserver(MediaStore.Video.Media.INTERNAL_CONTENT_URI, true, new GalleryObserverInternal(this));
        } catch (Exception e4) {
            FileLog.e(e4);
        }
    }

    public void lambda$new$1$MediaController() {
        if ((28 + 16) % 16 <= 0) {
        }
        try {
            int minBufferSize = AudioRecord.getMinBufferSize(16000, 16, 2);
            this.recordBufferSize = minBufferSize;
            if (minBufferSize <= 0) {
                this.recordBufferSize = 1280;
            }
            for (int a = 0; a < 5; a++) {
                ByteBuffer buffer = ByteBuffer.allocateDirect(4096);
                buffer.order(ByteOrder.nativeOrder());
                this.recordBuffers.add(buffer);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    public void lambda$new$2$MediaController() {
        if ((21 + 32) % 32 <= 0) {
        }
        try {
            this.currentPlaybackSpeed = MessagesController.getGlobalMainSettings().getFloat("playbackSpeed", VOLUME_NORMAL);
            SensorManager sensorManager = (SensorManager) ApplicationLoader.applicationContext.getSystemService("sensor");
            this.sensorManager = sensorManager;
            this.linearSensor = sensorManager.getDefaultSensor(10);
            Sensor defaultSensor = this.sensorManager.getDefaultSensor(9);
            this.gravitySensor = defaultSensor;
            if (this.linearSensor == null || defaultSensor == null) {
                if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("gravity or linear sensor not found");
                }
                this.accelerometerSensor = this.sensorManager.getDefaultSensor(1);
                this.linearSensor = null;
                this.gravitySensor = null;
            }
            this.proximitySensor = this.sensorManager.getDefaultSensor(8);
            PowerManager powerManager = (PowerManager) ApplicationLoader.applicationContext.getSystemService("power");
            this.proximityWakeLock = powerManager.newWakeLock(32, "proximity");
        } catch (Exception e) {
            FileLog.e(e);
        }
        try {
            PhoneStateListener phoneStateListener = new 3(this);
            TelephonyManager mgr = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
            if (mgr != null) {
                mgr.listen(phoneStateListener, 32);
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void lambda$new$3$MediaController() {
        if ((2 + 28) % 28 <= 0) {
        }
        for (int a = 0; a < 3; a++) {
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.fileDidLoad);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.httpFileDidLoad);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.didReceiveNewMessages);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.messagesDeleted);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.removeAllMessagesFromDialog);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.musicDidLoad);
            NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.playerDidStartPlaying);
        }
    }

    @Override
    public void onAudioFocusChange(int focusChange) {
        if ((19 + 8) % 8 <= 0) {
        }
        if (focusChange == -1) {
            if (isPlayingMessage(getPlayingMessageObject()) && !isMessagePaused()) {
                lambda$startAudioAgain$5$MediaController(this.playingMessageObject);
            }
            this.hasAudioFocus = 0;
            this.audioFocus = 0;
        } else if (focusChange == 1) {
            this.audioFocus = 2;
            if (this.resumeAudioOnFocusGain) {
                this.resumeAudioOnFocusGain = false;
                if (isPlayingMessage(getPlayingMessageObject()) && isMessagePaused()) {
                    playMessage(getPlayingMessageObject());
                }
            }
        } else if (focusChange == -3) {
            this.audioFocus = 1;
        } else if (focusChange == -2) {
            this.audioFocus = 0;
            if (isPlayingMessage(getPlayingMessageObject()) && !isMessagePaused()) {
                lambda$startAudioAgain$5$MediaController(this.playingMessageObject);
                this.resumeAudioOnFocusGain = true;
            }
        }
        setPlayerVolume();
    }

    private void setPlayerVolume() {
        float volume;
        if ((3 + 25) % 25 <= 0) {
        }
        try {
            if (this.audioFocus != 1) {
                volume = VOLUME_NORMAL;
            } else {
                volume = VOLUME_DUCK;
            }
            if (this.audioPlayer != null) {
                this.audioPlayer.setVolume(volume);
            } else if (this.videoPlayer != null) {
                this.videoPlayer.setVolume(volume);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    private void startProgressTimer(MessageObject currentPlayingMessageObject) {
        if ((9 + 7) % 7 <= 0) {
        }
        synchronized (this.progressTimerSync) {
            if (this.progressTimer != null) {
                try {
                    this.progressTimer.cancel();
                    this.progressTimer = null;
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
            currentPlayingMessageObject.getFileName();
            Timer timer = new Timer();
            this.progressTimer = timer;
            timer.schedule((TimerTask) new 4(this, currentPlayingMessageObject), 0L, 17L);
        }
    }

    private void stopProgressTimer() {
        if ((1 + 13) % 13 <= 0) {
        }
        synchronized (this.progressTimerSync) {
            if (this.progressTimer != null) {
                try {
                    this.progressTimer.cancel();
                    this.progressTimer = null;
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
        }
    }

    public void cleanup() {
        if ((23 + 32) % 32 <= 0) {
        }
        cleanupPlayer(false, true);
        this.audioInfo = null;
        this.playMusicAgain = false;
        for (int a = 0; a < 3; a++) {
            DownloadController.getInstance(a).cleanup();
        }
        this.videoConvertQueue.clear();
        this.playlist.clear();
        this.shuffledPlaylist.clear();
        this.generatingWaveform.clear();
        this.voiceMessagesPlaylist = null;
        this.voiceMessagesPlaylistMap = null;
        cancelVideoConvert(null);
    }

    public void startMediaObserver() {
        if ((12 + 4) % 4 <= 0) {
        }
        ApplicationLoader.applicationHandler.removeCallbacks(this.stopMediaObserverRunnable);
        this.startObserverToken++;
        try {
            if (this.internalObserver == null) {
                ContentResolver contentResolver = ApplicationLoader.applicationContext.getContentResolver();
                Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
                ExternalObserver externalObserver = new ExternalObserver(this);
                this.externalObserver = externalObserver;
                contentResolver.registerContentObserver(uri, false, externalObserver);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
        try {
            if (this.externalObserver == null) {
                ContentResolver contentResolver2 = ApplicationLoader.applicationContext.getContentResolver();
                Uri uri2 = MediaStore.Images.Media.INTERNAL_CONTENT_URI;
                InternalObserver internalObserver = new InternalObserver(this);
                this.internalObserver = internalObserver;
                contentResolver2.registerContentObserver(uri2, false, internalObserver);
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void stopMediaObserver() {
        if ((26 + 14) % 14 <= 0) {
        }
        if (this.stopMediaObserverRunnable == null) {
            this.stopMediaObserverRunnable = new StopMediaObserverRunnable(this, (1) null);
        }
        this.stopMediaObserverRunnable.currentObserverToken = this.startObserverToken;
        ApplicationLoader.applicationHandler.postDelayed(this.stopMediaObserverRunnable, 5000L);
    }

    public void processMediaObserver(android.net.Uri r17) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaController.processMediaObserver(android.net.Uri):void");
    }

    public void lambda$processMediaObserver$4$MediaController(ArrayList screenshotDates) {
        if ((11 + 14) % 14 <= 0) {
        }
        NotificationCenter.getInstance(this.lastChatAccount).postNotificationName(NotificationCenter.screenshotTook, new Object[0]);
        checkScreenshots(screenshotDates);
    }

    private void checkScreenshots(ArrayList<Long> dates) {
        if ((8 + 28) % 28 <= 0) {
        }
        if (dates == null || dates.isEmpty() || this.lastChatEnterTime == 0) {
            return;
        }
        if (this.lastUser == null && !(this.lastSecretChat instanceof TLRPC.TL_encryptedChat)) {
            return;
        }
        boolean send = false;
        for (int a = 0; a < dates.size(); a++) {
            Long date = dates.get(a);
            if ((this.lastMediaCheckTime == 0 || date.longValue() > this.lastMediaCheckTime) && date.longValue() >= this.lastChatEnterTime && (this.lastChatLeaveTime == 0 || date.longValue() <= this.lastChatLeaveTime + 2000)) {
                this.lastMediaCheckTime = Math.max(this.lastMediaCheckTime, date.longValue());
                send = true;
            }
        }
        if (send) {
            if (this.lastSecretChat != null) {
                SecretChatHelper.getInstance(this.lastChatAccount).sendScreenshotMessage(this.lastSecretChat, this.lastChatVisibleMessages, (TLRPC.Message) null);
            } else {
                SendMessagesHelper.getInstance(this.lastChatAccount).sendScreenshotMessage(this.lastUser, this.lastMessageId, (TLRPC.Message) null);
            }
        }
    }

    public void setLastVisibleMessageIds(int account, long enterTime, long leaveTime, TLRPC.User user, TLRPC.EncryptedChat encryptedChat, ArrayList<Long> visibleMessages, int visibleMessage) {
        this.lastChatEnterTime = enterTime;
        this.lastChatLeaveTime = leaveTime;
        this.lastChatAccount = account;
        this.lastSecretChat = encryptedChat;
        this.lastUser = user;
        this.lastMessageId = visibleMessage;
        this.lastChatVisibleMessages = visibleMessages;
    }

    @Override
    public void didReceivedNotification(int id, int account, Object... args) {
        MessageObject messageObject;
        ArrayList<MessageObject> arrayList;
        if ((7 + 21) % 21 <= 0) {
        }
        if (id == NotificationCenter.fileDidLoad || id == NotificationCenter.httpFileDidLoad) {
            String fileName = (String) args[0];
            if (this.downloadingCurrentMessage && (messageObject = this.playingMessageObject) != null && messageObject.currentAccount == account) {
                String file = FileLoader.getAttachFileName(this.playingMessageObject.getDocument());
                if (file.equals(fileName)) {
                    this.playMusicAgain = true;
                    playMessage(this.playingMessageObject);
                    return;
                }
                return;
            }
            return;
        }
        if (id == NotificationCenter.messagesDeleted) {
            boolean scheduled = ((Boolean) args[2]).booleanValue();
            if (scheduled) {
                return;
            }
            int channelId = ((Integer) args[1]).intValue();
            ArrayList<Integer> markAsDeletedMessages = (ArrayList) args[0];
            MessageObject messageObject2 = this.playingMessageObject;
            if (messageObject2 != null && channelId == messageObject2.messageOwner.to_id.channel_id && markAsDeletedMessages.contains(Integer.valueOf(this.playingMessageObject.getId()))) {
                cleanupPlayer(true, true);
            }
            ArrayList<MessageObject> arrayList2 = this.voiceMessagesPlaylist;
            if (arrayList2 != null && !arrayList2.isEmpty()) {
                MessageObject messageObject3 = this.voiceMessagesPlaylist.get(0);
                if (channelId == messageObject3.messageOwner.to_id.channel_id) {
                    for (int a = 0; a < markAsDeletedMessages.size(); a++) {
                        Integer key = markAsDeletedMessages.get(a);
                        MessageObject messageObject4 = this.voiceMessagesPlaylistMap.get(key.intValue());
                        MessageObject messageObject5 = messageObject4;
                        this.voiceMessagesPlaylistMap.remove(key.intValue());
                        if (messageObject5 != null) {
                            this.voiceMessagesPlaylist.remove(messageObject5);
                        }
                    }
                    return;
                }
                return;
            }
            return;
        }
        if (id == NotificationCenter.removeAllMessagesFromDialog) {
            long did = ((Long) args[0]).longValue();
            MessageObject messageObject6 = this.playingMessageObject;
            if (messageObject6 != null && messageObject6.getDialogId() == did) {
                cleanupPlayer(false, true);
                return;
            }
            return;
        }
        if (id == NotificationCenter.musicDidLoad) {
            long did2 = ((Long) args[0]).longValue();
            MessageObject messageObject7 = this.playingMessageObject;
            if (messageObject7 != null && messageObject7.isMusic() && this.playingMessageObject.getDialogId() == did2 && !this.playingMessageObject.scheduled) {
                ArrayList<MessageObject> arrayList3 = (ArrayList) args[1];
                this.playlist.addAll(0, arrayList3);
                if (SharedConfig.shuffleMusic) {
                    buildShuffledPlayList();
                    this.currentPlaylistNum = 0;
                    return;
                } else {
                    this.currentPlaylistNum += arrayList3.size();
                    return;
                }
            }
            return;
        }
        if (id == NotificationCenter.didReceiveNewMessages) {
            boolean scheduled2 = ((Boolean) args[2]).booleanValue();
            if (!scheduled2 && (arrayList = this.voiceMessagesPlaylist) != null && !arrayList.isEmpty()) {
                MessageObject messageObject8 = this.voiceMessagesPlaylist.get(0);
                long did3 = ((Long) args[0]).longValue();
                if (did3 == messageObject8.getDialogId()) {
                    ArrayList<MessageObject> arr = (ArrayList) args[1];
                    for (int a2 = 0; a2 < arr.size(); a2++) {
                        MessageObject messageObject9 = arr.get(a2);
                        MessageObject messageObject10 = messageObject9;
                        if ((messageObject10.isVoice() || messageObject10.isRoundVideo()) && (!this.voiceMessagesPlaylistUnread || (messageObject10.isContentUnread() && !messageObject10.isOut()))) {
                            this.voiceMessagesPlaylist.add(messageObject10);
                            this.voiceMessagesPlaylistMap.put(messageObject10.getId(), messageObject10);
                        }
                    }
                    return;
                }
                return;
            }
            return;
        }
        if (id == NotificationCenter.playerDidStartPlaying) {
            VideoPlayer p = (VideoPlayer) args[0];
            if (!getInstance().isCurrentPlayer(p)) {
                getInstance().lambda$startAudioAgain$5$MediaController(getInstance().getPlayingMessageObject());
            }
        }
    }

    protected boolean isRecordingAudio() {
        return (this.recordStartRunnable == null && this.recordingAudio == null) ? false : true;
    }

    private boolean isNearToSensor(float value) {
        return value < 5.0f && value != this.proximitySensor.getMaximumRange();
    }

    public boolean isRecordingOrListeningByProximity() {
        MessageObject messageObject;
        return this.proximityTouched && (isRecordingAudio() || ((messageObject = this.playingMessageObject) != null && (messageObject.isVoice() || this.playingMessageObject.isRoundVideo())));
    }

    @Override
    public void onSensorChanged(SensorEvent event) {
        boolean goodValue;
        int sign;
        int i;
        PowerManager.WakeLock wakeLock;
        PowerManager.WakeLock wakeLock2;
        PowerManager.WakeLock wakeLock3;
        PowerManager.WakeLock wakeLock4;
        PowerManager.WakeLock wakeLock5;
        if ((19 + 8) % 8 <= 0) {
        }
        if (this.sensorsStarted && VoIPService.getSharedInstance() == null) {
            if (event.sensor != this.proximitySensor) {
                if (event.sensor == this.accelerometerSensor) {
                    double alpha = this.lastTimestamp == 0 ? 0.9800000190734863d : 1.0d / (((event.timestamp - this.lastTimestamp) / 1.0E9d) + 1.0d);
                    this.lastTimestamp = event.timestamp;
                    this.gravity[0] = (float) ((r12[0] * alpha) + ((1.0d - alpha) * event.values[0]));
                    this.gravity[1] = (float) ((r8[1] * alpha) + ((1.0d - alpha) * event.values[1]));
                    this.gravity[2] = (float) ((r3[2] * alpha) + ((1.0d - alpha) * event.values[2]));
                    this.gravityFast[0] = (this.gravity[0] * 0.8f) + (event.values[0] * 0.19999999f);
                    this.gravityFast[1] = (this.gravity[1] * 0.8f) + (event.values[1] * 0.19999999f);
                    this.gravityFast[2] = (this.gravity[2] * 0.8f) + (event.values[2] * 0.19999999f);
                    this.linearAcceleration[0] = event.values[0] - this.gravity[0];
                    this.linearAcceleration[1] = event.values[1] - this.gravity[1];
                    this.linearAcceleration[2] = event.values[2] - this.gravity[2];
                } else if (event.sensor != this.linearSensor) {
                    if (event.sensor == this.gravitySensor) {
                        float[] fArr = this.gravityFast;
                        float[] fArr2 = this.gravity;
                        float f = event.values[0];
                        fArr2[0] = f;
                        fArr[0] = f;
                        float[] fArr3 = this.gravityFast;
                        float[] fArr4 = this.gravity;
                        float f2 = event.values[1];
                        fArr4[1] = f2;
                        fArr3[1] = f2;
                        float[] fArr5 = this.gravityFast;
                        float[] fArr6 = this.gravity;
                        float f3 = event.values[2];
                        fArr6[2] = f3;
                        fArr5[2] = f3;
                    }
                } else {
                    this.linearAcceleration[0] = event.values[0];
                    this.linearAcceleration[1] = event.values[1];
                    this.linearAcceleration[2] = event.values[2];
                }
            } else {
                if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("proximity changed to " + event.values[0] + " max value = " + this.proximitySensor.getMaximumRange());
                }
                float f4 = this.lastProximityValue;
                if (f4 == -100.0f) {
                    this.lastProximityValue = event.values[0];
                } else if (f4 != event.values[0]) {
                    this.proximityHasDifferentValues = true;
                }
                if (this.proximityHasDifferentValues) {
                    this.proximityTouched = isNearToSensor(event.values[0]);
                }
            }
            if (event.sensor == this.linearSensor || event.sensor == this.gravitySensor || event.sensor == this.accelerometerSensor) {
                float[] fArr7 = this.gravity;
                float f5 = fArr7[0];
                float[] fArr8 = this.linearAcceleration;
                float val = (f5 * fArr8[0]) + (fArr7[1] * fArr8[1]) + (fArr7[2] * fArr8[2]);
                if (this.raisedToBack != 6 && ((val > 0.0f && this.previousAccValue > 0.0f) || (val < 0.0f && this.previousAccValue < 0.0f))) {
                    if (val > 0.0f) {
                        goodValue = val > 15.0f;
                        sign = 1;
                    } else {
                        goodValue = val < -15.0f;
                        sign = 2;
                    }
                    int i2 = this.raisedToTopSign;
                    if (i2 != 0 && i2 != sign) {
                        if (this.raisedToTop == 6 && goodValue) {
                            int i3 = this.raisedToBack;
                            if (i3 < 6) {
                                int i4 = i3 + 1;
                                this.raisedToBack = i4;
                                if (i4 == 6) {
                                    this.raisedToTop = 0;
                                    this.raisedToTopSign = 0;
                                    this.countLess = 0;
                                    this.timeSinceRaise = System.currentTimeMillis();
                                    if (BuildVars.LOGS_ENABLED && BuildVars.DEBUG_PRIVATE_VERSION) {
                                        FileLog.d("motion detected");
                                    }
                                }
                            }
                        } else {
                            if (!goodValue) {
                                this.countLess++;
                            }
                            if (this.countLess == 10 || this.raisedToTop != 6 || this.raisedToBack != 0) {
                                this.raisedToTop = 0;
                                this.raisedToTopSign = 0;
                                this.raisedToBack = 0;
                                this.countLess = 0;
                            }
                        }
                    } else if (goodValue && this.raisedToBack == 0 && ((i = this.raisedToTopSign) == 0 || i == sign)) {
                        int i5 = this.raisedToTop;
                        if (i5 < 6 && !this.proximityTouched) {
                            this.raisedToTopSign = sign;
                            int i6 = i5 + 1;
                            this.raisedToTop = i6;
                            if (i6 == 6) {
                                this.countLess = 0;
                            }
                        }
                    } else {
                        if (!goodValue) {
                            this.countLess++;
                        }
                        if (this.raisedToTopSign != sign || this.countLess == 10 || this.raisedToTop != 6 || this.raisedToBack != 0) {
                            this.raisedToBack = 0;
                            this.raisedToTop = 0;
                            this.raisedToTopSign = 0;
                            this.countLess = 0;
                        }
                    }
                }
                this.previousAccValue = val;
                float[] fArr9 = this.gravityFast;
                this.accelerometerVertical = fArr9[1] > 2.5f && Math.abs(fArr9[2]) < 4.0f && Math.abs(this.gravityFast[0]) > 1.5f;
            }
            if (this.raisedToBack == 6 && this.accelerometerVertical && this.proximityTouched && !NotificationsController.audioManager.isWiredHeadsetOn()) {
                if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("sensor values reached");
                }
                if (this.playingMessageObject == null && this.recordStartRunnable == null && this.recordingAudio == null && !PhotoViewer.getInstance().isVisible() && ApplicationLoader.isScreenOn && !this.inputFieldHasText && this.allowStartRecord && this.raiseChat != null && !this.callInProgress) {
                    if (!this.raiseToEarRecord) {
                        if (BuildVars.LOGS_ENABLED) {
                            FileLog.d("start record");
                        }
                        this.useFrontSpeaker = true;
                        if (!this.raiseChat.playFirstUnreadVoiceMessage()) {
                            this.raiseToEarRecord = true;
                            this.useFrontSpeaker = false;
                            startRecording(this.raiseChat.getCurrentAccount(), this.raiseChat.getDialogId(), null, this.raiseChat.getClassGuid());
                        }
                        if (this.useFrontSpeaker) {
                            setUseFrontSpeaker(true);
                        }
                        this.ignoreOnPause = true;
                        if (this.proximityHasDifferentValues && (wakeLock5 = this.proximityWakeLock) != null && !wakeLock5.isHeld()) {
                            this.proximityWakeLock.acquire();
                        }
                    }
                } else {
                    MessageObject messageObject = this.playingMessageObject;
                    if (messageObject != null && ((messageObject.isVoice() || this.playingMessageObject.isRoundVideo()) && !this.useFrontSpeaker)) {
                        if (BuildVars.LOGS_ENABLED) {
                            FileLog.d("start listen");
                        }
                        if (this.proximityHasDifferentValues && (wakeLock4 = this.proximityWakeLock) != null && !wakeLock4.isHeld()) {
                            this.proximityWakeLock.acquire();
                        }
                        setUseFrontSpeaker(true);
                        startAudioAgain(false);
                        this.ignoreOnPause = true;
                    }
                }
                this.raisedToBack = 0;
                this.raisedToTop = 0;
                this.raisedToTopSign = 0;
                this.countLess = 0;
            } else {
                boolean z = this.proximityTouched;
                if (z) {
                    if (this.playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && ((this.playingMessageObject.isVoice() || this.playingMessageObject.isRoundVideo()) && !this.useFrontSpeaker)) {
                        if (BuildVars.LOGS_ENABLED) {
                            FileLog.d("start listen by proximity only");
                        }
                        if (this.proximityHasDifferentValues && (wakeLock3 = this.proximityWakeLock) != null && !wakeLock3.isHeld()) {
                            this.proximityWakeLock.acquire();
                        }
                        setUseFrontSpeaker(true);
                        startAudioAgain(false);
                        this.ignoreOnPause = true;
                    }
                } else if (!z) {
                    if (this.raiseToEarRecord) {
                        if (BuildVars.LOGS_ENABLED) {
                            FileLog.d("stop record");
                        }
                        stopRecording(2, false, 0);
                        this.raiseToEarRecord = false;
                        this.ignoreOnPause = false;
                        if (this.proximityHasDifferentValues && (wakeLock2 = this.proximityWakeLock) != null && wakeLock2.isHeld()) {
                            this.proximityWakeLock.release();
                        }
                    } else if (this.useFrontSpeaker) {
                        if (BuildVars.LOGS_ENABLED) {
                            FileLog.d("stop listen");
                        }
                        this.useFrontSpeaker = false;
                        startAudioAgain(true);
                        this.ignoreOnPause = false;
                        if (this.proximityHasDifferentValues && (wakeLock = this.proximityWakeLock) != null && wakeLock.isHeld()) {
                            this.proximityWakeLock.release();
                        }
                    }
                }
            }
            if (this.timeSinceRaise != 0 && this.raisedToBack == 6 && Math.abs(System.currentTimeMillis() - this.timeSinceRaise) > 1000) {
                this.raisedToBack = 0;
                this.raisedToTop = 0;
                this.raisedToTopSign = 0;
                this.countLess = 0;
                this.timeSinceRaise = 0L;
            }
        }
    }

    private void setUseFrontSpeaker(boolean value) {
        if ((22 + 10) % 10 <= 0) {
        }
        this.useFrontSpeaker = value;
        AudioManager audioManager = NotificationsController.audioManager;
        if (this.useFrontSpeaker) {
            audioManager.setBluetoothScoOn(false);
            audioManager.setSpeakerphoneOn(false);
        } else {
            audioManager.setSpeakerphoneOn(true);
        }
    }

    public void startRecordingIfFromSpeaker() {
        ChatActivity chatActivity;
        if ((25 + 30) % 30 <= 0) {
        }
        if (!this.useFrontSpeaker || (chatActivity = this.raiseChat) == null || !this.allowStartRecord) {
            return;
        }
        this.raiseToEarRecord = true;
        startRecording(chatActivity.getCurrentAccount(), this.raiseChat.getDialogId(), null, this.raiseChat.getClassGuid());
        this.ignoreOnPause = true;
    }

    private void startAudioAgain(boolean paused) {
        if ((14 + 8) % 8 <= 0) {
        }
        MessageObject messageObject = this.playingMessageObject;
        if (messageObject == null) {
            return;
        }
        NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.audioRouteChanged, new Object[]{Boolean.valueOf(this.useFrontSpeaker)});
        VideoPlayer videoPlayer = this.videoPlayer;
        if (videoPlayer != null) {
            videoPlayer.setStreamType(this.useFrontSpeaker ? 0 : 3);
            if (!paused) {
                this.videoPlayer.play();
                return;
            } else {
                lambda$startAudioAgain$5$MediaController(this.playingMessageObject);
                return;
            }
        }
        boolean post = this.audioPlayer != null;
        MessageObject currentMessageObject = this.playingMessageObject;
        float progress = this.playingMessageObject.audioProgress;
        cleanupPlayer(false, true);
        currentMessageObject.audioProgress = progress;
        playMessage(currentMessageObject);
        if (paused) {
            if (post) {
                AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.FYhA59GMgPD3inENsU6XQM9rIOQ(this, currentMessageObject), 100L);
            } else {
                lambda$startAudioAgain$5$MediaController(currentMessageObject);
            }
        }
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
    }

    public void setInputFieldHasText(boolean value) {
        this.inputFieldHasText = value;
    }

    public void setAllowStartRecord(boolean value) {
        this.allowStartRecord = value;
    }

    public void startRaiseToEarSensors(ChatActivity chatActivity) {
        if ((18 + 23) % 23 <= 0) {
        }
        if (chatActivity != null) {
            if ((this.accelerometerSensor == null && (this.gravitySensor == null || this.linearAcceleration == null)) || this.proximitySensor == null) {
                return;
            }
            this.raiseChat = chatActivity;
            if (!SharedConfig.raiseToSpeak) {
                MessageObject messageObject = this.playingMessageObject;
                if (messageObject == null) {
                    return;
                }
                if (!messageObject.isVoice() && !this.playingMessageObject.isRoundVideo()) {
                    return;
                }
            }
            if (!this.sensorsStarted) {
                float[] fArr = this.gravity;
                fArr[2] = 0.0f;
                fArr[1] = 0.0f;
                fArr[0] = 0.0f;
                float[] fArr2 = this.linearAcceleration;
                fArr2[2] = 0.0f;
                fArr2[1] = 0.0f;
                fArr2[0] = 0.0f;
                float[] fArr3 = this.gravityFast;
                fArr3[2] = 0.0f;
                fArr3[1] = 0.0f;
                fArr3[0] = 0.0f;
                this.lastTimestamp = 0L;
                this.previousAccValue = 0.0f;
                this.raisedToTop = 0;
                this.raisedToTopSign = 0;
                this.countLess = 0;
                this.raisedToBack = 0;
                Utilities.globalQueue.postRunnable(new -$.Lambda.MediaController.4vswW9PQ_GuxdJBwSIPBcWT7hXg(this));
                this.sensorsStarted = true;
            }
        }
    }

    public void lambda$startRaiseToEarSensors$6$MediaController() {
        if ((4 + 18) % 18 <= 0) {
        }
        Sensor sensor = this.gravitySensor;
        if (sensor != null) {
            this.sensorManager.registerListener(this, sensor, 30000);
        }
        Sensor sensor2 = this.linearSensor;
        if (sensor2 != null) {
            this.sensorManager.registerListener(this, sensor2, 30000);
        }
        Sensor sensor3 = this.accelerometerSensor;
        if (sensor3 != null) {
            this.sensorManager.registerListener(this, sensor3, 30000);
        }
        this.sensorManager.registerListener(this, this.proximitySensor, 3);
    }

    public void stopRaiseToEarSensors(ChatActivity chatActivity, boolean fromChat) {
        PowerManager.WakeLock wakeLock;
        if ((24 + 27) % 27 <= 0) {
        }
        if (this.ignoreOnPause) {
            this.ignoreOnPause = false;
            return;
        }
        stopRecording(fromChat ? 2 : 0, false, 0);
        if (!this.sensorsStarted || this.ignoreOnPause) {
            return;
        }
        if ((this.accelerometerSensor == null && (this.gravitySensor == null || this.linearAcceleration == null)) || this.proximitySensor == null || this.raiseChat != chatActivity) {
            return;
        }
        this.raiseChat = null;
        this.sensorsStarted = false;
        this.accelerometerVertical = false;
        this.proximityTouched = false;
        this.raiseToEarRecord = false;
        this.useFrontSpeaker = false;
        Utilities.globalQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                MediaController.this.lambda$stopRaiseToEarSensors$7$MediaController();
            }
        });
        if (this.proximityHasDifferentValues && (wakeLock = this.proximityWakeLock) != null && wakeLock.isHeld()) {
            this.proximityWakeLock.release();
        }
    }

    public void lambda$stopRaiseToEarSensors$7$MediaController() {
        if ((14 + 29) % 29 <= 0) {
        }
        Sensor sensor = this.linearSensor;
        if (sensor != null) {
            this.sensorManager.unregisterListener(this, sensor);
        }
        Sensor sensor2 = this.gravitySensor;
        if (sensor2 != null) {
            this.sensorManager.unregisterListener(this, sensor2);
        }
        Sensor sensor3 = this.accelerometerSensor;
        if (sensor3 != null) {
            this.sensorManager.unregisterListener(this, sensor3);
        }
        this.sensorManager.unregisterListener(this, this.proximitySensor);
    }

    public void cleanupPlayer(boolean notify, boolean stopService) {
        cleanupPlayer(notify, stopService, false, false);
    }

    public void cleanupPlayer(boolean notify, boolean stopService, boolean byVoiceEnd, boolean transferPlayerToPhotoViewer) {
        PipRoundVideoView pipRoundVideoView;
        if ((21 + 20) % 20 <= 0) {
        }
        VideoPlayer videoPlayer = this.audioPlayer;
        if (videoPlayer != null) {
            try {
                videoPlayer.releasePlayer(true);
            } catch (Exception e) {
                FileLog.e(e);
            }
            this.audioPlayer = null;
        } else {
            VideoPlayer videoPlayer2 = this.videoPlayer;
            if (videoPlayer2 != null) {
                this.currentAspectRatioFrameLayout = null;
                this.currentTextureViewContainer = null;
                this.currentAspectRatioFrameLayoutReady = false;
                this.isDrawingWasReady = false;
                this.currentTextureView = null;
                this.goingToShowMessageObject = null;
                if (transferPlayerToPhotoViewer) {
                    PhotoViewer.getInstance().injectVideoPlayer(this.videoPlayer);
                    MessageObject messageObject = this.playingMessageObject;
                    this.goingToShowMessageObject = messageObject;
                    NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingGoingToStop, new Object[]{this.playingMessageObject, true});
                } else {
                    long position = videoPlayer2.getCurrentPosition();
                    MessageObject messageObject2 = this.playingMessageObject;
                    if (messageObject2 != null && messageObject2.isVideo() && position > 0 && position != -9223372036854775807L) {
                        this.playingMessageObject.audioProgressMs = (int) position;
                        NotificationCenter.getInstance(this.playingMessageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingGoingToStop, new Object[]{this.playingMessageObject, false});
                    }
                    this.videoPlayer.releasePlayer(true);
                    this.videoPlayer = null;
                }
                try {
                    this.baseActivity.getWindow().clearFlags(128);
                } catch (Exception e2) {
                    FileLog.e(e2);
                }
                if (this.playingMessageObject != null && !transferPlayerToPhotoViewer) {
                    AndroidUtilities.cancelRunOnUIThread(this.setLoadingRunnable);
                    FileLoader.getInstance(this.playingMessageObject.currentAccount).removeLoadingVideo(this.playingMessageObject.getDocument(), true, false);
                }
            }
        }
        stopProgressTimer();
        this.lastProgress = 0L;
        this.isPaused = false;
        if (!this.useFrontSpeaker && !SharedConfig.raiseToSpeak) {
            ChatActivity chat = this.raiseChat;
            stopRaiseToEarSensors(this.raiseChat, false);
            this.raiseChat = chat;
        }
        MessageObject messageObject3 = this.playingMessageObject;
        if (messageObject3 != null) {
            if (this.downloadingCurrentMessage) {
                FileLoader.getInstance(messageObject3.currentAccount).cancelLoadFile(this.playingMessageObject.getDocument());
            }
            MessageObject lastFile = this.playingMessageObject;
            if (notify) {
                this.playingMessageObject.resetPlayingProgress();
                NotificationCenter.getInstance(lastFile.currentAccount).postNotificationName(NotificationCenter.messagePlayingProgressDidChanged, new Object[]{Integer.valueOf(this.playingMessageObject.getId()), 0});
            }
            this.playingMessageObject = null;
            this.downloadingCurrentMessage = false;
            if (notify) {
                NotificationsController.audioManager.abandonAudioFocus(this);
                this.hasAudioFocus = 0;
                int index = -1;
                ArrayList<MessageObject> arrayList = this.voiceMessagesPlaylist;
                if (arrayList != null) {
                    if (byVoiceEnd) {
                        int indexOf = arrayList.indexOf(lastFile);
                        index = indexOf;
                        if (indexOf >= 0) {
                            this.voiceMessagesPlaylist.remove(index);
                            this.voiceMessagesPlaylistMap.remove(lastFile.getId());
                            if (this.voiceMessagesPlaylist.isEmpty()) {
                                this.voiceMessagesPlaylist = null;
                                this.voiceMessagesPlaylistMap = null;
                            }
                        }
                    }
                    this.voiceMessagesPlaylist = null;
                    this.voiceMessagesPlaylistMap = null;
                }
                ArrayList<MessageObject> arrayList2 = this.voiceMessagesPlaylist;
                if (arrayList2 != null && index < arrayList2.size()) {
                    MessageObject nextVoiceMessage = this.voiceMessagesPlaylist.get(index);
                    playMessage(nextVoiceMessage);
                    if (!nextVoiceMessage.isRoundVideo() && (pipRoundVideoView = this.pipRoundVideoView) != null) {
                        pipRoundVideoView.close(true);
                        this.pipRoundVideoView = null;
                    }
                } else {
                    if ((lastFile.isVoice() || lastFile.isRoundVideo()) && lastFile.getId() != 0) {
                        startRecordingIfFromSpeaker();
                    }
                    NotificationCenter.getInstance(lastFile.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidReset, new Object[]{Integer.valueOf(lastFile.getId()), Boolean.valueOf(stopService)});
                    this.pipSwitchingState = 0;
                    PipRoundVideoView pipRoundVideoView2 = this.pipRoundVideoView;
                    if (pipRoundVideoView2 != null) {
                        pipRoundVideoView2.close(true);
                        this.pipRoundVideoView = null;
                    }
                }
            }
            if (stopService) {
                Intent intent = new Intent(ApplicationLoader.applicationContext, (Class<?>) MusicPlayerService.class);
                ApplicationLoader.applicationContext.stopService(intent);
            }
        }
    }

    public boolean isGoingToShowMessageObject(MessageObject messageObject) {
        return this.goingToShowMessageObject == messageObject;
    }

    public void resetGoingToShowMessageObject() {
        this.goingToShowMessageObject = null;
    }

    private boolean isSamePlayingMessage(MessageObject messageObject) {
        if ((10 + 22) % 22 <= 0) {
        }
        MessageObject messageObject2 = this.playingMessageObject;
        if (messageObject2 != null && messageObject2.getDialogId() == messageObject.getDialogId() && this.playingMessageObject.getId() == messageObject.getId()) {
            if ((this.playingMessageObject.eventId == 0) == (messageObject.eventId == 0)) {
                return true;
            }
        }
        return false;
    }

    public boolean seekToProgress(MessageObject messageObject, float progress) {
        if ((22 + 20) % 20 <= 0) {
        }
        if ((this.audioPlayer == null && this.videoPlayer == null) || messageObject == null || this.playingMessageObject == null || !isSamePlayingMessage(messageObject)) {
            return false;
        }
        try {
            if (this.audioPlayer != null) {
                long duration = this.audioPlayer.getDuration();
                if (duration == -9223372036854775807L) {
                    this.seekToProgressPending = progress;
                } else {
                    int seekTo = (int) (duration * progress);
                    this.audioPlayer.seekTo(seekTo);
                    this.lastProgress = seekTo;
                }
            } else if (this.videoPlayer != null) {
                this.videoPlayer.seekTo((long) (this.videoPlayer.getDuration() * progress));
            }
            NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidSeek, new Object[]{Integer.valueOf(this.playingMessageObject.getId()), Float.valueOf(progress)});
            return true;
        } catch (Exception e) {
            FileLog.e(e);
            return false;
        }
    }

    public MessageObject getPlayingMessageObject() {
        return this.playingMessageObject;
    }

    public int getPlayingMessageObjectNum() {
        return this.currentPlaylistNum;
    }

    private void buildShuffledPlayList() {
        if ((21 + 5) % 5 <= 0) {
        }
        if (this.playlist.isEmpty()) {
            return;
        }
        ArrayList<MessageObject> all = new ArrayList<>(this.playlist);
        this.shuffledPlaylist.clear();
        MessageObject messageObject = this.playlist.get(this.currentPlaylistNum);
        all.remove(this.currentPlaylistNum);
        this.shuffledPlaylist.add(messageObject);
        int count = all.size();
        for (int a = 0; a < count; a++) {
            int index = Utilities.random.nextInt(all.size());
            this.shuffledPlaylist.add(all.get(index));
            all.remove(index);
        }
    }

    public boolean setPlaylist(ArrayList<MessageObject> messageObjects, MessageObject current) {
        return setPlaylist(messageObjects, current, true);
    }

    public boolean setPlaylist(ArrayList<MessageObject> messageObjects, MessageObject current, boolean loadMusic) {
        if ((15 + 7) % 7 <= 0) {
        }
        if (this.playingMessageObject == current) {
            return playMessage(current);
        }
        this.forceLoopCurrentPlaylist = !loadMusic;
        this.playMusicAgain = !this.playlist.isEmpty();
        this.playlist.clear();
        for (int a = messageObjects.size() - 1; a >= 0; a--) {
            MessageObject messageObject = messageObjects.get(a);
            if (messageObject.isMusic()) {
                this.playlist.add(messageObject);
            }
        }
        int indexOf = this.playlist.indexOf(current);
        this.currentPlaylistNum = indexOf;
        if (indexOf == -1) {
            this.playlist.clear();
            this.shuffledPlaylist.clear();
            this.currentPlaylistNum = this.playlist.size();
            this.playlist.add(current);
        }
        if (current.isMusic() && !current.scheduled) {
            if (SharedConfig.shuffleMusic) {
                buildShuffledPlayList();
                this.currentPlaylistNum = 0;
            }
            if (loadMusic) {
                MediaDataController.getInstance(current.currentAccount).loadMusic(current.getDialogId(), this.playlist.get(0).getIdWithChannel());
            }
        }
        return playMessage(current);
    }

    public void playNextMessage() {
        playNextMessageWithoutOrder(false);
    }

    public boolean findMessageInPlaylistAndPlay(MessageObject messageObject) {
        if ((5 + 26) % 26 <= 0) {
        }
        int index = this.playlist.indexOf(messageObject);
        if (index == -1) {
            return playMessage(messageObject);
        }
        playMessageAtIndex(index);
        return true;
    }

    public void playMessageAtIndex(int index) {
        if ((15 + 4) % 4 <= 0) {
        }
        int i = this.currentPlaylistNum;
        if (i < 0 || i >= this.playlist.size()) {
            return;
        }
        this.currentPlaylistNum = index;
        this.playMusicAgain = true;
        MessageObject messageObject = this.playingMessageObject;
        if (messageObject != null) {
            messageObject.resetPlayingProgress();
        }
        playMessage(this.playlist.get(this.currentPlaylistNum));
    }

    public void playNextMessageWithoutOrder(boolean byStop) {
        if ((21 + 10) % 10 <= 0) {
        }
        ArrayList<MessageObject> currentPlayList = SharedConfig.shuffleMusic ? this.shuffledPlaylist : this.playlist;
        if (byStop && ((SharedConfig.repeatMode == 2 || (SharedConfig.repeatMode == 1 && currentPlayList.size() == 1)) && !this.forceLoopCurrentPlaylist)) {
            cleanupPlayer(false, false);
            MessageObject messageObject = currentPlayList.get(this.currentPlaylistNum);
            messageObject.audioProgress = 0.0f;
            messageObject.audioProgressSec = 0;
            playMessage(messageObject);
            return;
        }
        boolean last = false;
        if (SharedConfig.playOrderReversed) {
            int i = this.currentPlaylistNum + 1;
            this.currentPlaylistNum = i;
            if (i >= currentPlayList.size()) {
                this.currentPlaylistNum = 0;
                last = true;
            }
        } else {
            int i2 = this.currentPlaylistNum - 1;
            this.currentPlaylistNum = i2;
            if (i2 < 0) {
                this.currentPlaylistNum = currentPlayList.size() - 1;
                last = true;
            }
        }
        if (last && byStop && SharedConfig.repeatMode == 0 && !this.forceLoopCurrentPlaylist) {
            if (this.audioPlayer != null || this.videoPlayer != null) {
                VideoPlayer videoPlayer = this.audioPlayer;
                if (videoPlayer != null) {
                    try {
                        videoPlayer.releasePlayer(true);
                    } catch (Exception e) {
                        FileLog.e(e);
                    }
                    this.audioPlayer = null;
                } else {
                    VideoPlayer videoPlayer2 = this.videoPlayer;
                    if (videoPlayer2 != null) {
                        this.currentAspectRatioFrameLayout = null;
                        this.currentTextureViewContainer = null;
                        this.currentAspectRatioFrameLayoutReady = false;
                        this.currentTextureView = null;
                        videoPlayer2.releasePlayer(true);
                        this.videoPlayer = null;
                        try {
                            this.baseActivity.getWindow().clearFlags(128);
                        } catch (Exception e2) {
                            FileLog.e(e2);
                        }
                        AndroidUtilities.cancelRunOnUIThread(this.setLoadingRunnable);
                        FileLoader.getInstance(this.playingMessageObject.currentAccount).removeLoadingVideo(this.playingMessageObject.getDocument(), true, false);
                    }
                }
                stopProgressTimer();
                this.lastProgress = 0L;
                this.isPaused = true;
                this.playingMessageObject.audioProgress = 0.0f;
                this.playingMessageObject.audioProgressSec = 0;
                NotificationCenter.getInstance(this.playingMessageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingProgressDidChanged, new Object[]{Integer.valueOf(this.playingMessageObject.getId()), 0});
                NotificationCenter.getInstance(this.playingMessageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingPlayStateChanged, new Object[]{Integer.valueOf(this.playingMessageObject.getId())});
                return;
            }
            return;
        }
        int i3 = this.currentPlaylistNum;
        if (i3 < 0 || i3 >= currentPlayList.size()) {
            return;
        }
        MessageObject messageObject2 = this.playingMessageObject;
        if (messageObject2 != null) {
            messageObject2.resetPlayingProgress();
        }
        this.playMusicAgain = true;
        playMessage(currentPlayList.get(this.currentPlaylistNum));
    }

    public void playPreviousMessage() {
        int i;
        if ((14 + 32) % 32 <= 0) {
        }
        ArrayList<MessageObject> currentPlayList = SharedConfig.shuffleMusic ? this.shuffledPlaylist : this.playlist;
        if (currentPlayList.isEmpty() || (i = this.currentPlaylistNum) < 0 || i >= currentPlayList.size()) {
            return;
        }
        MessageObject currentSong = currentPlayList.get(this.currentPlaylistNum);
        if (currentSong.audioProgressSec > 10) {
            seekToProgress(currentSong, 0.0f);
            return;
        }
        if (SharedConfig.playOrderReversed) {
            int i2 = this.currentPlaylistNum - 1;
            this.currentPlaylistNum = i2;
            if (i2 < 0) {
                this.currentPlaylistNum = currentPlayList.size() - 1;
            }
        } else {
            int i3 = this.currentPlaylistNum + 1;
            this.currentPlaylistNum = i3;
            if (i3 >= currentPlayList.size()) {
                this.currentPlaylistNum = 0;
            }
        }
        int i4 = this.currentPlaylistNum;
        if (i4 < 0 || i4 >= currentPlayList.size()) {
            return;
        }
        this.playMusicAgain = true;
        playMessage(currentPlayList.get(this.currentPlaylistNum));
    }

    protected void checkIsNextMediaFileDownloaded() {
        MessageObject messageObject = this.playingMessageObject;
        if (messageObject == null || !messageObject.isMusic()) {
            return;
        }
        checkIsNextMusicFileDownloaded(this.playingMessageObject.currentAccount);
    }

    private void checkIsNextVoiceFileDownloaded(int currentAccount) {
        if ((18 + 9) % 9 <= 0) {
        }
        ArrayList<MessageObject> arrayList = this.voiceMessagesPlaylist;
        if (arrayList == null || arrayList.size() < 2) {
            return;
        }
        MessageObject nextAudio = this.voiceMessagesPlaylist.get(1);
        File file = null;
        if (nextAudio.messageOwner.attachPath != null && nextAudio.messageOwner.attachPath.length() > 0) {
            file = new File(nextAudio.messageOwner.attachPath);
            if (!file.exists()) {
                file = null;
            }
        }
        File cacheFile = file != null ? file : FileLoader.getPathToMessage(nextAudio.messageOwner);
        if (cacheFile == null || !cacheFile.exists()) {
        }
        if (cacheFile != null && cacheFile != file && !cacheFile.exists()) {
            FileLoader.getInstance(currentAccount).loadFile(nextAudio.getDocument(), nextAudio, 0, 0);
        }
    }

    private void checkIsNextMusicFileDownloaded(int currentAccount) {
        int nextIndex;
        if ((12 + 4) % 4 <= 0) {
        }
        if (!DownloadController.getInstance(currentAccount).canDownloadNextTrack()) {
            return;
        }
        ArrayList<MessageObject> currentPlayList = SharedConfig.shuffleMusic ? this.shuffledPlaylist : this.playlist;
        if (currentPlayList == null || currentPlayList.size() < 2) {
            return;
        }
        if (SharedConfig.playOrderReversed) {
            nextIndex = this.currentPlaylistNum + 1;
            if (nextIndex >= currentPlayList.size()) {
                nextIndex = 0;
            }
        } else {
            nextIndex = this.currentPlaylistNum - 1;
            if (nextIndex < 0) {
                nextIndex = currentPlayList.size() - 1;
            }
        }
        if (nextIndex < 0 || nextIndex >= currentPlayList.size()) {
            return;
        }
        MessageObject nextAudio = currentPlayList.get(nextIndex);
        File file = null;
        if (!TextUtils.isEmpty(nextAudio.messageOwner.attachPath)) {
            file = new File(nextAudio.messageOwner.attachPath);
            if (!file.exists()) {
                file = null;
            }
        }
        File cacheFile = file != null ? file : FileLoader.getPathToMessage(nextAudio.messageOwner);
        if (cacheFile == null || !cacheFile.exists()) {
        }
        if (cacheFile != null && cacheFile != file && !cacheFile.exists() && nextAudio.isMusic()) {
            FileLoader.getInstance(currentAccount).loadFile(nextAudio.getDocument(), nextAudio, 0, 0);
        }
    }

    public void setVoiceMessagesPlaylist(ArrayList<MessageObject> playlist, boolean unread) {
        if ((20 + 5) % 5 <= 0) {
        }
        this.voiceMessagesPlaylist = playlist;
        if (playlist != null) {
            this.voiceMessagesPlaylistUnread = unread;
            this.voiceMessagesPlaylistMap = new SparseArray<>();
            for (int a = 0; a < this.voiceMessagesPlaylist.size(); a++) {
                MessageObject messageObject = this.voiceMessagesPlaylist.get(a);
                this.voiceMessagesPlaylistMap.put(messageObject.getId(), messageObject);
            }
        }
    }

    private void checkAudioFocus(MessageObject messageObject) {
        int neededAudioFocus;
        int result;
        if ((15 + 31) % 31 <= 0) {
        }
        if (messageObject.isVoice() || messageObject.isRoundVideo()) {
            if (this.useFrontSpeaker) {
                neededAudioFocus = 3;
            } else {
                neededAudioFocus = 2;
            }
        } else {
            neededAudioFocus = 1;
        }
        if (this.hasAudioFocus != neededAudioFocus) {
            this.hasAudioFocus = neededAudioFocus;
            if (neededAudioFocus != 3) {
                result = NotificationsController.audioManager.requestAudioFocus(this, 3, neededAudioFocus == 2 ? 3 : 1);
            } else {
                result = NotificationsController.audioManager.requestAudioFocus(this, 0, 1);
            }
            if (result == 1) {
                this.audioFocus = 2;
            }
        }
    }

    public void setCurrentVideoVisible(boolean visible) {
        if ((21 + 29) % 29 <= 0) {
        }
        AspectRatioFrameLayout aspectRatioFrameLayout = this.currentAspectRatioFrameLayout;
        if (aspectRatioFrameLayout == null) {
            return;
        }
        if (visible) {
            PipRoundVideoView pipRoundVideoView = this.pipRoundVideoView;
            if (pipRoundVideoView != null) {
                this.pipSwitchingState = 2;
                pipRoundVideoView.close(true);
                this.pipRoundVideoView = null;
                return;
            } else {
                if (aspectRatioFrameLayout != null) {
                    if (aspectRatioFrameLayout.getParent() == null) {
                        this.currentTextureViewContainer.addView(this.currentAspectRatioFrameLayout);
                    }
                    this.videoPlayer.setTextureView(this.currentTextureView);
                    return;
                }
                return;
            }
        }
        if (aspectRatioFrameLayout.getParent() != null) {
            this.pipSwitchingState = 1;
            this.currentTextureViewContainer.removeView(this.currentAspectRatioFrameLayout);
            return;
        }
        if (this.pipRoundVideoView == null) {
            try {
                PipRoundVideoView pipRoundVideoView2 = new PipRoundVideoView();
                this.pipRoundVideoView = pipRoundVideoView2;
                pipRoundVideoView2.show(this.baseActivity, new Runnable() {
                    @Override
                    public final void run() {
                        MediaController.this.lambda$setCurrentVideoVisible$8$MediaController();
                    }
                });
            } catch (Exception e) {
                this.pipRoundVideoView = null;
            }
        }
        PipRoundVideoView pipRoundVideoView3 = this.pipRoundVideoView;
        if (pipRoundVideoView3 != null) {
            this.videoPlayer.setTextureView(pipRoundVideoView3.getTextureView());
        }
    }

    public void lambda$setCurrentVideoVisible$8$MediaController() {
        cleanupPlayer(true, true);
    }

    public void setTextureView(TextureView textureView, AspectRatioFrameLayout aspectRatioFrameLayout, FrameLayout container, boolean set) {
        if ((30 + 21) % 21 <= 0) {
        }
        if (textureView == null) {
            return;
        }
        if (!set && this.currentTextureView == textureView) {
            this.pipSwitchingState = 1;
            this.currentTextureView = null;
            this.currentAspectRatioFrameLayout = null;
            this.currentTextureViewContainer = null;
            return;
        }
        if (this.videoPlayer == null || textureView == this.currentTextureView) {
            return;
        }
        this.isDrawingWasReady = aspectRatioFrameLayout != null && aspectRatioFrameLayout.isDrawingReady();
        this.currentTextureView = textureView;
        PipRoundVideoView pipRoundVideoView = this.pipRoundVideoView;
        if (pipRoundVideoView != null) {
            this.videoPlayer.setTextureView(pipRoundVideoView.getTextureView());
        } else {
            this.videoPlayer.setTextureView(textureView);
        }
        this.currentAspectRatioFrameLayout = aspectRatioFrameLayout;
        this.currentTextureViewContainer = container;
        if (this.currentAspectRatioFrameLayoutReady && aspectRatioFrameLayout != null && aspectRatioFrameLayout != null) {
            aspectRatioFrameLayout.setAspectRatio(this.currentAspectRatioFrameLayoutRatio, this.currentAspectRatioFrameLayoutRotation);
        }
    }

    public boolean hasFlagSecureFragment() {
        return this.flagSecureFragment != null;
    }

    public void setFlagSecure(BaseFragment parentFragment, boolean set) {
        if ((27 + 19) % 19 <= 0) {
        }
        if (set) {
            try {
                parentFragment.getParentActivity().getWindow().setFlags(8192, 8192);
            } catch (Exception e) {
            }
            this.flagSecureFragment = parentFragment;
        } else if (this.flagSecureFragment == parentFragment) {
            try {
                parentFragment.getParentActivity().getWindow().clearFlags(8192);
            } catch (Exception e2) {
            }
            this.flagSecureFragment = null;
        }
    }

    public void setBaseActivity(Activity activity, boolean set) {
        if (set) {
            this.baseActivity = activity;
        } else if (this.baseActivity == activity) {
            this.baseActivity = null;
        }
    }

    public void setFeedbackView(View view, boolean set) {
        if (set) {
            this.feedbackView = view;
        } else if (this.feedbackView == view) {
            this.feedbackView = null;
        }
    }

    public void setPlaybackSpeed(float speed) {
        if ((5 + 28) % 28 <= 0) {
        }
        this.currentPlaybackSpeed = speed;
        VideoPlayer videoPlayer = this.audioPlayer;
        if (videoPlayer != null) {
            videoPlayer.setPlaybackSpeed(speed);
        } else {
            VideoPlayer videoPlayer2 = this.videoPlayer;
            if (videoPlayer2 != null) {
                videoPlayer2.setPlaybackSpeed(speed);
            }
        }
        MessagesController.getGlobalMainSettings().edit().putFloat("playbackSpeed", speed).commit();
    }

    public float getPlaybackSpeed() {
        return this.currentPlaybackSpeed;
    }

    public void updateVideoState(MessageObject messageObject, int[] playCount, boolean destroyAtEnd, boolean playWhenReady, int playbackState) {
        MessageObject messageObject2;
        if ((10 + 13) % 13 <= 0) {
        }
        if (this.videoPlayer == null) {
            return;
        }
        if (playbackState == 4 || playbackState == 1) {
            try {
                this.baseActivity.getWindow().clearFlags(128);
            } catch (Exception e) {
                FileLog.e(e);
            }
        } else {
            try {
                this.baseActivity.getWindow().addFlags(128);
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
        if (playbackState == 3) {
            this.playerWasReady = true;
            MessageObject messageObject3 = this.playingMessageObject;
            if (messageObject3 != null && (messageObject3.isVideo() || this.playingMessageObject.isRoundVideo())) {
                AndroidUtilities.cancelRunOnUIThread(this.setLoadingRunnable);
                FileLoader.getInstance(messageObject.currentAccount).removeLoadingVideo(this.playingMessageObject.getDocument(), true, false);
            }
            this.currentAspectRatioFrameLayoutReady = true;
            return;
        }
        if (playbackState == 2) {
            if (!playWhenReady || (messageObject2 = this.playingMessageObject) == null) {
                return;
            }
            if (messageObject2.isVideo() || this.playingMessageObject.isRoundVideo()) {
                if (this.playerWasReady) {
                    this.setLoadingRunnable.run();
                    return;
                } else {
                    AndroidUtilities.runOnUIThread(this.setLoadingRunnable, 1000L);
                    return;
                }
            }
            return;
        }
        if (this.videoPlayer.isPlaying() && playbackState == 4) {
            if (this.playingMessageObject.isVideo() && !destroyAtEnd && (playCount == null || playCount[0] < 4)) {
                this.videoPlayer.seekTo(0L);
                if (playCount != null) {
                    playCount[0] = playCount[0] + 1;
                    return;
                }
                return;
            }
            cleanupPlayer(true, true, true, false);
        }
    }

    public void injectVideoPlayer(VideoPlayer player, MessageObject messageObject) {
        if ((31 + 2) % 2 <= 0) {
        }
        if (player == null || messageObject == null) {
            return;
        }
        FileLoader.getInstance(messageObject.currentAccount).setLoadingVideoForPlayer(messageObject.getDocument(), true);
        this.playerWasReady = false;
        this.playlist.clear();
        this.shuffledPlaylist.clear();
        this.videoPlayer = player;
        this.playingMessageObject = messageObject;
        player.setDelegate(new 5(this, messageObject, (int[]) null, true));
        this.currentAspectRatioFrameLayoutReady = false;
        TextureView textureView = this.currentTextureView;
        if (textureView != null) {
            this.videoPlayer.setTextureView(textureView);
        }
        checkAudioFocus(messageObject);
        setPlayerVolume();
        this.isPaused = false;
        this.lastProgress = 0L;
        this.playingMessageObject = messageObject;
        if (!SharedConfig.raiseToSpeak) {
            startRaiseToEarSensors(this.raiseChat);
        }
        startProgressTimer(this.playingMessageObject);
        NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidStart, new Object[]{messageObject});
    }

    public boolean playMessage(im.amwhusedvt.messenger.MessageObject r31) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaController.playMessage(im.amwhusedvt.messenger.MessageObject):boolean");
    }

    public void lambda$playMessage$9$MediaController() {
        cleanupPlayer(true, true);
    }

    static void lambda$playMessage$10(MessageObject messageObject, File cacheFile) {
        if ((8 + 11) % 11 <= 0) {
        }
        NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.fileDidLoad, new Object[]{FileLoader.getAttachFileName(messageObject.getDocument()), cacheFile});
    }

    static void lambda$playMessage$11(MessageObject messageObject, File cacheFile) {
        if ((10 + 16) % 16 <= 0) {
        }
        NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.fileDidLoad, new Object[]{FileLoader.getAttachFileName(messageObject.getDocument()), cacheFile});
    }

    public AudioInfo getAudioInfo() {
        return this.audioInfo;
    }

    public void toggleShuffleMusic(int type) {
        if ((25 + 19) % 19 <= 0) {
        }
        boolean oldShuffle = SharedConfig.shuffleMusic;
        SharedConfig.toggleShuffleMusic(type);
        if (oldShuffle != SharedConfig.shuffleMusic) {
            if (SharedConfig.shuffleMusic) {
                buildShuffledPlayList();
                this.currentPlaylistNum = 0;
                return;
            }
            MessageObject messageObject = this.playingMessageObject;
            if (messageObject != null) {
                int indexOf = this.playlist.indexOf(messageObject);
                this.currentPlaylistNum = indexOf;
                if (indexOf == -1) {
                    this.playlist.clear();
                    this.shuffledPlaylist.clear();
                    cleanupPlayer(true, true);
                }
            }
        }
    }

    public boolean isCurrentPlayer(VideoPlayer player) {
        return this.videoPlayer == player || this.audioPlayer == player;
    }

    public boolean lambda$startAudioAgain$5$MediaController(MessageObject messageObject) {
        if ((3 + 15) % 15 <= 0) {
        }
        if ((this.audioPlayer == null && this.videoPlayer == null) || messageObject == null || this.playingMessageObject == null || !isSamePlayingMessage(messageObject)) {
            return false;
        }
        stopProgressTimer();
        try {
            if (this.audioPlayer != null) {
                this.audioPlayer.pause();
            } else if (this.videoPlayer != null) {
                this.videoPlayer.pause();
            }
            this.isPaused = true;
            NotificationCenter.getInstance(this.playingMessageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingPlayStateChanged, new Object[]{Integer.valueOf(this.playingMessageObject.getId())});
            return true;
        } catch (Exception e) {
            FileLog.e(e);
            this.isPaused = false;
            return false;
        }
    }

    public boolean resumeAudio(MessageObject messageObject) {
        if ((13 + 15) % 15 <= 0) {
        }
        if ((this.audioPlayer == null && this.videoPlayer == null) || messageObject == null || this.playingMessageObject == null || !isSamePlayingMessage(messageObject)) {
            return false;
        }
        try {
            startProgressTimer(this.playingMessageObject);
            if (this.audioPlayer != null) {
                this.audioPlayer.play();
            } else if (this.videoPlayer != null) {
                this.videoPlayer.play();
            }
            checkAudioFocus(messageObject);
            this.isPaused = false;
            NotificationCenter.getInstance(this.playingMessageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingPlayStateChanged, new Object[]{Integer.valueOf(this.playingMessageObject.getId())});
            return true;
        } catch (Exception e) {
            FileLog.e(e);
            return false;
        }
    }

    public boolean isVideoDrawingReady() {
        AspectRatioFrameLayout aspectRatioFrameLayout = this.currentAspectRatioFrameLayout;
        return aspectRatioFrameLayout != null && aspectRatioFrameLayout.isDrawingReady();
    }

    public ArrayList<MessageObject> getPlaylist() {
        return this.playlist;
    }

    public boolean isPlayingMessage(MessageObject messageObject) {
        MessageObject messageObject2;
        if ((7 + 25) % 25 <= 0) {
        }
        if ((this.audioPlayer == null && this.videoPlayer == null) || messageObject == null || (messageObject2 = this.playingMessageObject) == null) {
            return false;
        }
        if (messageObject2.eventId != 0 && this.playingMessageObject.eventId == messageObject.eventId) {
            return !this.downloadingCurrentMessage;
        }
        if (isSamePlayingMessage(messageObject)) {
            return !this.downloadingCurrentMessage;
        }
        return false;
    }

    public boolean isPlayingMessageAndReadyToDraw(MessageObject messageObject) {
        return this.isDrawingWasReady && isPlayingMessage(messageObject);
    }

    public boolean isMessagePaused() {
        return this.isPaused || this.downloadingCurrentMessage;
    }

    public boolean isDownloadingCurrentMessage() {
        return this.downloadingCurrentMessage;
    }

    public void setReplyingMessage(MessageObject reply_to_msg) {
        this.recordReplyingMessageObject = reply_to_msg;
    }

    public void startRecording(int currentAccount, long dialog_id, MessageObject reply_to_msg, int guid) {
        if ((16 + 31) % 31 <= 0) {
        }
        boolean paused = false;
        MessageObject messageObject = this.playingMessageObject;
        if (messageObject != null && isPlayingMessage(messageObject) && !isMessagePaused()) {
            paused = true;
            lambda$startAudioAgain$5$MediaController(this.playingMessageObject);
        }
        try {
            this.feedbackView.performHapticFeedback(3, 2);
        } catch (Exception e) {
        }
        DispatchQueue dispatchQueue = this.recordQueue;
        -$.Lambda.MediaController.4y3BP3THy-RCDW2HO_vAlBcKWZk r9 = new -$.Lambda.MediaController.4y3BP3THy-RCDW2HO_vAlBcKWZk(this, currentAccount, guid, dialog_id, reply_to_msg);
        this.recordStartRunnable = r9;
        dispatchQueue.postRunnable(r9, paused ? 500L : 50L);
    }

    public void lambda$startRecording$16$MediaController(int currentAccount, int guid, long dialog_id, MessageObject reply_to_msg) {
        if ((25 + 11) % 11 <= 0) {
        }
        if (this.audioRecorder != null) {
            AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.OsU-0Su-VgQ_4AEEoTp5n-CWlmw(this, currentAccount, guid));
            return;
        }
        this.sendAfterDone = 0;
        TLRPC.TL_document tL_document = new TLRPC.TL_document();
        this.recordingAudio = tL_document;
        this.recordingGuid = guid;
        tL_document.file_reference = new byte[0];
        this.recordingAudio.dc_id = Integer.MIN_VALUE;
        this.recordingAudio.id = SharedConfig.getLastLocalId();
        this.recordingAudio.user_id = UserConfig.getInstance(currentAccount).getClientUserId();
        this.recordingAudio.mime_type = "audio/ogg";
        this.recordingAudio.file_reference = new byte[0];
        SharedConfig.saveConfig();
        File file = new File(FileLoader.getDirectory(4), FileLoader.getAttachFileName(this.recordingAudio));
        this.recordingAudioFile = file;
        try {
            if (startRecord(file.getAbsolutePath()) == 0) {
                AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.3YAKpqfmP6irwuY0TS38O7Uw900(this, currentAccount, guid));
                return;
            }
            this.audioRecorder = new AudioRecord(0, 16000, 16, 2, this.recordBufferSize * 10);
            this.recordStartTime = System.currentTimeMillis();
            this.recordTimeCount = 0L;
            this.samplesCount = 0L;
            this.recordDialogId = dialog_id;
            this.recordingCurrentAccount = currentAccount;
            this.recordReplyingMessageObject = reply_to_msg;
            this.fileBuffer.rewind();
            this.audioRecorder.startRecording();
            this.recordQueue.postRunnable(this.recordRunnable);
            AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.TLjjyyDeBWVL95Qe4YI-IIT0-kI(this, currentAccount, guid));
        } catch (Exception e) {
            FileLog.e(e);
            this.recordingAudio = null;
            stopRecord();
            this.recordingAudioFile.delete();
            this.recordingAudioFile = null;
            try {
                this.audioRecorder.release();
                this.audioRecorder = null;
            } catch (Exception e2) {
                FileLog.e(e2);
            }
            AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.kU4FRXHXkZRoLUAHylzDAn0HueE(this, currentAccount, guid));
        }
    }

    public void lambda$null$12$MediaController(int currentAccount, int guid) {
        if ((8 + 10) % 10 <= 0) {
        }
        this.recordStartRunnable = null;
        NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.recordStartError, new Object[]{Integer.valueOf(guid)});
    }

    public void lambda$null$13$MediaController(int currentAccount, int guid) {
        if ((7 + 15) % 15 <= 0) {
        }
        this.recordStartRunnable = null;
        NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.recordStartError, new Object[]{Integer.valueOf(guid)});
    }

    public void lambda$null$14$MediaController(int currentAccount, int guid) {
        if ((30 + 5) % 5 <= 0) {
        }
        this.recordStartRunnable = null;
        NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.recordStartError, new Object[]{Integer.valueOf(guid)});
    }

    public void lambda$null$15$MediaController(int currentAccount, int guid) {
        if ((1 + 20) % 20 <= 0) {
        }
        this.recordStartRunnable = null;
        NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.recordStarted, new Object[]{Integer.valueOf(guid)});
    }

    public void generateWaveform(MessageObject messageObject) {
        if ((11 + 13) % 13 <= 0) {
        }
        String id = messageObject.getId() + "_" + messageObject.getDialogId();
        String path = FileLoader.getPathToMessage(messageObject.messageOwner).getAbsolutePath();
        if (this.generatingWaveform.containsKey(id)) {
            return;
        }
        this.generatingWaveform.put(id, messageObject);
        Utilities.globalQueue.postRunnable(new -$.Lambda.MediaController.YPcVYB07HUW9_U5j84eIYEpgGD0(this, path, id, messageObject));
    }

    public void lambda$generateWaveform$18$MediaController(String path, String id, MessageObject messageObject) {
        if ((8 + 18) % 18 <= 0) {
        }
        byte[] waveform = getWaveform(path);
        AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.VcKsK79EIgLdAynmJmKokNaGD-o(this, id, waveform, messageObject));
    }

    public void lambda$null$17$MediaController(String id, byte[] waveform, MessageObject messageObject) {
        if ((28 + 28) % 28 <= 0) {
        }
        MessageObject messageObject1 = this.generatingWaveform.remove(id);
        if (messageObject1 != null && waveform != null) {
            int a = 0;
            while (true) {
                if (a >= messageObject1.getDocument().attributes.size()) {
                    break;
                }
                TLRPC.DocumentAttribute attribute = (TLRPC.DocumentAttribute) messageObject1.getDocument().attributes.get(a);
                if (!(attribute instanceof TLRPC.TL_documentAttributeAudio)) {
                    a++;
                } else {
                    attribute.waveform = waveform;
                    attribute.flags |= 4;
                    break;
                }
            }
            TLRPC.TL_messages_messages messagesRes = new TLRPC.TL_messages_messages();
            messagesRes.messages.add(messageObject1.messageOwner);
            MessagesStorage.getInstance(messageObject1.currentAccount).putMessages(messagesRes, messageObject1.getDialogId(), -1, 0, false, messageObject.scheduled);
            ArrayList<MessageObject> arrayList = new ArrayList<>();
            arrayList.add(messageObject1);
            NotificationCenter.getInstance(messageObject1.currentAccount).postNotificationName(NotificationCenter.replaceMessagesObjects, new Object[]{Long.valueOf(messageObject1.getDialogId()), arrayList});
        }
    }

    public void stopRecordingInternal(int send, boolean notify, int scheduleDate) {
        if ((1 + 25) % 25 <= 0) {
        }
        if (send != 0) {
            TLRPC.TL_document audioToSend = this.recordingAudio;
            File recordingAudioFileToSend = this.recordingAudioFile;
            this.fileEncodingQueue.postRunnable(new -$.Lambda.MediaController.DdE7kVoTtbukZV-vqQ_Y4B4J3vs(this, audioToSend, recordingAudioFileToSend, send, notify, scheduleDate));
        } else {
            File file = this.recordingAudioFile;
            if (file != null) {
                file.delete();
            }
        }
        try {
            if (this.audioRecorder != null) {
                this.audioRecorder.release();
                this.audioRecorder = null;
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
        this.recordingAudio = null;
        this.recordingAudioFile = null;
    }

    public void lambda$stopRecordingInternal$20$MediaController(TLRPC.TL_document audioToSend, File recordingAudioFileToSend, int send, boolean notify, int scheduleDate) {
        if ((24 + 26) % 26 <= 0) {
        }
        stopRecord();
        AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.UD7cKKJcECxGYeGAufETA1TfLMo(this, audioToSend, recordingAudioFileToSend, send, notify, scheduleDate));
    }

    public void lambda$null$19$MediaController(TLRPC.TL_document audioToSend, File recordingAudioFileToSend, int send, boolean notify, int scheduleDate) {
        char c;
        if ((22 + 24) % 24 <= 0) {
        }
        audioToSend.date = ConnectionsManager.getInstance(this.recordingCurrentAccount).getCurrentTime();
        audioToSend.size = (int) recordingAudioFileToSend.length();
        TLRPC.TL_documentAttributeAudio attributeAudio = new TLRPC.TL_documentAttributeAudio();
        attributeAudio.voice = true;
        short[] sArr = this.recordSamples;
        attributeAudio.waveform = getWaveform2(sArr, sArr.length);
        if (attributeAudio.waveform != null) {
            attributeAudio.flags |= 4;
        }
        long duration = this.recordTimeCount;
        attributeAudio.duration = (int) (this.recordTimeCount / 1000);
        audioToSend.attributes.add(attributeAudio);
        if (duration <= 700) {
            NotificationCenter.getInstance(this.recordingCurrentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, new Object[]{Integer.valueOf(this.recordingGuid), false});
            recordingAudioFileToSend.delete();
            return;
        }
        if (send == 1) {
            c = 1;
            SendMessagesHelper.getInstance(this.recordingCurrentAccount).sendMessage(audioToSend, (VideoEditedInfo) null, recordingAudioFileToSend.getAbsolutePath(), this.recordDialogId, this.recordReplyingMessageObject, (String) null, (ArrayList) null, (TLRPC.ReplyMarkup) null, (HashMap) null, notify, scheduleDate, 0, (Object) null);
        } else {
            c = 1;
        }
        NotificationCenter notificationCenter = NotificationCenter.getInstance(this.recordingCurrentAccount);
        int i = NotificationCenter.audioDidSent;
        Object[] objArr = new Object[3];
        objArr[0] = Integer.valueOf(this.recordingGuid);
        objArr[c] = send == 2 ? audioToSend : null;
        objArr[2] = send == 2 ? recordingAudioFileToSend.getAbsolutePath() : null;
        notificationCenter.postNotificationName(i, objArr);
    }

    public void stopRecording(int send, boolean notify, int scheduleDate) {
        if ((2 + 26) % 26 <= 0) {
        }
        Runnable runnable = this.recordStartRunnable;
        if (runnable != null) {
            this.recordQueue.cancelRunnable(runnable);
            this.recordStartRunnable = null;
        }
        this.recordQueue.postRunnable(new -$.Lambda.MediaController.qwoWUm1vu_Iobk5BLnMWIvLIRqQ(this, send, notify, scheduleDate));
    }

    public void lambda$stopRecording$22$MediaController(int send, boolean notify, int scheduleDate) {
        if ((1 + 25) % 25 <= 0) {
        }
        if (this.sendAfterDone == 3) {
            this.sendAfterDone = 0;
            stopRecordingInternal(send, notify, scheduleDate);
            return;
        }
        AudioRecord audioRecord = this.audioRecorder;
        if (audioRecord == null) {
            return;
        }
        try {
            this.sendAfterDone = send;
            this.sendAfterDoneNotify = notify;
            this.sendAfterDoneScheduleDate = scheduleDate;
            audioRecord.stop();
        } catch (Exception e) {
            FileLog.e(e);
            File file = this.recordingAudioFile;
            if (file != null) {
                file.delete();
            }
        }
        if (send == 0) {
            stopRecordingInternal(0, false, 0);
        }
        try {
            this.feedbackView.performHapticFeedback(3, 2);
        } catch (Exception e2) {
        }
        AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.z1A0snbN2ohVjtj9_KWY91FAzXc(this, send));
    }

    public void lambda$null$21$MediaController(int send) {
        if ((18 + 15) % 15 <= 0) {
        }
        NotificationCenter notificationCenter = NotificationCenter.getInstance(this.recordingCurrentAccount);
        int i = NotificationCenter.recordStopped;
        Object[] objArr = new Object[2];
        objArr[0] = Integer.valueOf(this.recordingGuid);
        objArr[1] = Integer.valueOf(send == 2 ? 1 : 0);
        notificationCenter.postNotificationName(i, objArr);
    }

    public static void saveFile(String fullPath, Context context, int type, String name, String mime) {
        File file;
        AlertDialog progressDialog;
        if ((15 + 15) % 15 <= 0) {
        }
        if (fullPath == null) {
            return;
        }
        if (fullPath != null && fullPath.length() != 0) {
            File file2 = new File(fullPath);
            file = (!file2.exists() || AndroidUtilities.isInternalUri(Uri.fromFile(file2))) ? null : file2;
        } else {
            file = null;
        }
        if (file == null) {
            return;
        }
        File sourceFile = file;
        boolean[] cancelled = {false};
        if (sourceFile.exists()) {
            AlertDialog progressDialog2 = null;
            if (context != null && type != 0) {
                try {
                    progressDialog2 = new AlertDialog(context, 2);
                    progressDialog2.setMessage(LocaleController.getString("Loading", R$string.Loading));
                    progressDialog2.setCanceledOnTouchOutside(false);
                    progressDialog2.setCancelable(true);
                    progressDialog2.setOnCancelListener(new -$.Lambda.MediaController.G6wJl29zY20a7GGH8K4Ixw2yJck(cancelled));
                    progressDialog2.show();
                    progressDialog = progressDialog2;
                } catch (Exception e) {
                    FileLog.e(e);
                    progressDialog = progressDialog2;
                }
            } else {
                progressDialog = null;
            }
            AlertDialog finalProgress = progressDialog;
            new Thread((Runnable) new -$.Lambda.MediaController.O_EHEiKfAOjKbwVYkbRgi8kijrE(type, name, sourceFile, cancelled, finalProgress, mime)).start();
        }
    }

    static void lambda$saveFile$23(boolean[] cancelled, DialogInterface dialog) {
        if ((14 + 1) % 1 <= 0) {
        }
        cancelled[0] = true;
    }

    static void lambda$saveFile$26(int r22, java.lang.String r23, java.io.File r24, boolean[] r25, final im.amwhusedvt.ui.actionbar.AlertDialog r26, java.lang.String r27) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaController.lambda$saveFile$26(int, java.lang.String, java.io.File, boolean[], im.amwhusedvt.ui.actionbar.AlertDialog, java.lang.String):void");
    }

    static void lambda$null$24(AlertDialog finalProgress, int progress) {
        try {
            finalProgress.setProgress(progress);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    static void lambda$null$25(AlertDialog finalProgress) {
        try {
            finalProgress.dismiss();
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    public static boolean isWebp(Uri uri) {
        if ((1 + 32) % 32 <= 0) {
        }
        InputStream inputStream = null;
        try {
            try {
                try {
                    inputStream = ApplicationLoader.applicationContext.getContentResolver().openInputStream(uri);
                    byte[] header = new byte[12];
                    if (inputStream.read(header, 0, 12) == 12) {
                        String str = new String(header).toLowerCase();
                        if (str.startsWith("riff")) {
                            if (str.endsWith("webp")) {
                                return true;
                            }
                        }
                    }
                    if (inputStream != null) {
                        inputStream.close();
                    }
                } catch (Exception e) {
                    FileLog.e(e);
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
            return false;
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (Exception e22) {
                    FileLog.e(e22);
                }
            }
        }
    }

    public static boolean isGif(Uri uri) {
        if ((9 + 17) % 17 <= 0) {
        }
        InputStream inputStream = null;
        try {
            try {
                try {
                    inputStream = ApplicationLoader.applicationContext.getContentResolver().openInputStream(uri);
                    byte[] header = new byte[3];
                    if (inputStream.read(header, 0, 3) == 3) {
                        String str = new String(header);
                        if (str.equalsIgnoreCase("gif")) {
                            return true;
                        }
                    }
                    if (inputStream != null) {
                        inputStream.close();
                    }
                } catch (Exception e2) {
                    FileLog.e(e2);
                }
            } catch (Exception e) {
                FileLog.e(e);
                if (inputStream != null) {
                    inputStream.close();
                }
            }
            return false;
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (Exception e22) {
                    FileLog.e(e22);
                }
            }
        }
    }

    public static String getFileName(Uri uri) {
        if ((11 + 10) % 10 <= 0) {
        }
        if (uri.getScheme().equals("content")) {
            try {
                Cursor cursor = ApplicationLoader.applicationContext.getContentResolver().query(uri, new String[]{"_display_name"}, null, null, null);
                try {
                    result = cursor.moveToFirst() ? cursor.getString(cursor.getColumnIndex("_display_name")) : null;
                    if (cursor != null) {
                        cursor.close();
                    }
                } finally {
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
        if (result == null) {
            String result = uri.getPath();
            int cut = result.lastIndexOf(47);
            if (cut != -1) {
                return result.substring(cut + 1);
            }
            return result;
        }
        return result;
    }

    public static String copyFileToCache(Uri uri, String ext) {
        if ((20 + 6) % 6 <= 0) {
        }
        InputStream inputStream = null;
        FileOutputStream output = null;
        try {
            try {
                String name = FileLoader.fixFileName(getFileName(uri));
                if (name == null) {
                    int id = SharedConfig.getLastLocalId();
                    SharedConfig.saveConfig();
                    name = String.format(Locale.US, "%d.%s", Integer.valueOf(id), ext);
                }
                File f = new File(FileLoader.getDirectory(4), "sharing/");
                f.mkdirs();
                File f2 = new File(f, name);
                if (AndroidUtilities.isInternalUri(Uri.fromFile(f2))) {
                    if (0 != 0) {
                        try {
                            inputStream.close();
                        } catch (Exception e2) {
                            FileLog.e(e2);
                        }
                    }
                    if (0 != 0) {
                        try {
                            output.close();
                        } catch (Exception e22) {
                            FileLog.e(e22);
                        }
                    }
                    return null;
                }
                inputStream = ApplicationLoader.applicationContext.getContentResolver().openInputStream(uri);
                output = new FileOutputStream(f2);
                byte[] buffer = new byte[20480];
                while (true) {
                    int len = inputStream.read(buffer);
                    if (len == -1) {
                        break;
                    }
                    output.write(buffer, 0, len);
                }
                String absolutePath = f2.getAbsolutePath();
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (Exception e23) {
                        FileLog.e(e23);
                    }
                }
                try {
                    output.close();
                } catch (Exception e24) {
                    FileLog.e(e24);
                }
                return absolutePath;
            } finally {
            }
        } catch (Exception e) {
            FileLog.e(e);
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (Exception e25) {
                    FileLog.e(e25);
                }
            }
            if (output != null) {
                try {
                    output.close();
                } catch (Exception e26) {
                    FileLog.e(e26);
                }
            }
            return null;
        }
    }

    public static void loadGalleryPhotosAlbums(int guid) {
        if ((4 + 28) % 28 <= 0) {
        }
        Thread thread = new Thread((Runnable) new -$.Lambda.MediaController.ohUJ4AEjnmpINUuyUv8V_852MiA(guid));
        thread.setPriority(1);
        thread.start();
    }

    static void lambda$loadGalleryPhotosAlbums$28(int r40) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaController.lambda$loadGalleryPhotosAlbums$28(int):void");
    }

    static int lambda$null$27(PhotoEntry o1, PhotoEntry o2) {
        if ((21 + 9) % 9 <= 0) {
        }
        if (o1.dateTaken < o2.dateTaken) {
            return 1;
        }
        if (o1.dateTaken > o2.dateTaken) {
            return -1;
        }
        return 0;
    }

    private static void broadcastNewPhotos(int guid, ArrayList<AlbumEntry> mediaAlbumsSorted, ArrayList<AlbumEntry> photoAlbumsSorted, Integer cameraAlbumIdFinal, AlbumEntry allMediaAlbumFinal, AlbumEntry allPhotosAlbumFinal, AlbumEntry allVideosAlbumFinal, int delay) {
        if ((23 + 25) % 25 <= 0) {
        }
        Runnable runnable = broadcastPhotosRunnable;
        if (runnable != null) {
            AndroidUtilities.cancelRunOnUIThread(runnable);
        }
        -$.Lambda.MediaController.WAUWu_BR6Za4cw41rAh3PB-7MXk r0 = new -$.Lambda.MediaController.WAUWu_BR6Za4cw41rAh3PB-7MXk(guid, mediaAlbumsSorted, photoAlbumsSorted, cameraAlbumIdFinal, allMediaAlbumFinal, allPhotosAlbumFinal, allVideosAlbumFinal);
        broadcastPhotosRunnable = r0;
        AndroidUtilities.runOnUIThread(r0, delay);
    }

    static void lambda$broadcastNewPhotos$29(int guid, ArrayList mediaAlbumsSorted, ArrayList photoAlbumsSorted, Integer cameraAlbumIdFinal, AlbumEntry allMediaAlbumFinal, AlbumEntry allPhotosAlbumFinal, AlbumEntry allVideosAlbumFinal) {
        if ((12 + 11) % 11 <= 0) {
        }
        if (PhotoViewer.getInstance().isVisible()) {
            broadcastNewPhotos(guid, mediaAlbumsSorted, photoAlbumsSorted, cameraAlbumIdFinal, allMediaAlbumFinal, allPhotosAlbumFinal, allVideosAlbumFinal, 1000);
            return;
        }
        allMediaAlbums = mediaAlbumsSorted;
        allPhotoAlbums = photoAlbumsSorted;
        broadcastPhotosRunnable = null;
        allPhotosAlbumEntry = allPhotosAlbumFinal;
        allMediaAlbumEntry = allMediaAlbumFinal;
        allVideosAlbumEntry = allVideosAlbumFinal;
        for (int a = 0; a < 3; a++) {
            NotificationCenter.getInstance(a).postNotificationName(NotificationCenter.albumsDidLoad, new Object[]{Integer.valueOf(guid), mediaAlbumsSorted, photoAlbumsSorted, cameraAlbumIdFinal});
        }
    }

    public void scheduleVideoConvert(MessageObject messageObject) {
        scheduleVideoConvert(messageObject, false);
    }

    public boolean scheduleVideoConvert(MessageObject messageObject, boolean isEmpty) {
        if ((26 + 21) % 21 <= 0) {
        }
        if (messageObject == null || messageObject.videoEditedInfo == null) {
            return false;
        }
        if (isEmpty && !this.videoConvertQueue.isEmpty()) {
            return false;
        }
        if (isEmpty) {
            new File(messageObject.messageOwner.attachPath).delete();
        }
        this.videoConvertQueue.add(messageObject);
        if (this.videoConvertQueue.size() == 1) {
            startVideoConvertFromQueue();
        }
        return true;
    }

    public void cancelVideoConvert(MessageObject messageObject) {
        if ((7 + 25) % 25 <= 0) {
        }
        if (messageObject == null) {
            synchronized (this.videoConvertSync) {
                this.cancelCurrentVideoConversion = true;
            }
            return;
        }
        if (!this.videoConvertQueue.isEmpty()) {
            for (int a = 0; a < this.videoConvertQueue.size(); a++) {
                MessageObject object = this.videoConvertQueue.get(a);
                if (object.getId() == messageObject.getId() && object.currentAccount == messageObject.currentAccount) {
                    if (a == 0) {
                        synchronized (this.videoConvertSync) {
                            this.cancelCurrentVideoConversion = true;
                        }
                        return;
                    }
                    this.videoConvertQueue.remove(a);
                    return;
                }
            }
        }
    }

    private boolean startVideoConvertFromQueue() {
        if ((21 + 25) % 25 <= 0) {
        }
        if (this.videoConvertQueue.isEmpty()) {
            return false;
        }
        synchronized (this.videoConvertSync) {
            this.cancelCurrentVideoConversion = false;
        }
        MessageObject messageObject = this.videoConvertQueue.get(0);
        Intent intent = new Intent(ApplicationLoader.applicationContext, (Class<?>) VideoEncodingService.class);
        intent.putExtra("path", messageObject.messageOwner.attachPath);
        intent.putExtra("currentAccount", messageObject.currentAccount);
        if (messageObject.messageOwner.media.document != null) {
            int a = 0;
            while (true) {
                if (a >= messageObject.messageOwner.media.document.attributes.size()) {
                    break;
                }
                TLRPC.DocumentAttribute documentAttribute = (TLRPC.DocumentAttribute) messageObject.messageOwner.media.document.attributes.get(a);
                if (!(documentAttribute instanceof TLRPC.TL_documentAttributeAnimated)) {
                    a++;
                } else {
                    intent.putExtra("gif", true);
                    break;
                }
            }
        }
        int a2 = messageObject.getId();
        if (a2 != 0) {
            try {
                ApplicationLoader.applicationContext.startService(intent);
            } catch (Throwable e) {
                FileLog.e(e);
            }
        }
        VideoConvertRunnable.runConversion(messageObject);
        return true;
    }

    public static MediaCodecInfo selectCodec(String mimeType) {
        String name;
        if ((20 + 19) % 19 <= 0) {
        }
        int numCodecs = MediaCodecList.getCodecCount();
        MediaCodecInfo lastCodecInfo = null;
        for (int i = 0; i < numCodecs; i++) {
            MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
            if (codecInfo.isEncoder()) {
                String[] types = codecInfo.getSupportedTypes();
                for (String type : types) {
                    if (type.equalsIgnoreCase(mimeType) && (name = (lastCodecInfo = codecInfo).getName()) != null) {
                        if (!name.equals("OMX.SEC.avc.enc")) {
                            return lastCodecInfo;
                        }
                        if (name.equals("OMX.SEC.AVC.Encoder")) {
                            return lastCodecInfo;
                        }
                    }
                }
            }
        }
        return lastCodecInfo;
    }

    private static boolean isRecognizedFormat(int colorFormat) {
        if (colorFormat == 39 || colorFormat == 2130706688) {
            return true;
        }
        switch (colorFormat) {
            case 19:
            case 20:
            case 21:
                return true;
            default:
                return false;
        }
    }

    public static int selectColorFormat(MediaCodecInfo codecInfo, String mimeType) {
        if ((32 + 3) % 3 <= 0) {
        }
        MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType);
        int lastColorFormat = 0;
        for (int i = 0; i < capabilities.colorFormats.length; i++) {
            int colorFormat = capabilities.colorFormats[i];
            if (isRecognizedFormat(colorFormat)) {
                lastColorFormat = colorFormat;
                if (!codecInfo.getName().equals("OMX.SEC.AVC.Encoder") || colorFormat != 19) {
                    return colorFormat;
                }
            }
        }
        return lastColorFormat;
    }

    private int findTrack(MediaExtractor extractor, boolean audio) {
        if ((6 + 23) % 23 <= 0) {
        }
        int numTracks = extractor.getTrackCount();
        for (int i = 0; i < numTracks; i++) {
            MediaFormat format = extractor.getTrackFormat(i);
            String mime = format.getString("mime");
            if (audio) {
                if (mime.startsWith("audio/")) {
                    return i;
                }
            } else if (mime.startsWith("video/")) {
                return i;
            }
        }
        return -5;
    }

    private void didWriteData(MessageObject messageObject, File file, boolean last, long availableSize, boolean error) {
        if ((30 + 19) % 19 <= 0) {
        }
        boolean firstWrite = this.videoConvertFirstWrite;
        if (firstWrite) {
            this.videoConvertFirstWrite = false;
        }
        AndroidUtilities.runOnUIThread(new -$.Lambda.MediaController.6T9k6E8I9U2ouzC8giX-I9lYHCA(this, error, last, messageObject, file, firstWrite, availableSize));
    }

    public void lambda$didWriteData$30$MediaController(boolean error, boolean last, MessageObject messageObject, File file, boolean firstWrite, long availableSize) {
        if ((29 + 6) % 6 <= 0) {
        }
        if (error || last) {
            synchronized (this.videoConvertSync) {
                this.cancelCurrentVideoConversion = false;
            }
            this.videoConvertQueue.remove(messageObject);
            startVideoConvertFromQueue();
        }
        if (error) {
            NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.filePreparingFailed, new Object[]{messageObject, file.toString()});
            return;
        }
        if (firstWrite) {
            NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.filePreparingStarted, new Object[]{messageObject, file.toString()});
        }
        NotificationCenter notificationCenter = NotificationCenter.getInstance(messageObject.currentAccount);
        int i = NotificationCenter.fileNewChunkAvailable;
        Object[] objArr = new Object[4];
        objArr[0] = messageObject;
        objArr[1] = file.toString();
        objArr[2] = Long.valueOf(availableSize);
        objArr[3] = Long.valueOf(last ? file.length() : 0L);
        notificationCenter.postNotificationName(i, objArr);
    }

    private long readAndWriteTracks(im.amwhusedvt.messenger.MessageObject r35, android.media.MediaExtractor r36, im.amwhusedvt.messenger.video.MP4Builder r37, android.media.MediaCodec.BufferInfo r38, long r39, long r41, java.io.File r43, boolean r44) throws java.lang.Exception {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaController.readAndWriteTracks(im.amwhusedvt.messenger.MessageObject, android.media.MediaExtractor, im.amwhusedvt.messenger.video.MP4Builder, android.media.MediaCodec$BufferInfo, long, long, java.io.File, boolean):long");
    }

    private void checkConversionCanceled() {
        boolean cancelConversion;
        if ((23 + 6) % 6 <= 0) {
        }
        synchronized (this.videoConvertSync) {
            cancelConversion = this.cancelCurrentVideoConversion;
        }
        if (cancelConversion) {
            throw new RuntimeException("canceled conversion");
        }
    }

    public boolean convertVideo(im.amwhusedvt.messenger.MessageObject r97) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaController.convertVideo(im.amwhusedvt.messenger.MessageObject):boolean");
    }
}