Started log collection upload
This commit is contained in:
parent
0f4de68059
commit
83b5650a0e
7 changed files with 92 additions and 36 deletions
|
@ -50,30 +50,24 @@
|
|||
<View android:layout_weight="30" android:layout_width="0dp" android:layout_height="0dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout android:id="@+id/send_log_layout"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="30dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/send_log"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_send_log"/>
|
||||
<View android:layout_width="50dp" android:layout_height="0dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button android:id="@+id/exit"
|
||||
android:gravity="center"
|
||||
android:layout_toRightOf="@id/send_log_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_exit"
|
||||
/>
|
||||
android:text="@string/menu_exit"/>
|
||||
|
||||
</LinearLayout>
|
||||
<View android:layout_weight="30" android:layout_width="0dp" android:layout_height="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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;
|
||||
}
|
||||
|
@ -81,14 +85,55 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9b06383c7e75ee3d6dacb564bd6598b00df16128
|
||||
Subproject commit 4e5e409dc27546cb72406f49e852afd02d4cdc6c
|
Loading…
Reference in a new issue