Commit d00fa46f authored by Jazz Xu's avatar Jazz Xu Committed by Commit Bot

[PiP Android API] Fix chrome crashes when closing pip immediately after opening it.

Bug: 1003450

Change-Id: I5a7a601442cc1d58ba0510f306f76369685f4cdf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1797249
Commit-Queue: Jazz Xu <jazzhsu@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697419}
parent 3c53d3cf
...@@ -118,6 +118,8 @@ public class PictureInPictureActivity extends AsyncInitializationActivity { ...@@ -118,6 +118,8 @@ public class PictureInPictureActivity extends AsyncInitializationActivity {
@Override @Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) { int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (sNativeOverlayWindowAndroid == 0) return;
PictureInPictureActivityJni.get().onViewSizeChanged( PictureInPictureActivityJni.get().onViewSizeChanged(
sNativeOverlayWindowAndroid, right - left, bottom - top); sNativeOverlayWindowAndroid, right - left, bottom - top);
} }
...@@ -167,7 +169,7 @@ public class PictureInPictureActivity extends AsyncInitializationActivity { ...@@ -167,7 +169,7 @@ public class PictureInPictureActivity extends AsyncInitializationActivity {
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
mCompositorView.destroy(); if (mCompositorView != null) mCompositorView.destroy();
} }
@Override @Override
...@@ -254,8 +256,9 @@ public class PictureInPictureActivity extends AsyncInitializationActivity { ...@@ -254,8 +256,9 @@ public class PictureInPictureActivity extends AsyncInitializationActivity {
Intent intent = new Intent(context, PictureInPictureActivity.class); Intent intent = new Intent(context, PictureInPictureActivity.class);
// Dissociate OverlayWindowAndroid if there is one already. // Dissociate OverlayWindowAndroid if there is one already.
if (sNativeOverlayWindowAndroid != 0) if (sNativeOverlayWindowAndroid != 0) {
PictureInPictureActivityJni.get().destroy(sNativeOverlayWindowAndroid); PictureInPictureActivityJni.get().destroy(sNativeOverlayWindowAndroid);
}
sNativeOverlayWindowAndroid = nativeOverlayWindowAndroid; sNativeOverlayWindowAndroid = nativeOverlayWindowAndroid;
sInitiatorTab = (Tab) initiatorTab; sInitiatorTab = (Tab) initiatorTab;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment