Show work profile status bar icon for lockscreen app.
If currently active app is in work profile and is shown on top of
keyguard (i.e. keyguard is occluded), we need to show work profile icon.
Bug: 31796748
Test: manually, running navigation in Google Maps.
Change-Id: I25e12ccf6a5def6efbee22f41bfa216c8acc3b26
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index f3ba5aa..6cdb757 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -484,7 +484,8 @@
boolean isManagedProfile = mUserManager.isManagedProfile(userId);
mHandler.post(() -> {
final boolean showIcon;
- if (isManagedProfile && !mKeyguardMonitor.isShowing()) {
+ if (isManagedProfile &&
+ (!mKeyguardMonitor.isShowing() || mKeyguardMonitor.isOccluded())) {
showIcon = true;
mIconController.setIcon(mSlotManagedProfile,
R.drawable.stat_sys_managed_profile_status,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
index 728005d..ccfbb26 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
@@ -21,12 +21,13 @@
boolean isSecure();
boolean canSkipBouncer();
boolean isShowing();
+ boolean isOccluded();
boolean isKeyguardFadingAway();
boolean isKeyguardGoingAway();
long getKeyguardFadingAwayDuration();
long getKeyguardFadingAwayDelay();
- public interface Callback {
+ interface Callback {
void onKeyguardShowingChanged();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
index 7bce33a..5ead02f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
@@ -58,6 +58,7 @@
};
}
+ @Override
public void addCallback(Callback callback) {
mCallbacks.add(callback);
if (mCallbacks.size() != 0 && !mListening) {
@@ -69,6 +70,7 @@
}
}
+ @Override
public void removeCallback(Callback callback) {
if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) {
mListening = false;
@@ -77,18 +79,22 @@
}
}
+ @Override
public boolean isShowing() {
return mShowing;
}
+ @Override
public boolean isSecure() {
return mSecure;
}
+ @Override
public boolean isOccluded() {
return mOccluded;
}
+ @Override
public boolean canSkipBouncer() {
return mCanSkipBouncer;
}