File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,8 @@ protected void onPostExecute(String result) {
183
183
184
184
PowerManager pm = (PowerManager ) mActivity .getSystemService (Context .POWER_SERVICE );
185
185
if ( mActivity .mMetaData .getInt ("wakelock" ) == 1 ) {
186
- mActivity .mWakeLock = pm .newWakeLock (PowerManager .SCREEN_BRIGHT_WAKE_LOCK , "Screen On" );
186
+ mActivity .mWakeLock = pm .newWakeLock (PowerManager .SCREEN_BRIGHT_WAKE_LOCK , "Screen On" );
187
+ mActivity .mWakeLock .acquire ();
187
188
}
188
189
if ( mActivity .mMetaData .getInt ("surface.transparent" ) != 0 ) {
189
190
Log .v (TAG , "Surface will be transparent." );
@@ -452,5 +453,27 @@ protected void showLoadingScreen() {
452
453
}
453
454
454
455
}
456
+
457
+ @ Override
458
+ protected void onPause () {
459
+ // fooabc
460
+ if ( this .mWakeLock != null && mWakeLock .isHeld ()){
461
+ this .mWakeLock .release ();
462
+ }
463
+
464
+ Log .v (TAG , "onPause()" );
465
+ super .onPause ();
466
+ }
467
+
468
+ @ Override
469
+ protected void onResume () {
470
+ if ( this .mWakeLock != null ){
471
+ this .mWakeLock .acquire ();
472
+ }
473
+ Log .v (TAG , "onResume()" );
474
+ super .onResume ();
475
+ }
476
+
477
+
455
478
456
479
}
You can’t perform that action at this time.
0 commit comments