summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
diff options
context:
space:
mode:
authorAlec Mouri <alecmouri@google.com>2021-02-17 00:18:55 +0000
committerDave Mankoff <mankoff@google.com>2021-02-18 11:35:34 -0500
commit3f652cb990b991552dfc7057e3b3552655f236c7 (patch)
treed73a403aaa3f0e0d0f402830137bcd294ec54948 /packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
parentbfec35b4f4e7fc70cfa2c4c209c9edf3cacb7f95 (diff)
Revert "Remove Dependency.get from KeyguardStatusView."
Revert submission 13536242-b179775696-depenency-get-keyguard Reason for revert: Candidate reversion for broken tests: b/180440298 Reverted Changes: I6d0271692:Add ViewController to CarrierText. I4d9a4a21f:Add Controller for Emergency Button. I4c76d99f9:Remove Dependency.get from KeyguardSliceTextView. I730593fcf:Add injection to ClockProvider. Ifbb93e624:Remove Dependency.get from KeyguardStatusView. I237215456:Remove final calls to Dependency.get from keyguard... Change-Id: Ic6d3e290592a146af71e728cef469faed5177b9a
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index 5db4f9e61140..fea152abe36a 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -34,6 +34,7 @@ import android.widget.TextView;
import androidx.core.graphics.ColorUtils;
import com.android.internal.widget.LockPatternUtils;
+import com.android.systemui.Dependency;
import com.android.systemui.R;
import java.io.FileDescriptor;
@@ -55,6 +56,7 @@ public class KeyguardStatusView extends GridLayout {
private final IActivityManager mIActivityManager;
private TextView mLogoutView;
+ private boolean mCanShowLogout = true; // by default, try to show the logout button here
private KeyguardClockSwitch mClockView;
private TextView mOwnerInfo;
private boolean mCanShowOwnerInfo = true; // by default, try to show the owner information here
@@ -128,6 +130,11 @@ public class KeyguardStatusView extends GridLayout {
}
}
+ void setCanShowLogout(boolean canShowLogout) {
+ mCanShowLogout = canShowLogout;
+ updateLogoutView();
+ }
+
@Override
protected void onFinishInflate() {
super.onFinishInflate();
@@ -152,7 +159,10 @@ public class KeyguardStatusView extends GridLayout {
mKeyguardSlice.setContentChangeListener(this::onSliceContentChanged);
onSliceContentChanged();
+ boolean shouldMarquee = Dependency.get(KeyguardUpdateMonitor.class).isDeviceInteractive();
+ setEnableMarquee(shouldMarquee);
updateOwnerInfo();
+ updateLogoutView();
updateDark();
}
@@ -199,11 +209,11 @@ public class KeyguardStatusView extends GridLayout {
return mOwnerInfo.getVisibility() == VISIBLE ? mOwnerInfo.getHeight() : 0;
}
- void updateLogoutView(boolean shouldShowLogout) {
+ void updateLogoutView() {
if (mLogoutView == null) {
return;
}
- mLogoutView.setVisibility(shouldShowLogout ? VISIBLE : GONE);
+ mLogoutView.setVisibility(mCanShowLogout && shouldShowLogout() ? VISIBLE : GONE);
// Logout button will stay in language of user 0 if we don't set that manually.
mLogoutView.setText(mContext.getResources().getString(
com.android.internal.R.string.global_action_logout));
@@ -303,6 +313,11 @@ public class KeyguardStatusView extends GridLayout {
}
}
+ private boolean shouldShowLogout() {
+ return Dependency.get(KeyguardUpdateMonitor.class).isLogoutEnabled()
+ && KeyguardUpdateMonitor.getCurrentUser() != UserHandle.USER_SYSTEM;
+ }
+
private void onLogoutClicked(View view) {
int currentUserId = KeyguardUpdateMonitor.getCurrentUser();
try {