Merge branch 'master' of git.linphone.org:linphone-android

This commit is contained in:
Sylvain Berfini 2012-01-06 11:16:47 +01:00
commit 05b959900c
10 changed files with 1392 additions and 15 deletions

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="gen"/>
<classpathentry excluding="org/linphone/mediastream/MediastreamerActivity.java" kind="src" path="submodules/linphone/mediastreamer2/java/src"/> <classpathentry excluding="org/linphone/mediastream/MediastreamerActivity.java" kind="src" path="submodules/linphone/mediastreamer2/java/src"/>
<classpathentry kind="src" path="submodules/linphone/java/j2se"/> <classpathentry kind="src" path="submodules/linphone/java/j2se"/>
<classpathentry kind="src" path="submodules/linphone/java/common"/> <classpathentry kind="src" path="submodules/linphone/java/common"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/> <classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

1336
build.xml Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -23,8 +23,9 @@
android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_width="wrap_content" android:layout_height="fill_parent"
android:layout_centerVertical="true"> android:layout_centerVertical="true">
<TextView android:id="@+id/status_label" style="@style/callee_status" /> <TextView android:id="@+id/status_label" style="@style/callee_status" />
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/QoS" android:src="@drawable/stat_sys_signal_0" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" /> <ImageView android:id="@+id/callee_status_speeking" style="@style/callee_status" android:src="@drawable/conf_speaking" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" android:visibility="gone"/> <ImageView android:id="@+id/callee_status_qos" style="@style/callee_status" android:src="@drawable/stat_sys_signal_0" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" android:src="@drawable/conf_secured" android:visibility="gone"/> <ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" android:src="@drawable/conf_secured" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_maybe_secured" style="@style/callee_status" android:src="@drawable/conf_maybe_secured" android:visibility="gone"/> <ImageView android:id="@+id/callee_status_maybe_secured" style="@style/callee_status" android:src="@drawable/conf_maybe_secured" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status" android:src="@drawable/conf_not_secured" android:visibility="gone"/> <ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status" android:src="@drawable/conf_not_secured" android:visibility="gone"/>

View file

@ -67,6 +67,7 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
private Handler callqualityHandler; private Handler callqualityHandler;
private List<View> viewsToUpdateCallQuality; private List<View> viewsToUpdateCallQuality;
private boolean shouldDisplayWhoIsTalking = false;
@Override @Override
/** /**
* Called by the child classes AFTER their own onCreate. * Called by the child classes AFTER their own onCreate.
@ -215,6 +216,12 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
} }
protected final void initCallQualityListener() { protected final void initCallQualityListener() {
final int timeToRefresh;
if (shouldDisplayWhoIsTalking)
timeToRefresh = 100;
else
timeToRefresh = 1000;
callqualityHandler = new Handler(); callqualityHandler = new Handler();
viewsToUpdateCallQuality = new ArrayList<View>(); viewsToUpdateCallQuality = new ArrayList<View>();
callqualityHandler.postDelayed(new Runnable() { callqualityHandler.postDelayed(new Runnable() {
@ -226,12 +233,20 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
for (View v : viewsToUpdateCallQuality) { for (View v : viewsToUpdateCallQuality) {
LinphoneCall call = (LinphoneCall) v.getTag(); LinphoneCall call = (LinphoneCall) v.getTag();
float newQuality = call.getCurrentQuality(); float newQuality = call.getCurrentQuality();
updateQualityOfSignalIcon(v, newQuality); updateQualityOfSignalIcon(v, newQuality);
// We also use this handler to display the ones who speaks
ImageView speaking = (ImageView) v.findViewById(R.id.callee_status_speeking);
if (shouldDisplayWhoIsTalking && call.getPlayVolume() >= -20) {
speaking.setVisibility(View.VISIBLE);
} else if (speaking.getVisibility() != View.GONE) {
speaking.setVisibility(View.GONE);
}
} }
callqualityHandler.postDelayed(this, 1000); callqualityHandler.postDelayed(this, timeToRefresh);
} }
},1000); },timeToRefresh);
} }
protected final void registerCallQualityListener(final View v, final LinphoneCall call) { protected final void registerCallQualityListener(final View v, final LinphoneCall call) {
@ -241,6 +256,10 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
v.setTag(call); v.setTag(call);
viewsToUpdateCallQuality.add(v); viewsToUpdateCallQuality.add(v);
} }
protected final void registerCallSpeakerListener() {
shouldDisplayWhoIsTalking = true;
}
} }
@Override @Override
@ -282,7 +301,10 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
void updateQualityOfSignalIcon(View v, float quality) void updateQualityOfSignalIcon(View v, float quality)
{ {
ImageView qos = (ImageView) v.findViewById(R.id.QoS); ImageView qos = (ImageView) v.findViewById(R.id.callee_status_qos);
if (!(qos.getVisibility() == View.VISIBLE)) {
qos.setVisibility(View.VISIBLE);
}
if (quality >= 4) // Good Quality if (quality >= 4) // Good Quality
{ {
qos.setImageDrawable(getResources().getDrawable(R.drawable.stat_sys_signal_4)); qos.setImageDrawable(getResources().getDrawable(R.drawable.stat_sys_signal_4));

View file

@ -96,12 +96,15 @@ public class ConferenceDetailsActivity extends AbstractCalleesActivity {
} }
}); });
setVisibility(v, R.id.callee_status_qos, true);
// May be greatly sped up using a drawable cache // May be greatly sped up using a drawable cache
ImageView pictureView = (ImageView) v.findViewById(R.id.picture); ImageView pictureView = (ImageView) v.findViewById(R.id.picture);
setCalleePicture(pictureView, address); setCalleePicture(pictureView, address);
registerCallDurationTimer(v, call); registerCallDurationTimer(v, call);
registerCallQualityListener(v, call); registerCallQualityListener(v, call);
registerCallSpeakerListener();
return v; return v;
} }

View file

@ -456,7 +456,7 @@ public class IncallActivity extends AbstractCalleesActivity implements
boolean statusPaused = state== State.Paused || state == State.PausedByRemote; boolean statusPaused = state== State.Paused || state == State.PausedByRemote;
setVisibility(v, R.id.callee_status_paused, statusPaused); setVisibility(v, R.id.callee_status_paused, statusPaused);
setVisibility(v, R.id.QoS, !statusPaused); setVisibility(v, R.id.callee_status_qos, !statusPaused);
final OnLongClickListener showCallActionsLongListener = new OnLongClickListener() { final OnLongClickListener showCallActionsLongListener = new OnLongClickListener() {
public boolean onLongClick(View v) { public boolean onLongClick(View v) {

View file

@ -38,6 +38,7 @@ import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.Service; import android.app.Service;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
@ -48,6 +49,8 @@ import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.net.wifi.WifiManager.WifiLock;
import android.net.wifi.WifiManager;
/** /**
* *
@ -73,7 +76,8 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
// private boolean mTestDelayElapsed; // add a timer for testing // private boolean mTestDelayElapsed; // add a timer for testing
private boolean mTestDelayElapsed = true; // no timer private boolean mTestDelayElapsed = true; // no timer
private WifiManager mWifiManager ;
private WifiLock mWifiLock ;
public static boolean isReady() { public static boolean isReady() {
return instance!=null && instance.mTestDelayElapsed; return instance!=null && instance.mTestDelayElapsed;
} }
@ -136,6 +140,9 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
LinphoneManager.createAndStart(this, this); LinphoneManager.createAndStart(this, this);
LinphoneManager.getLc().setPresenceInfo(0, null, OnlineStatus.Online); LinphoneManager.getLc().setPresenceInfo(0, null, OnlineStatus.Online);
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
mWifiLock = mWifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, this.getPackageName()+"-wifi-call-lock");
mWifiLock.setReferenceCounted(false);
instance = this; // instance is ready once linphone manager has been created instance = this; // instance is ready once linphone manager has been created
@ -365,7 +372,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
// Make sure our notification is gone. // Make sure our notification is gone.
stopForegroundCompat(NOTIF_ID); stopForegroundCompat(NOTIF_ID);
mNM.cancel(INCALL_NOTIF_ID); mNM.cancel(INCALL_NOTIF_ID);
mWifiLock.release();
super.onDestroy(); super.onDestroy();
} }
@ -444,10 +451,13 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
if (state == State.StreamsRunning) { if (state == State.StreamsRunning) {
// Workaround bug current call seems to be updated after state changed to streams running // Workaround bug current call seems to be updated after state changed to streams running
refreshIncallIcon(call); refreshIncallIcon(call);
mWifiLock.acquire();
} else { } else {
refreshIncallIcon(LinphoneManager.getLc().getCurrentCall()); refreshIncallIcon(LinphoneManager.getLc().getCurrentCall());
} }
if ((state == State.CallEnd || state == State.Error) && LinphoneManager.getLc().getCallsNb() < 1) {
mWifiLock.release();
}
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
public void run() { public void run() {
if (guiListener() != null) if (guiListener() != null)

View file

@ -147,4 +147,9 @@ class LinphoneCallImpl implements LinphoneCall {
public String toString() { public String toString() {
return "Call " + nativePtr; return "Call " + nativePtr;
} }
private native float getPlayVolume(long nativePtr);
public float getPlayVolume() {
return getPlayVolume(nativePtr);
}
} }

@ -1 +1 @@
Subproject commit 5bf95231b51641ce095af49a864cf00fa6837750 Subproject commit 29e89fc9de102f88b8ebf36a5fe7449a26a8bbff