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
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
@@ -115,7 +94,7 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
|
||||
public boolean needsInput() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void onPause() {
|
||||
mOnPauseCount++;
|
||||
@@ -202,7 +181,7 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
|
||||
}
|
||||
|
||||
public void keyguardDoneDrawing() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int getPokeWakelockCount() {
|
||||
@@ -293,7 +272,7 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase {
|
||||
|
||||
// should have poked the wakelock to turn on the screen
|
||||
assertEquals(1, mKeyguardViewCallback.getPokeWakelockCount());
|
||||
|
||||
|
||||
// shouldn't be any additional views created
|
||||
assertEquals(1, mLPKV.getInjectedLockScreens().size());
|
||||
assertEquals(1, mLPKV.getInjectedUnlockScreens().size());
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user