Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
development
Commits
112ffc76
Commit
112ffc76
authored
15 years ago
by
Dan Egnor
Browse files
Options
Download
Email Patches
Plain Diff
Remove BugReportSender, which has a happy new home in packages/experimental
Change-Id: I97628264f3249c86d83cded73daf3b1cc291e051
parent
a3916df8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
382 deletions
+0
-382
apps/BugReportSender/Android.mk
apps/BugReportSender/Android.mk
+0
-23
apps/BugReportSender/AndroidManifest.xml
apps/BugReportSender/AndroidManifest.xml
+0
-47
apps/BugReportSender/res/drawable-hdpi/icon.png
apps/BugReportSender/res/drawable-hdpi/icon.png
+0
-0
apps/BugReportSender/res/drawable-mdpi/icon.png
apps/BugReportSender/res/drawable-mdpi/icon.png
+0
-0
apps/BugReportSender/res/layout/bugreport_preview.xml
apps/BugReportSender/res/layout/bugreport_preview.xml
+0
-12
apps/BugReportSender/src/com/android/bugreportsender/BugReportListActivity.java
...rc/com/android/bugreportsender/BugReportListActivity.java
+0
-172
apps/BugReportSender/src/com/android/bugreportsender/BugReportParser.java
...nder/src/com/android/bugreportsender/BugReportParser.java
+0
-49
apps/BugReportSender/src/com/android/bugreportsender/BugReportPreviewActivity.java
...com/android/bugreportsender/BugReportPreviewActivity.java
+0
-79
No files found.
apps/BugReportSender/Android.mk
deleted
100644 → 0
View file @
a3916df8
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
LOCAL_PATH
:=
$(
call
my-dir
)
include
$(CLEAR_VARS)
LOCAL_CERTIFICATE
:=
platform
LOCAL_MODULE_TAGS
:=
eng
LOCAL_PACKAGE_NAME
:=
BugReportSender
LOCAL_SDK_VERSION
:=
4
LOCAL_SRC_FILES
:=
$(
call
all-subdir-java-files
)
include
$(BUILD_PACKAGE)
This diff is collapsed.
Click to expand it.
apps/BugReportSender/AndroidManifest.xml
deleted
100644 → 0
View file @
a3916df8
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.android.bugreportsender"
android:versionCode=
"11"
>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!-- Minimum Donut, target Froyo -->
<uses-sdk
android:minSdkVersion=
"4"
android:targetSdkVersion=
"7"
/>
<application
android:icon=
"@drawable/icon"
android:label=
"Bug Report Sender"
>
<activity
android:name=
"BugReportListActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
"BugReportPreviewActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:mimeType=
"vnd.android/bugreport"
/>
</intent-filter>
</activity>
</application>
</manifest>
This diff is collapsed.
Click to expand it.
apps/BugReportSender/res/drawable-hdpi/icon.png
deleted
100755 → 0
View file @
a3916df8
5.02 KB
This diff is collapsed.
Click to expand it.
apps/BugReportSender/res/drawable-mdpi/icon.png
deleted
100644 → 0
View file @
a3916df8
3.06 KB
This diff is collapsed.
Click to expand it.
apps/BugReportSender/res/layout/bugreport_preview.xml
deleted
100644 → 0
View file @
a3916df8
<ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:id=
"@+id/preview"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:scrollbars=
"horizontal|vertical"
android:scrollbarAlwaysDrawVerticalTrack=
"true"
/>
</ScrollView>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
apps/BugReportSender/src/com/android/bugreportsender/BugReportListActivity.java
deleted
100644 → 0
View file @
a3916df8
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.android.bugreportsender
;
import
android.app.ListActivity
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.FileObserver
;
import
android.os.Handler
;
import
android.util.Log
;
import
android.view.ContextMenu
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.ArrayAdapter
;
import
android.widget.ListView
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashMap
;
/**
* Shows a list of bug reports currently in /sdcard/bugreports
*/
public
class
BugReportListActivity
extends
ListActivity
{
private
static
final
String
TAG
=
"BugReportListActivity"
;
private
static
final
File
REPORT_DIR
=
new
File
(
"/sdcard/bugreports"
);
private
static
final
int
SYSTEM_LOG_ID
=
1
;
private
static
final
int
MEMORY_ID
=
2
;
private
static
final
int
CPU_ID
=
3
;
private
static
final
int
PROCRANK_ID
=
4
;
private
static
final
HashMap
<
Integer
,
String
>
ID_MAP
=
new
HashMap
<
Integer
,
String
>();
static
{
ID_MAP
.
put
(
SYSTEM_LOG_ID
,
"SYSTEM LOG"
);
ID_MAP
.
put
(
MEMORY_ID
,
"MEMORY INFO"
);
ID_MAP
.
put
(
CPU_ID
,
"CPU INFO"
);
ID_MAP
.
put
(
PROCRANK_ID
,
"PROCRANK"
);
}
private
ArrayAdapter
<
String
>
mAdapter
=
null
;
private
ArrayList
<
File
>
mFiles
=
null
;
private
Handler
mHandler
=
null
;
private
FileObserver
mObserver
=
null
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
mAdapter
=
new
ArrayAdapter
<
String
>(
this
,
android
.
R
.
layout
.
simple_list_item_1
);
mFiles
=
new
ArrayList
<
File
>();
mHandler
=
new
Handler
();
int
flags
=
FileObserver
.
CREATE
|
FileObserver
.
MOVED_TO
;
mObserver
=
new
FileObserver
(
REPORT_DIR
.
getPath
(),
flags
)
{
public
void
onEvent
(
int
event
,
String
path
)
{
mHandler
.
post
(
new
Runnable
()
{
public
void
run
()
{
scanDirectory
();
}
});
}
};
setListAdapter
(
mAdapter
);
registerForContextMenu
(
getListView
());
}
@Override
public
void
onCreateContextMenu
(
ContextMenu
menu
,
View
v
,
ContextMenu
.
ContextMenuInfo
menuInfo
)
{
super
.
onCreateContextMenu
(
menu
,
v
,
menuInfo
);
menu
.
add
(
0
,
SYSTEM_LOG_ID
,
0
,
"System Log"
);
menu
.
add
(
0
,
CPU_ID
,
0
,
"CPU Info"
);
menu
.
add
(
0
,
MEMORY_ID
,
0
,
"Memory Info"
);
menu
.
add
(
0
,
PROCRANK_ID
,
0
,
"Procrank"
);
}
@Override
public
void
onStart
()
{
super
.
onStart
();
mObserver
.
startWatching
();
scanDirectory
();
}
@Override
public
void
onStop
()
{
super
.
onStop
();
mObserver
.
stopWatching
();
}
@Override
protected
void
onListItemClick
(
ListView
l
,
View
v
,
int
position
,
long
id
)
{
super
.
onListItemClick
(
l
,
v
,
position
,
id
);
if
(
position
<
mFiles
.
size
())
{
File
file
=
mFiles
.
get
(
position
);
Intent
intent
=
new
Intent
(
Intent
.
ACTION_SEND
);
intent
.
putExtra
(
"subject"
,
file
.
getName
());
intent
.
putExtra
(
"body"
,
"Build: "
+
Build
.
DISPLAY
+
"\n(Sent by BugReportSender)"
);
intent
.
putExtra
(
Intent
.
EXTRA_STREAM
,
Uri
.
fromFile
(
file
));
if
(
file
.
getName
().
endsWith
(
".gz"
))
{
intent
.
setType
(
"application/x-gzip"
);
}
else
if
(
file
.
getName
().
endsWith
(
".txt"
))
{
intent
.
setType
(
"text/plain"
);
}
else
{
intent
.
setType
(
"application/octet-stream"
);
}
startActivity
(
intent
);
}
}
@Override
public
boolean
onContextItemSelected
(
MenuItem
item
)
{
AdapterView
.
AdapterContextMenuInfo
info
=
(
AdapterView
.
AdapterContextMenuInfo
)
item
.
getMenuInfo
();
if
(
info
.
position
>=
mFiles
.
size
())
{
return
true
;
}
int
id
=
item
.
getItemId
();
switch
(
id
)
{
case
SYSTEM_LOG_ID:
// drop down
case
MEMORY_ID:
// drop down
case
CPU_ID:
// drop down
case
PROCRANK_ID:
File
file
=
mFiles
.
get
(
info
.
position
);
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
intent
.
setDataAndType
(
Uri
.
fromFile
(
file
),
"vnd.android/bugreport"
);
intent
.
putExtra
(
"section"
,
ID_MAP
.
get
(
id
));
startActivity
(
intent
);
return
true
;
default
:
return
super
.
onContextItemSelected
(
item
);
}
}
private
void
scanDirectory
()
{
mAdapter
.
clear
();
mFiles
.
clear
();
File
[]
files
=
REPORT_DIR
.
listFiles
();
if
(
files
==
null
)
return
;
// Sort in reverse order: newest bug reports first
Arrays
.
sort
(
files
,
Collections
.
reverseOrder
());
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
String
name
=
files
[
i
].
getName
();
if
(
name
.
endsWith
(
".gz"
))
name
=
name
.
substring
(
0
,
name
.
length
()
-
3
);
if
(!
name
.
startsWith
(
"bugreport-"
)
||
!
name
.
endsWith
(
".txt"
))
{
Log
.
w
(
TAG
,
"Ignoring non-bugreport: "
+
files
[
i
]);
continue
;
}
// Make sure to keep the parallel arrays in sync
mAdapter
.
add
(
name
.
substring
(
10
,
name
.
length
()
-
4
));
mFiles
.
add
(
files
[
i
]);
}
}
}
This diff is collapsed.
Click to expand it.
apps/BugReportSender/src/com/android/bugreportsender/BugReportParser.java
deleted
100644 → 0
View file @
a3916df8
package
com.android.bugreportsender
;
import
android.util.Log
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
/**
* Utility class for parsing a bugreport into its sections.
*/
public
final
class
BugReportParser
{
private
static
final
int
BUFFER_SIZE
=
8
*
1024
;
private
static
final
String
SECTION_HEADER
=
"------"
;
private
static
final
int
MAX_LINES
=
1000
;
// just in case we miss the end of the section.
// utility class
private
BugReportParser
()
{}
public
static
String
extractSystemLogs
(
InputStream
in
,
String
section
)
throws
IOException
{
final
String
sectionWithHeader
=
SECTION_HEADER
+
" "
+
section
;
StringBuilder
sb
=
new
StringBuilder
();
// open a reader around the provided inputstream.
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
in
,
"UTF-8"
),
BUFFER_SIZE
);
boolean
inSection
=
false
;
int
numLines
=
0
;
// read file contents. loop until we get to the appropriate section header.
// once we reach that header, accumulate all lines until we get to the next section.
String
line
=
null
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
if
(
inSection
)
{
// finish when we get to:
// -----
if
(
line
.
startsWith
(
SECTION_HEADER
)
||
(
numLines
>
MAX_LINES
))
{
break
;
}
sb
.
append
(
line
);
sb
.
append
(
"\n"
);
++
numLines
;
}
else
if
(
line
.
startsWith
(
sectionWithHeader
))
{
sb
.
append
(
line
);
sb
.
append
(
"\n"
);
inSection
=
true
;
}
}
return
sb
.
toString
();
}
}
This diff is collapsed.
Click to expand it.
apps/BugReportSender/src/com/android/bugreportsender/BugReportPreviewActivity.java
deleted
100644 → 0
View file @
a3916df8
package
com.android.bugreportsender
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.util.Config
;
import
android.util.Log
;
import
android.widget.TextView
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
/**
* Provides a scrolling text view previewing a named section of a
* bugreport.
*/
public
class
BugReportPreviewActivity
extends
Activity
{
private
static
final
String
TAG
=
"BugReportPreview"
;
private
TextView
mText
;
@Override
protected
void
onCreate
(
Bundle
icicle
)
{
super
.
onCreate
(
icicle
);
setContentView
(
com
.
android
.
bugreportsender
.
R
.
layout
.
bugreport_preview
);
mText
=
(
TextView
)
findViewById
(
R
.
id
.
preview
);
if
(
icicle
!=
null
&&
icicle
.
getString
(
"text"
)
!=
null
)
{
mText
.
setText
(
icicle
.
getString
(
"text"
));
}
else
{
Intent
intent
=
getIntent
();
if
(
intent
==
null
)
{
Log
.
w
(
TAG
,
"No intent provided."
);
return
;
}
Uri
uri
=
intent
.
getData
();
String
section
=
intent
.
getStringExtra
(
"section"
);
if
(
section
==
null
||
section
.
length
()
==
0
)
{
section
=
"SYSTEM LOG"
;
}
Log
.
d
(
TAG
,
"Loading "
+
uri
);
InputStream
in
=
null
;
try
{
// TODO: do this in a background thread, using handlers and all that nonsense.
in
=
getContentResolver
().
openInputStream
(
uri
);
String
text
=
BugReportParser
.
extractSystemLogs
(
in
,
section
);
mText
.
setText
(
text
);
}
catch
(
FileNotFoundException
fnfe
)
{
Log
.
w
(
TAG
,
"Unable to open file: "
+
uri
,
fnfe
);
mText
.
setText
(
"Unable to open file: "
+
uri
+
": "
+
fnfe
);
return
;
}
catch
(
IOException
ioe
)
{
Log
.
w
(
TAG
,
"Unable to process log."
,
ioe
);
mText
.
setText
(
"Unable to process log: "
+
ioe
);
return
;
}
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
ioe
)
{
// ignore
}
}
}
}
@Override
protected
void
onSaveInstanceState
(
Bundle
icicle
)
{
CharSequence
text
=
mText
.
getText
();
if
(
text
!=
null
)
{
icicle
.
putString
(
"text"
,
mText
.
getText
().
toString
());
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment