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