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

Commit 43fdc250 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android Git Automerger
Browse files

am e6c029b4: am 27c1a728: am f610bd78: Fix race conditions for camera prewarm service

* commit 'e6c029b4':
  Fix race conditions for camera prewarm service
parents f10e475d e6c029b4
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -113,12 +113,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            mPrewarmMessenger = new Messenger(service);
            mPrewarmBound = true;
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            mPrewarmBound = false;
            mPrewarmMessenger = null;
        }
    };
@@ -384,8 +382,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
                serviceIntent.setClassName(targetInfo.packageName, clazz);
                serviceIntent.setAction(CameraPrewarmService.ACTION_PREWARM);
                try {
                    getContext().bindServiceAsUser(serviceIntent, mPrewarmConnection,
                            Context.BIND_AUTO_CREATE, new UserHandle(UserHandle.USER_CURRENT));
                    if (getContext().bindServiceAsUser(serviceIntent, mPrewarmConnection,
                            Context.BIND_AUTO_CREATE, new UserHandle(UserHandle.USER_CURRENT))) {
                        mPrewarmBound = true;
                    }
                } catch (SecurityException e) {
                    Log.w(TAG, "Unable to bind to prewarm service package=" + targetInfo.packageName
                            + " class=" + clazz, e);
@@ -396,7 +396,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL

    public void unbindCameraPrewarmService(boolean launched) {
        if (mPrewarmBound) {
            if (launched) {
            if (mPrewarmMessenger != null && launched) {
                try {
                    mPrewarmMessenger.send(Message.obtain(null /* handler */,
                            CameraPrewarmService.MSG_CAMERA_FIRED));