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

Commit 3a1837e9 authored by Jim Miller's avatar Jim Miller
Browse files

Fix for 2292713: Remove workaround that hides SlidingTab widget while internal...

Fix for 2292713: Remove workaround that hides SlidingTab widget while internal state is inconsistent.

The previous workaround for this race condition prevented glitches by postponing drawing the SlidingTab until the internal state was consistent.  Unfortunately, the InCallScreen seems to trigger this most of the time if the keyboard is open or the last application was in landscape mode.

Instead, we'll handle this separately in lockscreen.
parent bb2e5c91
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.accounts.OperationCanceledException;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
@@ -40,6 +41,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;

import java.io.IOException;
@@ -139,6 +141,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase
     */
    private final LockPatternUtils mLockPatternUtils;

    private boolean mIsPortrait;

    /**
     * @return Whether we are stuck on the lock screen because the sim is
     *   missing.
@@ -334,6 +338,33 @@ public class LockPatternKeyguardView extends KeyguardViewBase
    }


    // TODO:
    // This overloaded method was added to workaround a race condition in the framework between
    // notification for orientation changed, layout() and switching resources.  This code attempts
    // to avoid drawing the incorrect layout while things are in transition.  The method can just
    // be removed once the race condition is fixed. See bugs 2262578 and 2292713.
    @Override
    protected void dispatchDraw(Canvas canvas) {
        final int orientation = getResources().getConfiguration().orientation;
        if (mIsPortrait && Configuration.ORIENTATION_PORTRAIT != orientation
                || getResources().getBoolean(R.bool.lockscreen_isPortrait) != mIsPortrait) {
            // Make sure we redraw once things settle down.
            // Log.v(TAG, "dispatchDraw(): not drawing because state is inconsistent");
            postInvalidate();

            // In order to minimize flashing, draw the first child's background for now.
            ViewGroup view = (ViewGroup) (mMode == Mode.LockScreen ? mLockScreen : mUnlockScreen);
            if (view != null && view.getChildAt(0) != null) {
                Drawable background = view.getChildAt(0).getBackground();
                if (background != null) {
                    background.draw(canvas);
                }
            }
            return;
        }
        super.dispatchDraw(canvas);
    }

    @Override
    public void reset() {
        mIsVerifyUnlockOnly = false;
@@ -482,6 +513,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase
    }

    View createUnlockScreenFor(UnlockMode unlockMode) {
        // Capture the orientation this layout was created in.
        mIsPortrait = getResources().getBoolean(R.bool.lockscreen_isPortrait);

        if (unlockMode == UnlockMode.Pattern) {
            UnlockScreen view = new UnlockScreen(
                    mContext,