summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/policy/IKeyguardStateCallback.aidl1
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java26
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java2
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java14
-rw-r--r--services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java7
-rw-r--r--services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java4
-rw-r--r--services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java10
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java9
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java14
11 files changed, 105 insertions, 10 deletions
diff --git a/core/java/com/android/internal/policy/IKeyguardStateCallback.aidl b/core/java/com/android/internal/policy/IKeyguardStateCallback.aidl
index 419b1f8feac7..8e454db4cb04 100644
--- a/core/java/com/android/internal/policy/IKeyguardStateCallback.aidl
+++ b/core/java/com/android/internal/policy/IKeyguardStateCallback.aidl
@@ -20,4 +20,5 @@ interface IKeyguardStateCallback {
void onSimSecureStateChanged(boolean simSecure);
void onInputRestrictedStateChanged(boolean inputRestricted);
void onTrustedChanged(boolean trusted);
+ void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper);
} \ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 5707fa7b18d7..5c0fb5d4257a 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -271,6 +271,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
private boolean mBouncer; // true if bouncerIsOrWillBeShowing
private boolean mAuthInterruptActive;
private boolean mNeedsSlowUnlockTransition;
+ private boolean mHasLockscreenWallpaper;
private boolean mAssistantVisible;
private boolean mKeyguardOccluded;
private boolean mOccludingAppRequestingFp;
@@ -2532,6 +2533,31 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
}
/**
+ * Update the state whether Keyguard currently has a lockscreen wallpaper.
+ *
+ * @param hasLockscreenWallpaper Whether Keyguard has a lockscreen wallpaper.
+ */
+ public void setHasLockscreenWallpaper(boolean hasLockscreenWallpaper) {
+ Assert.isMainThread();
+ if (hasLockscreenWallpaper != mHasLockscreenWallpaper) {
+ mHasLockscreenWallpaper = hasLockscreenWallpaper;
+ for (int i = 0; i < mCallbacks.size(); i++) {
+ KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
+ if (cb != null) {
+ cb.onHasLockscreenWallpaperChanged(hasLockscreenWallpaper);
+ }
+ }
+ }
+ }
+
+ /**
+ * @return Whether Keyguard has a lockscreen wallpaper.
+ */
+ public boolean hasLockscreenWallpaper() {
+ return mHasLockscreenWallpaper;
+ }
+
+ /**
* Handle {@link #MSG_DPM_STATE_CHANGED}
*/
private void handleDevicePolicyManagerStateChanged(int userId) {
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 12431984c9b9..1e951f923f13 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -292,6 +292,11 @@ public class KeyguardUpdateMonitorCallback {
public void onStrongAuthStateChanged(int userId) { }
/**
+ * Called when the state whether we have a lockscreen wallpaper has changed.
+ */
+ public void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper) { }
+
+ /**
* Called when the dream's window state is changed.
* @param dreaming true if the dream's window has been created and is visible
*/
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 784346e59721..c5694398cdc6 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -670,6 +670,13 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
}
}
}
+
+ @Override
+ public void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper) {
+ synchronized (KeyguardViewMediator.this) {
+ notifyHasLockscreenWallpaperChanged(hasLockscreenWallpaper);
+ }
+ }
};
ViewMediatorCallback mViewMediatorCallback = new ViewMediatorCallback() {
@@ -2860,6 +2867,21 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
}
}
+ private void notifyHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper) {
+ int size = mKeyguardStateCallbacks.size();
+ for (int i = size - 1; i >= 0; i--) {
+ try {
+ mKeyguardStateCallbacks.get(i).onHasLockscreenWallpaperChanged(
+ hasLockscreenWallpaper);
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Failed to call onHasLockscreenWallpaperChanged", e);
+ if (e instanceof DeadObjectException) {
+ mKeyguardStateCallbacks.remove(i);
+ }
+ }
+ }
+ }
+
public void addStateMonitorCallback(IKeyguardStateCallback callback) {
synchronized (this) {
mKeyguardStateCallbacks.add(callback);
@@ -2869,6 +2891,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
callback.onInputRestrictedStateChanged(mInputRestricted);
callback.onTrustedChanged(mUpdateMonitor.getUserHasTrust(
KeyguardUpdateMonitor.getCurrentUser()));
+ callback.onHasLockscreenWallpaperChanged(mUpdateMonitor.hasLockscreenWallpaper());
} catch (RemoteException e) {
Slog.w(TAG, "Failed to call to IKeyguardStateCallback", e);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
index 2a13e6bbd37e..78fcd82dc1f5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java
@@ -119,6 +119,7 @@ public class LockscreenWallpaper extends IWallpaperManagerCallback.Stub implemen
LoaderResult result = loadBitmap(mCurrentUserId, mSelectedUser);
if (result.success) {
mCached = true;
+ mUpdateMonitor.setHasLockscreenWallpaper(result.bitmap != null);
mCache = result.bitmap;
}
return mCache;
@@ -234,6 +235,7 @@ public class LockscreenWallpaper extends IWallpaperManagerCallback.Stub implemen
if (result.success) {
mCached = true;
mCache = result.bitmap;
+ mUpdateMonitor.setHasLockscreenWallpaper(result.bitmap != null);
mMediaManager.updateMediaMetaData(
true /* metaDataChanged */, true /* allowEnterAnimation */);
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 5b6bf1510bf2..5acff2b6c743 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -47,6 +47,7 @@ import static android.view.KeyEvent.KEYCODE_VOLUME_UP;
import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW;
+import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
@@ -3288,7 +3289,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
final boolean showing = mKeyguardDelegate.isShowing();
final boolean animate = showing && !isOccluded;
mKeyguardDelegate.setOccluded(isOccluded, animate);
- return showing;
+
+ if (!showing) {
+ return false;
+ }
+ if (mKeyguardCandidate != null) {
+ if (isOccluded) {
+ mKeyguardCandidate.getAttrs().flags &= ~FLAG_SHOW_WALLPAPER;
+ } else if (!mKeyguardDelegate.hasLockscreenWallpaper()) {
+ mKeyguardCandidate.getAttrs().flags |= FLAG_SHOW_WALLPAPER;
+ }
+ }
+ return true;
}
/** {@inheritDoc} */
diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
index cdd36f7e25dd..86ff33e8cc42 100644
--- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
+++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
@@ -235,6 +235,13 @@ public class KeyguardServiceDelegate {
return false;
}
+ public boolean hasLockscreenWallpaper() {
+ if (mKeyguardService != null) {
+ return mKeyguardService.hasLockscreenWallpaper();
+ }
+ return false;
+ }
+
public boolean hasKeyguard() {
return mKeyguardState.deviceHasKeyguard;
}
diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
index ac650ec0f564..051f555fab95 100644
--- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
+++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
@@ -261,6 +261,10 @@ public class KeyguardServiceWrapper implements IKeyguardService {
return mKeyguardStateMonitor.isTrusted();
}
+ public boolean hasLockscreenWallpaper() {
+ return mKeyguardStateMonitor.hasLockscreenWallpaper();
+ }
+
public boolean isSecure(int userId) {
return mKeyguardStateMonitor.isSecure(userId);
}
diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java b/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java
index e6511372d62c..add0b01f1879 100644
--- a/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java
+++ b/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java
@@ -44,6 +44,7 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub {
private volatile boolean mSimSecure = true;
private volatile boolean mInputRestricted = true;
private volatile boolean mTrusted = false;
+ private volatile boolean mHasLockscreenWallpaper = false;
private int mCurrentUserId;
@@ -78,6 +79,10 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub {
return mTrusted;
}
+ public boolean hasLockscreenWallpaper() {
+ return mHasLockscreenWallpaper;
+ }
+
@Override // Binder interface
public void onShowingStateChanged(boolean showing) {
mIsShowing = showing;
@@ -105,6 +110,11 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub {
mCallback.onTrustedChanged();
}
+ @Override // Binder interface
+ public void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper) {
+ mHasLockscreenWallpaper = hasLockscreenWallpaper;
+ }
+
public interface StateCallback {
void onTrustedChanged();
void onShowingChanged();
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index c09db1e6fa98..a7c496e5af39 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -898,6 +898,15 @@ public class DisplayPolicy {
// letterboxed. Hence always let them extend under the cutout.
attrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
break;
+ case TYPE_NOTIFICATION_SHADE:
+ // If the Keyguard is in a hidden state (occluded by another window), we force to
+ // remove the wallpaper and keyguard flag so that any change in-flight after setting
+ // the keyguard as occluded wouldn't set these flags again.
+ // See {@link #processKeyguardSetHiddenResultLw}.
+ if (mService.mPolicy.isKeyguardOccluded()) {
+ attrs.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
+ }
+ break;
case TYPE_TOAST:
// While apps should use the dedicated toast APIs to add such windows
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 17297bd0ba45..38f6863d8a0d 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2583,17 +2583,13 @@ public class WindowManagerService extends IWindowManager.Stub
// an exit.
win.mAnimatingExit = true;
} else if (win.mDisplayContent.okToAnimate()
- && win.mDisplayContent.mWallpaperController.isWallpaperTarget(win)
- && win.mAttrs.type == TYPE_NOTIFICATION_SHADE) {
- // If the wallpaper is currently behind this app window, we need to change both of them
- // inside of a transaction to avoid artifacts.
- // For NotificationShade, sysui is in charge of running window animation and it updates
- // the client view visibility only after both NotificationShade and the wallpaper are
- // hidden. So we don't need to care about exit animation, but can destroy its surface
- // immediately.
+ && win.mDisplayContent.mWallpaperController.isWallpaperTarget(win)) {
+ // If the wallpaper is currently behind this
+ // window, we need to change both of them inside
+ // of a transaction to avoid artifacts.
win.mAnimatingExit = true;
} else {
- boolean stopped = win.mActivityRecord == null || win.mActivityRecord.mAppStopped;
+ boolean stopped = win.mActivityRecord != null ? win.mActivityRecord.mAppStopped : true;
// We set mDestroying=true so ActivityRecord#notifyAppStopped in-to destroy surfaces
// will later actually destroy the surface if we do not do so here. Normally we leave
// this to the exit animation.