Fix errors with different Android SDK (3, 5)
This commit is contained in:
parent
0b75c714f1
commit
ecc32e221b
12 changed files with 25 additions and 426 deletions
|
@ -78,9 +78,9 @@ include $(linphone-root-dir)/submodules/externals/build/ffmpeg/Android.mk
|
||||||
else
|
else
|
||||||
include $(linphone-root-dir)/submodules/externals/prebuilts/ffmpeg.mk
|
include $(linphone-root-dir)/submodules/externals/prebuilts/ffmpeg.mk
|
||||||
endif
|
endif
|
||||||
endif #armeabi-v7a
|
|
||||||
|
|
||||||
include $(linphone-root-dir)/submodules/externals/build/libvpx/Android.mk
|
include $(linphone-root-dir)/submodules/externals/build/libvpx/Android.mk
|
||||||
|
endif #armeabi-v7a
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(BUILD_GPLV3_ZRTP), 1)
|
ifeq ($(BUILD_GPLV3_ZRTP), 1)
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.linphone;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.linphone.core.Version;
|
import org.linphone.mediastream.Version;
|
||||||
|
|
||||||
import android.content.ContentUris;
|
import android.content.ContentUris;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
|
@ -24,8 +24,8 @@ import org.linphone.core.CallDirection;
|
||||||
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.Log;
|
||||||
import org.linphone.core.Version;
|
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.ui.AddVideoButton;
|
import org.linphone.ui.AddVideoButton;
|
||||||
import org.linphone.ui.AddressAware;
|
import org.linphone.ui.AddressAware;
|
||||||
import org.linphone.ui.AddressText;
|
import org.linphone.ui.AddressText;
|
||||||
|
|
|
@ -1,274 +0,0 @@
|
||||||
package org.linphone;
|
|
||||||
|
|
||||||
import javax.microedition.khronos.egl.EGL10;
|
|
||||||
import javax.microedition.khronos.egl.EGLConfig;
|
|
||||||
import javax.microedition.khronos.egl.EGLContext;
|
|
||||||
import javax.microedition.khronos.egl.EGLDisplay;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.opengl.GLSurfaceView;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
class GL2JNIView extends GLSurfaceView {
|
|
||||||
private static String TAG = "GL2JNIView";
|
|
||||||
private static final boolean DEBUG = false;
|
|
||||||
|
|
||||||
public GL2JNIView(Context context) {
|
|
||||||
super(context);
|
|
||||||
init(false, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GL2JNIView(Context context, AttributeSet att) {
|
|
||||||
super(context, att);
|
|
||||||
init(false, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GL2JNIView(Context context, boolean translucent, int depth, int stencil) {
|
|
||||||
super(context);
|
|
||||||
init(translucent, depth, stencil);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init(boolean translucent, int depth, int stencil) {
|
|
||||||
|
|
||||||
/* By default, GLSurfaceView() creates a RGB_565 opaque surface.
|
|
||||||
* If we want a translucent one, we should change the surface's
|
|
||||||
* format here, using PixelFormat.TRANSLUCENT for GL Surfaces
|
|
||||||
* is interpreted as any 32-bit surface with alpha by SurfaceFlinger.
|
|
||||||
*/
|
|
||||||
if (translucent) {
|
|
||||||
this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup the context factory for 2.0 rendering.
|
|
||||||
* See ContextFactory class definition below
|
|
||||||
*/
|
|
||||||
setEGLContextFactory(new ContextFactory());
|
|
||||||
|
|
||||||
/* We need to choose an EGLConfig that matches the format of
|
|
||||||
* our surface exactly. This is going to be done in our
|
|
||||||
* custom config chooser. See ConfigChooser class definition
|
|
||||||
* below.
|
|
||||||
*/
|
|
||||||
setEGLConfigChooser( translucent ?
|
|
||||||
new ConfigChooser(8, 8, 8, 8, depth, stencil) :
|
|
||||||
new ConfigChooser(5, 6, 5, 0, depth, stencil) );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
|
|
||||||
private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
|
|
||||||
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
|
|
||||||
Log.w(TAG, "creating OpenGL ES 2.0 context");
|
|
||||||
checkEglError("Before eglCreateContext", egl);
|
|
||||||
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
|
|
||||||
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
|
|
||||||
checkEglError("After eglCreateContext", egl);
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
|
|
||||||
egl.eglDestroyContext(display, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void checkEglError(String prompt, EGL10 egl) {
|
|
||||||
int error;
|
|
||||||
while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) {
|
|
||||||
Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
|
|
||||||
|
|
||||||
public ConfigChooser(int r, int g, int b, int a, int depth, int stencil) {
|
|
||||||
mRedSize = r;
|
|
||||||
mGreenSize = g;
|
|
||||||
mBlueSize = b;
|
|
||||||
mAlphaSize = a;
|
|
||||||
mDepthSize = depth;
|
|
||||||
mStencilSize = stencil;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This EGL config specification is used to specify 2.0 rendering.
|
|
||||||
* We use a minimum size of 4 bits for red/green/blue, but will
|
|
||||||
* perform actual matching in chooseConfig() below.
|
|
||||||
*/
|
|
||||||
private static int EGL_OPENGL_ES2_BIT = 4;
|
|
||||||
private static int[] s_configAttribs2 =
|
|
||||||
{
|
|
||||||
EGL10.EGL_RED_SIZE, 4,
|
|
||||||
EGL10.EGL_GREEN_SIZE, 4,
|
|
||||||
EGL10.EGL_BLUE_SIZE, 4,
|
|
||||||
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
|
||||||
EGL10.EGL_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
|
|
||||||
|
|
||||||
/* Get the number of minimally matching EGL configurations
|
|
||||||
*/
|
|
||||||
int[] num_config = new int[1];
|
|
||||||
egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
|
|
||||||
|
|
||||||
int numConfigs = num_config[0];
|
|
||||||
|
|
||||||
if (numConfigs <= 0) {
|
|
||||||
throw new IllegalArgumentException("No configs match configSpec");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate then read the array of minimally matching EGL configs
|
|
||||||
*/
|
|
||||||
EGLConfig[] configs = new EGLConfig[numConfigs];
|
|
||||||
egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config);
|
|
||||||
|
|
||||||
if (DEBUG) {
|
|
||||||
printConfigs(egl, display, configs);
|
|
||||||
}
|
|
||||||
/* Now return the "best" one
|
|
||||||
*/
|
|
||||||
return chooseConfig(egl, display, configs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
|
|
||||||
EGLConfig[] configs) {
|
|
||||||
for(EGLConfig config : configs) {
|
|
||||||
int d = findConfigAttrib(egl, display, config,
|
|
||||||
EGL10.EGL_DEPTH_SIZE, 0);
|
|
||||||
int s = findConfigAttrib(egl, display, config,
|
|
||||||
EGL10.EGL_STENCIL_SIZE, 0);
|
|
||||||
|
|
||||||
// We need at least mDepthSize and mStencilSize bits
|
|
||||||
if (d < mDepthSize || s < mStencilSize)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// We want an *exact* match for red/green/blue/alpha
|
|
||||||
int r = findConfigAttrib(egl, display, config,
|
|
||||||
EGL10.EGL_RED_SIZE, 0);
|
|
||||||
int g = findConfigAttrib(egl, display, config,
|
|
||||||
EGL10.EGL_GREEN_SIZE, 0);
|
|
||||||
int b = findConfigAttrib(egl, display, config,
|
|
||||||
EGL10.EGL_BLUE_SIZE, 0);
|
|
||||||
int a = findConfigAttrib(egl, display, config,
|
|
||||||
EGL10.EGL_ALPHA_SIZE, 0);
|
|
||||||
|
|
||||||
if (r == mRedSize && g == mGreenSize && b == mBlueSize && a == mAlphaSize)
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
|
|
||||||
EGLConfig config, int attribute, int defaultValue) {
|
|
||||||
|
|
||||||
if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
|
|
||||||
return mValue[0];
|
|
||||||
}
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printConfigs(EGL10 egl, EGLDisplay display,
|
|
||||||
EGLConfig[] configs) {
|
|
||||||
int numConfigs = configs.length;
|
|
||||||
Log.w(TAG, String.format("%d configurations", numConfigs));
|
|
||||||
for (int i = 0; i < numConfigs; i++) {
|
|
||||||
Log.w(TAG, String.format("Configuration %d:\n", i));
|
|
||||||
printConfig(egl, display, configs[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printConfig(EGL10 egl, EGLDisplay display,
|
|
||||||
EGLConfig config) {
|
|
||||||
int[] attributes = {
|
|
||||||
EGL10.EGL_BUFFER_SIZE,
|
|
||||||
EGL10.EGL_ALPHA_SIZE,
|
|
||||||
EGL10.EGL_BLUE_SIZE,
|
|
||||||
EGL10.EGL_GREEN_SIZE,
|
|
||||||
EGL10.EGL_RED_SIZE,
|
|
||||||
EGL10.EGL_DEPTH_SIZE,
|
|
||||||
EGL10.EGL_STENCIL_SIZE,
|
|
||||||
EGL10.EGL_CONFIG_CAVEAT,
|
|
||||||
EGL10.EGL_CONFIG_ID,
|
|
||||||
EGL10.EGL_LEVEL,
|
|
||||||
EGL10.EGL_MAX_PBUFFER_HEIGHT,
|
|
||||||
EGL10.EGL_MAX_PBUFFER_PIXELS,
|
|
||||||
EGL10.EGL_MAX_PBUFFER_WIDTH,
|
|
||||||
EGL10.EGL_NATIVE_RENDERABLE,
|
|
||||||
EGL10.EGL_NATIVE_VISUAL_ID,
|
|
||||||
EGL10.EGL_NATIVE_VISUAL_TYPE,
|
|
||||||
0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
|
|
||||||
EGL10.EGL_SAMPLES,
|
|
||||||
EGL10.EGL_SAMPLE_BUFFERS,
|
|
||||||
EGL10.EGL_SURFACE_TYPE,
|
|
||||||
EGL10.EGL_TRANSPARENT_TYPE,
|
|
||||||
EGL10.EGL_TRANSPARENT_RED_VALUE,
|
|
||||||
EGL10.EGL_TRANSPARENT_GREEN_VALUE,
|
|
||||||
EGL10.EGL_TRANSPARENT_BLUE_VALUE,
|
|
||||||
0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
|
|
||||||
0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
|
|
||||||
0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
|
|
||||||
0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
|
|
||||||
EGL10.EGL_LUMINANCE_SIZE,
|
|
||||||
EGL10.EGL_ALPHA_MASK_SIZE,
|
|
||||||
EGL10.EGL_COLOR_BUFFER_TYPE,
|
|
||||||
EGL10.EGL_RENDERABLE_TYPE,
|
|
||||||
0x3042 // EGL10.EGL_CONFORMANT
|
|
||||||
};
|
|
||||||
String[] names = {
|
|
||||||
"EGL_BUFFER_SIZE",
|
|
||||||
"EGL_ALPHA_SIZE",
|
|
||||||
"EGL_BLUE_SIZE",
|
|
||||||
"EGL_GREEN_SIZE",
|
|
||||||
"EGL_RED_SIZE",
|
|
||||||
"EGL_DEPTH_SIZE",
|
|
||||||
"EGL_STENCIL_SIZE",
|
|
||||||
"EGL_CONFIG_CAVEAT",
|
|
||||||
"EGL_CONFIG_ID",
|
|
||||||
"EGL_LEVEL",
|
|
||||||
"EGL_MAX_PBUFFER_HEIGHT",
|
|
||||||
"EGL_MAX_PBUFFER_PIXELS",
|
|
||||||
"EGL_MAX_PBUFFER_WIDTH",
|
|
||||||
"EGL_NATIVE_RENDERABLE",
|
|
||||||
"EGL_NATIVE_VISUAL_ID",
|
|
||||||
"EGL_NATIVE_VISUAL_TYPE",
|
|
||||||
"EGL_PRESERVED_RESOURCES",
|
|
||||||
"EGL_SAMPLES",
|
|
||||||
"EGL_SAMPLE_BUFFERS",
|
|
||||||
"EGL_SURFACE_TYPE",
|
|
||||||
"EGL_TRANSPARENT_TYPE",
|
|
||||||
"EGL_TRANSPARENT_RED_VALUE",
|
|
||||||
"EGL_TRANSPARENT_GREEN_VALUE",
|
|
||||||
"EGL_TRANSPARENT_BLUE_VALUE",
|
|
||||||
"EGL_BIND_TO_TEXTURE_RGB",
|
|
||||||
"EGL_BIND_TO_TEXTURE_RGBA",
|
|
||||||
"EGL_MIN_SWAP_INTERVAL",
|
|
||||||
"EGL_MAX_SWAP_INTERVAL",
|
|
||||||
"EGL_LUMINANCE_SIZE",
|
|
||||||
"EGL_ALPHA_MASK_SIZE",
|
|
||||||
"EGL_COLOR_BUFFER_TYPE",
|
|
||||||
"EGL_RENDERABLE_TYPE",
|
|
||||||
"EGL_CONFORMANT"
|
|
||||||
};
|
|
||||||
int[] value = new int[1];
|
|
||||||
for (int i = 0; i < attributes.length; i++) {
|
|
||||||
int attribute = attributes[i];
|
|
||||||
String name = names[i];
|
|
||||||
if ( egl.eglGetConfigAttrib(display, config, attribute, value)) {
|
|
||||||
Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
|
|
||||||
} else {
|
|
||||||
// Log.w(TAG, String.format(" %s: failed\n", name));
|
|
||||||
while (egl.eglGetError() != EGL10.EGL_SUCCESS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subclasses can adjust these values:
|
|
||||||
protected int mRedSize;
|
|
||||||
protected int mGreenSize;
|
|
||||||
protected int mBlueSize;
|
|
||||||
protected int mAlphaSize;
|
|
||||||
protected int mDepthSize;
|
|
||||||
protected int mStencilSize;
|
|
||||||
private int[] mValue = new int[1];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,24 +21,15 @@ package org.linphone;
|
||||||
|
|
||||||
import static android.content.Intent.ACTION_MAIN;
|
import static android.content.Intent.ACTION_MAIN;
|
||||||
|
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.security.KeyStoreException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.net.ssl.TrustManager;
|
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
|
|
||||||
import org.linphone.LinphoneManager.EcCalibrationListener;
|
import org.linphone.LinphoneManager.EcCalibrationListener;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.core.Version;
|
|
||||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -57,7 +48,6 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.util.Base64;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -151,50 +141,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
|
||||||
|
|
||||||
if (savedInstanceState !=null && savedInstanceState.getBoolean(SCREEN_IS_HIDDEN,false)) {
|
if (savedInstanceState !=null && savedInstanceState.getBoolean(SCREEN_IS_HIDDEN,false)) {
|
||||||
hideScreen(true);
|
hideScreen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false) {
|
|
||||||
try {
|
|
||||||
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
|
|
||||||
Enumeration<String> al = ks.aliases();
|
|
||||||
while(al.hasMoreElements()) {
|
|
||||||
Log.i(al.nextElement());
|
|
||||||
}
|
|
||||||
Log.i("Enumeration done");
|
|
||||||
} catch (KeyStoreException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (false) {
|
|
||||||
try {
|
|
||||||
String defaultAlg = TrustManagerFactory.getDefaultAlgorithm();
|
|
||||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(defaultAlg);
|
|
||||||
// init is needed for Android to fill the javax.net.ssl.trustStore property
|
|
||||||
// ref : http://groups.google.com/group/android-developers/browse_thread/thread/366a3c8a6b2a7ad/163ff07c8ac39929?lnk=gst&q=SSL+root
|
|
||||||
tmf.init((KeyStore)null);
|
|
||||||
String trustStore = System.getProperty("javax.net.ssl.trustStore");
|
|
||||||
Log.i(trustStore + "\n");
|
|
||||||
|
|
||||||
for(TrustManager tm: tmf.getTrustManagers()) {
|
|
||||||
X509TrustManager xtm = (X509TrustManager)tm;
|
|
||||||
Log.i(xtm.getAcceptedIssuers().length);
|
|
||||||
for(X509Certificate ca : xtm.getAcceptedIssuers()) {
|
|
||||||
byte[] encoded = ca.getEncoded();
|
|
||||||
String s = new String(encoded);
|
|
||||||
byte[] d2 = Base64.decode(encoded, 0);
|
|
||||||
String s2 = new String(d2);
|
|
||||||
Log.i(ca.toString());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (KeyStoreException e) {
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,7 +241,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
|
||||||
if (event==null || event.sensor == mAccelerometer) {
|
if (event==null || event.sensor == mAccelerometer) {
|
||||||
int rot;
|
int rot;
|
||||||
|
|
||||||
rot=getWindowManager().getDefaultDisplay().getOrientation();
|
rot = AndroidVideoWindowImpl.rotationToAngle(getWindowManager().getDefaultDisplay().getOrientation());
|
||||||
|
|
||||||
if (rot != previousRotation) {
|
if (rot != previousRotation) {
|
||||||
Log.d("New device rotation: ", rot);
|
Log.d("New device rotation: ", rot);
|
||||||
|
|
|
@ -54,13 +54,13 @@ import org.linphone.core.LinphoneFriend;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.core.PayloadType;
|
import org.linphone.core.PayloadType;
|
||||||
import org.linphone.core.Version;
|
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||||
import org.linphone.core.LinphoneCore.FirewallPolicy;
|
import org.linphone.core.LinphoneCore.FirewallPolicy;
|
||||||
import org.linphone.core.LinphoneCore.GlobalState;
|
import org.linphone.core.LinphoneCore.GlobalState;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
import org.linphone.core.LinphoneCore.Transports;
|
import org.linphone.core.LinphoneCore.Transports;
|
||||||
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper;
|
import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||||
|
@ -214,7 +214,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
instance.startLibLinphone(c);
|
instance.startLibLinphone(c);
|
||||||
|
|
||||||
if (Version.isVideoCapable())
|
if (Version.isVideoCapable())
|
||||||
AndroidVideoApi5JniWrapper.setAndroidSdkVersion(Build.VERSION.SDK_INT);
|
AndroidVideoApi5JniWrapper.setAndroidSdkVersion(Version.sdk());
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ import java.util.List;
|
||||||
import org.linphone.LinphoneManager.EcCalibrationListener;
|
import org.linphone.LinphoneManager.EcCalibrationListener;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.core.Version;
|
|
||||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||||
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ import org.linphone.LinphoneManager.LinphoneServiceListener;
|
||||||
import org.linphone.LinphoneManager.NewOutgoingCallUiListener;
|
import org.linphone.LinphoneManager.NewOutgoingCallUiListener;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.core.Version;
|
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.core.LinphoneCore.GlobalState;
|
import org.linphone.core.LinphoneCore.GlobalState;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
|
|
@ -20,6 +20,8 @@ package org.linphone;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import junit.runner.Version;
|
||||||
|
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
|
@ -60,8 +62,9 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
mVideoCaptureView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
mVideoCaptureView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
||||||
|
|
||||||
/* force surfaces Z ordering */
|
/* force surfaces Z ordering */
|
||||||
mVideoView.setZOrderOnTop(false);
|
if (org.linphone.mediastream.Version.sdkAboveOrEqual(5)) {
|
||||||
mVideoCaptureView.setZOrderOnTop(true);
|
fixZOrder();
|
||||||
|
}
|
||||||
|
|
||||||
androidVideoWindowImpl = new AndroidVideoWindowImpl(mVideoView, mVideoCaptureView);
|
androidVideoWindowImpl = new AndroidVideoWindowImpl(mVideoView, mVideoCaptureView);
|
||||||
androidVideoWindowImpl.setListener(new AndroidVideoWindowImpl.VideoWindowListener() {
|
androidVideoWindowImpl.setListener(new AndroidVideoWindowImpl.VideoWindowListener() {
|
||||||
|
@ -91,7 +94,7 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
// * onDestroy -> sendStaticImage(true) => destroy video graph
|
// * onDestroy -> sendStaticImage(true) => destroy video graph
|
||||||
// * onCreate -> sendStaticImage(false) => recreate the video graph.
|
// * onCreate -> sendStaticImage(false) => recreate the video graph.
|
||||||
// Before creating the graph, the orientation must be known to LC => this is done here
|
// Before creating the graph, the orientation must be known to LC => this is done here
|
||||||
LinphoneManager.getLc().setDeviceRotation(AndroidVideoWindowImpl.rotationToAngle(getWindowManager().getDefaultDisplay().getRotation()));
|
LinphoneManager.getLc().setDeviceRotation(AndroidVideoWindowImpl.rotationToAngle(getWindowManager().getDefaultDisplay().getOrientation()));
|
||||||
|
|
||||||
if (!LinphoneManager.getInstance().shareMyCamera())
|
if (!LinphoneManager.getInstance().shareMyCamera())
|
||||||
LinphoneManager.getInstance().sendStaticImage(false);
|
LinphoneManager.getInstance().sendStaticImage(false);
|
||||||
|
@ -99,6 +102,11 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG);
|
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG);
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fixZOrder() {
|
||||||
|
mVideoView.setZOrderOnTop(false);
|
||||||
|
mVideoCaptureView.setZOrderOnTop(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,6 +196,7 @@ public class VideoCallActivity extends SoftVolumeActivity {
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
Log.d("onPause VideoCallActivity");
|
Log.d("onPause VideoCallActivity");
|
||||||
LinphoneManager.getLc().setVideoWindow(null);
|
LinphoneManager.getLc().setVideoWindow(null);
|
||||||
|
LinphoneManager.getLc().setPreviewWindow(null);
|
||||||
LinphoneManager.getInstance().sendStaticImage(true);
|
LinphoneManager.getInstance().sendStaticImage(true);
|
||||||
if (mWakeLock.isHeld()) mWakeLock.release();
|
if (mWakeLock.isHeld()) mWakeLock.release();
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
|
@ -35,6 +35,8 @@ import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import org.linphone.mediastream.Version;
|
||||||
|
|
||||||
public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
||||||
|
|
||||||
private static void loadOptionalLibrary(String s) {
|
private static void loadOptionalLibrary(String s) {
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
/*
|
|
||||||
Version.java
|
|
||||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
package org.linphone.core;
|
|
||||||
|
|
||||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
|
||||||
|
|
||||||
import android.os.Build;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Centralize version access and allow simulation of lower versions.
|
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*/
|
|
||||||
public class Version {
|
|
||||||
|
|
||||||
public static final int API03_CUPCAKE_15 = 3;
|
|
||||||
public static final int API04_DONUT_16 = 4;
|
|
||||||
public static final int API06_ECLAIR_20 = 6;
|
|
||||||
public static final int API07_ECLAIR_21 = 7;
|
|
||||||
public static final int API08_FROYO_22 = 8;
|
|
||||||
public static final int API09_GINGERBREAD_23 = 9;
|
|
||||||
public static final int API11_HONEYCOMB_30 = 11;
|
|
||||||
|
|
||||||
private static native boolean nativeHasZrtp();
|
|
||||||
private static native boolean nativeHasNeon();
|
|
||||||
private static Boolean hasNeon;
|
|
||||||
|
|
||||||
private static final int buildVersion =
|
|
||||||
Integer.parseInt(Build.VERSION.SDK);
|
|
||||||
// 8; // 2.2
|
|
||||||
// 7; // 2.1
|
|
||||||
|
|
||||||
public static final boolean sdkAboveOrEqual(int value) {
|
|
||||||
return buildVersion >= value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean sdkStrictlyBelow(int value) {
|
|
||||||
return buildVersion < value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int sdk() {
|
|
||||||
return buildVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isArmv7() {
|
|
||||||
try {
|
|
||||||
return sdkAboveOrEqual(4)
|
|
||||||
&& Build.class.getField("CPU_ABI").get(null).toString().startsWith("armeabi-v7");
|
|
||||||
} catch (Throwable e) {}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public static boolean hasNeon(){
|
|
||||||
if (hasNeon == null) hasNeon = nativeHasNeon();
|
|
||||||
return hasNeon;
|
|
||||||
}
|
|
||||||
public static boolean isVideoCapable() {
|
|
||||||
return !Version.sdkStrictlyBelow(5) && Version.hasNeon() && Hacks.hasCamera();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasZrtp(){
|
|
||||||
return nativeHasZrtp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void dumpCapabilities(){
|
|
||||||
StringBuilder sb = new StringBuilder(" ==== Capabilities dump ====\n");
|
|
||||||
sb.append("Has neon: ").append(Boolean.toString(hasNeon())).append("\n");
|
|
||||||
sb.append("Has ZRTP: ").append(Boolean.toString(hasZrtp())).append("\n");
|
|
||||||
Log.i(sb.toString());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ef7dc050f57967cb63a0b2e6a8d294ca504816b8
|
Subproject commit a9d3c766fd6a48dafa925a938611c2aaabdd69ac
|
Loading…
Reference in a new issue