After a crash, finish some autostarting activities.
- auto restart of activities when service crash spotted on Samsung devices; - only some activities supported: incall, conference, linphoneactivity.
This commit is contained in:
parent
f2e13e6a5b
commit
ff81ad9a30
6 changed files with 32 additions and 4 deletions
|
@ -28,6 +28,7 @@ import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
|
import org.linphone.core.Log;
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
|
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
|
@ -82,6 +83,15 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
|
||||||
|
|
||||||
protected abstract CalleeListAdapter createCalleeListAdapter();
|
protected abstract CalleeListAdapter createCalleeListAdapter();
|
||||||
|
|
||||||
|
protected final boolean finishIfAutoRestartAfterACrash() {
|
||||||
|
if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc().getCallsNb() == 0) {
|
||||||
|
Log.e("No service running: avoid crash by finishing ", this.getClass().getName());
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
mSpecificCalls = updateSpecificCallsList();
|
mSpecificCalls = updateSpecificCallsList();
|
||||||
|
|
|
@ -87,12 +87,13 @@ public class CallManager {
|
||||||
|
|
||||||
// Check if video possible regarding bandwidth limitations
|
// Check if video possible regarding bandwidth limitations
|
||||||
bm().updateWithProfileSettings(lc, params);
|
bm().updateWithProfileSettings(lc, params);
|
||||||
|
|
||||||
|
// Abort if not enough bandwidth...
|
||||||
if (!params.getVideoEnabled()) {
|
if (!params.getVideoEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not yet in video call: try to re-invite with video
|
// Not yet in video call: try to re-invite with video
|
||||||
params.setVideoEnabled(true);
|
|
||||||
lc.updateCall(lCall, params);
|
lc.updateCall(lCall, params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class ConferenceDetailsActivity extends AbstractCalleesActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
if (finishIfAutoRestartAfterACrash()) return;
|
||||||
setContentView(R.layout.conference_details_layout);
|
setContentView(R.layout.conference_details_layout);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
if (finishIfAutoRestartAfterACrash()) 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,6 +95,11 @@ public class LinphoneActivity extends TabActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
if (!LinphoneManager.isInstanciated()) {
|
||||||
|
Log.e("No service running: avoid crash by finishing ", this.getClass().getName());
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
instance = this;
|
instance = this;
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
@ -424,15 +429,20 @@ public class LinphoneActivity extends TabActivity implements
|
||||||
// Do not call if video activity already launched as it would cause a pause() of the launched one
|
// Do not call if video activity already launched as it would cause a pause() of the launched one
|
||||||
// and a race condition with capture surfaceview leading to a crash
|
// and a race condition with capture surfaceview leading to a crash
|
||||||
public void startVideoActivity(final LinphoneCall call, int delay) {
|
public void startVideoActivity(final LinphoneCall call, int delay) {
|
||||||
if (VideoCallActivity.launched || call == null) return;
|
if (VideoCallActivity.launched || call == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mHandler.postDelayed(new Runnable() {
|
mHandler.postDelayed(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
LinphoneManager.getInstance().enableCamera(call, true);
|
|
||||||
if (VideoCallActivity.launched) return;
|
if (VideoCallActivity.launched) return;
|
||||||
|
LinphoneManager.getInstance().enableCamera(call, true);
|
||||||
startActivityForResult(new Intent().setClass(
|
startActivityForResult(new Intent().setClass(
|
||||||
LinphoneActivity.this,
|
LinphoneActivity.this,
|
||||||
VideoCallActivity.class),
|
VideoCallActivity.class),
|
||||||
video_activity);
|
video_activity);
|
||||||
|
// Avoid two consecutive runs to enter the previous block
|
||||||
|
VideoCallActivity.launched = true;
|
||||||
}
|
}
|
||||||
}, delay);
|
}, delay);
|
||||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||||
|
|
|
@ -59,7 +59,12 @@ public class VideoCallActivity extends Activity implements LinphoneOnCallStateCh
|
||||||
AndroidVideoWindowImpl androidVideoWindowImpl;
|
AndroidVideoWindowImpl androidVideoWindowImpl;
|
||||||
private Runnable mCallQualityUpdater;
|
private Runnable mCallQualityUpdater;
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc().getCallsNb() == 0) {
|
||||||
|
Log.e("No service running: avoid crash by finishing ", this.getClass().getName());
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
Log.d("onCreate VideoCallActivity");
|
Log.d("onCreate VideoCallActivity");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.videocall);
|
setContentView(R.layout.videocall);
|
||||||
|
|
Loading…
Reference in a new issue