Better workaround for infinite loop
This commit is contained in:
parent
b52bd60ca3
commit
4ac20cc8c7
2 changed files with 9 additions and 10 deletions
|
@ -27,6 +27,7 @@ import android.app.Dialog;
|
|||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
|
@ -1337,6 +1338,14 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
|||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||
boolean locked = km.inKeyguardRestrictedInputMode();
|
||||
if (locked) {
|
||||
// This is to workaround an infinite loop of pause/start in LinphoneActivity issue
|
||||
// if incoming call ends while screen if off and locked
|
||||
finish();
|
||||
}
|
||||
|
||||
ArrayList<String> permissionsToAskFor = new ArrayList<>();
|
||||
String[] permissionsToHave = {
|
||||
// This one is to allow floating notifications
|
||||
|
|
|
@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
|
@ -30,7 +29,6 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.view.WindowManager;
|
||||
import java.util.ArrayList;
|
||||
|
@ -434,15 +432,7 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
|
||||
private void onIncomingReceived() {
|
||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
Intent intent = new Intent().setClass(this, mIncomingReceivedActivity);
|
||||
|
||||
if (!pm.isInteractive()) {
|
||||
// This is to workaround an infinite loop of pause/start in LinphoneActivity issue
|
||||
// if incoming call is being stopped by caller while screen if off and locked
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
}
|
||||
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneActivity.instance().startActivity(intent);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue