Merge branch 'master' of git.linphone.org:linphone-android
This commit is contained in:
commit
878013c867
7 changed files with 49 additions and 32 deletions
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
import org.linphone.core.LinphoneCallParams;
|
import org.linphone.core.LinphoneCallParams;
|
||||||
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.VideoSize;
|
import org.linphone.core.VideoSize;
|
||||||
import org.linphone.core.video.AndroidCameraRecordManager;
|
import org.linphone.core.video.AndroidCameraRecordManager;
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@ public class BandwidthManager {
|
||||||
public void updateWithProfileSettings(LinphoneCore lc, LinphoneCallParams callParams) {
|
public void updateWithProfileSettings(LinphoneCore lc, LinphoneCallParams callParams) {
|
||||||
// Setting Linphone Core Preferred Video Size
|
// Setting Linphone Core Preferred Video Size
|
||||||
boolean bandwidthOKForVideo = isVideoPossible();
|
boolean bandwidthOKForVideo = isVideoPossible();
|
||||||
if (bandwidthOKForVideo) {
|
if (bandwidthOKForVideo && Version.isVideoCapable()) {
|
||||||
AndroidCameraRecordManager acrm = AndroidCameraRecordManager.getInstance();
|
AndroidCameraRecordManager acrm = AndroidCameraRecordManager.getInstance();
|
||||||
boolean isPortrait=acrm.isFrameToBeShownPortrait();
|
boolean isPortrait=acrm.isFrameToBeShownPortrait();
|
||||||
VideoSize targetVideoSize=maxSupportedVideoSize(isPortrait, getMaximumVideoSize(isPortrait),
|
VideoSize targetVideoSize=maxSupportedVideoSize(isPortrait, getMaximumVideoSize(isPortrait),
|
||||||
|
|
|
@ -24,6 +24,7 @@ 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.core.video.AndroidCameraRecordManager;
|
import org.linphone.core.video.AndroidCameraRecordManager;
|
||||||
import org.linphone.ui.AddVideoButton;
|
import org.linphone.ui.AddVideoButton;
|
||||||
|
@ -314,15 +315,18 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
|
||||||
((CallButton) incomingCallView.findViewById(R.id.Call)).setExternalClickListener(new OnClickListener() {
|
((CallButton) incomingCallView.findViewById(R.id.Call)).setExternalClickListener(new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
LinphoneManager.getInstance().resetCameraFromPreferences();
|
if (Version.isVideoCapable()) {
|
||||||
|
LinphoneManager.getInstance().resetCameraFromPreferences();
|
||||||
|
|
||||||
// Privacy setting to not share the user camera by default
|
// Privacy setting to not share the user camera by default
|
||||||
boolean prefVideoEnable = LinphoneManager.getInstance().isVideoEnabled();
|
boolean prefVideoEnable = LinphoneManager.getInstance().isVideoEnabled();
|
||||||
boolean prefAutoShareMyCamera = mPref.getBoolean(getString(R.string.pref_video_automatically_share_my_video_key), false);
|
int key = R.string.pref_video_automatically_share_my_video_key;
|
||||||
boolean videoMuted = !(prefVideoEnable && prefAutoShareMyCamera);
|
boolean prefAutoShareMyCamera = mPref.getBoolean(getString(key), false);
|
||||||
AndroidCameraRecordManager.getInstance().setMuted(videoMuted);
|
boolean videoMuted = !(prefVideoEnable && prefAutoShareMyCamera);
|
||||||
|
AndroidCameraRecordManager.getInstance().setMuted(videoMuted);
|
||||||
|
|
||||||
LinphoneManager.getLc().getCurrentCall().enableCamera(prefAutoShareMyCamera);
|
LinphoneManager.getLc().getCurrentCall().enableCamera(prefAutoShareMyCamera);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
((HangCallButton) incomingCallView.findViewById(R.id.Decline)).setExternalClickListener(new OnClickListener() {
|
((HangCallButton) incomingCallView.findViewById(R.id.Decline)).setExternalClickListener(new OnClickListener() {
|
||||||
|
|
|
@ -129,8 +129,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
mPref = PreferenceManager.getDefaultSharedPreferences(c);
|
mPref = PreferenceManager.getDefaultSharedPreferences(c);
|
||||||
mPowerManager = (PowerManager) c.getSystemService(Context.POWER_SERVICE);
|
mPowerManager = (PowerManager) c.getSystemService(Context.POWER_SERVICE);
|
||||||
mR = c.getResources();
|
mR = c.getResources();
|
||||||
|
|
||||||
AndroidCameraRecordManager.getInstance().startOrientationSensor(c.getApplicationContext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL;
|
private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL;
|
||||||
|
@ -146,15 +144,12 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
|
|
||||||
private BroadcastReceiver mKeepAliveReceiver = new KeepAliveReceiver();
|
private BroadcastReceiver mKeepAliveReceiver = new KeepAliveReceiver();
|
||||||
|
|
||||||
private synchronized void routeAudioToSpeakerHelper(boolean speakerOn) {
|
private native void hackSpeakerState(boolean speakerOn);
|
||||||
LinphoneCall call = mLc.getCurrentCall();
|
@SuppressWarnings("unused")
|
||||||
boolean paused = false;
|
private static void sRouteAudioToSpeakerHelperHelper(boolean speakerOn) {
|
||||||
if (call != null && call.getState() == State.StreamsRunning && Hacks.needPausingCallForSpeakers()) {
|
getInstance().routeAudioToSpeakerHelperHelper(speakerOn);
|
||||||
Log.d("Hack pausing call to have speaker=",speakerOn);
|
}
|
||||||
mLc.pauseCall(call);
|
private void routeAudioToSpeakerHelperHelper(boolean speakerOn) {
|
||||||
paused = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Hacks.needGalaxySAudioHack() || lpm.useGalaxySHack())
|
if (Hacks.needGalaxySAudioHack() || lpm.useGalaxySHack())
|
||||||
setAudioModeIncallForGalaxyS();
|
setAudioModeIncallForGalaxyS();
|
||||||
|
|
||||||
|
@ -169,13 +164,18 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
} else {
|
} else {
|
||||||
mAudioManager.setSpeakerphoneOn(speakerOn);
|
mAudioManager.setSpeakerphoneOn(speakerOn);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (paused) {
|
private synchronized void routeAudioToSpeakerHelper(boolean speakerOn) {
|
||||||
Log.d("Hack resuming call to have speaker=",speakerOn);
|
final LinphoneCall call = mLc.getCurrentCall();
|
||||||
mLc.resumeCall(call);
|
if (call != null && call.getState() == State.StreamsRunning && Hacks.needPausingCallForSpeakers()) {
|
||||||
|
Log.d("Hack to have speaker=",speakerOn," while on call");
|
||||||
|
hackSpeakerState(speakerOn);
|
||||||
|
} else {
|
||||||
|
routeAudioToSpeakerHelperHelper(speakerOn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void routeAudioToSpeaker() {
|
public void routeAudioToSpeaker() {
|
||||||
routeAudioToSpeakerHelper(true);
|
routeAudioToSpeakerHelper(true);
|
||||||
if (mLc.isIncall()) {
|
if (mLc.isIncall()) {
|
||||||
|
@ -203,6 +203,9 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
instance = new LinphoneManager(c);
|
instance = new LinphoneManager(c);
|
||||||
instance.serviceListener = listener;
|
instance.serviceListener = listener;
|
||||||
instance.startLibLinphone(c);
|
instance.startLibLinphone(c);
|
||||||
|
if (Version.isVideoCapable()) {
|
||||||
|
AndroidCameraRecordManager.getInstance().startOrientationSensor(c.getApplicationContext());
|
||||||
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +244,16 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
lAddress.setDisplayName(address.getDisplayedName());
|
lAddress.setDisplayName(address.getDisplayedName());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean prefVideoEnable = isVideoEnabled();
|
if (Version.isVideoCapable()) {
|
||||||
boolean prefInitiateWithVideo = mPref.getBoolean(mR.getString(R.string.pref_video_initiate_call_with_video_key), false);
|
boolean prefVideoEnable = isVideoEnabled();
|
||||||
resetCameraFromPreferences();
|
int key = R.string.pref_video_initiate_call_with_video_key;
|
||||||
CallManager.getInstance().inviteAddress(lAddress, prefVideoEnable && prefInitiateWithVideo);
|
boolean prefInitiateWithVideo = mPref.getBoolean(mR.getString(key), false);
|
||||||
|
resetCameraFromPreferences();
|
||||||
|
CallManager.getInstance().inviteAddress(lAddress, prefVideoEnable && prefInitiateWithVideo);
|
||||||
|
} else {
|
||||||
|
CallManager.getInstance().inviteAddress(lAddress, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
serviceListener.tryingNewOutgoingCallButCannotGetCallParameters();
|
serviceListener.tryingNewOutgoingCallButCannotGetCallParameters();
|
||||||
|
|
|
@ -98,6 +98,8 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
||||||
// No video
|
// No video
|
||||||
if (!Version.isVideoCapable()) {
|
if (!Version.isVideoCapable()) {
|
||||||
uncheckAndDisableCheckbox(pref_video_enable_key);
|
uncheckAndDisableCheckbox(pref_video_enable_key);
|
||||||
|
} else if (!AndroidCameraRecordManager.getInstance().hasFrontCamera()) {
|
||||||
|
uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key);
|
||||||
}
|
}
|
||||||
if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) {
|
if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) {
|
||||||
if (fastCpu) {
|
if (fastCpu) {
|
||||||
|
@ -110,9 +112,7 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
||||||
|
|
||||||
detectVideoCodec(R.string.pref_video_codec_h264_key, "H264");
|
detectVideoCodec(R.string.pref_video_codec_h264_key, "H264");
|
||||||
|
|
||||||
if (!AndroidCameraRecordManager.getInstance().hasFrontCamera()) {
|
|
||||||
uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Hacks.needSoftvolume()) checkAndDisableCheckbox(R.string.pref_audio_soft_volume_key);
|
if (Hacks.needSoftvolume()) checkAndDisableCheckbox(R.string.pref_audio_soft_volume_key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public final class Hacks {
|
||||||
sleep(200);
|
sleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final void sleep(int time) {
|
public static final void sleep(int time) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(time);
|
Thread.sleep(time);
|
||||||
} catch(InterruptedException ie){}
|
} catch(InterruptedException ie){}
|
||||||
|
|
|
@ -67,6 +67,9 @@ public class AndroidCameraRecordManager {
|
||||||
|
|
||||||
// singleton
|
// singleton
|
||||||
private AndroidCameraRecordManager() {
|
private AndroidCameraRecordManager() {
|
||||||
|
if (!Version.isVideoCapable()) { // imply sdk>=5
|
||||||
|
throw new RuntimeException("AndroidCameraRecordManager: hardware is not video capable");
|
||||||
|
}
|
||||||
cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5();
|
cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5();
|
||||||
Log.i("=== Detected " + cc.getFoundCameras()+ " ===");
|
Log.i("=== Detected " + cc.getFoundCameras()+ " ===");
|
||||||
cameraId = cc.getFoundCameras().defaultC;
|
cameraId = cc.getFoundCameras().defaultC;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a0b9b02506a8a4eb97f7eb44e376ea1999e4bd9b
|
Subproject commit 68df42b2924930043bbf466b0c6eab1409fb6c3e
|
Loading…
Reference in a new issue