Skip to content

Commit 77e4a52

Browse files
committed
Re-allow suppressing onDetachedFromWindow
Bug: 17578553 Games seem to be doing this to prevent destruction of their GL contexts, and they assume it works even if it doesn't. However, GLSurfaceView is clunky here, so while the app is doing something questionable we don't really offer a better way. For now revert back to kitkat behavior. Change-Id: Icfa9e496279b9cfa47f9bc7f6848d9313caed0d5
1 parent c909e1b commit 77e4a52

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

core/java/android/view/SurfaceView.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,8 @@ public void setVisibility(int visibility) {
256256
updateWindow(false, false);
257257
}
258258

259-
/** @hide */
260259
@Override
261-
protected void onDetachedFromWindowInternal() {
260+
protected void onDetachedFromWindow() {
262261
if (mGlobalListenersAdded) {
263262
ViewTreeObserver observer = getViewTreeObserver();
264263
observer.removeOnScrollChangedListener(mScrollChangedListener);
@@ -280,7 +279,7 @@ protected void onDetachedFromWindowInternal() {
280279
mSession = null;
281280
mLayout.token = null;
282281

283-
super.onDetachedFromWindowInternal();
282+
super.onDetachedFromWindow();
284283
}
285284

286285
@Override

opengl/java/android/opengl/GLSurfaceView.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,17 +595,16 @@ protected void onAttachedToWindow() {
595595
mDetached = false;
596596
}
597597

598-
/** @hide */
599598
@Override
600-
protected void onDetachedFromWindowInternal() {
599+
protected void onDetachedFromWindow() {
601600
if (LOG_ATTACH_DETACH) {
602601
Log.d(TAG, "onDetachedFromWindow");
603602
}
604603
if (mGLThread != null) {
605604
mGLThread.requestExitAndWait();
606605
}
607606
mDetached = true;
608-
super.onDetachedFromWindowInternal();
607+
super.onDetachedFromWindow();
609608
}
610609

611610
// ----------------------------------------------------------------------

0 commit comments

Comments
 (0)