summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Mankoff <mankoff@google.com>2021-02-09 16:58:40 -0500
committerDave Mankoff <mankoff@google.com>2021-02-16 12:28:55 -0500
commitb8b5aa4ed2e7499cb6e1b84d9d68202b65d033b5 (patch)
tree70d17da134915f5caad14977dfdc88a1d5a0879a
parent000e4071584a3b43eadb3be4403448dd66097cdc (diff)
Remove Dependency.get from KeyguardStatusView.
Bug: 179775696 Test: atest SystemUITests && manual Change-Id: Ifbb93e624d839d7506b45da2cabb4fcf8b0b75ff
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java19
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java18
2 files changed, 15 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index fea152abe36a..5db4f9e61140 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -34,7 +34,6 @@ 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;
@@ -56,7 +55,6 @@ 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
@@ -130,11 +128,6 @@ public class KeyguardStatusView extends GridLayout {
}
}
- void setCanShowLogout(boolean canShowLogout) {
- mCanShowLogout = canShowLogout;
- updateLogoutView();
- }
-
@Override
protected void onFinishInflate() {
super.onFinishInflate();
@@ -159,10 +152,7 @@ public class KeyguardStatusView extends GridLayout {
mKeyguardSlice.setContentChangeListener(this::onSliceContentChanged);
onSliceContentChanged();
- boolean shouldMarquee = Dependency.get(KeyguardUpdateMonitor.class).isDeviceInteractive();
- setEnableMarquee(shouldMarquee);
updateOwnerInfo();
- updateLogoutView();
updateDark();
}
@@ -209,11 +199,11 @@ public class KeyguardStatusView extends GridLayout {
return mOwnerInfo.getVisibility() == VISIBLE ? mOwnerInfo.getHeight() : 0;
}
- void updateLogoutView() {
+ void updateLogoutView(boolean shouldShowLogout) {
if (mLogoutView == null) {
return;
}
- mLogoutView.setVisibility(mCanShowLogout && shouldShowLogout() ? VISIBLE : GONE);
+ mLogoutView.setVisibility(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));
@@ -313,11 +303,6 @@ 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 {
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
index 6fb6760be653..bfe7f8c7ebd8 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java
@@ -16,6 +16,7 @@
package com.android.keyguard;
+import android.os.UserHandle;
import android.util.Slog;
import android.view.View;
@@ -78,6 +79,8 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
@Override
public void onInit() {
mKeyguardClockSwitchController.init();
+ mView.setEnableMarquee(mKeyguardUpdateMonitor.isDeviceInteractive());
+ mView.updateLogoutView(shouldShowLogout());
}
@Override
@@ -245,6 +248,11 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
}
}
+ private boolean shouldShowLogout() {
+ return mKeyguardUpdateMonitor.isLogoutEnabled()
+ && KeyguardUpdateMonitor.getCurrentUser() != UserHandle.USER_SYSTEM;
+ }
+
private final ConfigurationController.ConfigurationListener mConfigurationListener =
new ConfigurationController.ConfigurationListener() {
@Override
@@ -271,12 +279,12 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
mKeyguardSliceViewController.updateTopMargin(
mKeyguardClockSwitchController.getClockTextTopPadding());
mView.setCanShowOwnerInfo(false);
- mView.setCanShowLogout(false);
+ mView.updateLogoutView(false);
} else {
// reset margin
mKeyguardSliceViewController.updateTopMargin(0);
mView.setCanShowOwnerInfo(true);
- mView.setCanShowLogout(false);
+ mView.updateLogoutView(false);
}
updateAodIcons();
}
@@ -302,7 +310,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing);
refreshTime();
mView.updateOwnerInfo();
- mView.updateLogoutView();
+ mView.updateLogoutView(shouldShowLogout());
}
}
@@ -320,12 +328,12 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
public void onUserSwitchComplete(int userId) {
mKeyguardClockSwitchController.refreshFormat();
mView.updateOwnerInfo();
- mView.updateLogoutView();
+ mView.updateLogoutView(shouldShowLogout());
}
@Override
public void onLogoutEnabledChanged() {
- mView.updateLogoutView();
+ mView.updateLogoutView(shouldShowLogout());
}
};
}