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

Commit a027c95e authored by Jim Miller's avatar Jim Miller
Browse files

Fix 2428368: Fix most of the lockscreen orientation refresh bugs

This change removes the legacy notification of orientation and configuration changed events
from KeyguardUpdateMonitor and moves them into the individual activities.  This was necessary
to guarantee order of events.

In addition, to minimize discrepencies due to notification lag, Keyguard screens (LockScreen,
PatternUnlock, etc.) are now responsible for handling onConfigurationChanged() notification and
forwarding them to LockPatternKeyguardView by a call to recreateMe() with the new configuration.

Change-Id: I703daf3e91bc6588e87c844a3ed3d259a6b8ecdf
parent 9bcf789a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import java.util.List;
public class LockPatternUtils {

    private static final String TAG = "LockPatternUtils";
    private static final boolean LDEBUG = false;

    private static final String LOCK_PATTERN_FILE = "/system/gesture.key";
    private static final String LOCK_PASSWORD_FILE = "/system/password.key";
@@ -126,7 +127,6 @@ public class LockPatternUtils {
    public LockPatternUtils(Context context) {
        mContext = context;
        mContentResolver = context.getContentResolver();
        mDevicePolicyManager = getDevicePolicyManager();
        // Initialize the location of gesture lock file
        if (sLockPatternFilename == null) {
            sLockPatternFilename = android.os.Environment.getDataDirectory()
+5 −26
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.policy.impl;

import android.content.Context;
import com.android.internal.telephony.IccCard;
import android.content.res.Configuration;
import android.test.AndroidTestCase;
import android.view.View;
import android.view.KeyEvent;
@@ -39,8 +40,6 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
    private static class MockUpdateMonitor extends KeyguardUpdateMonitor {

        public IccCard.State simState = IccCard.State.READY;
        public boolean inPortrait = false;
        public boolean keyboardOpen = false;

        private MockUpdateMonitor(Context context) {
            super(context);
@@ -50,26 +49,6 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
        public IccCard.State getSimState() {
            return simState;
        }

        @Override
        public boolean isInPortrait() {
            return inPortrait;
        }

        @Override
        public boolean isKeyboardOpen() {
            return keyboardOpen;
        }

        @Override
        boolean queryInPortrait() {
            return inPortrait;
        }

        @Override
        boolean queryKeyboardOpen() {
            return keyboardOpen;
        }
    }

    private static class MockLockPatternUtils extends LockPatternUtils {
@@ -317,7 +296,7 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
        assertEquals(1, lockScreen.getOnResumeCount());

        // simulate screen asking to be recreated
        mLPKV.mKeyguardScreenCallback.recreateMe();
        mLPKV.mKeyguardScreenCallback.recreateMe(new Configuration());

        // should have been recreated
        assertEquals(2, mLPKV.getInjectedLockScreens().size());