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

Commit 24bab4e7 authored by Muhammed Siju's avatar Muhammed Siju Committed by Gerrit - the friendly Code Review server
Browse files

IMS-VT: Fix orientation change not working after back key press

When InCall activity is recreated after finishing by back key press,
there is a chance that VideoCallPresenter tries to enable
orientation change even before activity is registered with
IncallPresenter. In such cases the cached orientation mode is
updated in VideoCallPresenter even though it was not really updated
in InCallActivity. To fix this, check if new orientation mode was
actually updated before updating cached value in VideoCallPresenter.

Change-Id: Iedc06167bf2edd50c7405a09cd99e68fdc3f4f7c
Crs-Fixed: 1050432
parent 6bdfac41
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1811,16 +1811,18 @@ public class InCallPresenter implements CallList.Listener,
     * orientation event listener if allowOrientationChange is true, disables it if false.
     *
     * @param orientation {@link ActivityInfo#screenOrientation} Actual orientation value to set
     * @return returns whether the new orientation mode was set successfully or not.
     */
    public void setInCallAllowsOrientationChange(int orientation) {
    public boolean setInCallAllowsOrientationChange(int orientation) {
        if (mInCallActivity == null) {
            Log.e(this, "InCallActivity is null. Can't set requested orientation.");
            return;
            return false;
        }

        mInCallActivity.setRequestedOrientation(orientation);
        mInCallActivity.enableInCallOrientationEventListener(
                orientation == InCallOrientationEventListener.FULL_SENSOR_SCREEN_ORIENTATION);
        return true;
    }

    /* returns TRUE if screen is turned ON else false */
+2 −2
Original line number Diff line number Diff line
@@ -670,11 +670,11 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi

    private void checkForOrientationAllowedChange(Call call) {
        final int newMode = OrientationModeHandler.getInstance().getOrientation(call);
        if (newMode != mActivityOrientationMode) {
        if (newMode != mActivityOrientationMode && InCallPresenter.
                getInstance().setInCallAllowsOrientationChange(newMode)) {
            Log.d(this, "checkForOrientationAllowedChange: currMode = " +
                    mActivityOrientationMode + " newMode = " + newMode);
            mActivityOrientationMode = newMode;
            InCallPresenter.getInstance().setInCallAllowsOrientationChange(newMode);
        }
    }