Skip to content

Commit 2370d0a

Browse files
committed
make sure to re-initialize SurfaceTexture to its default state on disconnect
this caused problems where the NavigationBar would disapear or be drawn in the wrong orientation. Change-Id: I083c41338db83a4afd14f427caec2f31c180d734
1 parent ec49d89 commit 2370d0a

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

libs/gui/SurfaceTexture.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ status_t SurfaceTexture::disconnect(int api) {
608608
if (mConnectedApi == api) {
609609
drainQueueAndFreeBuffersLocked();
610610
mConnectedApi = NO_CONNECTED_API;
611+
mNextCrop.makeInvalid();
612+
mNextScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
613+
mNextTransform = 0;
611614
mDequeueCondition.signal();
612615
} else {
613616
LOGE("disconnect: connected to another api (cur=%d, req=%d)",
@@ -1022,7 +1025,7 @@ void SurfaceTexture::dump(String8& result, const char* prefix,
10221025
mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom,
10231026
mCurrentTransform, mCurrentTexture,
10241027
prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right, mNextCrop.bottom,
1025-
mCurrentTransform, fifoSize, fifo.string()
1028+
mNextTransform, fifoSize, fifo.string()
10261029
);
10271030
result.append(buffer);
10281031

libs/gui/SurfaceTextureClient.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,15 @@ int SurfaceTextureClient::disconnect(int api) {
407407
LOGV("SurfaceTextureClient::disconnect");
408408
Mutex::Autolock lock(mMutex);
409409
int err = mSurfaceTexture->disconnect(api);
410-
if (!err && api == NATIVE_WINDOW_API_CPU) {
411-
mConnectedToCpu = false;
410+
if (!err) {
411+
freeAllBuffers();
412+
mReqFormat = 0;
413+
mReqWidth = 0;
414+
mReqHeight = 0;
415+
mReqUsage = 0;
416+
if (api == NATIVE_WINDOW_API_CPU) {
417+
mConnectedToCpu = false;
418+
}
412419
}
413420
return err;
414421
}

services/java/com/android/server/Watchdog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class Watchdog extends Thread {
5454

5555
static final int MONITOR = 2718;
5656

57-
static final int TIME_TO_RESTART = DB ? 15*1000 : 60*1000;
57+
static final int TIME_TO_RESTART = DB ? 15*1000000 : 60*1000000;
5858
static final int TIME_TO_WAIT = TIME_TO_RESTART / 2;
5959

6060
static final int MEMCHECK_DEFAULT_MIN_SCREEN_OFF = DB ? 1*60 : 5*60; // 5 minutes

0 commit comments

Comments
 (0)