Fix oncreate not called when finishing after a crash
This commit is contained in:
parent
ce2bf4f9a1
commit
02ae758766
5 changed files with 17 additions and 6 deletions
|
@ -69,6 +69,9 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
|
|||
* Called by the child classes AFTER their own onCreate.
|
||||
*/
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (finishIfAutoRestartAfterACrash(savedInstanceState)) {
|
||||
return;
|
||||
}
|
||||
setListAdapter(mListAdapter = createCalleeListAdapter());
|
||||
|
||||
View muteMic = findViewById(R.id.toggleMuteMic);
|
||||
|
@ -83,9 +86,10 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
|
|||
|
||||
protected abstract CalleeListAdapter createCalleeListAdapter();
|
||||
|
||||
protected final boolean finishIfAutoRestartAfterACrash() {
|
||||
protected final boolean finishIfAutoRestartAfterACrash(Bundle savedInstanceState) {
|
||||
if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
Log.e("No service running: avoid crash by finishing ", this.getClass().getName());
|
||||
super.onCreate(savedInstanceState);
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ public class ConferenceDetailsActivity extends AbstractCalleesActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (finishIfAutoRestartAfterACrash()) return;
|
||||
if (finishIfAutoRestartAfterACrash(savedInstanceState)) {
|
||||
return;
|
||||
}
|
||||
setContentView(R.layout.conference_details_layout);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,9 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (finishIfAutoRestartAfterACrash()) return;
|
||||
if (finishIfAutoRestartAfterACrash(savedInstanceState)) {
|
||||
return;
|
||||
}
|
||||
setContentView(R.layout.incall_layout);
|
||||
|
||||
mAllowTransfers = getResources().getBoolean(R.bool.allow_transfers);
|
||||
|
|
|
@ -95,13 +95,15 @@ public class LinphoneActivity extends TabActivity implements
|
|||
}
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!LinphoneManager.isInstanciated()) {
|
||||
Log.e("No service running: avoid crash by finishing ", this.getClass().getName());
|
||||
// super.onCreate called earlier
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
LinphonePreferenceManager.getInstance(this);
|
||||
|
|
|
@ -60,13 +60,14 @@ public class VideoCallActivity extends Activity implements LinphoneOnCallStateCh
|
|||
private Runnable mCallQualityUpdater;
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
Log.e("No service running: avoid crash by finishing ", this.getClass().getName());
|
||||
// super.onCreate called earlier
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
Log.d("onCreate VideoCallActivity");
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.videocall);
|
||||
|
||||
SurfaceView videoView = (SurfaceView) findViewById(R.id.video_surface);
|
||||
|
|
Loading…
Reference in a new issue