Merge "[Bouncer] destroy and recreate view when..." into tm-qpr-dev am: 0bb041d646 am: f820fa354c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20584941 Change-Id: Ia3e273f0496e51cc9d0dfd6a9e389a4bea81f77b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -25,7 +25,6 @@ import android.widget.Button;
|
||||
|
||||
import com.android.internal.util.EmergencyAffordanceManager;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settingslib.Utils;
|
||||
|
||||
/**
|
||||
* This class implements a smart emergency button that updates itself based
|
||||
@@ -91,17 +90,6 @@ public class EmergencyButton extends Button {
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload colors from resources.
|
||||
**/
|
||||
public void reloadColors() {
|
||||
int color = Utils.getColorAttrDefaultColor(getContext(),
|
||||
com.android.internal.R.attr.textColorOnAccent);
|
||||
setTextColor(color);
|
||||
setBackground(getContext()
|
||||
.getDrawable(com.android.systemui.R.drawable.kg_emergency_button_background));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performLongClick() {
|
||||
return super.performLongClick();
|
||||
|
||||
@@ -20,7 +20,6 @@ import static com.android.internal.util.LatencyTracker.ACTION_CHECK_CREDENTIAL;
|
||||
import static com.android.internal.util.LatencyTracker.ACTION_CHECK_CREDENTIAL_UNLOCKED;
|
||||
import static com.android.keyguard.KeyguardAbsKeyInputView.MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT;
|
||||
|
||||
import android.annotation.CallSuper;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.CountDownTimer;
|
||||
@@ -117,13 +116,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
|
||||
}
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void reloadColors() {
|
||||
super.reloadColors();
|
||||
mMessageAreaController.reloadColors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsInput() {
|
||||
return false;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.keyguard;
|
||||
|
||||
import android.annotation.CallSuper;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
@@ -142,16 +141,6 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
|
||||
public void showMessage(CharSequence message, ColorStateList colorState) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload colors from resources.
|
||||
**/
|
||||
@CallSuper
|
||||
public void reloadColors() {
|
||||
if (mEmergencyButton != null) {
|
||||
mEmergencyButton.reloadColors();
|
||||
}
|
||||
}
|
||||
|
||||
public void startAppearAnimation() {
|
||||
if (TextUtils.isEmpty(mMessageAreaController.getMessage())) {
|
||||
mMessageAreaController.setMessage(getInitialMessageResId());
|
||||
|
||||
@@ -116,13 +116,6 @@ public class KeyguardMessageAreaController<T extends KeyguardMessageArea>
|
||||
return mView.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload colors from resources.
|
||||
**/
|
||||
public void reloadColors() {
|
||||
mView.reloadColor();
|
||||
}
|
||||
|
||||
/** Factory for creating {@link com.android.keyguard.KeyguardMessageAreaController}. */
|
||||
public static class Factory {
|
||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.keyguard;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.os.UserHandle;
|
||||
import android.text.Editable;
|
||||
@@ -39,7 +38,6 @@ import android.widget.TextView.OnEditorActionListener;
|
||||
import com.android.internal.util.LatencyTracker;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.classifier.FalsingCollector;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
@@ -95,18 +93,6 @@ public class KeyguardPasswordViewController
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void reloadColors() {
|
||||
super.reloadColors();
|
||||
int textColor = Utils.getColorAttr(mView.getContext(),
|
||||
android.R.attr.textColorPrimary).getDefaultColor();
|
||||
mPasswordEntry.setTextColor(textColor);
|
||||
mPasswordEntry.setHighlightColor(textColor);
|
||||
mPasswordEntry.setBackgroundTintList(ColorStateList.valueOf(textColor));
|
||||
mPasswordEntry.setForegroundTintList(ColorStateList.valueOf(textColor));
|
||||
mSwitchImeButton.setImageTintList(ColorStateList.valueOf(textColor));
|
||||
}
|
||||
|
||||
protected KeyguardPasswordViewController(KeyguardPasswordView view,
|
||||
KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||
SecurityMode securityMode,
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.android.internal.widget.LockPatternView.Cell;
|
||||
import com.android.internal.widget.LockscreenCredential;
|
||||
import com.android.keyguard.EmergencyButtonController.EmergencyButtonCallback;
|
||||
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.classifier.FalsingClassifier;
|
||||
import com.android.systemui.classifier.FalsingCollector;
|
||||
@@ -271,16 +270,6 @@ public class KeyguardPatternViewController
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadColors() {
|
||||
super.reloadColors();
|
||||
mMessageAreaController.reloadColors();
|
||||
int textColor = Utils.getColorAttr(mLockPatternView.getContext(),
|
||||
android.R.attr.textColorSecondary).getDefaultColor();
|
||||
int errorColor = Utils.getColorError(mLockPatternView.getContext()).getDefaultColor();
|
||||
mLockPatternView.setColors(textColor, textColor, errorColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
@@ -69,12 +69,6 @@ public class KeyguardPinViewController
|
||||
mPostureController.removeCallback(mPostureCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadColors() {
|
||||
super.reloadColors();
|
||||
mView.reloadColors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startDisappearAnimation(Runnable finishRunnable) {
|
||||
return mView.startDisappearAnimation(
|
||||
|
||||
@@ -730,16 +730,20 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
||||
}
|
||||
|
||||
private void reloadColors() {
|
||||
mSecurityViewFlipperController.reloadColors();
|
||||
resetViewFlipper();
|
||||
mView.reloadColors();
|
||||
}
|
||||
|
||||
/** Handles density or font scale changes. */
|
||||
private void onDensityOrFontScaleChanged() {
|
||||
mSecurityViewFlipperController.onDensityOrFontScaleChanged();
|
||||
resetViewFlipper();
|
||||
mView.onDensityOrFontScaleChanged();
|
||||
}
|
||||
|
||||
private void resetViewFlipper() {
|
||||
mSecurityViewFlipperController.clearViews();
|
||||
mSecurityViewFlipperController.getSecurityView(mCurrentSecurityMode,
|
||||
mKeyguardSecurityCallback);
|
||||
mView.onDensityOrFontScaleChanged();
|
||||
}
|
||||
|
||||
static class Factory {
|
||||
|
||||
@@ -74,17 +74,8 @@ public class KeyguardSecurityViewFlipperController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload colors of ui elements upon theme change.
|
||||
*/
|
||||
public void reloadColors() {
|
||||
for (KeyguardInputViewController<KeyguardInputView> child : mChildren) {
|
||||
child.reloadColors();
|
||||
}
|
||||
}
|
||||
|
||||
/** Handles density or font scale changes. */
|
||||
public void onDensityOrFontScaleChanged() {
|
||||
public void clearViews() {
|
||||
mView.removeAllViews();
|
||||
mChildren.clear();
|
||||
}
|
||||
|
||||
@@ -132,12 +132,6 @@ public class KeyguardSimPinViewController
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadColors() {
|
||||
super.reloadColors();
|
||||
mView.reloadColors();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verifyPasswordAndUnlock() {
|
||||
String entry = mPasswordEntry.getText();
|
||||
|
||||
@@ -120,12 +120,6 @@ public class KeyguardSimPukViewController
|
||||
mStateMachine.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadColors() {
|
||||
super.reloadColors();
|
||||
mView.reloadColors();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verifyPasswordAndUnlock() {
|
||||
mStateMachine.next();
|
||||
|
||||
@@ -558,11 +558,40 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
|
||||
configurationListenerArgumentCaptor.getValue().onDensityOrFontScaleChanged();
|
||||
|
||||
verify(mView).onDensityOrFontScaleChanged();
|
||||
verify(mKeyguardSecurityViewFlipperController).onDensityOrFontScaleChanged();
|
||||
verify(mKeyguardSecurityViewFlipperController).clearViews();
|
||||
verify(mKeyguardSecurityViewFlipperController).getSecurityView(any(SecurityMode.class),
|
||||
any(KeyguardSecurityCallback.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onThemeChanged() {
|
||||
ArgumentCaptor<ConfigurationController.ConfigurationListener>
|
||||
configurationListenerArgumentCaptor = ArgumentCaptor.forClass(
|
||||
ConfigurationController.ConfigurationListener.class);
|
||||
mKeyguardSecurityContainerController.onViewAttached();
|
||||
verify(mConfigurationController).addCallback(configurationListenerArgumentCaptor.capture());
|
||||
configurationListenerArgumentCaptor.getValue().onThemeChanged();
|
||||
|
||||
verify(mView).reloadColors();
|
||||
verify(mKeyguardSecurityViewFlipperController).clearViews();
|
||||
verify(mKeyguardSecurityViewFlipperController).getSecurityView(any(SecurityMode.class),
|
||||
any(KeyguardSecurityCallback.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onUiModeChanged() {
|
||||
ArgumentCaptor<ConfigurationController.ConfigurationListener>
|
||||
configurationListenerArgumentCaptor = ArgumentCaptor.forClass(
|
||||
ConfigurationController.ConfigurationListener.class);
|
||||
mKeyguardSecurityContainerController.onViewAttached();
|
||||
verify(mConfigurationController).addCallback(configurationListenerArgumentCaptor.capture());
|
||||
configurationListenerArgumentCaptor.getValue().onUiModeChanged();
|
||||
|
||||
verify(mView).reloadColors();
|
||||
verify(mKeyguardSecurityViewFlipperController).clearViews();
|
||||
verify(mKeyguardSecurityViewFlipperController).getSecurityView(any(SecurityMode.class),
|
||||
any(KeyguardSecurityCallback.class));
|
||||
}
|
||||
|
||||
private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
|
||||
mKeyguardSecurityContainerController.onViewAttached();
|
||||
|
||||
@@ -109,7 +109,7 @@ public class KeyguardSecurityViewFlipperControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void onDensityOrFontScaleChanged() {
|
||||
mKeyguardSecurityViewFlipperController.onDensityOrFontScaleChanged();
|
||||
mKeyguardSecurityViewFlipperController.clearViews();
|
||||
verify(mView).removeAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user