Merge cherrypicks of [8894175, 8894118, 8894119, 8894120, 8891937, 8894143, 8894144] into qt-release

Change-Id: I308f140fb027a19e9e4a5f4c9d74d0eb0b6263ed
This commit is contained in:
android-build-team Robot
2019-07-26 02:16:45 +00:00
3 changed files with 28 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ public final class SharedMemory implements Parcelable, Closeable {
mMemoryRegistration = new MemoryRegistration(mSize);
mCleaner = Cleaner.create(mFileDescriptor,
new Closer(mFileDescriptor, mMemoryRegistration));
new Closer(mFileDescriptor.getInt$(), mMemoryRegistration));
}
/**
@@ -259,6 +259,9 @@ public final class SharedMemory implements Parcelable, Closeable {
mCleaner.clean();
mCleaner = null;
}
// Cleaner.clean doesn't clear the value of the file descriptor.
mFileDescriptor.setInt$(-1);
}
@Override
@@ -290,10 +293,10 @@ public final class SharedMemory implements Parcelable, Closeable {
* Cleaner that closes the FD
*/
private static final class Closer implements Runnable {
private FileDescriptor mFd;
private int mFd;
private MemoryRegistration mMemoryReference;
private Closer(FileDescriptor fd, MemoryRegistration memoryReference) {
private Closer(int fd, MemoryRegistration memoryReference) {
mFd = fd;
mMemoryReference = memoryReference;
}
@@ -301,7 +304,9 @@ public final class SharedMemory implements Parcelable, Closeable {
@Override
public void run() {
try {
Os.close(mFd);
FileDescriptor fd = new FileDescriptor();
fd.setInt$(mFd);
Os.close(fd);
} catch (ErrnoException e) { /* swallow error */ }
mMemoryReference.release();
mMemoryReference = null;

View File

@@ -79,6 +79,7 @@ import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.logWithStack;
import static com.android.server.wm.WindowState.LEGACY_POLICY_VISIBILITY;
import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM;
@@ -540,6 +541,18 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
// If the app was already visible, don't reset the waitingToShow state.
if (isHidden()) {
waitingToShow = true;
// Let's reset the draw state in order to prevent the starting window to be
// immediately dismissed when the app still has the surface.
forAllWindows(w -> {
if (w.mWinAnimator.mDrawState == HAS_DRAWN) {
w.mWinAnimator.resetDrawState();
// Force add to mResizingWindows, so that we are guaranteed to get
// another reportDrawn callback.
w.resetLastContentInsets();
}
}, true /* traverseTopToBottom */);
}
}

View File

@@ -1623,7 +1623,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|| !mRelayoutCalled
|| (atoken == null && mToken.isHidden())
|| (atoken != null && atoken.hiddenRequested)
|| isParentWindowHidden()
|| isParentWindowGoneForLayout()
|| (mAnimatingExit && !isAnimatingLw())
|| mDestroying;
}
@@ -3795,6 +3795,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
return parent != null && parent.mHidden;
}
private boolean isParentWindowGoneForLayout() {
final WindowState parent = getParentWindow();
return parent != null && parent.isGoneForLayoutLw();
}
void setWillReplaceWindow(boolean animate) {
for (int i = mChildren.size() - 1; i >= 0; i--) {
final WindowState c = mChildren.get(i);