Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0794cd33 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Move MountService's Handler to a different thread."

parents 4f33d800 5f27ef49
Loading
Loading
Loading
Loading
+15 −3
Original line number Original line Diff line number Diff line
@@ -29,6 +29,8 @@ import android.os.storage.IMountServiceListener;
import android.os.storage.IMountShutdownObserver;
import android.os.storage.IMountShutdownObserver;
import android.os.storage.StorageResultCode;
import android.os.storage.StorageResultCode;
import android.os.Handler;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.Message;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.IBinder;
import android.os.IBinder;
@@ -193,10 +195,14 @@ class MountService extends IMountService.Stub
        }
        }
    }
    }


    final private Handler mHandler = new Handler() {
    class MountServiceHandler extends Handler {
        ArrayList<UnmountCallBack> mForceUnmounts = new ArrayList<UnmountCallBack>();
        ArrayList<UnmountCallBack> mForceUnmounts = new ArrayList<UnmountCallBack>();
        boolean mRegistered = false;
        boolean mRegistered = false;


        MountServiceHandler(Looper l) {
            super(l);
        }

        void registerReceiver() {
        void registerReceiver() {
            mRegistered = true;
            mRegistered = true;
            mContext.registerReceiver(mPmReceiver, mPmFilter);
            mContext.registerReceiver(mPmReceiver, mPmFilter);
@@ -287,6 +293,8 @@ class MountService extends IMountService.Stub
            }
            }
        }
        }
    };
    };
    final private HandlerThread mHandlerThread;
    final private Handler mHandler;


    private void waitForReady() {
    private void waitForReady() {
        while (mReady == false) {
        while (mReady == false) {
@@ -850,6 +858,10 @@ class MountService extends IMountService.Stub
        mContext.registerReceiver(mBroadcastReceiver,
        mContext.registerReceiver(mBroadcastReceiver,
                new IntentFilter(Intent.ACTION_BOOT_COMPLETED), null, null);
                new IntentFilter(Intent.ACTION_BOOT_COMPLETED), null, null);


        mHandlerThread = new HandlerThread("MountService");
        mHandlerThread.start();
        mHandler = new MountServiceHandler(mHandlerThread.getLooper());

        /*
        /*
         * Vold does not run in the simulator, so pretend the connector thread
         * Vold does not run in the simulator, so pretend the connector thread
         * ran and did its thing.
         * ran and did its thing.