Prevent incall activity from launching twice
This commit is contained in:
parent
e124d9603d
commit
908849e1c9
2 changed files with 13 additions and 5 deletions
|
@ -85,8 +85,8 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
private static IncallActivity instance;
|
private static IncallActivity instance;
|
||||||
private CountDownTimer timer;
|
private CountDownTimer timer;
|
||||||
public static boolean active;
|
public static boolean active;
|
||||||
@Override protected void setActive(boolean a) {active = a;}
|
@Override protected synchronized void setActive(boolean a) {active = a;}
|
||||||
@Override protected boolean isActive() {return active;}
|
@Override protected synchronized boolean isActive() {return active;}
|
||||||
|
|
||||||
public static boolean isReady() {
|
public static boolean isReady() {
|
||||||
return instance!=null;
|
return instance!=null;
|
||||||
|
@ -116,6 +116,8 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
if (finishIfAutoRestartAfterACrash(savedInstanceState)) {
|
if (finishIfAutoRestartAfterACrash(savedInstanceState)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setActive(true);
|
||||||
|
|
||||||
if (!Version.isXLargeScreen(this))
|
if (!Version.isXLargeScreen(this))
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
|
||||||
|
@ -148,6 +150,12 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
IncallActivity.active = false;
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldFinishCalleeActivity() {
|
protected boolean shouldFinishCalleeActivity() {
|
||||||
return lc().getCallsNb() == 0;
|
return lc().getCallsNb() == 0;
|
||||||
|
|
|
@ -420,13 +420,13 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
|
||||||
if (IncallActivity.instance() != null && IncallActivity.instance().isActive()) {
|
if (IncallActivity.instance() != null && IncallActivity.instance().isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mHandler.postDelayed(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (IncallActivity.instance() != null && IncallActivity.instance().isActive()) return;
|
if (IncallActivity.instance() != null && IncallActivity.instance().isActive()) return;
|
||||||
Intent intent = new Intent().setClass(LinphoneActivity.this, IncallActivity.class);
|
Intent intent = new Intent().setClass(LinphoneActivity.this, IncallActivity.class);
|
||||||
startActivityForResult(intent, incall_activity);
|
startActivityForResult(intent, incall_activity);
|
||||||
}
|
}
|
||||||
}, 0);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startIncomingCallActivity() {
|
public void startIncomingCallActivity() {
|
||||||
|
|
Loading…
Reference in a new issue