Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java +9 −6 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.keyguard; import android.annotation.Nullable; import android.content.res.ColorStateList; import android.graphics.Color; import android.text.TextUtils; import android.view.View; import androidx.annotation.IntDef; Loading Loading @@ -69,8 +70,7 @@ public class KeyguardIndicationRotateTextViewController extends public KeyguardIndicationRotateTextViewController( KeyguardIndicationTextView view, @Main DelayableExecutor executor, StatusBarStateController statusBarStateController, int lockScreenMode StatusBarStateController statusBarStateController ) { super(view); mMaxAlpha = view.getAlpha(); Loading @@ -78,7 +78,6 @@ public class KeyguardIndicationRotateTextViewController extends mInitialTextColorState = mView != null ? mView.getTextColors() : ColorStateList.valueOf(Color.WHITE); mStatusBarStateController = statusBarStateController; mView.setLockScreenMode(lockScreenMode); init(); } Loading @@ -102,7 +101,7 @@ public class KeyguardIndicationRotateTextViewController extends * the IndicationQueue comes around. */ public void updateIndication(@IndicationType int type, KeyguardIndication newIndication, boolean showImmediately) { boolean updateImmediately) { if (type == INDICATION_TYPE_NOW_PLAYING || type == INDICATION_TYPE_REVERSE_CHARGING) { // temporarily don't show here, instead use AmbientContainer b/181049781 Loading @@ -125,7 +124,7 @@ public class KeyguardIndicationRotateTextViewController extends return; } final boolean showNow = showImmediately final boolean showNow = updateImmediately || mCurrIndicationType == INDICATION_TYPE_NONE || mCurrIndicationType == type; if (hasNewIndication) { Loading @@ -139,7 +138,7 @@ public class KeyguardIndicationRotateTextViewController extends if (mCurrIndicationType == type && !hasNewIndication && showImmediately) { && updateImmediately) { if (mShowNextIndicationRunnable != null) { mShowNextIndicationRunnable.runImmediately(); } else { Loading @@ -154,6 +153,10 @@ public class KeyguardIndicationRotateTextViewController extends * If the current indication is of this type, immediately stops showing the message. */ public void hideIndication(@IndicationType int type) { if (!mIndicationMessages.containsKey(type) || TextUtils.isEmpty(mIndicationMessages.get(type).getMessage())) { return; } updateIndication(type, null, true); } Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +15 −91 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static com.android.keyguard.KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1; import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_ALIGNMENT; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_BATTERY; Loading @@ -30,6 +29,7 @@ import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewCont import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_RESTING; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_TRUST; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED; import static com.android.systemui.plugins.FalsingManager.LOW_PENALTY; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; Loading Loading @@ -77,6 +77,7 @@ import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dock.DockManager; import com.android.systemui.keyguard.KeyguardIndication; import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; Loading Loading @@ -120,6 +121,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal private final @Main DelayableExecutor mExecutor; private final LockPatternUtils mLockPatternUtils; private final IActivityManager mIActivityManager; private final FalsingManager mFalsingManager; protected KeyguardIndicationRotateTextViewController mRotateTextViewController; private BroadcastReceiver mBroadcastReceiver; Loading Loading @@ -171,7 +173,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal DevicePolicyManager devicePolicyManager, IBatteryStats iBatteryStats, UserManager userManager, @Main DelayableExecutor executor) { @Main DelayableExecutor executor, FalsingManager falsingManager) { mContext = context; mBroadcastDispatcher = broadcastDispatcher; mDevicePolicyManager = devicePolicyManager; Loading @@ -188,6 +191,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mExecutor = executor; mLockPatternUtils = new LockPatternUtils(context); mIActivityManager = ActivityManager.getService(); mFalsingManager = falsingManager; mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback()); mKeyguardUpdateMonitor.registerCallback(mTickReceiver); Loading @@ -203,8 +207,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mRotateTextViewController = new KeyguardIndicationRotateTextViewController( indicationArea.findViewById(R.id.keyguard_indication_text_bottom), mExecutor, mStatusBarStateController, mLockScreenMode); mStatusBarStateController); updateIndication(false /* animate */); updateDisclosure(); if (mBroadcastReceiver == null) { Loading Loading @@ -284,10 +287,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mRotateTextViewController.hideIndication(INDICATION_TYPE_DISCLOSURE); } if (isKeyguardLayoutEnabled()) { updateResting(); } } private CharSequence getDisclosureText(@Nullable CharSequence organizationName) { final Resources packageResources = mContext.getResources(); Loading @@ -306,10 +307,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal } private void updateOwnerInfo() { if (!isKeyguardLayoutEnabled()) { mRotateTextViewController.hideIndication(INDICATION_TYPE_OWNER_INFO); return; } String info = mLockPatternUtils.getDeviceOwnerInfo(); if (info == null) { // Use the current user owner information if enabled. Loading Loading @@ -431,15 +428,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal } } protected boolean isKeyguardLayoutEnabled() { return mLockScreenMode == LOCK_SCREEN_MODE_LAYOUT_1; } private void updateLogoutView() { if (!isKeyguardLayoutEnabled()) { mRotateTextViewController.hideIndication(INDICATION_TYPE_LOGOUT); return; } final boolean shouldShowLogout = mKeyguardUpdateMonitor.isLogoutEnabled() && KeyguardUpdateMonitor.getCurrentUser() != UserHandle.USER_SYSTEM; if (shouldShowLogout) { Loading @@ -452,6 +441,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal .setBackground(mContext.getDrawable( com.android.systemui.R.drawable.logout_button_background)) .setClickListener((view) -> { if (mFalsingManager.isFalseTap(LOW_PENALTY)) { return; } int currentUserId = KeyguardUpdateMonitor.getCurrentUser(); try { mIActivityManager.switchUser(UserHandle.USER_SYSTEM); Loading Loading @@ -651,76 +643,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal } // LOCK SCREEN // Some cases here might need to hide the indication (if the battery is not present) int userId = KeyguardUpdateMonitor.getCurrentUser(); if (mLockScreenMode == LOCK_SCREEN_MODE_LAYOUT_1) { mTopIndicationView.setVisibility(GONE); updateIndications(animate, userId); } else { boolean hideIndication = false; boolean isError = false; String trustGrantedIndication = getTrustGrantedIndication(); String trustManagedIndication = getTrustManagedIndication(); String powerIndication = null; if (mPowerPluggedIn || mEnableBatteryDefender) { powerIndication = computePowerIndication(); } if (!mKeyguardUpdateMonitor.isUserUnlocked(userId)) { mTopIndicationView.switchIndication( com.android.internal.R.string.lockscreen_storage_locked); } else if (!TextUtils.isEmpty(mTransientIndication)) { if (powerIndication != null && !mTransientIndication.equals(powerIndication)) { String indication = mContext.getResources().getString( R.string.keyguard_indication_trust_unlocked_plugged_in, mTransientIndication, powerIndication); mTopIndicationView.switchIndication(indication, null); hideIndication = !mBatteryPresent; } else { mTopIndicationView.switchIndication(mTransientIndication, null); } isError = mTransientTextIsError; } else if (!TextUtils.isEmpty(trustGrantedIndication) && mKeyguardUpdateMonitor.getUserHasTrust(userId)) { if (powerIndication != null) { String indication = mContext.getResources().getString( R.string.keyguard_indication_trust_unlocked_plugged_in, trustGrantedIndication, powerIndication); mTopIndicationView.switchIndication(indication, null); hideIndication = !mBatteryPresent; } else { mTopIndicationView.switchIndication(trustGrantedIndication, null); } } else if (!TextUtils.isEmpty(mAlignmentIndication)) { mTopIndicationView.switchIndication(mAlignmentIndication, null); isError = true; hideIndication = !mBatteryPresent; } else if (mPowerPluggedIn || mEnableBatteryDefender) { if (DEBUG_CHARGING_SPEED) { powerIndication += ", " + (mChargingWattage / 1000) + " mW"; } if (animate) { animateText(mTopIndicationView, powerIndication); } else { mTopIndicationView.switchIndication(powerIndication, null); } hideIndication = !mBatteryPresent; } else if (!TextUtils.isEmpty(trustManagedIndication) && mKeyguardUpdateMonitor.getUserTrustIsManaged(userId) && !mKeyguardUpdateMonitor.getUserHasTrust(userId)) { mTopIndicationView.switchIndication(trustManagedIndication, null); } else { mTopIndicationView.switchIndication(mRestingIndication, null); } mTopIndicationView.setTextColor( isError ? Utils.getColorError(mContext) : mInitialTextColorState); if (hideIndication) { mIndicationArea.setVisibility(GONE); } } updateIndications(animate, KeyguardUpdateMonitor.getCurrentUser()); } // animates textView - textView moves up and bounces down Loading Loading @@ -883,7 +807,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal @Override public void onUnlockedChanged() { updateIndication(!mDozing); updateIndication(false); } protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { Loading Loading @@ -1025,7 +949,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal @Override public void onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType) { if (running) { if (running && biometricSourceType == BiometricSourceType.FACE) { // Let's hide any previous messages when authentication starts, otherwise // multiple auth attempts would overlap. hideTransientIndication(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +19 −41 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.phone; import static com.android.keyguard.KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; Loading @@ -40,16 +38,12 @@ import java.util.LinkedList; * A view to show hints on Keyguard ("Swipe up to unlock", "Tap again to open"). */ public class KeyguardIndicationTextView extends TextView { private static final int FADE_OUT_MILLIS = 200; private static final int FADE_IN_MILLIS = 250; private static final long MSG_DURATION_MILLIS = 600; private long mNextAnimationTime = 0; private boolean mAnimationsEnabled = true; private LinkedList<CharSequence> mMessages = new LinkedList<>(); private LinkedList<KeyguardIndication> mKeyguardIndicationInfo = new LinkedList<>(); private boolean mUseNewAnimations = false; public KeyguardIndicationTextView(Context context) { super(context); } Loading @@ -67,10 +61,6 @@ public class KeyguardIndicationTextView extends TextView { super(context, attrs, defStyleAttr, defStyleRes); } public void setLockScreenMode(int lockScreenMode) { mUseNewAnimations = lockScreenMode == LOCK_SCREEN_MODE_LAYOUT_1; } /** * Changes the text with an animation and makes sure a single indication is shown long enough. */ Loading Loading @@ -148,15 +138,11 @@ public class KeyguardIndicationTextView extends TextView { } }); if (mUseNewAnimations) { Animator yTranslate = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, 0, -getYTranslationPixels()); yTranslate.setDuration(getFadeOutDuration()); fadeOut.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN); animatorSet.playTogether(fadeOut, yTranslate); } else { animatorSet.play(fadeOut); } return animatorSet; } Loading @@ -168,7 +154,6 @@ public class KeyguardIndicationTextView extends TextView { fadeIn.setDuration(getFadeInDuration()); fadeIn.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN); if (mUseNewAnimations) { Animator yTranslate = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, getYTranslationPixels(), 0); yTranslate.setDuration(getYInDuration()); Loading @@ -179,9 +164,6 @@ public class KeyguardIndicationTextView extends TextView { } }); animatorSet.playTogether(yTranslate, fadeIn); } else { animatorSet.play(fadeIn); } return animatorSet; } Loading @@ -193,26 +175,22 @@ public class KeyguardIndicationTextView extends TextView { private long getFadeInDelay() { if (!mAnimationsEnabled) return 0L; if (mUseNewAnimations) return 150L; return 0L; return 150L; } private long getFadeInDuration() { if (!mAnimationsEnabled) return 0L; if (mUseNewAnimations) return 317L; return FADE_IN_MILLIS; return 317L; } private long getYInDuration() { if (!mAnimationsEnabled) return 0L; if (mUseNewAnimations) return 600L; return 0L; return 600L; } private long getFadeOutDuration() { if (!mAnimationsEnabled) return 0L; if (mUseNewAnimations) return 167L; return FADE_OUT_MILLIS; return 167L; } private void setNextAnimationTime(long time) { Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.keyguard; import static com.android.keyguard.KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_BATTERY; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_DISCLOSURE; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_OWNER_INFO; Loading Loading @@ -77,7 +76,7 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas MockitoAnnotations.initMocks(this); when(mView.getTextColors()).thenReturn(ColorStateList.valueOf(Color.WHITE)); mController = new KeyguardIndicationRotateTextViewController(mView, mExecutor, mStatusBarStateController, LOCK_SCREEN_MODE_LAYOUT_1); mStatusBarStateController); mController.onViewAttached(); verify(mStatusBarStateController).addCallback(mStatusBarStateListenerCaptor.capture()); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +79 −63 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java +9 −6 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.keyguard; import android.annotation.Nullable; import android.content.res.ColorStateList; import android.graphics.Color; import android.text.TextUtils; import android.view.View; import androidx.annotation.IntDef; Loading Loading @@ -69,8 +70,7 @@ public class KeyguardIndicationRotateTextViewController extends public KeyguardIndicationRotateTextViewController( KeyguardIndicationTextView view, @Main DelayableExecutor executor, StatusBarStateController statusBarStateController, int lockScreenMode StatusBarStateController statusBarStateController ) { super(view); mMaxAlpha = view.getAlpha(); Loading @@ -78,7 +78,6 @@ public class KeyguardIndicationRotateTextViewController extends mInitialTextColorState = mView != null ? mView.getTextColors() : ColorStateList.valueOf(Color.WHITE); mStatusBarStateController = statusBarStateController; mView.setLockScreenMode(lockScreenMode); init(); } Loading @@ -102,7 +101,7 @@ public class KeyguardIndicationRotateTextViewController extends * the IndicationQueue comes around. */ public void updateIndication(@IndicationType int type, KeyguardIndication newIndication, boolean showImmediately) { boolean updateImmediately) { if (type == INDICATION_TYPE_NOW_PLAYING || type == INDICATION_TYPE_REVERSE_CHARGING) { // temporarily don't show here, instead use AmbientContainer b/181049781 Loading @@ -125,7 +124,7 @@ public class KeyguardIndicationRotateTextViewController extends return; } final boolean showNow = showImmediately final boolean showNow = updateImmediately || mCurrIndicationType == INDICATION_TYPE_NONE || mCurrIndicationType == type; if (hasNewIndication) { Loading @@ -139,7 +138,7 @@ public class KeyguardIndicationRotateTextViewController extends if (mCurrIndicationType == type && !hasNewIndication && showImmediately) { && updateImmediately) { if (mShowNextIndicationRunnable != null) { mShowNextIndicationRunnable.runImmediately(); } else { Loading @@ -154,6 +153,10 @@ public class KeyguardIndicationRotateTextViewController extends * If the current indication is of this type, immediately stops showing the message. */ public void hideIndication(@IndicationType int type) { if (!mIndicationMessages.containsKey(type) || TextUtils.isEmpty(mIndicationMessages.get(type).getMessage())) { return; } updateIndication(type, null, true); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +15 −91 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static com.android.keyguard.KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1; import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_ALIGNMENT; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_BATTERY; Loading @@ -30,6 +29,7 @@ import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewCont import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_RESTING; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_TRUST; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED; import static com.android.systemui.plugins.FalsingManager.LOW_PENALTY; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; Loading Loading @@ -77,6 +77,7 @@ import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dock.DockManager; import com.android.systemui.keyguard.KeyguardIndication; import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; Loading Loading @@ -120,6 +121,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal private final @Main DelayableExecutor mExecutor; private final LockPatternUtils mLockPatternUtils; private final IActivityManager mIActivityManager; private final FalsingManager mFalsingManager; protected KeyguardIndicationRotateTextViewController mRotateTextViewController; private BroadcastReceiver mBroadcastReceiver; Loading Loading @@ -171,7 +173,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal DevicePolicyManager devicePolicyManager, IBatteryStats iBatteryStats, UserManager userManager, @Main DelayableExecutor executor) { @Main DelayableExecutor executor, FalsingManager falsingManager) { mContext = context; mBroadcastDispatcher = broadcastDispatcher; mDevicePolicyManager = devicePolicyManager; Loading @@ -188,6 +191,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mExecutor = executor; mLockPatternUtils = new LockPatternUtils(context); mIActivityManager = ActivityManager.getService(); mFalsingManager = falsingManager; mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback()); mKeyguardUpdateMonitor.registerCallback(mTickReceiver); Loading @@ -203,8 +207,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mRotateTextViewController = new KeyguardIndicationRotateTextViewController( indicationArea.findViewById(R.id.keyguard_indication_text_bottom), mExecutor, mStatusBarStateController, mLockScreenMode); mStatusBarStateController); updateIndication(false /* animate */); updateDisclosure(); if (mBroadcastReceiver == null) { Loading Loading @@ -284,10 +287,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mRotateTextViewController.hideIndication(INDICATION_TYPE_DISCLOSURE); } if (isKeyguardLayoutEnabled()) { updateResting(); } } private CharSequence getDisclosureText(@Nullable CharSequence organizationName) { final Resources packageResources = mContext.getResources(); Loading @@ -306,10 +307,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal } private void updateOwnerInfo() { if (!isKeyguardLayoutEnabled()) { mRotateTextViewController.hideIndication(INDICATION_TYPE_OWNER_INFO); return; } String info = mLockPatternUtils.getDeviceOwnerInfo(); if (info == null) { // Use the current user owner information if enabled. Loading Loading @@ -431,15 +428,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal } } protected boolean isKeyguardLayoutEnabled() { return mLockScreenMode == LOCK_SCREEN_MODE_LAYOUT_1; } private void updateLogoutView() { if (!isKeyguardLayoutEnabled()) { mRotateTextViewController.hideIndication(INDICATION_TYPE_LOGOUT); return; } final boolean shouldShowLogout = mKeyguardUpdateMonitor.isLogoutEnabled() && KeyguardUpdateMonitor.getCurrentUser() != UserHandle.USER_SYSTEM; if (shouldShowLogout) { Loading @@ -452,6 +441,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal .setBackground(mContext.getDrawable( com.android.systemui.R.drawable.logout_button_background)) .setClickListener((view) -> { if (mFalsingManager.isFalseTap(LOW_PENALTY)) { return; } int currentUserId = KeyguardUpdateMonitor.getCurrentUser(); try { mIActivityManager.switchUser(UserHandle.USER_SYSTEM); Loading Loading @@ -651,76 +643,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal } // LOCK SCREEN // Some cases here might need to hide the indication (if the battery is not present) int userId = KeyguardUpdateMonitor.getCurrentUser(); if (mLockScreenMode == LOCK_SCREEN_MODE_LAYOUT_1) { mTopIndicationView.setVisibility(GONE); updateIndications(animate, userId); } else { boolean hideIndication = false; boolean isError = false; String trustGrantedIndication = getTrustGrantedIndication(); String trustManagedIndication = getTrustManagedIndication(); String powerIndication = null; if (mPowerPluggedIn || mEnableBatteryDefender) { powerIndication = computePowerIndication(); } if (!mKeyguardUpdateMonitor.isUserUnlocked(userId)) { mTopIndicationView.switchIndication( com.android.internal.R.string.lockscreen_storage_locked); } else if (!TextUtils.isEmpty(mTransientIndication)) { if (powerIndication != null && !mTransientIndication.equals(powerIndication)) { String indication = mContext.getResources().getString( R.string.keyguard_indication_trust_unlocked_plugged_in, mTransientIndication, powerIndication); mTopIndicationView.switchIndication(indication, null); hideIndication = !mBatteryPresent; } else { mTopIndicationView.switchIndication(mTransientIndication, null); } isError = mTransientTextIsError; } else if (!TextUtils.isEmpty(trustGrantedIndication) && mKeyguardUpdateMonitor.getUserHasTrust(userId)) { if (powerIndication != null) { String indication = mContext.getResources().getString( R.string.keyguard_indication_trust_unlocked_plugged_in, trustGrantedIndication, powerIndication); mTopIndicationView.switchIndication(indication, null); hideIndication = !mBatteryPresent; } else { mTopIndicationView.switchIndication(trustGrantedIndication, null); } } else if (!TextUtils.isEmpty(mAlignmentIndication)) { mTopIndicationView.switchIndication(mAlignmentIndication, null); isError = true; hideIndication = !mBatteryPresent; } else if (mPowerPluggedIn || mEnableBatteryDefender) { if (DEBUG_CHARGING_SPEED) { powerIndication += ", " + (mChargingWattage / 1000) + " mW"; } if (animate) { animateText(mTopIndicationView, powerIndication); } else { mTopIndicationView.switchIndication(powerIndication, null); } hideIndication = !mBatteryPresent; } else if (!TextUtils.isEmpty(trustManagedIndication) && mKeyguardUpdateMonitor.getUserTrustIsManaged(userId) && !mKeyguardUpdateMonitor.getUserHasTrust(userId)) { mTopIndicationView.switchIndication(trustManagedIndication, null); } else { mTopIndicationView.switchIndication(mRestingIndication, null); } mTopIndicationView.setTextColor( isError ? Utils.getColorError(mContext) : mInitialTextColorState); if (hideIndication) { mIndicationArea.setVisibility(GONE); } } updateIndications(animate, KeyguardUpdateMonitor.getCurrentUser()); } // animates textView - textView moves up and bounces down Loading Loading @@ -883,7 +807,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal @Override public void onUnlockedChanged() { updateIndication(!mDozing); updateIndication(false); } protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { Loading Loading @@ -1025,7 +949,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal @Override public void onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType) { if (running) { if (running && biometricSourceType == BiometricSourceType.FACE) { // Let's hide any previous messages when authentication starts, otherwise // multiple auth attempts would overlap. hideTransientIndication(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +19 −41 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.phone; import static com.android.keyguard.KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; Loading @@ -40,16 +38,12 @@ import java.util.LinkedList; * A view to show hints on Keyguard ("Swipe up to unlock", "Tap again to open"). */ public class KeyguardIndicationTextView extends TextView { private static final int FADE_OUT_MILLIS = 200; private static final int FADE_IN_MILLIS = 250; private static final long MSG_DURATION_MILLIS = 600; private long mNextAnimationTime = 0; private boolean mAnimationsEnabled = true; private LinkedList<CharSequence> mMessages = new LinkedList<>(); private LinkedList<KeyguardIndication> mKeyguardIndicationInfo = new LinkedList<>(); private boolean mUseNewAnimations = false; public KeyguardIndicationTextView(Context context) { super(context); } Loading @@ -67,10 +61,6 @@ public class KeyguardIndicationTextView extends TextView { super(context, attrs, defStyleAttr, defStyleRes); } public void setLockScreenMode(int lockScreenMode) { mUseNewAnimations = lockScreenMode == LOCK_SCREEN_MODE_LAYOUT_1; } /** * Changes the text with an animation and makes sure a single indication is shown long enough. */ Loading Loading @@ -148,15 +138,11 @@ public class KeyguardIndicationTextView extends TextView { } }); if (mUseNewAnimations) { Animator yTranslate = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, 0, -getYTranslationPixels()); yTranslate.setDuration(getFadeOutDuration()); fadeOut.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN); animatorSet.playTogether(fadeOut, yTranslate); } else { animatorSet.play(fadeOut); } return animatorSet; } Loading @@ -168,7 +154,6 @@ public class KeyguardIndicationTextView extends TextView { fadeIn.setDuration(getFadeInDuration()); fadeIn.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN); if (mUseNewAnimations) { Animator yTranslate = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, getYTranslationPixels(), 0); yTranslate.setDuration(getYInDuration()); Loading @@ -179,9 +164,6 @@ public class KeyguardIndicationTextView extends TextView { } }); animatorSet.playTogether(yTranslate, fadeIn); } else { animatorSet.play(fadeIn); } return animatorSet; } Loading @@ -193,26 +175,22 @@ public class KeyguardIndicationTextView extends TextView { private long getFadeInDelay() { if (!mAnimationsEnabled) return 0L; if (mUseNewAnimations) return 150L; return 0L; return 150L; } private long getFadeInDuration() { if (!mAnimationsEnabled) return 0L; if (mUseNewAnimations) return 317L; return FADE_IN_MILLIS; return 317L; } private long getYInDuration() { if (!mAnimationsEnabled) return 0L; if (mUseNewAnimations) return 600L; return 0L; return 600L; } private long getFadeOutDuration() { if (!mAnimationsEnabled) return 0L; if (mUseNewAnimations) return 167L; return FADE_OUT_MILLIS; return 167L; } private void setNextAnimationTime(long time) { Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.keyguard; import static com.android.keyguard.KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_BATTERY; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_DISCLOSURE; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_OWNER_INFO; Loading Loading @@ -77,7 +76,7 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas MockitoAnnotations.initMocks(this); when(mView.getTextColors()).thenReturn(ColorStateList.valueOf(Color.WHITE)); mController = new KeyguardIndicationRotateTextViewController(mView, mExecutor, mStatusBarStateController, LOCK_SCREEN_MODE_LAYOUT_1); mStatusBarStateController); mController.onViewAttached(); verify(mStatusBarStateController).addCallback(mStatusBarStateListenerCaptor.capture()); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +79 −63 File changed.Preview size limit exceeded, changes collapsed. Show changes