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
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.keyguard;
|
||||
|
||||
import android.os.UserHandle;
|
||||
import android.util.Slog;
|
||||
import android.view.View;
|
||||
|
||||
@@ -79,8 +78,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
||||
@Override
|
||||
public void onInit() {
|
||||
mKeyguardClockSwitchController.init();
|
||||
mView.setEnableMarquee(mKeyguardUpdateMonitor.isDeviceInteractive());
|
||||
mView.updateLogoutView(shouldShowLogout());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,11 +245,6 @@ 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
|
||||
@@ -279,12 +271,12 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
||||
mKeyguardSliceViewController.updateTopMargin(
|
||||
mKeyguardClockSwitchController.getClockTextTopPadding());
|
||||
mView.setCanShowOwnerInfo(false);
|
||||
mView.updateLogoutView(false);
|
||||
mView.setCanShowLogout(false);
|
||||
} else {
|
||||
// reset margin
|
||||
mKeyguardSliceViewController.updateTopMargin(0);
|
||||
mView.setCanShowOwnerInfo(true);
|
||||
mView.updateLogoutView(false);
|
||||
mView.setCanShowLogout(false);
|
||||
}
|
||||
updateAodIcons();
|
||||
}
|
||||
@@ -310,7 +302,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
||||
if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing);
|
||||
refreshTime();
|
||||
mView.updateOwnerInfo();
|
||||
mView.updateLogoutView(shouldShowLogout());
|
||||
mView.updateLogoutView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,12 +320,12 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
||||
public void onUserSwitchComplete(int userId) {
|
||||
mKeyguardClockSwitchController.refreshFormat();
|
||||
mView.updateOwnerInfo();
|
||||
mView.updateLogoutView(shouldShowLogout());
|
||||
mView.updateLogoutView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLogoutEnabledChanged() {
|
||||
mView.updateLogoutView(shouldShowLogout());
|
||||
mView.updateLogoutView();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user