Fix overlay crash on rotation + go back to call activity when clicking on overlay
This commit is contained in:
parent
dbdb72c465
commit
d53ee51346
4 changed files with 13 additions and 14 deletions
|
@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
@ -25,10 +26,13 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
public class KeepAliveHandler extends BroadcastReceiver {
|
public class KeepAliveHandler extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
//Log.i("Keep alive handler invoked"); //TODO FIXME Crash since the log rework
|
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||||
|
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
|
||||||
|
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
||||||
|
|
||||||
|
Log.i("Keep alive handler invoked");
|
||||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
|
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
|
||||||
//first refresh registers
|
//first refresh registers
|
||||||
LinphoneManager.getLc().refreshRegisters();
|
LinphoneManager.getLc().refreshRegisters();
|
||||||
|
@ -38,9 +42,6 @@ public class KeepAliveHandler extends BroadcastReceiver {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
//Log.e("Cannot sleep for 2s", e); //TODO FIXME Crash since the log rework
|
//Log.e("Cannot sleep for 2s", e); //TODO FIXME Crash since the log rework
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,8 @@ import android.content.Intent;
|
||||||
* Purpose of this receiver is to disable keep alives when screen is off
|
* Purpose of this receiver is to disable keep alives when screen is off
|
||||||
* */
|
* */
|
||||||
public class KeepAliveReceiver extends BroadcastReceiver {
|
public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
||||||
if (!LinphoneService.isReady()) {
|
if (!LinphoneService.isReady()) {
|
||||||
Log.i("Keep alive broadcast received while Linphone service not ready");
|
Log.i("Keep alive broadcast received while Linphone service not ready");
|
||||||
return;
|
return;
|
||||||
|
@ -43,7 +41,5 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
LinphoneManager.getLc().enableKeepAlive(false);
|
LinphoneManager.getLc().enableKeepAlive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -57,7 +56,6 @@ import android.os.IBinder;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -314,7 +312,7 @@ public final class LinphoneService extends Service {
|
||||||
|
|
||||||
public void destroyOverlay() {
|
public void destroyOverlay() {
|
||||||
if (mOverlay != null) {
|
if (mOverlay != null) {
|
||||||
mWindowManager.removeView(mOverlay);
|
mWindowManager.removeViewImmediate(mOverlay);
|
||||||
mOverlay.destroy();
|
mOverlay.destroy();
|
||||||
}
|
}
|
||||||
mOverlay = null;
|
mOverlay = null;
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneActivity;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
|
import org.linphone.LinphoneService;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.LinphoneCallParams;
|
import org.linphone.core.LinphoneCallParams;
|
||||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
@ -48,7 +51,6 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
||||||
LinphoneManager.getLc().setPreviewWindow(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
||||||
|
@ -64,7 +66,9 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
||||||
setOnClickListener(new OnClickListener() {
|
setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
Context context = LinphoneService.instance();
|
||||||
|
Intent intent = new Intent(context, LinphoneActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue