Convert Logs to new system. No more "tags" remaining.

This commit is contained in:
Guillaume Beraudo 2011-06-20 14:44:50 +02:00
parent 228982d53f
commit 6ecc4f4020
25 changed files with 130 additions and 170 deletions

View file

@ -18,10 +18,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
package org.linphone; package org.linphone;
import org.linphone.core.Log;
import android.app.Activity; import android.app.Activity;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.widget.TextView; import android.widget.TextView;
@ -35,7 +36,7 @@ public class AboutActivity extends Activity {
try { try {
aboutText.setText(String.format(getString(R.string.about_text), getPackageManager().getPackageInfo(getPackageName(), 0).versionName)); aboutText.setText(String.format(getString(R.string.about_text), getPackageManager().getPackageInfo(getPackageName(), 0).versionName));
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
Log.e(LinphoneManager.TAG, "cannot get version name", e); Log.e(e, "cannot get version name");
} }
} }

View file

@ -23,9 +23,9 @@ import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCallParams; import org.linphone.core.LinphoneCallParams;
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.video.AndroidCameraRecordManager; import org.linphone.core.video.AndroidCameraRecordManager;
import android.util.Log;
/** /**
* Handle call updating, reinvites. * Handle call updating, reinvites.
@ -82,7 +82,7 @@ class CallManager {
LinphoneCore lc = LinphoneManager.getLc(); LinphoneCore lc = LinphoneManager.getLc();
LinphoneCall lCall = lc.getCurrentCall(); LinphoneCall lCall = lc.getCurrentCall();
if (lCall == null) { if (lCall == null) {
Log.e(LinphoneManager.TAG, "Trying to reinviteWithVideo while not in call: doing nothing"); Log.e("Trying to reinviteWithVideo while not in call: doing nothing");
return false; return false;
} }
LinphoneCallParams params = lCall.getCurrentParamsCopy(); LinphoneCallParams params = lCall.getCurrentParamsCopy();
@ -112,7 +112,7 @@ class CallManager {
LinphoneCore lc = LinphoneManager.getLc(); LinphoneCore lc = LinphoneManager.getLc();
LinphoneCall lCall = lc.getCurrentCall(); LinphoneCall lCall = lc.getCurrentCall();
if (lCall == null) { if (lCall == null) {
Log.e(LinphoneManager.TAG, "Trying to reinvite while not in call: doing nothing"); Log.e("Trying to reinvite while not in call: doing nothing");
return; return;
} }
LinphoneCallParams params = lCall.getCurrentParamsCopy(); LinphoneCallParams params = lCall.getCurrentParamsCopy();
@ -129,7 +129,7 @@ class CallManager {
LinphoneCore lc = LinphoneManager.getLc(); LinphoneCore lc = LinphoneManager.getLc();
LinphoneCall lCall = lc.getCurrentCall(); LinphoneCall lCall = lc.getCurrentCall();
if (lCall == null) { if (lCall == null) {
Log.e(LinphoneManager.TAG, "Trying to updateCall while not in call: doing nothing"); Log.e("Trying to updateCall while not in call: doing nothing");
return; return;
} }
LinphoneCallParams params = lCall.getCurrentParamsCopy(); LinphoneCallParams params = lCall.getCurrentParamsCopy();

View file

@ -23,6 +23,7 @@ import org.linphone.LinphoneService.LinphoneGuiListener;
import org.linphone.core.CallDirection; 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.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;
@ -44,7 +45,6 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.PowerManager; import android.os.PowerManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.TextView; import android.widget.TextView;
@ -108,7 +108,7 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
mPref = PreferenceManager.getDefaultSharedPreferences(this); mPref = PreferenceManager.getDefaultSharedPreferences(this);
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,"Linphone"); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG);
mAddress = (AddressText) findViewById(R.id.SipUri); mAddress = (AddressText) findViewById(R.id.SipUri);
@ -165,7 +165,7 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
if (getIntent().getData() == null) return; if (getIntent().getData() == null) return;
if (!LinphoneService.isReady() || LinphoneManager.getLc().isIncall()) { if (!LinphoneService.isReady() || LinphoneManager.getLc().isIncall()) {
Log.w(LinphoneManager.TAG, "Outgoing call aborted as LinphoneService" Log.w("Outgoing call aborted as LinphoneService"
+ " is not ready or we are already in call"); + " is not ready or we are already in call");
return; return;
} }

View file

@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
package org.linphone; package org.linphone;
import org.linphone.core.Log;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RegistrationState;
import android.app.Activity; import android.app.Activity;
@ -25,7 +26,6 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
@ -87,7 +87,7 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
try { try {
LinphoneManager.getInstance().initFromConf(getApplicationContext()); LinphoneManager.getInstance().initFromConf(getApplicationContext());
} catch (Throwable e) { } catch (Throwable e) {
Log.e(LinphoneManager.TAG, "Error while initializing from config in first login activity", e); Log.e(e, "Error while initializing from config in first login activity");
toast(R.string.error);; toast(R.string.error);;
} }
} }

View file

@ -27,11 +27,11 @@ import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCallLog; import org.linphone.core.LinphoneCallLog;
import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.Log;
import android.app.ListActivity; import android.app.ListActivity;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -92,7 +92,7 @@ public class HistoryActivity extends ListActivity {
break; break;
default: default:
Log.e(LinphoneManager.TAG, "Unknown menu item ["+item+"]"); Log.e("Unknown menu item [",item,"]");
break; break;
} }

View file

@ -18,10 +18,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
package org.linphone; package org.linphone;
import org.linphone.core.Log;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log;
@ -31,7 +32,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (!LinphoneService.isReady()) { if (!LinphoneService.isReady()) {
Log.i(LinphoneManager.TAG, "Keep alive broadcast received while Linphone service not ready"); Log.i("Keep alive broadcast received while Linphone service not ready");
return; return;
} else { } else {
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SCREEN_ON)) { if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SCREEN_ON)) {

View file

@ -26,6 +26,7 @@ import java.util.List;
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.Version; 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;
@ -46,7 +47,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.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -73,7 +73,6 @@ public class LinphoneActivity extends TabActivity {
private FrameLayout mMainFrame; private FrameLayout mMainFrame;
private SensorManager mSensorManager; private SensorManager mSensorManager;
private static SensorEventListener mSensorEventListener; private static SensorEventListener mSensorEventListener;
private static String TAG = LinphoneManager.TAG;
private static final String SCREEN_IS_HIDDEN = "screen_is_hidden"; private static final String SCREEN_IS_HIDDEN = "screen_is_hidden";
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
@ -160,7 +159,7 @@ public class LinphoneActivity extends TabActivity {
} }
}); });
} catch (LinphoneCoreException e) { } catch (LinphoneCoreException e) {
Log.e(TAG, "Unable to calibrate EC", e); Log.e(e, "Unable to calibrate EC");
} }
fillTabHost(); fillTabHost();
@ -208,7 +207,7 @@ public class LinphoneActivity extends TabActivity {
protected void onNewIntent(Intent intent) { protected void onNewIntent(Intent intent) {
super.onNewIntent(intent); super.onNewIntent(intent);
if (intent.getData() == null) { if (intent.getData() == null) {
Log.e(TAG, "LinphoneActivity received an intent without data, recreating GUI if needed"); Log.e("LinphoneActivity received an intent without data, recreating GUI if needed");
if (!LinphoneService.isReady() || !LinphoneManager.getLc().isIncall()) return; if (!LinphoneService.isReady() || !LinphoneManager.getLc().isIncall()) return;
LinphoneCore lc = LinphoneManager.getLc(); LinphoneCore lc = LinphoneManager.getLc();
if(lc.isInComingInvitePending()) { if(lc.isInComingInvitePending()) {
@ -218,7 +217,7 @@ public class LinphoneActivity extends TabActivity {
startIncallActivity(LinphoneManager.getInstance().extractADisplayName(), null); startIncallActivity(LinphoneManager.getInstance().extractADisplayName(), null);
} else { } else {
// TODO // TODO
Log.e(TAG, "Not handled case: recreation while in call and not using incall activity"); Log.e("Not handled case: recreation while in call and not using incall activity");
} }
} }
return; return;
@ -268,7 +267,7 @@ public class LinphoneActivity extends TabActivity {
startActivity(new Intent(ACTION_MAIN) startActivity(new Intent(ACTION_MAIN)
.setClass(this, AboutActivity.class)); .setClass(this, AboutActivity.class));
default: default:
Log.e(TAG, "Unknown menu item ["+item+"]"); Log.e("Unknown menu item [",item,"]");
break; break;
} }
@ -297,7 +296,7 @@ public class LinphoneActivity extends TabActivity {
synchronized void startProxymitySensor() { synchronized void startProxymitySensor() {
if (mSensorEventListener != null) { if (mSensorEventListener != null) {
Log.i(TAG, "proximity sensor already active"); Log.i("proximity sensor already active");
return; return;
} }
List<Sensor> lSensorList = mSensorManager.getSensorList(Sensor.TYPE_PROXIMITY); List<Sensor> lSensorList = mSensorManager.getSensorList(Sensor.TYPE_PROXIMITY);
@ -312,7 +311,7 @@ public class LinphoneActivity extends TabActivity {
}; };
if (lSensorList.size() >0) { if (lSensorList.size() >0) {
mSensorManager.registerListener(mSensorEventListener,lSensorList.get(0),SensorManager.SENSOR_DELAY_UI); mSensorManager.registerListener(mSensorEventListener,lSensorList.get(0),SensorManager.SENSOR_DELAY_UI);
Log.i(TAG, "Proximity sensor detected, registering"); Log.i("Proximity sensor detected, registering");
} }
} }
@ -449,35 +448,6 @@ public class LinphoneActivity extends TabActivity {
finishActivity(INCALL_ACTIVITY); finishActivity(INCALL_ACTIVITY);
} }
/*
private String INCALL_ACTIVITY_TAG = "incall";
void changeTabVisibility(String tag, int value) {
View tab = getTabHost().getTabWidget().findViewWithTag(tag);
if (tab != null) {
tab.setVisibility(value);
} else {
Log.e(TAG, "Tab not found: " + tag);
}
}
public void closeIncallActivity() {
changeTabVisibility(DIALER_TAB, View.VISIBLE);
getTabHost().setCurrentTabByTag(DIALER_TAB);
getLocalActivityManager().getActivity(INCALL_ACTIVITY_TAG).finish();
getTabHost().clearAllTabs();
fillTabHost();
}
@Override
public void finishFromChild(Activity child) {
if (child instanceof IncallActivity) {
return;
}
super.finishFromChild(child);
}*/
public void startVideoActivity() { public void startVideoActivity() {
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
public void run() { public void run() {

View file

@ -54,6 +54,7 @@ import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneFriend; import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.Log;
import org.linphone.core.PayloadType; import org.linphone.core.PayloadType;
import org.linphone.core.Version; import org.linphone.core.Version;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCall.State;
@ -84,7 +85,6 @@ import android.os.PowerManager.WakeLock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.Settings; import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException; import android.provider.Settings.SettingNotFoundException;
import android.util.Log;
/** /**
* *
@ -131,7 +131,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
AndroidCameraRecordManager.getInstance().startOrientationSensor(c.getApplicationContext()); AndroidCameraRecordManager.getInstance().startOrientationSensor(c.getApplicationContext());
} }
public static final String TAG=Version.TAG;
private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL; private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL;
private static final int dbStep = 4; private static final int dbStep = 4;
/** Called when the activity is first created. */ /** Called when the activity is first created. */
@ -148,7 +147,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
LinphoneCall call = mLc.getCurrentCall(); LinphoneCall call = mLc.getCurrentCall();
boolean paused = false; boolean paused = false;
if (call != null && call.getState() == State.StreamsRunning && Hacks.needPausingCallForSpeakers()) { if (call != null && call.getState() == State.StreamsRunning && Hacks.needPausingCallForSpeakers()) {
Log.d(TAG, "Hack pausing call to have speaker="+speakerOn); Log.d("Hack pausing call to have speaker=",speakerOn);
mLc.pauseCall(call); mLc.pauseCall(call);
paused = true; paused = true;
} }
@ -169,7 +168,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
} }
if (paused) { if (paused) {
Log.d(TAG, "Hack resuming call to have speaker="+speakerOn); Log.d("Hack resuming call to have speaker=",speakerOn);
mLc.resumeCall(call); mLc.resumeCall(call);
} }
} }
@ -329,7 +328,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
try { try {
initFromConf(context); initFromConf(context);
} catch (LinphoneException e) { } catch (LinphoneException e) {
Log.w(TAG, "no config ready yet"); Log.w("no config ready yet");
} }
TimerTask lTask = new TimerTask() { TimerTask lTask = new TimerTask() {
@Override @Override
@ -345,7 +344,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
context.registerReceiver(mKeepAliveReceiver, lFilter); context.registerReceiver(mKeepAliveReceiver, lFilter);
} }
catch (Exception e) { catch (Exception e) {
Log.e(TAG,"Cannot start linphone",e); Log.e(e,"Cannot start linphone");
} }
} }
@ -550,7 +549,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
} else if ("H263-1998".equals(mime)) { } else if ("H263-1998".equals(mime)) {
key = R.string.pref_video_codec_h263_key; key = R.string.pref_video_codec_h263_key;
} else { } else {
Log.e(TAG, "Unhandled video codec " + mime); Log.e("Unhandled video codec ", mime);
mLc.enablePayloadType(videoCodec, false); mLc.enablePayloadType(videoCodec, false);
return; return;
} }
@ -629,26 +628,26 @@ public final class LinphoneManager implements LinphoneCoreListener {
public void displayStatus(final LinphoneCore lc, final String message) { public void displayStatus(final LinphoneCore lc, final String message) {
Log.i(TAG, message); Log.i(message);
serviceListener.onDisplayStatus(message); serviceListener.onDisplayStatus(message);
} }
public void globalState(final LinphoneCore lc, final LinphoneCore.GlobalState state, final String message) { public void globalState(final LinphoneCore lc, final LinphoneCore.GlobalState state, final String message) {
Log.i(TAG, "new state ["+state+"]"); Log.i("new state [",state,"]");
serviceListener.onGlobalStateChanged(state, message); serviceListener.onGlobalStateChanged(state, message);
} }
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig cfg,final LinphoneCore.RegistrationState state,final String message) { public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig cfg,final LinphoneCore.RegistrationState state,final String message) {
Log.i(TAG, "new state ["+state+"]"); Log.i("new state ["+state+"]");
serviceListener.onRegistrationStateChanged(state, message); serviceListener.onRegistrationStateChanged(state, message);
} }
public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) { public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) {
Log.i(TAG, "new state ["+state+"]"); Log.i("new state [",state,"]");
if (state == IncomingReceived && !call.equals(lc.getCurrentCall())) { if (state == IncomingReceived && !call.equals(lc.getCurrentCall())) {
if (call.getReplacedCall()==null){ if (call.getReplacedCall()==null){
//no multicall support, just decline //no multicall support, just decline
@ -735,10 +734,10 @@ public final class LinphoneManager implements LinphoneCoreListener {
mRingerPlayer.setLooping(true); mRingerPlayer.setLooping(true);
mRingerPlayer.start(); mRingerPlayer.start();
} else { } else {
Log.w(LinphoneManager.TAG,"already ringing"); Log.w("already ringing");
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(LinphoneManager.TAG, "cannot handle incoming call",e); Log.e(e,"cannot handle incoming call");
} }
} }
@ -790,7 +789,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
// Called on first launch only // Called on first launch only
public void initializePayloads() { public void initializePayloads() {
Log.i(TAG, "Initializing supported payloads"); Log.i("Initializing supported payloads");
Editor e = mPref.edit(); Editor e = mPref.edit();
boolean fastCpu = Version.isArmv7(); boolean fastCpu = Version.isArmv7();
@ -863,7 +862,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
final float distanceInCm = event.values[0]; final float distanceInCm = event.values[0];
final float maxDistance = event.sensor.getMaximumRange(); final float maxDistance = event.sensor.getMaximumRange();
Log.d(TAG, "Proximity sensor report ["+distanceInCm+"] , for max range ["+maxDistance+"]"); Log.d("Proximity sensor report [",distanceInCm,"] , for max range [",maxDistance,"]");
if (maxDistance <= threshold) { if (maxDistance <= threshold) {
// Case binary 0/1 and short sensors // Case binary 0/1 and short sensors

View file

@ -22,9 +22,9 @@ package org.linphone;
import static org.linphone.R.string.ec_calibrating; import static org.linphone.R.string.ec_calibrating;
import static org.linphone.R.string.ec_calibration_launch_message; import static org.linphone.R.string.ec_calibration_launch_message;
import static org.linphone.R.string.pref_codec_amr_key;
import static org.linphone.R.string.pref_codec_ilbc_key; import static org.linphone.R.string.pref_codec_ilbc_key;
import static org.linphone.R.string.pref_codec_speex16_key; import static org.linphone.R.string.pref_codec_speex16_key;
import static org.linphone.R.string.pref_codec_amr_key;
import static org.linphone.R.string.pref_echo_canceller_calibration_key; import static org.linphone.R.string.pref_echo_canceller_calibration_key;
import static org.linphone.R.string.pref_video_enable_key; import static org.linphone.R.string.pref_video_enable_key;
@ -34,6 +34,7 @@ import java.util.List;
import org.linphone.LinphoneManager.EcCalibrationListener; import org.linphone.LinphoneManager.EcCalibrationListener;
import org.linphone.core.Hacks; import org.linphone.core.Hacks;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreException;
import org.linphone.core.Log;
import org.linphone.core.Version; import org.linphone.core.Version;
import org.linphone.core.LinphoneCore.EcCalibratorStatus; import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.video.AndroidCameraRecordManager; import org.linphone.core.video.AndroidCameraRecordManager;
@ -46,7 +47,6 @@ import android.preference.Preference;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener; import android.preference.Preference.OnPreferenceClickListener;
import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
public class LinphonePreferencesActivity extends PreferenceActivity implements EcCalibrationListener { public class LinphonePreferencesActivity extends PreferenceActivity implements EcCalibrationListener {
@ -177,7 +177,7 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
ecPref.setSummary(ec_calibrating); ecPref.setSummary(ec_calibrating);
ecPref.getEditor().putBoolean(getString(pref_echo_canceller_calibration_key), false).commit(); ecPref.getEditor().putBoolean(getString(pref_echo_canceller_calibration_key), false).commit();
} catch (LinphoneCoreException e) { } catch (LinphoneCoreException e) {
Log.w(LinphoneManager.TAG, "Cannot calibrate EC",e); Log.w(e, "Cannot calibrate EC");
} }
} }
@ -235,7 +235,7 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
} catch (LinphoneException e) { } catch (LinphoneException e) {
if (! (e instanceof LinphoneConfigException)) { if (! (e instanceof LinphoneConfigException)) {
Log.e(LinphoneManager.TAG, "Cannot update config",e); Log.e(e, "Cannot update config");
return; return;
} }

View file

@ -19,17 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package org.linphone; package org.linphone;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import org.linphone.LinphoneManager.LinphoneServiceListener; import org.linphone.LinphoneManager.LinphoneServiceListener;
import org.linphone.LinphoneManager.NewOutgoingCallUiListener; import org.linphone.LinphoneManager.NewOutgoingCallUiListener;
import org.linphone.core.Hacks; import org.linphone.core.Hacks;
import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall;
import org.linphone.core.Log;
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 android.app.ActivityManager;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
@ -44,7 +43,6 @@ import android.net.Uri;
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.util.Log;
/*** /***
* *
@ -139,9 +137,9 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
} catch (NameNotFoundException nnfe) {} } catch (NameNotFoundException nnfe) {}
if (info != null) { if (info != null) {
Log.i(LinphoneManager.TAG, "Linphone version is " + info.versionCode); Log.i("Linphone version is ", info.versionCode);
} else { } else {
Log.i(LinphoneManager.TAG, "Linphone version is unknown"); Log.i("Linphone version is unknown");
} }
} }
@ -268,7 +266,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
try { try {
mRingerPlayer.setDataSource(getApplicationContext(), ringtoneUri); mRingerPlayer.setDataSource(getApplicationContext(), ringtoneUri);
} catch (IOException e) { } catch (IOException e) {
Log.e(LinphoneManager.TAG, "cannot set ringtone", e); Log.e(e, "cannot set ringtone");
} }
} }

View file

@ -18,12 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
package org.linphone; package org.linphone;
import org.linphone.core.Log;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.util.Log;
@ -38,12 +39,12 @@ public class NetworkManager extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
NetworkInfo lNetworkInfo = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); NetworkInfo lNetworkInfo = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
Log.i(LinphoneManager.TAG, "Network info ["+lNetworkInfo+"]"); Log.i("Network info [",lNetworkInfo,"]");
Boolean lNoConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,false); Boolean lNoConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,false);
if (!LinphoneService.isReady()) { if (!LinphoneService.isReady()) {
Log.i(LinphoneManager.TAG, "Network broadcast received while Linphone service not ready"); Log.i("Network broadcast received while Linphone service not ready");
return; return;
} }

View file

@ -21,6 +21,7 @@ package org.linphone;
import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore;
import org.linphone.core.Log;
import org.linphone.core.Version; 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;
@ -32,7 +33,6 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.PowerManager.WakeLock; import android.os.PowerManager.WakeLock;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -48,7 +48,6 @@ public class VideoCallActivity extends SoftVolumeActivity implements OnCapturing
private SurfaceView mVideoView; private SurfaceView mVideoView;
private SurfaceView mVideoCaptureView; private SurfaceView mVideoCaptureView;
private AndroidCameraRecordManager recordManager; private AndroidCameraRecordManager recordManager;
private static final String tag = "Linphone";
public static boolean launched = false; public static boolean launched = false;
private WakeLock mWakeLock; private WakeLock mWakeLock;
private static final int capturePreviewLargestDimension = 150; private static final int capturePreviewLargestDimension = 150;
@ -57,7 +56,7 @@ public class VideoCallActivity extends SoftVolumeActivity implements OnCapturing
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
launched = true; launched = true;
Log.d(tag, "onCreate VideoCallActivity"); Log.d("onCreate VideoCallActivity");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.videocall); setContentView(R.layout.videocall);
@ -74,7 +73,7 @@ public class VideoCallActivity extends SoftVolumeActivity implements OnCapturing
if (!recordManager.isMuted()) LinphoneManager.getInstance().sendStaticImage(false); if (!recordManager.isMuted()) LinphoneManager.getInstance().sendStaticImage(false);
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,"Linphone"); mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG);
mWakeLock.acquire(); mWakeLock.acquire();
fixScreenOrientationForOldDevices(); fixScreenOrientationForOldDevices();
@ -94,7 +93,7 @@ public class VideoCallActivity extends SoftVolumeActivity implements OnCapturing
@Override @Override
protected void onResume() { protected void onResume() {
if (Version.sdkAboveOrEqual(8) && recordManager.isOutputOrientationMismatch()) { if (Version.sdkAboveOrEqual(8) && recordManager.isOutputOrientationMismatch()) {
Log.i(tag,"Phone orientation has changed: updating call."); Log.i("Phone orientation has changed: updating call.");
CallManager.getInstance().updateCall(); CallManager.getInstance().updateCall();
// resizeCapturePreview by callback when recording started // resizeCapturePreview by callback when recording started
} }
@ -173,7 +172,6 @@ public class VideoCallActivity extends SoftVolumeActivity implements OnCapturing
break; break;
case R.id.videocall_menu_terminate_call: case R.id.videocall_menu_terminate_call:
LinphoneManager.getInstance().terminateCall(); LinphoneManager.getInstance().terminateCall();
finish();
break; break;
case R.id.videocall_menu_toggle_camera: case R.id.videocall_menu_toggle_camera:
LinphoneManager.getInstance().toggleCameraMuting(); LinphoneManager.getInstance().toggleCameraMuting();
@ -184,7 +182,7 @@ public class VideoCallActivity extends SoftVolumeActivity implements OnCapturing
fixScreenOrientationForOldDevices(); fixScreenOrientationForOldDevices();
break; break;
default: default:
Log.e(LinphoneManager.TAG, "Unknown menu item ["+item+"]"); Log.e("Unknown menu item [",item,"]");
break; break;
} }
@ -200,7 +198,7 @@ public class VideoCallActivity extends SoftVolumeActivity implements OnCapturing
@Override @Override
protected void onPause() { protected void onPause() {
Log.d(tag, "onPause VideoCallActivity"); Log.d("onPause VideoCallActivity");
LinphoneManager.getInstance().sendStaticImage(true); LinphoneManager.getInstance().sendStaticImage(true);
if (mWakeLock.isHeld()) mWakeLock.release(); if (mWakeLock.isHeld()) mWakeLock.release();
super.onPause(); super.onPause();

View file

@ -3,7 +3,6 @@ package org.linphone.core;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Bitmap.Config; import android.graphics.Bitmap.Config;
import android.util.Log;
import android.view.Surface; import android.view.Surface;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
@ -15,7 +14,6 @@ public class AndroidVideoWindowImpl {
private SurfaceView mView; private SurfaceView mView;
private Surface mSurface; private Surface mSurface;
private VideoWindowListener mListener; private VideoWindowListener mListener;
static private String TAG = "Linphone";
public static interface VideoWindowListener{ public static interface VideoWindowListener{
void onSurfaceReady(AndroidVideoWindowImpl vw); void onSurfaceReady(AndroidVideoWindowImpl vw);
void onSurfaceDestroyed(AndroidVideoWindowImpl vw); void onSurfaceDestroyed(AndroidVideoWindowImpl vw);
@ -28,17 +26,17 @@ public class AndroidVideoWindowImpl {
view.getHolder().addCallback(new Callback(){ view.getHolder().addCallback(new Callback(){
public void surfaceChanged(SurfaceHolder holder, int format, public void surfaceChanged(SurfaceHolder holder, int format,
int width, int height) { int width, int height) {
Log.i(TAG,"Surface is being changed."); Log.i("Surface is being changed.");
synchronized(AndroidVideoWindowImpl.this){ synchronized(AndroidVideoWindowImpl.this){
mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565); mBitmap=Bitmap.createBitmap(width,height,Config.RGB_565);
mSurface=holder.getSurface(); mSurface=holder.getSurface();
} }
if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this); if (mListener!=null) mListener.onSurfaceReady(AndroidVideoWindowImpl.this);
Log.w(TAG, "Video display surface changed"); Log.w("Video display surface changed");
} }
public void surfaceCreated(SurfaceHolder holder) { public void surfaceCreated(SurfaceHolder holder) {
Log.w(TAG, "Video display surface created"); Log.w("Video display surface created");
} }
public void surfaceDestroyed(SurfaceHolder holder) { public void surfaceDestroyed(SurfaceHolder holder) {
@ -48,7 +46,7 @@ public class AndroidVideoWindowImpl {
} }
if (mListener!=null) if (mListener!=null)
mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this); mListener.onSurfaceDestroyed(AndroidVideoWindowImpl.this);
Log.d(TAG, "Video display surface destroyed"); Log.d("Video display surface destroyed");
} }
}); });
} }
@ -56,7 +54,7 @@ public class AndroidVideoWindowImpl {
static final int PORTRAIT=1; static final int PORTRAIT=1;
public void requestOrientation(int orientation){ public void requestOrientation(int orientation){
//Surface.setOrientation(0, orientation==LANDSCAPE ? 1 : 0); //Surface.setOrientation(0, orientation==LANDSCAPE ? 1 : 0);
//Log.d("Linphone", "Orientation changed."); //Log.d("Orientation changed.");
} }
public void setListener(VideoWindowListener l){ public void setListener(VideoWindowListener l){
mListener=l; mListener=l;

View file

@ -21,7 +21,6 @@ package org.linphone.core;
import android.hardware.Camera; import android.hardware.Camera;
import android.media.AudioManager; import android.media.AudioManager;
import android.os.Build; import android.os.Build;
import android.util.Log;
public final class Hacks { public final class Hacks {
@ -65,7 +64,7 @@ public final class Hacks {
/* private static final boolean log(final String msg) { /* private static final boolean log(final String msg) {
Log.d("Linphone", msg); Log.d(msg);
return true; return true;
}*/ }*/
@ -104,7 +103,7 @@ public final class Hacks {
//sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n");
sb.append("SDK=").append(Build.VERSION.SDK); sb.append("SDK=").append(Build.VERSION.SDK);
Log.i(Version.TAG, sb.toString()); Log.i(sb.toString());
} }
public static boolean needSoftvolume() { public static boolean needSoftvolume() {
@ -134,12 +133,12 @@ public final class Hacks {
try { try {
nb = (Integer) Camera.class.getMethod("getNumberOfCameras", (Class[])null).invoke(null); nb = (Integer) Camera.class.getMethod("getNumberOfCameras", (Class[])null).invoke(null);
} catch (Exception e) { } catch (Exception e) {
Log.e(Version.TAG, "Error getting number of cameras"); Log.e("Error getting number of cameras");
} }
return nb > 0; return nb > 0;
} }
Log.i(Version.TAG, "Hack: considering there IS a camera.\n" Log.i("Hack: considering there IS a camera.\n"
+ "If it is not the case, report DEVICE and MODEL to linphone-users@nongnu.org"); + "If it is not the case, report DEVICE and MODEL to linphone-users@nongnu.org");
return true; return true;
} }

View file

@ -21,15 +21,13 @@ package org.linphone.core;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import android.util.Log;
public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
private static void loadOptionalLibrary(String s) { private static void loadOptionalLibrary(String s) {
try { try {
System.loadLibrary(s); System.loadLibrary(s);
} catch (Throwable e) { } catch (Throwable e) {
Log.w(Version.TAG, "Unable to load optional library lib" + s); Log.w("Unable to load optional library lib", s);
} }
} }

View file

@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package org.linphone.core; package org.linphone.core;
/** /**
* Convenient wrapper for Android logs. * Convenient wrapper for Android logs.
* *

View file

@ -26,8 +26,6 @@ import android.os.Build;
*/ */
public class Version { public class Version {
public static final String TAG="Linphone";
public static final int API03_CUPCAKE_15 = 3; public static final int API03_CUPCAKE_15 = 3;
public static final int API04_DONUT_16 = 4; public static final int API04_DONUT_16 = 4;
public static final int API06_ECLAIR_20 = 6; public static final int API06_ECLAIR_20 = 6;

View file

@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
package org.linphone.core.tutorials; package org.linphone.core.tutorials;
import org.linphone.core.Log;
import org.linphone.core.video.AndroidCameraRecord; import org.linphone.core.video.AndroidCameraRecord;
import android.hardware.Camera; import android.hardware.Camera;
import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera.Size; import android.hardware.Camera.Size;
import android.util.Log;
import android.widget.TextView; import android.widget.TextView;
/** /**
@ -59,8 +59,8 @@ class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallbac
Size s = camera.getParameters().getPreviewSize(); Size s = camera.getParameters().getPreviewSize();
int expectedBuffLength = s.width * s.height * 3 /2; int expectedBuffLength = s.width * s.height * 3 /2;
if (expectedBuffLength != data.length) { if (expectedBuffLength != data.length) {
Log.e(tag, "onPreviewFrame called with bad buffer length " + data.length Log.e("onPreviewFrame called with bad buffer length ", data.length,
+ " whereas expected is " + expectedBuffLength + " don't calling putImage"); " whereas expected is ", expectedBuffLength, " don't calling putImage");
return; return;
} }

View file

@ -18,15 +18,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
package org.linphone.core.tutorials; package org.linphone.core.tutorials;
import static org.linphone.core.VideoSize.CIF;
import static org.linphone.core.VideoSize.HVGA;
import static org.linphone.core.VideoSize.QCIF;
import static org.linphone.core.VideoSize.QVGA;
import java.util.Stack; import java.util.Stack;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.Log;
import org.linphone.core.VideoSize; import org.linphone.core.VideoSize;
import org.linphone.core.video.AndroidCameraRecord; import org.linphone.core.video.AndroidCameraRecord;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.view.View; import android.view.View;
@ -35,7 +40,6 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import static org.linphone.core.VideoSize.*;
/** /**
* Activity for displaying and starting the HelloWorld example on Android phone. * Activity for displaying and starting the HelloWorld example on Android phone.
@ -48,7 +52,6 @@ public class TestVideoActivity extends Activity implements Callback, OnClickList
private SurfaceView surfaceView; private SurfaceView surfaceView;
private static final int rate = 7; private static final int rate = 7;
private JavaCameraRecordImpl recorder; private JavaCameraRecordImpl recorder;
private static String tag = "Linphone";
private TextView debugView; private TextView debugView;
private Button nextSize; private Button nextSize;
private Button changeCamera; private Button changeCamera;
@ -171,12 +174,12 @@ public class TestVideoActivity extends Activity implements Callback, OnClickList
public void surfaceDestroyed(SurfaceHolder holder) { public void surfaceDestroyed(SurfaceHolder holder) {
surfaceView = null; surfaceView = null;
Log.d(tag , "Video capture surface destroyed"); Log.d("Video capture surface destroyed");
if (recorder != null) recorder.stopPreview(); if (recorder != null) recorder.stopPreview();
} }
public void surfaceCreated(SurfaceHolder holder) { public void surfaceCreated(SurfaceHolder holder) {
Log.d(tag , "Video capture surface created"); Log.d("Video capture surface created");
} }
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

View file

@ -19,42 +19,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package org.linphone.core.video; package org.linphone.core.video;
import org.linphone.core.Hacks; import org.linphone.core.Hacks;
import org.linphone.core.Log;
import android.util.Log;
class AndroidCameraConf5 implements AndroidCameraConf { class AndroidCameraConf5 implements AndroidCameraConf {
private static final String tag = "Linphone";
private AndroidCameras foundCameras; private AndroidCameras foundCameras;
public AndroidCameras getFoundCameras() {return foundCameras;} public AndroidCameras getFoundCameras() {return foundCameras;}
public AndroidCameraConf5() { public AndroidCameraConf5() {
Log.i(tag, "Detecting cameras"); Log.i("Detecting cameras");
// Defaults // Defaults
foundCameras = new AndroidCameras(); foundCameras = new AndroidCameras();
if (Hacks.isGalaxySOrTab()) { if (Hacks.isGalaxySOrTab()) {
Log.d(tag, "Hack Galaxy S : has one or more cameras"); Log.d("Hack Galaxy S : has one or more cameras");
if (Hacks.isGalaxySOrTabWithFrontCamera()) { if (Hacks.isGalaxySOrTabWithFrontCamera()) {
Log.d(tag, "Hack Galaxy S : HAS a front camera with id=2"); Log.d("Hack Galaxy S : HAS a front camera with id=2");
foundCameras.front = 2; foundCameras.front = 2;
} else { } else {
Log.d(tag, "Hack Galaxy S : NO front camera"); Log.d("Hack Galaxy S : NO front camera");
} }
Log.d(tag, "Hack Galaxy S : HAS a rear camera with id=1"); Log.d("Hack Galaxy S : HAS a rear camera with id=1");
foundCameras.rear = 1; foundCameras.rear = 1;
foundCameras.defaultC = foundCameras.rear; foundCameras.defaultC = foundCameras.rear;
} else if (Hacks.hasTwoCamerasRear0Front1()) { } else if (Hacks.hasTwoCamerasRear0Front1()) {
Log.d(tag, "Hack SPHD700 has 2 cameras a rear with id=0 and a front with id=1"); Log.d("Hack SPHD700 has 2 cameras a rear with id=0 and a front with id=1");
foundCameras.front = 1; foundCameras.front = 1;
} }
} }
public int getNumberOfCameras() { public int getNumberOfCameras() {
Log.i(tag, "Detecting the number of cameras"); Log.i("Detecting the number of cameras");
if (Hacks.hasTwoCamerasRear0Front1() || Hacks.isGalaxySOrTabWithFrontCamera()) { if (Hacks.hasTwoCamerasRear0Front1() || Hacks.isGalaxySOrTabWithFrontCamera()) {
Log.d(tag, "Hack: we know this model has 2 cameras"); Log.d("Hack: we know this model has 2 cameras");
return 2; return 2;
} else } else
return 1; return 1;
@ -65,7 +64,7 @@ class AndroidCameraConf5 implements AndroidCameraConf {
public int getCameraOrientation(int cameraId) { public int getCameraOrientation(int cameraId) {
// Use hacks to guess orientation of the camera // Use hacks to guess orientation of the camera
if (Hacks.isGalaxySOrTab() && isFrontCamera(cameraId)) { if (Hacks.isGalaxySOrTab() && isFrontCamera(cameraId)) {
Log.d(tag, "Hack Galaxy S : front camera mounted landscape"); Log.d("Hack Galaxy S : front camera mounted landscape");
// mounted in landscape for a portrait phone orientation // mounted in landscape for a portrait phone orientation
// |^^^^^^^^| // |^^^^^^^^|
// | ____ | // | ____ |
@ -84,10 +83,10 @@ class AndroidCameraConf5 implements AndroidCameraConf {
public boolean isFrontCamera(int cameraId) { public boolean isFrontCamera(int cameraId) {
// Use hacks to guess facing of the camera // Use hacks to guess facing of the camera
if (cameraId == 2 && Hacks.isGalaxySOrTab()) { if (cameraId == 2 && Hacks.isGalaxySOrTab()) {
Log.d(tag, "Hack Galaxy S : front camera has id=2"); Log.d("Hack Galaxy S : front camera has id=2");
return true; return true;
} else if (cameraId == 1 && Hacks.hasTwoCamerasRear0Front1()) { } else if (cameraId == 1 && Hacks.hasTwoCamerasRear0Front1()) {
Log.d(tag, "Hack SPHD700 : front camera has id=1"); Log.d("Hack SPHD700 : front camera has id=1");
return true; return true;
} }

View file

@ -18,10 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
package org.linphone.core.video; package org.linphone.core.video;
import org.linphone.core.Version; import org.linphone.core.Log;
import android.hardware.Camera; import android.hardware.Camera;
import android.util.Log;
class AndroidCameraConf9 implements AndroidCameraConf { class AndroidCameraConf9 implements AndroidCameraConf {
private AndroidCameras foundCameras; private AndroidCameras foundCameras;
@ -49,9 +48,7 @@ class AndroidCameraConf9 implements AndroidCameraConf {
public int getCameraOrientation(int cameraId) { public int getCameraOrientation(int cameraId) {
android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
Camera.getCameraInfo(cameraId, info); Camera.getCameraInfo(cameraId, info);
Log.d(Version.TAG, String.format("Camera info for %d: orientation=%d", Log.d("Camera info for ",cameraId,": orientation=",info.orientation);
cameraId,
info.orientation));
return info.orientation; return info.orientation;
} }

View file

@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.linphone.core.Log;
import org.linphone.core.Version; import org.linphone.core.Version;
import android.hardware.Camera; import android.hardware.Camera;
@ -30,7 +31,6 @@ import android.hardware.Camera.ErrorCallback;
import android.hardware.Camera.Parameters; import android.hardware.Camera.Parameters;
import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera.Size; import android.hardware.Camera.Size;
import android.util.Log;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.view.View; import android.view.View;
@ -44,7 +44,6 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback {
private PreviewCallback storedPreviewCallback; private PreviewCallback storedPreviewCallback;
private boolean previewStarted; private boolean previewStarted;
protected static final String tag="Linphone";
private List <Size> supportedVideoSizes; private List <Size> supportedVideoSizes;
private Size currentPreviewSize; private Size currentPreviewSize;
@ -58,27 +57,27 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback {
public synchronized void startPreview() { // FIXME throws exception? public synchronized void startPreview() { // FIXME throws exception?
if (previewStarted) { if (previewStarted) {
Log.w(tag, "Already started"); Log.w("Already started");
throw new RuntimeException("Video recorder already started"); throw new RuntimeException("Video recorder already started");
// return // return
} }
if (params.surfaceView.getVisibility() != SurfaceView.VISIBLE) { if (params.surfaceView.getVisibility() != SurfaceView.VISIBLE) {
// Illegal state // Illegal state
Log.e(tag, "Illegal state: video capture surface view is not visible"); Log.e("Illegal state: video capture surface view is not visible");
return; return;
} }
Log.d(tag, "Trying to open camera with id " + params.cameraId); Log.d("Trying to open camera with id ", params.cameraId);
if (camera != null) { if (camera != null) {
Log.e(tag, "Camera is not null, ?already open? : aborting"); Log.e("Camera is not null, ?already open? : aborting");
return; return;
} }
camera = openCamera(params.cameraId); camera = openCamera(params.cameraId);
camera.setErrorCallback(new ErrorCallback() { camera.setErrorCallback(new ErrorCallback() {
public void onError(int error, Camera camera) { public void onError(int error, Camera camera) {
Log.e(tag, "Camera error : " + error); Log.e("Camera error : ", error);
} }
}); });
@ -113,14 +112,14 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback {
camera.setPreviewDisplay(holder); camera.setPreviewDisplay(holder);
} }
catch (Throwable t) { catch (Throwable t) {
Log.e(tag, "Exception in Video capture setPreviewDisplay()", t); Log.e(t,"Exception in Video capture setPreviewDisplay()");
} }
try { try {
camera.startPreview(); camera.startPreview();
} catch (Throwable e) { } catch (Throwable e) {
Log.e(tag, "Error, can't start camera preview. Releasing camera!"); Log.e("Error, can't start camera preview. Releasing camera!");
camera.release(); camera.release();
camera = null; camera = null;
return; return;
@ -132,7 +131,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback {
if (Camera.Parameters.FOCUS_MODE_AUTO.equals(parameters.getFocusMode())) { if (Camera.Parameters.FOCUS_MODE_AUTO.equals(parameters.getFocusMode())) {
OnClickListener svClickListener = new OnClickListener() { OnClickListener svClickListener = new OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
Log.i(tag, "Auto focus requested"); Log.i("Auto focus requested");
camera.autoFocus(AndroidCameraRecord.this); camera.autoFocus(AndroidCameraRecord.this);
} }
}; };
@ -167,7 +166,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback {
public void storePreviewCallBack(PreviewCallback cb) { public void storePreviewCallBack(PreviewCallback cb) {
this.storedPreviewCallback = cb; this.storedPreviewCallback = cb;
if (camera == null) { if (camera == null) {
Log.w(tag, "Capture camera not ready, storing preview callback"); Log.w("Capture camera not ready, storing preview callback");
return; return;
} }
@ -181,7 +180,7 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback {
camera.stopPreview(); camera.stopPreview();
camera.release(); camera.release();
camera=null; camera=null;
Log.d(tag, "Camera released"); Log.d("Camera released");
currentPreviewSize = null; currentPreviewSize = null;
previewStarted = false; previewStarted = false;
} }
@ -236,8 +235,8 @@ public abstract class AndroidCameraRecord implements AutoFocusCallback {
} }
public void onAutoFocus(boolean success, Camera camera) { public void onAutoFocus(boolean success, Camera camera) {
if (success) Log.i(tag, "Autofocus success"); if (success) Log.i("Autofocus success");
else Log.i(tag, "Autofocus failure"); else Log.i("Autofocus failure");
} }
public int getStoredPhoneOrientation() { public int getStoredPhoneOrientation() {

View file

@ -21,13 +21,13 @@ package org.linphone.core.video;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.linphone.core.Log;
import org.linphone.core.video.AndroidCameraRecord.RecorderParams.MirrorType; import org.linphone.core.video.AndroidCameraRecord.RecorderParams.MirrorType;
import android.hardware.Camera; import android.hardware.Camera;
import android.hardware.Camera.Parameters; import android.hardware.Camera.Parameters;
import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera.Size; import android.hardware.Camera.Size;
import android.util.Log;
/** /**
* Record from Android camera. * Record from Android camera.
@ -63,18 +63,18 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac
public void onPreviewFrame(byte[] data, Camera camera) { public void onPreviewFrame(byte[] data, Camera camera) {
if (data == null) { if (data == null) {
Log.e(tag, "onPreviewFrame Called with null buffer"); Log.e("onPreviewFrame Called with null buffer");
return; return;
} }
if (filterCtxPtr == 0l) { if (filterCtxPtr == 0l) {
Log.e(tag, "onPreviewFrame Called with no filterCtxPtr set"); Log.e("onPreviewFrame Called with no filterCtxPtr set");
return; return;
} }
int expectedBuffLength = getExpectedBufferLength(); int expectedBuffLength = getExpectedBufferLength();
if (expectedBuffLength != data.length) { if (expectedBuffLength != data.length) {
Log.e(tag, "onPreviewFrame called with bad buffer length " + data.length Log.e("onPreviewFrame called with bad buffer length ", data.length,
+ " whereas expected is " + expectedBuffLength + " don't calling putImage"); " whereas expected is ", expectedBuffLength, " don't calling putImage");
return; return;
} }
@ -87,7 +87,7 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac
double currentTimeElapsed = 0.8 * (curTime - lastFrameTime) / 1000 + 0.2 * timeElapsedBetweenFrames; double currentTimeElapsed = 0.8 * (curTime - lastFrameTime) / 1000 + 0.2 * timeElapsedBetweenFrames;
if (currentTimeElapsed < expectedTimeBetweenFrames) { if (currentTimeElapsed < expectedTimeBetweenFrames) {
// Log.d(tag, "Clipping frame " + Math.round(1 / currentTimeElapsed) + " > " + fps); // Log.d("Clipping frame ", Math.round(1 / currentTimeElapsed), " > ", fps);
return; return;
} }
lastFrameTime = curTime; lastFrameTime = curTime;
@ -118,10 +118,10 @@ class AndroidCameraRecord5 extends AndroidCameraRecord implements PreviewCallbac
List<String> supportedFocusModes = parameters.getSupportedFocusModes(); List<String> supportedFocusModes = parameters.getSupportedFocusModes();
String focusMode = selectFocusMode(supportedFocusModes); String focusMode = selectFocusMode(supportedFocusModes);
if (focusMode != null) { if (focusMode != null) {
Log.w(tag, "Selected focus mode: " + focusMode); Log.w("Selected focus mode: ", focusMode);
parameters.setFocusMode(focusMode); parameters.setFocusMode(focusMode);
} else { } else {
Log.i(tag, "No suitable focus mode found in : " + Arrays.toString(supportedFocusModes.toArray())); Log.i("No suitable focus mode found in : ", Arrays.toString(supportedFocusModes.toArray()));
} }
} }

View file

@ -20,11 +20,12 @@ package org.linphone.core.video;
import java.util.List; import java.util.List;
import org.linphone.core.Log;
import android.hardware.Camera; import android.hardware.Camera;
import android.hardware.Camera.Parameters; import android.hardware.Camera.Parameters;
import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera.Size; import android.hardware.Camera.Size;
import android.util.Log;
/** /**
* *
@ -42,7 +43,7 @@ class AndroidCameraRecord8 extends AndroidCameraRecord5 {
@Override @Override
protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) { protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) {
if (cb != null) { if (cb != null) {
Log.d(tag, "Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!"); Log.d("Setting optimized callback with buffer (Android >= 8). Remember to manage the pool of buffers!!!");
} }
camera.setPreviewCallbackWithBuffer(cb); camera.setPreviewCallbackWithBuffer(cb);
} }

View file

@ -21,12 +21,12 @@ package org.linphone.core.video;
import java.util.List; import java.util.List;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.core.Log;
import org.linphone.core.Version; import org.linphone.core.Version;
import org.linphone.core.video.AndroidCameraRecord.RecorderParams; import org.linphone.core.video.AndroidCameraRecord.RecorderParams;
import android.content.Context; import android.content.Context;
import android.hardware.Camera.Size; import android.hardware.Camera.Size;
import android.util.Log;
import android.view.OrientationEventListener; import android.view.OrientationEventListener;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
@ -41,7 +41,6 @@ import android.view.SurfaceHolder.Callback;
* *
*/ */
public class AndroidCameraRecordManager { public class AndroidCameraRecordManager {
private static final String tag = "Linphone";
private static AndroidCameraRecordManager instance; private static AndroidCameraRecordManager instance;
private OrientationEventListener orientationEventListener; private OrientationEventListener orientationEventListener;
private OnCapturingStateChangedListener capturingStateChangedListener; private OnCapturingStateChangedListener capturingStateChangedListener;
@ -70,7 +69,7 @@ public class AndroidCameraRecordManager {
// singleton // singleton
private AndroidCameraRecordManager() { private AndroidCameraRecordManager() {
cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5(); cc = Version.sdkAboveOrEqual(9) ? new AndroidCameraConf9() : new AndroidCameraConf5();
Log.i(tag, "=== Detected " + cc.getFoundCameras()+ " ==="); Log.i("=== Detected " + cc.getFoundCameras()+ " ===");
cameraId = cc.getFoundCameras().defaultC; cameraId = cc.getFoundCameras().defaultC;
} }
@ -87,7 +86,7 @@ public class AndroidCameraRecordManager {
public void setUseFrontCamera(boolean value) { public void setUseFrontCamera(boolean value) {
if (!hasFrontCamera()) { if (!hasFrontCamera()) {
Log.e(tag, "setUseFrontCamera(true) while no front camera detected on device: using rear"); Log.e("setUseFrontCamera(true) while no front camera detected on device: using rear");
value = false; value = false;
} }
if (cc.isFrontCamera(cameraId) == value) return; // already OK if (cc.isFrontCamera(cameraId) == value) return; // already OK
@ -116,7 +115,7 @@ public class AndroidCameraRecordManager {
public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) { public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) {
if (recorder != null) { if (recorder != null) {
Log.w(tag, "Recorder should not be running"); Log.w("Recorder should not be running");
stopVideoRecording(); stopVideoRecording();
} }
RecorderParams p = new RecorderParams(filterDataPtr); RecorderParams p = new RecorderParams(filterDataPtr);
@ -148,19 +147,19 @@ public class AndroidCameraRecordManager {
holder.addCallback(new Callback() { holder.addCallback(new Callback() {
public void surfaceDestroyed(SurfaceHolder holder) { public void surfaceDestroyed(SurfaceHolder holder) {
surfaceView = null; surfaceView = null;
Log.d(tag , "Video capture surface destroyed"); Log.d("Video capture surface destroyed");
stopVideoRecording(); stopVideoRecording();
} }
public void surfaceCreated(SurfaceHolder holder) { public void surfaceCreated(SurfaceHolder holder) {
surfaceView = sv; surfaceView = sv;
Log.d(tag , "Video capture surface created"); Log.d("Video capture surface created");
tryToStartVideoRecording(); tryToStartVideoRecording();
} }
public void surfaceChanged(SurfaceHolder holder, int format, int width, public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) { int height) {
Log.d(tag , "Video capture surface changed"); Log.d("Video capture surface changed");
} }
}); });
} }
@ -200,7 +199,7 @@ public class AndroidCameraRecordManager {
if (muted || surfaceView == null || parameters == null) return; if (muted || surfaceView == null || parameters == null) return;
if (recorder != null) { if (recorder != null) {
Log.e(tag, "Recorder already present"); Log.e("Recorder already present");
stopVideoRecording(); stopVideoRecording();
} }
@ -271,7 +270,7 @@ public class AndroidCameraRecordManager {
final int rotation = bufferRotationToCompensateCameraAndPhoneOrientations(); final int rotation = bufferRotationToCompensateCameraAndPhoneOrientations();
final boolean isPortrait = (rotation % 180) == 90; final boolean isPortrait = (rotation % 180) == 90;
Log.d(tag, "Camera sensor in " + (isPortrait? "portrait":"landscape") + " orientation."); Log.d("Camera sensor in ", isPortrait? "portrait":"landscape"," orientation.");
return isPortrait; return isPortrait;
} }
@ -296,10 +295,10 @@ public class AndroidCameraRecordManager {
final int phoneOrientation = mAlwaysChangingPhoneOrientation; final int phoneOrientation = mAlwaysChangingPhoneOrientation;
final int cameraOrientation = cc.getCameraOrientation(cameraId); final int cameraOrientation = cc.getCameraOrientation(cameraId);
final int rotation = (cameraOrientation + phoneOrientation) % 360; final int rotation = (cameraOrientation + phoneOrientation) % 360;
Log.d(tag, String.format( Log.d("Capture video buffer of cameraId=",cameraId,
"Capture video buffer of cameraId=%d will need a rotation of " " will need a rotation of ",rotation,
+ "%d degrees: camera_orientation=%d, phone_orientation=%d", " degrees: camera_orientation=",cameraOrientation,
cameraId, rotation, cameraOrientation, phoneOrientation)); " phone_orientation=", phoneOrientation);
return rotation; return rotation;
} }
@ -329,7 +328,7 @@ public class AndroidCameraRecordManager {
if (mAlwaysChangingPhoneOrientation == degrees) return; if (mAlwaysChangingPhoneOrientation == degrees) return;
Log.i(tag, "Phone orientation changed to " + degrees); Log.i("Phone orientation changed to ", degrees);
mAlwaysChangingPhoneOrientation = degrees; mAlwaysChangingPhoneOrientation = degrees;
} }
} }