Merge "Fix issue #5384631: hw windows not resizing correctly"
This commit is contained in:
@@ -183,6 +183,22 @@ public abstract class HardwareRenderer {
|
|||||||
*/
|
*/
|
||||||
abstract void setup(int width, int height);
|
abstract void setup(int width, int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current width of the surface. This is the width that the surface
|
||||||
|
* was last set to in a call to {@link #setup(int, int)}.
|
||||||
|
*
|
||||||
|
* @return the current width of the surface
|
||||||
|
*/
|
||||||
|
abstract int getWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current height of the surface. This is the height that the surface
|
||||||
|
* was last set to in a call to {@link #setup(int, int)}.
|
||||||
|
*
|
||||||
|
* @return the current width of the surface
|
||||||
|
*/
|
||||||
|
abstract int getHeight();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface used to receive callbacks whenever a view is drawn by
|
* Interface used to receive callbacks whenever a view is drawn by
|
||||||
* a hardware renderer instance.
|
* a hardware renderer instance.
|
||||||
@@ -362,6 +378,7 @@ public abstract class HardwareRenderer {
|
|||||||
static EGLDisplay sEglDisplay;
|
static EGLDisplay sEglDisplay;
|
||||||
static EGLConfig sEglConfig;
|
static EGLConfig sEglConfig;
|
||||||
static final Object[] sEglLock = new Object[0];
|
static final Object[] sEglLock = new Object[0];
|
||||||
|
int mWidth = -1, mHeight = -1;
|
||||||
|
|
||||||
static final ThreadLocal<EGLContext> sEglContextStorage = new ThreadLocal<EGLContext>();
|
static final ThreadLocal<EGLContext> sEglContextStorage = new ThreadLocal<EGLContext>();
|
||||||
|
|
||||||
@@ -714,9 +731,21 @@ public abstract class HardwareRenderer {
|
|||||||
void setup(int width, int height) {
|
void setup(int width, int height) {
|
||||||
if (validate()) {
|
if (validate()) {
|
||||||
mCanvas.setViewport(width, height);
|
mCanvas.setViewport(width, height);
|
||||||
|
mWidth = width;
|
||||||
|
mHeight = height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
int getWidth() {
|
||||||
|
return mWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
int getHeight() {
|
||||||
|
return mHeight;
|
||||||
|
}
|
||||||
|
|
||||||
boolean canDraw() {
|
boolean canDraw() {
|
||||||
return mGl != null && mCanvas != null;
|
return mGl != null && mCanvas != null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -860,7 +860,6 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
|||||||
CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get();
|
CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get();
|
||||||
if (compatibilityInfo.supportsScreen() == mLastInCompatMode) {
|
if (compatibilityInfo.supportsScreen() == mLastInCompatMode) {
|
||||||
params = lp;
|
params = lp;
|
||||||
windowAttributesChanges |= WindowManager.LayoutParams.BUFFER_CHANGED;
|
|
||||||
fullRedrawNeeded = true;
|
fullRedrawNeeded = true;
|
||||||
mLayoutRequested = true;
|
mLayoutRequested = true;
|
||||||
if (mLastInCompatMode) {
|
if (mLastInCompatMode) {
|
||||||
@@ -1078,7 +1077,6 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
|||||||
~WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) |
|
~WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST) |
|
||||||
resizeMode;
|
resizeMode;
|
||||||
params = lp;
|
params = lp;
|
||||||
windowAttributesChanges |= WindowManager.LayoutParams.BUFFER_CHANGED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1375,13 +1373,15 @@ public final class ViewRootImpl extends Handler implements ViewParent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hwInitialized || ((windowShouldResize || (params != null &&
|
if (mAttachInfo.mHardwareRenderer != null &&
|
||||||
(windowAttributesChanges & WindowManager.LayoutParams.BUFFER_CHANGED) != 0)) &&
|
mAttachInfo.mHardwareRenderer.isEnabled()) {
|
||||||
mAttachInfo.mHardwareRenderer != null &&
|
if (hwInitialized || windowShouldResize ||
|
||||||
mAttachInfo.mHardwareRenderer.isEnabled())) {
|
mWidth != mAttachInfo.mHardwareRenderer.getWidth() ||
|
||||||
mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight);
|
mHeight != mAttachInfo.mHardwareRenderer.getHeight()) {
|
||||||
if (!hwInitialized && mAttachInfo.mHardwareRenderer.isEnabled()) {
|
mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight);
|
||||||
mAttachInfo.mHardwareRenderer.invalidate(mHolder);
|
if (!hwInitialized) {
|
||||||
|
mAttachInfo.mHardwareRenderer.invalidate(mHolder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1260,8 +1260,6 @@ public interface WindowManager extends ViewManager {
|
|||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public static final int PRIVATE_FLAGS_CHANGED = 1<<16;
|
public static final int PRIVATE_FLAGS_CHANGED = 1<<16;
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public static final int BUFFER_CHANGED = 1<<17;
|
|
||||||
/** {@hide} */
|
|
||||||
public static final int EVERYTHING_CHANGED = 0xffffffff;
|
public static final int EVERYTHING_CHANGED = 0xffffffff;
|
||||||
|
|
||||||
// internal buffer to backup/restore parameters under compatibility mode.
|
// internal buffer to backup/restore parameters under compatibility mode.
|
||||||
@@ -1272,11 +1270,11 @@ public interface WindowManager extends ViewManager {
|
|||||||
|
|
||||||
if (width != o.width) {
|
if (width != o.width) {
|
||||||
width = o.width;
|
width = o.width;
|
||||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
changes |= LAYOUT_CHANGED;
|
||||||
}
|
}
|
||||||
if (height != o.height) {
|
if (height != o.height) {
|
||||||
height = o.height;
|
height = o.height;
|
||||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
changes |= LAYOUT_CHANGED;
|
||||||
}
|
}
|
||||||
if (x != o.x) {
|
if (x != o.x) {
|
||||||
x = o.x;
|
x = o.x;
|
||||||
@@ -1288,19 +1286,19 @@ public interface WindowManager extends ViewManager {
|
|||||||
}
|
}
|
||||||
if (horizontalWeight != o.horizontalWeight) {
|
if (horizontalWeight != o.horizontalWeight) {
|
||||||
horizontalWeight = o.horizontalWeight;
|
horizontalWeight = o.horizontalWeight;
|
||||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
changes |= LAYOUT_CHANGED;
|
||||||
}
|
}
|
||||||
if (verticalWeight != o.verticalWeight) {
|
if (verticalWeight != o.verticalWeight) {
|
||||||
verticalWeight = o.verticalWeight;
|
verticalWeight = o.verticalWeight;
|
||||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
changes |= LAYOUT_CHANGED;
|
||||||
}
|
}
|
||||||
if (horizontalMargin != o.horizontalMargin) {
|
if (horizontalMargin != o.horizontalMargin) {
|
||||||
horizontalMargin = o.horizontalMargin;
|
horizontalMargin = o.horizontalMargin;
|
||||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
changes |= LAYOUT_CHANGED;
|
||||||
}
|
}
|
||||||
if (verticalMargin != o.verticalMargin) {
|
if (verticalMargin != o.verticalMargin) {
|
||||||
verticalMargin = o.verticalMargin;
|
verticalMargin = o.verticalMargin;
|
||||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
changes |= LAYOUT_CHANGED;
|
||||||
}
|
}
|
||||||
if (type != o.type) {
|
if (type != o.type) {
|
||||||
type = o.type;
|
type = o.type;
|
||||||
@@ -1308,7 +1306,7 @@ public interface WindowManager extends ViewManager {
|
|||||||
}
|
}
|
||||||
if (flags != o.flags) {
|
if (flags != o.flags) {
|
||||||
flags = o.flags;
|
flags = o.flags;
|
||||||
changes |= FLAGS_CHANGED | BUFFER_CHANGED;
|
changes |= FLAGS_CHANGED;
|
||||||
}
|
}
|
||||||
if (privateFlags != o.privateFlags) {
|
if (privateFlags != o.privateFlags) {
|
||||||
privateFlags = o.privateFlags;
|
privateFlags = o.privateFlags;
|
||||||
@@ -1320,11 +1318,11 @@ public interface WindowManager extends ViewManager {
|
|||||||
}
|
}
|
||||||
if (gravity != o.gravity) {
|
if (gravity != o.gravity) {
|
||||||
gravity = o.gravity;
|
gravity = o.gravity;
|
||||||
changes |= LAYOUT_CHANGED | BUFFER_CHANGED;
|
changes |= LAYOUT_CHANGED;
|
||||||
}
|
}
|
||||||
if (format != o.format) {
|
if (format != o.format) {
|
||||||
format = o.format;
|
format = o.format;
|
||||||
changes |= FORMAT_CHANGED | BUFFER_CHANGED;
|
changes |= FORMAT_CHANGED;
|
||||||
}
|
}
|
||||||
if (windowAnimations != o.windowAnimations) {
|
if (windowAnimations != o.windowAnimations) {
|
||||||
windowAnimations = o.windowAnimations;
|
windowAnimations = o.windowAnimations;
|
||||||
@@ -1363,7 +1361,7 @@ public interface WindowManager extends ViewManager {
|
|||||||
|
|
||||||
if (screenOrientation != o.screenOrientation) {
|
if (screenOrientation != o.screenOrientation) {
|
||||||
screenOrientation = o.screenOrientation;
|
screenOrientation = o.screenOrientation;
|
||||||
changes |= SCREEN_ORIENTATION_CHANGED | BUFFER_CHANGED;
|
changes |= SCREEN_ORIENTATION_CHANGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systemUiVisibility != o.systemUiVisibility
|
if (systemUiVisibility != o.systemUiVisibility
|
||||||
|
|||||||
Reference in New Issue
Block a user