Report bug button in about activity when debug on.
This commit is contained in:
parent
e5b42cb70c
commit
45da67aa1c
9 changed files with 168 additions and 34 deletions
|
@ -155,17 +155,19 @@
|
|||
</application>
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"></uses-permission>
|
||||
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
|
||||
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
|
||||
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
|
||||
<uses-permission android:name="android.permission.CALL_PHONE"/>
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||
|
||||
|
||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/>
|
||||
</manifest>
|
||||
|
|
|
@ -9,4 +9,10 @@
|
|||
android:layout_height="wrap_content" android:text="@string/about_text"
|
||||
android:autoLink="web" android:gravity="center" android:paddingTop="50sp"
|
||||
android:textStyle="bold" android:id="@+id/AboutText"></TextView>
|
||||
<Button android:id="@+id/about_report_issue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_report_issue"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="30sp"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<string name="default_domain">test.linphone.org</string>
|
||||
|
||||
<bool name="use_android_contact_picker">true</bool>
|
||||
<!-- <string name="merge_another_contact_provider">content://something</string>-->
|
||||
|
||||
<bool name="useFirstLoginActivity">false</bool>
|
||||
<bool name="useMenuSettings">true</bool>
|
||||
|
@ -19,5 +18,8 @@
|
|||
<bool name="allow_edit_in_dialer">true</bool>
|
||||
<string name="notification_registered">Registered to %s </string>
|
||||
<string name="notification_register_failure">Fails to register to %s</string>
|
||||
|
||||
<string name="about_text">Linphone %s SIP (rfc 3261) compatible phone under GNU Public License V2\n http://www.linphone.org\n\nInstructions\nhttp://www.linphone.org/m/help\n\n© 2011 Belledonne Communications</string>
|
||||
<string name="about_bugreport_email">linphone-android@belledonne-communications.com</string>
|
||||
</resources>
|
||||
|
|
@ -74,7 +74,12 @@
|
|||
<string name="pref_codecs">Codecs</string>
|
||||
<string name="place_call_chooser">Place a call</string>
|
||||
<string name="pref_debug">Debug</string>
|
||||
<string name="about_text">Linphone %s SIP (rfc 3261) compatible phone under GNU Public License V2\n http://www.linphone.org\n\nInstructions\nhttp://www.linphone.org/m/help\n\n© 2011 Belledonne Communications</string>
|
||||
<string name="about_report_issue">Report issue</string>
|
||||
<string name="about_bugreport_email_text">Describe problem here</string>
|
||||
<string name="about_error_generating_bugreport_attachement">Error generating bug report</string>
|
||||
<string name="about_logs_not_found">Logs not found.</string>
|
||||
<string name="about_reading_logs">Reading logs, may takes time...</string>
|
||||
<string name="about_mailer_chooser_text">Send bug report with...</string>
|
||||
<string name="menu_about">About</string>
|
||||
<string name="pref_audio">Audio</string>
|
||||
<string name="menu_exit">Exit</string>
|
||||
|
|
|
@ -15,29 +15,152 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.linphone.core.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
|
||||
public class AboutActivity extends Activity {
|
||||
TextView aboutText;
|
||||
public class AboutActivity extends Activity implements OnClickListener {
|
||||
|
||||
private Handler mHandler = new Handler();
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.about);
|
||||
aboutText = (TextView) findViewById(R.id.AboutText);
|
||||
|
||||
TextView aboutText = (TextView) findViewById(R.id.AboutText);
|
||||
try {
|
||||
aboutText.setText(String.format(getString(R.string.about_text), getPackageManager().getPackageInfo(getPackageName(), 0).versionName));
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.e(e, "cannot get version name");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (pref.getBoolean(getString(R.string.pref_debug_key), false)) {
|
||||
View issue = findViewById(R.id.about_report_issue);
|
||||
issue.setOnClickListener(this);
|
||||
issue.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private Thread thread;
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (thread != null) return;
|
||||
Toast.makeText(this, getString(R.string.about_reading_logs), Toast.LENGTH_LONG).show();
|
||||
thread = new ReadLogThread();
|
||||
thread.start();
|
||||
}
|
||||
|
||||
private void onLogsRead(String logs) {
|
||||
File tempFile;
|
||||
if (logs == null) {
|
||||
Toast.makeText(this, getString(R.string.about_logs_not_found), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
|
||||
try {
|
||||
tempFile = File.createTempFile("bugreport", ".txt");
|
||||
tempFile.deleteOnExit();
|
||||
FileWriter writer = new FileWriter(tempFile);
|
||||
writer.append(logs);
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(this, getString(R.string.about_error_generating_bugreport_attachement), Toast.LENGTH_LONG).show();
|
||||
Log.e(e, "couldn't write to temporary file");
|
||||
return;
|
||||
} finally {
|
||||
thread = null;
|
||||
}
|
||||
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setType("plain/text");
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{getString(R.string.about_bugreport_email)});
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT,"Bug report " + getString(R.string.app_name) + "-android");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.about_bugreport_email_text));
|
||||
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(tempFile));
|
||||
intent = Intent.createChooser(intent,getString(R.string.about_mailer_chooser_text));
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class ReadLogThread extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
final String logs = readLogs();
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onLogsRead(logs);
|
||||
}
|
||||
});
|
||||
super.run();
|
||||
}
|
||||
}
|
||||
|
||||
private String readLogs() {
|
||||
StringBuilder sb1 = null;
|
||||
StringBuilder sb2 = null;
|
||||
BufferedReader br = null;
|
||||
Process p = null;
|
||||
|
||||
try {
|
||||
p = Runtime.getRuntime().exec(new String[] {"logcat", "-d"});
|
||||
br = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
|
||||
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.contains(LinphoneService.START_LINPHONE_LOGS)) {
|
||||
if (sb1 != null) {
|
||||
sb2 = sb1;
|
||||
}
|
||||
sb1 = new StringBuilder();
|
||||
}
|
||||
if (sb1 != null) {
|
||||
sb1.append(line).append('\n');
|
||||
}
|
||||
}
|
||||
|
||||
if (sb1 == null) return null;
|
||||
if (sb2 != null) {
|
||||
sb1.append(sb2);
|
||||
}
|
||||
return sb1.toString();
|
||||
} catch (IOException e) {
|
||||
Log.e(e, "Error while reading logs");
|
||||
return null;
|
||||
} finally {
|
||||
if (br != null) {
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
if (p != null) {
|
||||
p.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.linphone.core.LinphoneCall.State;
|
|||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
|
@ -41,6 +40,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
|||
import android.media.MediaPlayer;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -111,7 +111,8 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
notificationTitle = getString(R.string.app_name);
|
||||
|
||||
// Dump some debugging information to the logs
|
||||
Hacks.dumpDeviceInformation();
|
||||
Log.i(START_LINPHONE_LOGS);
|
||||
dumpDeviceInformation();
|
||||
dumpInstalledLinphoneInformation();
|
||||
|
||||
mNotificationMgr = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
@ -130,6 +131,18 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
|
||||
|
||||
|
||||
public static final String START_LINPHONE_LOGS = " ==== Phone information dump ====";
|
||||
private void dumpDeviceInformation() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("DEVICE=").append(Build.DEVICE).append("\n");
|
||||
sb.append("MODEL=").append(Build.MODEL).append("\n");
|
||||
//MANUFACTURER doesn't exist in android 1.5.
|
||||
//sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n");
|
||||
sb.append("SDK=").append(Build.VERSION.SDK);
|
||||
Log.i(sb.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void dumpInstalledLinphoneInformation() {
|
||||
PackageInfo info = null;
|
||||
|
|
|
@ -19,21 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
package org.linphone.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.PKIXParameters;
|
||||
import java.security.cert.TrustAnchor;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import org.linphone.mediastream.Version;
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||
|
||||
|
||||
class LinphoneCoreImpl implements LinphoneCore {
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5b6ac8974d1a5f8059b964b329c565d4afe06358
|
||||
Subproject commit af32518af41f97caee07070234a3475409b9a27d
|
Loading…
Reference in a new issue