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

Commit d4290a3f authored by Yorke Lee's avatar Yorke Lee
Browse files

Disable OrientationEventListener when activity backgrounded

Bug: 21439982
Change-Id: I8cc014ffd272b6a4fa19030eeaeef87f3ffd5d82
parent 9b8d23fb
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -233,13 +233,6 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
            }
        };

        if (mOrientationEventListener.canDetectOrientation()) {
            Log.v(this, "Orientation detection enabled.");
            mOrientationEventListener.enable();
        } else {
            Log.v(this, "Orientation detection disabled.");
            mOrientationEventListener.disable();
        }
        Log.d(this, "onCreate(): exit");
    }

@@ -259,6 +252,14 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
        Log.d(this, "onStart()...");
        super.onStart();

        if (mOrientationEventListener.canDetectOrientation()) {
            Log.v(this, "Orientation detection enabled.");
            mOrientationEventListener.enable();
        } else {
            Log.v(this, "Orientation detection disabled.");
            mOrientationEventListener.disable();
        }

        // setting activity should be last thing in setup process
        InCallPresenter.getInstance().setActivity(this);

@@ -314,9 +315,9 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
    @Override
    protected void onStop() {
        Log.d(this, "onStop()...");

        InCallPresenter.getInstance().updateIsChangingConfigurations();
        InCallPresenter.getInstance().onActivityStopped();
        mOrientationEventListener.disable();
        super.onStop();
    }