diff --git a/res/layout/about.xml b/res/layout/about.xml
index 5ee98b6d9..ccf860f9f 100644
--- a/res/layout/about.xml
+++ b/res/layout/about.xml
@@ -50,30 +50,24 @@
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="horizontal"
+ android:paddingBottom="30dp">
-
-
-
-
-
+
+
+
+
-
diff --git a/res/raw-sw600dp/linphonerc_factory b/res/raw-sw600dp/linphonerc_factory
index 7d32cbd63..982a552fc 100644
--- a/res/raw-sw600dp/linphonerc_factory
+++ b/res/raw-sw600dp/linphonerc_factory
@@ -29,3 +29,4 @@ dtmf_player_amp=0.1
[misc]
max_calls=10
+log_collection_upload_server_url=https://www.linphone.org:444/lft.php
\ No newline at end of file
diff --git a/res/raw/linphonerc_factory b/res/raw/linphonerc_factory
index 7d32cbd63..982a552fc 100644
--- a/res/raw/linphonerc_factory
+++ b/res/raw/linphonerc_factory
@@ -29,3 +29,4 @@ dtmf_player_amp=0.1
[misc]
max_calls=10
+log_collection_upload_server_url=https://www.linphone.org:444/lft.php
\ No newline at end of file
diff --git a/src/org/linphone/AboutFragment.java b/src/org/linphone/AboutFragment.java
index 9c60acfd9..2d03031d8 100644
--- a/src/org/linphone/AboutFragment.java
+++ b/src/org/linphone/AboutFragment.java
@@ -18,8 +18,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCore.LogCollectionUploadState;
+import org.linphone.core.LinphoneCoreListener;
import org.linphone.mediastream.Log;
+import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@@ -27,21 +31,18 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.widget.LinearLayout;
import android.widget.TextView;
/**
* @author Sylvain Berfini
*/
-public class AboutFragment extends Fragment implements OnClickListener {
+public class AboutFragment extends Fragment implements OnClickListener, LinphoneCoreListener.LinphoneLogCollectionUploadListener {
private FragmentsAvailable about = FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT;
View exitButton = null;
View sendLogButton = null;
- LinearLayout sendLogLayout = null;
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (getArguments() != null && getArguments().getSerializable("About") != null) {
about = (FragmentsAvailable) getArguments().getSerializable("About");
}
@@ -57,13 +58,16 @@ public class AboutFragment extends Fragment implements OnClickListener {
sendLogButton = view.findViewById(R.id.send_log);
sendLogButton.setOnClickListener(this);
- sendLogLayout = (LinearLayout)view.findViewById(R.id.send_log_layout);
- sendLogLayout.setVisibility(getResources().getBoolean(R.bool.enable_log_collect) ? View.VISIBLE : View.GONE);
+ sendLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
exitButton = view.findViewById(R.id.exit);
exitButton.setOnClickListener(this);
exitButton.setVisibility(View.VISIBLE);
-
+
+ LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
+ if (lc != null) {
+ lc.addListener(this);
+ }
return view;
}
@@ -80,15 +84,56 @@ public class AboutFragment extends Fragment implements OnClickListener {
}
}
}
+
@Override
public void onClick(View v) {
if (LinphoneActivity.isInstanciated()) {
if (v == sendLogButton) {
- LinphoneUtils.collectLogs(LinphoneActivity.instance(), getString(R.string.about_bugreport_email));
+ //LinphoneUtils.collectLogs(LinphoneActivity.instance(), getString(R.string.about_bugreport_email));
+ LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
+ if (lc != null) {
+ lc.uploadLogCollection();
+ }
} else {
LinphoneActivity.instance().exit();
}
}
}
+
+ @Override
+ public void onDestroy() {
+ LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
+ if (lc != null) {
+ lc.removeListener(this);
+ }
+
+ super.onDestroy();
+ }
+
+ @Override
+ public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
+ Log.d("Log upload progress: currently uploaded = " + offset + " , total = " + total + ", % = " + String.valueOf((offset * 100) / total));
+ }
+
+ @Override
+ public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) {
+ Log.d("Log upload state: " + state.toString() + ", info = " + info);
+
+ if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered) {
+ final String appName = getString(R.string.app_name);
+
+ Intent i = new Intent(Intent.ACTION_SEND);
+ i.putExtra(Intent.EXTRA_EMAIL, new String[]{ getString(R.string.about_bugreport_email) });
+ i.putExtra(Intent.EXTRA_SUBJECT, appName + " Logs");
+ i.putExtra(Intent.EXTRA_TEXT, info);
+ i.setType("application/zip");
+
+ try {
+ startActivity(Intent.createChooser(i, "Send mail..."));
+ } catch (android.content.ActivityNotFoundException ex) {
+ Log.e(ex);
+ }
+ }
+ }
}
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 061a320a7..5801e5312 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -46,6 +46,7 @@ import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.GlobalState;
+import org.linphone.core.LinphoneCore.LogCollectionUploadState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
import org.linphone.core.LinphoneCoreException;
@@ -1261,19 +1262,27 @@ public class LinphoneManager implements LinphoneListener {
@Override
public void fileTransferProgressIndication(LinphoneCore lc,
LinphoneChatMessage message, LinphoneContent content, int progress) {
- // TODO Auto-generated method stub
}
@Override
public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message,
LinphoneContent content, byte[] buffer, int size) {
- // TODO Auto-generated method stub
}
@Override
public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message,
LinphoneContent content, ByteBuffer buffer, int size) {
- // TODO Auto-generated method stub
return 0;
}
+
+ @Override
+ public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
+
+ }
+
+ @Override
+ public void uploadStateChanged(LinphoneCore lc,
+ LogCollectionUploadState state, String info) {
+
+ }
}
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index 54d8f8e8a..76ddd845f 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -30,6 +30,7 @@ import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactoryImpl;
+import org.linphone.core.LinphoneCoreImpl;
import org.linphone.core.LinphoneCoreListener.LinphoneCallStateListener;
import org.linphone.core.LinphoneCoreListener.LinphoneGlobalStateListener;
import org.linphone.core.LinphoneCoreListener.LinphoneRegistrationStateListener;
@@ -137,6 +138,11 @@ public final class LinphoneService extends Service implements LinphoneCallStateL
// In case restart after a crash. Main in LinphoneActivity
mNotificationTitle = getString(R.string.service_name);
+ // Needed in order for the two next calls to succeed, libraries must have been loaded first
+ LinphoneCoreFactoryImpl.instance();
+ LinphoneCoreImpl.setLogCollectionPath(getFilesDir().getAbsolutePath());
+ LinphoneCoreImpl.enableLogCollection(!(getResources().getBoolean(R.bool.disable_every_log)));
+
// Dump some debugging information to the logs
Log.i(START_LINPHONE_LOGS);
dumpDeviceInformation();
diff --git a/submodules/linphone b/submodules/linphone
index 9b06383c7..4e5e409dc 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit 9b06383c7e75ee3d6dacb564bd6598b00df16128
+Subproject commit 4e5e409dc27546cb72406f49e852afd02d4cdc6c