Merge "Revert "Keep FLAG_SHOW_WALLPAPER flag on NotificationShade."" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ae46cf3869
@@ -20,4 +20,5 @@ interface IKeyguardStateCallback {
|
||||
void onSimSecureStateChanged(boolean simSecure);
|
||||
void onInputRestrictedStateChanged(boolean inputRestricted);
|
||||
void onTrustedChanged(boolean trusted);
|
||||
void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -2531,6 +2532,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}
|
||||
*/
|
||||
|
||||
@@ -291,6 +291,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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 */);
|
||||
}
|
||||
|
||||
@@ -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} */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user