mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-28 02:37:46 +00:00
Post startService() in onPause() as a possible fix to an Android P bug.
We already did it for onResume(), and while it fixed the crash there, the crash just moved to onPause(). Let's see if the same magic works.
This commit is contained in:
parent
1a5c1a4b42
commit
feb9e1d513
@ -61,6 +61,7 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
|
||||
protected void onResume() {
|
||||
Log.i(TAG, "onResume()");
|
||||
super.onResume();
|
||||
isVisible = true;
|
||||
|
||||
// Android P has a bug in foreground timings where starting a service in onResume() can still crash
|
||||
Util.postToMain(() -> {
|
||||
@ -69,19 +70,19 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
|
||||
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStarted(this);
|
||||
else ApplicationContext.getInstance(this).getJobManager().add(new PushNotificationReceiveJob(this));
|
||||
});
|
||||
|
||||
isVisible = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Log.i(TAG, "onPause()");
|
||||
super.onPause();
|
||||
KeyCachingService.registerPassphraseActivityStopped(this);
|
||||
|
||||
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStopped(this);
|
||||
|
||||
isVisible = false;
|
||||
|
||||
// Android P has a bug in foreground timings where starting a service in onPause() can still crash
|
||||
Util.postToMain(() -> {
|
||||
KeyCachingService.registerPassphraseActivityStopped(this);
|
||||
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStopped(this);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,8 +115,12 @@ public class WebRtcCallActivity extends Activity {
|
||||
public void onPause() {
|
||||
Log.i(TAG, "onPause");
|
||||
super.onPause();
|
||||
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStopped(this);
|
||||
EventBus.getDefault().unregister(this);
|
||||
|
||||
// Android P has a bug in foreground timings where starting a service in onPause() can still crash
|
||||
Util.postToMain(() -> {
|
||||
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStopped(this);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user