wallpaper: add reportVisibility(forceReport)
- On DisplayState change, force report visibility to the wallpaper to trigger a immediate redraw - Fix lint Context: go/wear-o-o-wallpaper-customization Test: build Bug: 271497696 Bug: 218998001 Bug: 191264924 Change-Id: I2a274642078e4a15f7f11bddeece8ebf4a3f19b5 (cherry picked from commit 6831ca21dc2cd527ade7bc4dd30dbe618971bdc4)
This commit is contained in:
@@ -1543,14 +1543,14 @@ public abstract class WallpaperService extends Service {
|
||||
void doVisibilityChanged(boolean visible) {
|
||||
if (!mDestroyed) {
|
||||
mVisible = visible;
|
||||
reportVisibility();
|
||||
reportVisibility(false);
|
||||
if (mReportedVisible) processLocalColors();
|
||||
} else {
|
||||
AnimationHandler.requestAnimatorsEnabled(visible, this);
|
||||
}
|
||||
}
|
||||
|
||||
void reportVisibility() {
|
||||
void reportVisibility(boolean forceReport) {
|
||||
if (mScreenshotSurfaceControl != null && mVisible) {
|
||||
if (DEBUG) Log.v(TAG, "Frozen so don't report visibility change");
|
||||
return;
|
||||
@@ -1558,10 +1558,29 @@ public abstract class WallpaperService extends Service {
|
||||
if (!mDestroyed) {
|
||||
mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : mDisplay.getState();
|
||||
boolean visible = mVisible && mDisplayState != Display.STATE_OFF;
|
||||
if (mReportedVisible != visible) {
|
||||
if (DEBUG) {
|
||||
Log.v(
|
||||
TAG,
|
||||
"reportVisibility"
|
||||
+ " mReportedVisible="
|
||||
+ mReportedVisible
|
||||
+ " mVisible="
|
||||
+ mVisible
|
||||
+ " mDisplayState="
|
||||
+ mDisplayState);
|
||||
}
|
||||
if (mReportedVisible != visible || forceReport) {
|
||||
mReportedVisible = visible;
|
||||
if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible
|
||||
+ "): " + this);
|
||||
if (DEBUG) {
|
||||
Log.v(
|
||||
TAG,
|
||||
"onVisibilityChanged("
|
||||
+ visible
|
||||
+ "): "
|
||||
+ this
|
||||
+ " forceReport="
|
||||
+ forceReport);
|
||||
}
|
||||
if (visible) {
|
||||
// If becoming visible, in preview mode the surface
|
||||
// may have been destroyed so now we need to make
|
||||
@@ -2205,22 +2224,22 @@ public abstract class WallpaperService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private final DisplayListener mDisplayListener = new DisplayListener() {
|
||||
@Override
|
||||
public void onDisplayChanged(int displayId) {
|
||||
if (mDisplay.getDisplayId() == displayId) {
|
||||
reportVisibility();
|
||||
}
|
||||
}
|
||||
private final DisplayListener mDisplayListener =
|
||||
new DisplayListener() {
|
||||
@Override
|
||||
public void onDisplayChanged(int displayId) {
|
||||
if (mDisplay.getDisplayId() == displayId) {
|
||||
boolean forceReport = mDisplay.getState() != Display.STATE_DOZE_SUSPEND;
|
||||
reportVisibility(forceReport);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayRemoved(int displayId) {
|
||||
}
|
||||
@Override
|
||||
public void onDisplayRemoved(int displayId) {}
|
||||
|
||||
@Override
|
||||
public void onDisplayAdded(int displayId) {
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public void onDisplayAdded(int displayId) {}
|
||||
};
|
||||
|
||||
private Surface getOrCreateBLASTSurface(int width, int height, int format) {
|
||||
Surface ret = null;
|
||||
|
||||
Reference in New Issue
Block a user