Skip to content

Commit dfff6d2

Browse files
committed
ANDROID: fix ChromeOS crash when restarting over existing instance
1 parent d014923 commit dfff6d2

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2019-08-23 (0.12.15)
2+
ANDROID: fix ChromeOS crash when restarting over existing instance
3+
14
2019-08-19 (0.12.15)
25
ANDROID: fix issue with crash on minimise with ChromeOS
36
ANDROID: fix permission issue with share command

src/platform/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.4.2'
8+
classpath 'com.android.tools.build:gradle:3.5.0'
99
classpath "com.github.ben-manes:gradle-versions-plugin:0.22.0"
1010
}
1111
}

src/platform/android/jni/display.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,6 @@ void Graphics::redraw() {
167167
locked = ANativeWindow_lock(_app->window, &buffer, NULL) == 0;
168168
trace("Restore format %d", locked);
169169
}
170-
if (buffer.format != AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM) {
171-
ANativeWindow_unlockAndPost(_app->window);
172-
ANativeWindow_setBuffersGeometry(_app->window, 0, 0, AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM);
173-
locked = false;
174-
trace("Restore format failed");
175-
}
176170
if (locked) {
177171
void *pixels = buffer.bits;
178172
int width = MIN(_w, MIN(buffer.width, _screen->_w));

src/platform/android/jni/runtime.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define GBOARD_KEY_QUESTION 274
3838
#define EVENT_TYPE_EXIT 100
3939

40-
Runtime *runtime;
40+
Runtime *runtime = NULL;
4141

4242
MAEvent *getMotionEvent(int type, AInputEvent *event) {
4343
MAEvent *result = new MAEvent();
@@ -203,6 +203,10 @@ Runtime::Runtime(android_app *app) :
203203
_app->onAppCmd = handleCommand;
204204
_app->onInputEvent = handleInput;
205205
_app->inputPollSource.process = process_input;
206+
if (runtime != NULL) {
207+
trace("another instance is still active");
208+
_state = kClosingState;
209+
}
206210
runtime = this;
207211
pthread_mutex_init(&_mutex, NULL);
208212
_looper = ALooper_forThread();

0 commit comments

Comments
 (0)