Skip to content

Commit 4bb4d89

Browse files
egnorAndroid (Google) Code Review
authored andcommitted
Merge "Make San happy: use Environment.getExternalStorage... instead of hardcoding "/sdcard""
2 parents 49608d9 + 2bd1c8d commit 4bb4d89

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

apps/BugReportSender/src/com/android/bugreportsender/BugReportListActivity.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import android.net.Uri;
2222
import android.os.Build;
2323
import android.os.Bundle;
24+
import android.os.Environment;
2425
import android.os.FileObserver;
2526
import android.os.Handler;
2627
import android.util.Log;
@@ -42,7 +43,6 @@
4243
*/
4344
public class BugReportListActivity extends ListActivity {
4445
private static final String TAG = "BugReportListActivity";
45-
private static final File REPORT_DIR = new File("/sdcard/bugreports");
4646
private static final int SYSTEM_LOG_ID = 1;
4747
private static final int MEMORY_ID = 2;
4848
private static final int CPU_ID = 3;
@@ -56,6 +56,7 @@ public class BugReportListActivity extends ListActivity {
5656
ID_MAP.put(PROCRANK_ID, "PROCRANK");
5757
}
5858

59+
private File mReportDir = null;
5960
private ArrayAdapter<String> mAdapter = null;
6061
private ArrayList<File> mFiles = null;
6162
private Handler mHandler = null;
@@ -64,12 +65,13 @@ public class BugReportListActivity extends ListActivity {
6465
@Override
6566
public void onCreate(Bundle savedInstanceState) {
6667
super.onCreate(savedInstanceState);
68+
mReportDir = new File(Environment.getExternalStorageDirectory(), "bugreports");
6769
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
6870
mFiles = new ArrayList<File>();
6971
mHandler = new Handler();
7072

7173
int flags = FileObserver.CREATE | FileObserver.MOVED_TO;
72-
mObserver = new FileObserver(REPORT_DIR.getPath(), flags) {
74+
mObserver = new FileObserver(mReportDir.getPath(), flags) {
7375
public void onEvent(int event, String path) {
7476
mHandler.post(new Runnable() { public void run() { scanDirectory(); } });
7577
}
@@ -151,7 +153,7 @@ private void scanDirectory() {
151153
mAdapter.clear();
152154
mFiles.clear();
153155

154-
File[] files = REPORT_DIR.listFiles();
156+
File[] files = mReportDir.listFiles();
155157
if (files == null) return;
156158

157159
// Sort in reverse order: newest bug reports first

0 commit comments

Comments
 (0)