// Path: src/com/xiaomi/mitv/soundbarapp/util/Worker.java
// public class Worker implements Runnable {
//     private final Object mLock = new Object();
//     private Looper mLooper;
// 
//     /**
//      * Creates a worker thread with the given name. The thread
//      * then runs a {@link android.os.Looper}.
//      * @param name A name for the new thread
//      */
//     public Worker(String name) {
//         Thread t = new Thread(null, this, name);
//         t.setPriority(Thread.MIN_PRIORITY);
//         t.start();
//         synchronized (mLock) {
//             while (mLooper == null) {
//                 try {
//                     mLock.wait();
//                 } catch (InterruptedException ex) {
//                 }
//             }
//         }
//     }
// 
//     public Looper getLooper() {
//         return mLooper;
//     }
// 
//     public void run() {
//         synchronized (mLock) {
//             Looper.prepare();
//             mLooper = Looper.myLooper();
//             mLock.notifyAll();
//         }
//         Looper.loop();
//     }
// 
//     public void quit() {
//         mLooper.quit();
//     }
// }


import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.*;
import android.database.Cursor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.audiofx.AudioEffect;
import android.net.Uri;
import android.os.*;
import android.provider.MediaStore;
import android.util.Log;
import android.widget.RemoteViews;
import android.widget.Toast;
import com.xiaomi.mitv.soundbarapp.R;
import com.xiaomi.mitv.soundbarapp.util.Worker;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.util.Random;
import java.util.Vector;
    private long [] mAutoShuffleList = null;
    private long [] mPlayList = null;
    private int mPlayListLen = 0;
    private Vector<Integer> mHistory = new Vector<Integer>(MAX_HISTORY_SIZE);
    private Cursor mCursor;
    private int mPlayPos = -1;
    private int mNextPlayPos = -1;

    private final Shuffler mRand = new Shuffler();
    private int mOpenFailedCounter = 0;
    private final static int IDCOLIDX = 0;
    private final static int PODCASTCOLIDX = 8;
    private final static int BOOKMARKCOLIDX = 9;
    private BroadcastReceiver mUnmountReceiver = null;
    private PowerManager.WakeLock mWakeLock;
    private int mServiceStartId = -1;
    private boolean mServiceInUse = false;
    private boolean mIsSupposedToBePlaying = false;
    private boolean mQuietMode = false;
    private AudioManager mAudioManager;
    // used to track what type of audio focus loss caused the playback to pause
    private boolean mPausedByTransientLossOfFocus = false;

    private SharedPreferences mPreferences;
    // We use this to distinguish between different cards when saving/restoring playlists.
    // This will have to change if we want to support multiple simultaneous cards.
    private int mCardId;

    // interval after which we stop the service when idle
    private static final int IDLE_DELAY = 60000;
// Path: src/com/xiaomi/mitv/soundbarapp/util/Worker.java
// public class Worker implements Runnable {
//     private final Object mLock = new Object();
//     private Looper mLooper;
// 
//     /**
//      * Creates a worker thread with the given name. The thread
//      * then runs a {@link android.os.Looper}.
//      * @param name A name for the new thread
//      */
//     public Worker(String name) {
//         Thread t = new Thread(null, this, name);
//         t.setPriority(Thread.MIN_PRIORITY);
//         t.start();
//         synchronized (mLock) {
//             while (mLooper == null) {
//                 try {
//                     mLock.wait();
//                 } catch (InterruptedException ex) {
//                 }
//             }
//         }
//     }
// 
//     public Looper getLooper() {
//         return mLooper;
//     }
// 
//     public void run() {
//         synchronized (mLock) {
//             Looper.prepare();
//             mLooper = Looper.myLooper();
//             mLock.notifyAll();
//         }
//         Looper.loop();
//     }
// 
//     public void quit() {
//         mLooper.quit();
//     }
// }


// Path: src/com/xiaomi/mitv/soundbarapp/player/PlayerService.java
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.*;
import android.database.Cursor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.audiofx.AudioEffect;
import android.net.Uri;
import android.os.*;
import android.provider.MediaStore;
import android.util.Log;
import android.widget.RemoteViews;
import android.widget.Toast;
import com.xiaomi.mitv.soundbarapp.R;
import com.xiaomi.mitv.soundbarapp.util.Worker;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.util.Random;
import java.util.Vector;

    private long [] mAutoShuffleList = null;
    private long [] mPlayList = null;
    private int mPlayListLen = 0;
    private Vector<Integer> mHistory = new Vector<Integer>(MAX_HISTORY_SIZE);
    private Cursor mCursor;
    private int mPlayPos = -1;
    private int mNextPlayPos = -1;

    private final Shuffler mRand = new Shuffler();
    private int mOpenFailedCounter = 0;
    private final static int IDCOLIDX = 0;
    private final static int PODCASTCOLIDX = 8;
    private final static int BOOKMARKCOLIDX = 9;
    private BroadcastReceiver mUnmountReceiver = null;
    private PowerManager.WakeLock mWakeLock;
    private int mServiceStartId = -1;
    private boolean mServiceInUse = false;
    private boolean mIsSupposedToBePlaying = false;
    private boolean mQuietMode = false;
    private AudioManager mAudioManager;
    // used to track what type of audio focus loss caused the playback to pause
    private boolean mPausedByTransientLossOfFocus = false;

    private SharedPreferences mPreferences;
    // We use this to distinguish between different cards when saving/restoring playlists.
    // This will have to change if we want to support multiple simultaneous cards.
    private int mCardId;

    // interval after which we stop the service when idle
    private static final int IDLE_DELAY = 60000;
    private Worker mWorker;