Merge lp:~humpolec-team/humpolec/UbuntuInstaller_lp1264034 into lp:humpolec

Proposed by Yuan-Chen Cheng
Status: Merged
Merged at revision: 32
Proposed branch: lp:~humpolec-team/humpolec/UbuntuInstaller_lp1264034
Merge into: lp:humpolec
Diff against target: 118 lines (+56/-1)
3 files modified
res/menu/installer_menu.xml (+5/-0)
res/values/strings.xml (+5/-1)
src/com/canonical/ubuntu/installer/InstallActivity.java (+46/-0)
To merge this branch: bzr merge lp:~humpolec-team/humpolec/UbuntuInstaller_lp1264034
Reviewer Review Type Date Requested Status
Rex Tsai Approve
Review via email: mp+200031@code.launchpad.net

Description of the change

Dump:
1. Board fingerprint
2. apk version
3. content of terminal
on /sdcard to make it easy to debug

To post a comment you must log in.
Revision history for this message
Rex Tsai (chihchun) wrote :

LGTM, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'res/menu/installer_menu.xml'
2--- res/menu/installer_menu.xml 2013-12-20 03:39:53 +0000
3+++ res/menu/installer_menu.xml 2013-12-25 06:14:14 +0000
4@@ -5,6 +5,11 @@
5 android:orderInCategory="100"
6 android:showAsAction="never"
7 android:title="@string/action_detele_download"/>
8+ <item
9+ android:id="@+id/action_dump_terminal"
10+ android:orderInCategory="100"
11+ android:showAsAction="never"
12+ android:title="@string/action_dump_terminal"/>
13 <!-- <item
14 android:id="@+id/action_settings"
15 android:orderInCategory="100"
16
17=== modified file 'res/values/strings.xml'
18--- res/values/strings.xml 2013-12-20 03:39:53 +0000
19+++ res/values/strings.xml 2013-12-25 06:14:14 +0000
20@@ -4,6 +4,7 @@
21 <string name="app_name">Ubuntu Dual Boot</string>
22 <string name="action_settings">Settings</string>
23 <string name="action_detele_download">Delete download</string>
24+ <string name="action_dump_terminal">Dump Terminal</string>
25 <string name="action_install">Install</string>
26 <string name="action_uninstall">Uninstall Ubuntu</string>
27 <string name="action_uninstall_button">Uninstall</string>
28@@ -29,7 +30,10 @@
29 <string name="deleting_user_data">Deleting Ubuntu user data</string>
30 <string name="fail_fetching_versions">Fail to fetch available versions</string>
31 <string name="uninstall_dialog_message">This will remove all Ubuntu system files and Ubuntu swap file</string>
32-
33+ <string name="terminal_is_empty">Terminal is emtpy.</string>
34+ <string name="terminal_dump_succ">Dump Terminal to file success</string>
35+ <string name="terminal_dump_fail">Dump Terminal to file fail</string>
36+ <string name="external_storage_unavailable">External Storage is not available</string>
37 <!-- Strings for Launch screen -->
38 <string name="launch_title">Ubuntu</string>
39 <string name="label_channel">Channel:</string>
40
41=== modified file 'src/com/canonical/ubuntu/installer/InstallActivity.java'
42--- src/com/canonical/ubuntu/installer/InstallActivity.java 2013-12-23 09:13:47 +0000
43+++ src/com/canonical/ubuntu/installer/InstallActivity.java 2013-12-25 06:14:14 +0000
44@@ -1,7 +1,12 @@
45 package com.canonical.ubuntu.installer;
46
47+import java.io.File;
48+import java.io.FileWriter;
49+import java.text.SimpleDateFormat;
50+import java.util.Calendar;
51 import java.util.HashMap;
52 import java.util.List;
53+import java.util.Locale;
54
55 import com.canonical.ubuntu.installer.R;
56 import com.canonical.ubuntu.installer.TextPickerDialog;
57@@ -12,6 +17,7 @@
58 import com.canonical.ubuntu.widget.UbuntuButton;
59
60 import android.os.Bundle;
61+import android.os.Environment;
62 import android.app.Activity;
63 import android.app.ProgressDialog;
64 import android.content.BroadcastReceiver;
65@@ -19,6 +25,8 @@
66 import android.content.Intent;
67 import android.content.IntentFilter;
68 import android.content.SharedPreferences;
69+import android.content.pm.PackageInfo;
70+import android.content.pm.PackageManager;
71 import android.text.Html;
72 import android.text.method.ScrollingMovementMethod;
73 import android.util.Log;
74@@ -126,6 +134,44 @@
75 mDownloadedVersion = null;
76 requestServiceState();
77 break;
78+ case R.id.action_dump_terminal:
79+ CharSequence terminalText = mTerminal.getText();
80+ if (terminalText.length() == 0) {
81+ Utils.showToast(this.getApplicationContext(), R.string.terminal_is_empty);
82+ break;
83+ }
84+
85+ Calendar c = Calendar.getInstance();
86+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss", Locale.US);
87+ String formattedDate = df.format(c.getTime());
88+
89+ String filename = "UbuntuInstaller-" + formattedDate + ".log";
90+ File dumpFile = null;
91+ try {
92+ File vSDCard;
93+ if(Environment.getExternalStorageState().equals(Environment.MEDIA_REMOVED)) {
94+ Utils.showToast(this.getApplicationContext(), R.string.external_storage_unavailable);
95+ break;
96+ } else {
97+ vSDCard = Environment.getExternalStorageDirectory();
98+ }
99+
100+ dumpFile = new File(vSDCard + "/" + filename);
101+ FileWriter dumpFileWriter = new FileWriter(dumpFile);
102+ dumpFileWriter.write("Device: " + android.os.Build.FINGERPRINT + "\n");
103+
104+ Context context = this.getApplicationContext();
105+ PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_META_DATA);
106+ String versionInfo = pInfo.versionName;
107+ dumpFileWriter.write("APK Version: " + versionInfo + "\n");
108+
109+ dumpFileWriter.write(terminalText.toString());
110+ dumpFileWriter.close();
111+ Utils.showToast(this.getApplicationContext(), getResources().getString(R.string.terminal_dump_succ) + ": " + dumpFile.getPath());
112+ } catch (Exception e) {
113+ Utils.showToast(this.getApplicationContext(), getResources().getString(R.string.terminal_dump_fail) + ": " + dumpFile.getPath());
114+ }
115+ break;
116 }
117 return super.onOptionsItemSelected(item);
118 }

Subscribers

People subscribed via source and target branches

to all changes: