mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 17:27:21 +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() {
|
protected void onResume() {
|
||||||
Log.i(TAG, "onResume()");
|
Log.i(TAG, "onResume()");
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
isVisible = true;
|
||||||
|
|
||||||
// Android P has a bug in foreground timings where starting a service in onResume() can still crash
|
// Android P has a bug in foreground timings where starting a service in onResume() can still crash
|
||||||
Util.postToMain(() -> {
|
Util.postToMain(() -> {
|
||||||
@ -69,19 +70,19 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
|
|||||||
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStarted(this);
|
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStarted(this);
|
||||||
else ApplicationContext.getInstance(this).getJobManager().add(new PushNotificationReceiveJob(this));
|
else ApplicationContext.getInstance(this).getJobManager().add(new PushNotificationReceiveJob(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
isVisible = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
Log.i(TAG, "onPause()");
|
Log.i(TAG, "onPause()");
|
||||||
super.onPause();
|
super.onPause();
|
||||||
KeyCachingService.registerPassphraseActivityStopped(this);
|
|
||||||
|
|
||||||
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStopped(this);
|
|
||||||
|
|
||||||
isVisible = false;
|
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
|
@Override
|
||||||
|
@ -115,8 +115,12 @@ public class WebRtcCallActivity extends Activity {
|
|||||||
public void onPause() {
|
public void onPause() {
|
||||||
Log.i(TAG, "onPause");
|
Log.i(TAG, "onPause");
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStopped(this);
|
|
||||||
EventBus.getDefault().unregister(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
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user