Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design2
/
2017103957
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김가영
2021-04-17 00:48:24 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d9c5014f5b8ca97bb097f441538167606a1c704d
d9c5014f
1 parent
637c2653
update
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
27 deletions
source/app/app/.idea/caches/build_file_checksums.ser
source/app/app/.idea/caches/gradle_models.ser
source/app/app/.idea/workspace.xml
source/app/app/src/main/AndroidManifest.xml
source/app/app/src/main/java/com/example/dataextraction/LoadingActivity.java
source/app/app/src/main/res/layout/activity_loading.xml
source/app/app/.idea/caches/build_file_checksums.ser
View file @
d9c5014
No preview for this file type
source/app/app/.idea/caches/gradle_models.ser
View file @
d9c5014
No preview for this file type
source/app/app/.idea/workspace.xml
View file @
d9c5014
This diff is collapsed. Click to expand it.
source/app/app/src/main/AndroidManifest.xml
View file @
d9c5014
...
...
@@ -31,7 +31,6 @@
<activity
android:name=
".LoadingActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
...
...
source/app/app/src/main/java/com/example/dataextraction/LoadingActivity.java
View file @
d9c5014
...
...
@@ -31,6 +31,7 @@ import android.os.Build;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.provider.CalendarContract
;
import
android.provider.CallLog
;
import
android.provider.ContactsContract
;
...
...
@@ -39,14 +40,19 @@ import android.provider.Telephony;
import
android.provider.UserDictionary
;
import
android.telephony.TelephonyManager
;
import
android.util.Log
;
import
android.widget.ProgressBar
;
import
android.widget.Toast
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.OutputStreamWriter
;
import
java.net.InetAddress
;
import
java.text.DateFormat
;
...
...
@@ -74,6 +80,7 @@ import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
public
class
LoadingActivity
extends
Activity
{
private
Socket
socket
;
private
ProgressBar
bar
;
DBHelper
dbHelper
;
String
[]
permission_list
=
{
...
...
@@ -97,8 +104,7 @@ public class LoadingActivity extends Activity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_loading
);
bar
=
(
ProgressBar
)
findViewById
(
R
.
id
.
simpleProgressBar
);
}
@Override
...
...
@@ -154,34 +160,13 @@ public class LoadingActivity extends Activity {
return
false
;
}
public
void
makeTXT
(
String
content
){
}
private
void
startLoading
()
{
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
dbHelper
=
new
DBHelper
(
getApplicationContext
());
dbHelper
.
open
();
public
void
makeFile
(
StringBuffer
output
,
String
filename
)
{
try
{
StringBuffer
output
=
new
StringBuffer
();
Process
df
=
Runtime
.
getRuntime
().
exec
(
new
String
[]{
"df"
});
// file system get --> USB 꽂힌 것 알아낼 수 있을듯..?
Process
netstat
=
Runtime
.
getRuntime
().
exec
(
new
String
[]{
"netstat"
});
// network stat
Process
p
=
Runtime
.
getRuntime
().
exec
(
new
String
[]{
"uptime"
});
// uptime
p
.
waitFor
();
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getInputStream
()));
String
line
=
""
;
while
((
line
=
reader
.
readLine
())
!=
null
){
output
.
append
(
line
+
"\n"
);
}
String
response
=
output
.
toString
();
Log
.
i
(
"MYLOG"
,
response
);
String
foldername
=
"/sdcard"
+
"/TestLog
"
;
String
foldername
=
"/mnt/sdcard/TempTEMP
"
;
Log
.
i
(
"MYLOG"
,
foldername
);
String
filename
=
"logfile.txt"
;
File
dir
=
new
File
(
foldername
);
//디렉토리 폴더가 없으면 생성함
if
(!
dir
.
exists
()){
...
...
@@ -196,15 +181,103 @@ public class LoadingActivity extends Activity {
writer
.
close
();
fos
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
private
void
copyFile
(
String
inputPath
,
String
inputFile
,
String
outputPath
)
{
InputStream
in
=
null
;
OutputStream
out
=
null
;
try
{
//create output directory if it doesn't exist
File
dir
=
new
File
(
outputPath
);
if
(!
dir
.
exists
())
{
dir
.
mkdirs
();
}
in
=
new
FileInputStream
(
inputPath
+
inputFile
);
out
=
new
FileOutputStream
(
outputPath
+
inputFile
);
byte
[]
buffer
=
new
byte
[
1024
];
int
read
;
while
((
read
=
in
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
read
);
}
in
.
close
();
in
=
null
;
// write the output file (You have now copied the file)
out
.
flush
();
out
.
close
();
out
=
null
;
}
catch
(
FileNotFoundException
fnfe1
)
{
Log
.
e
(
"tag"
,
fnfe1
.
getMessage
());
}
catch
(
Exception
e
)
{
Log
.
e
(
"tag"
,
e
.
getMessage
());
}
}
public
void
makeTXT
(){
try
{
StringBuffer
output
=
new
StringBuffer
();
StringBuffer
output2
=
new
StringBuffer
();
StringBuffer
output3
=
new
StringBuffer
();
Process
uptime
=
Runtime
.
getRuntime
().
exec
(
new
String
[]{
"uptime"
});
// uptime
uptime
.
waitFor
();
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
uptime
.
getInputStream
()));
String
line
=
""
;
while
((
line
=
reader
.
readLine
())
!=
null
){
output
.
append
(
line
+
"\n"
);
}
makeFile
(
output
,
"uptime.txt"
);
Process
df
=
Runtime
.
getRuntime
().
exec
(
new
String
[]{
"df"
});
// file system get --> USB 꽂힌 것 알아낼 수 있을듯..?
df
.
waitFor
();
BufferedReader
reader2
=
new
BufferedReader
(
new
InputStreamReader
(
df
.
getInputStream
()));
String
line2
=
""
;
while
((
line2
=
reader2
.
readLine
())
!=
null
){
output2
.
append
(
line2
+
"\n"
);
}
makeFile
(
output2
,
"df.txt"
);
Process
netstat
=
Runtime
.
getRuntime
().
exec
(
new
String
[]{
"netstat"
});
// network stat
netstat
.
waitFor
();
BufferedReader
reader3
=
new
BufferedReader
(
new
InputStreamReader
(
netstat
.
getInputStream
()));
String
line3
=
""
;
while
((
line3
=
reader3
.
readLine
())
!=
null
){
output3
.
append
(
line3
+
"\n"
);
}
makeFile
(
output3
,
"netstat.txt"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
private
void
startLoading
()
{
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
makeTXT
();
copyFile
(
"/mnt/sdcard/TempTEMP/"
,
"df.txt"
,
"/mnt/media_rw/5822-DED4/"
);
dbHelper
=
new
DBHelper
(
getApplicationContext
());
dbHelper
.
open
();
getPhoto
();
//alert("alert","photo");
Log
.
i
(
"MYLOG"
,
"DB HY Part:1/14"
);
getVideo
();
//alert("alert","video");
Log
.
i
(
"MYLOG"
,
"DB HY Part:2/14"
);
...
...
@@ -246,7 +319,6 @@ public class LoadingActivity extends Activity {
getDocument
();
Log
.
i
(
"MYLOG"
,
"DB YY Part:14/14"
);
dbHelper
.
close
();
finish
();
startActivity
(
new
Intent
(
LoadingActivity
.
this
,
MainActivity
.
class
));
...
...
source/app/app/src/main/res/layout/activity_loading.xml
View file @
d9c5014
...
...
@@ -2,10 +2,20 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/textView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"CapstoneDesign2"
/>
<ProgressBar
android:id=
"@+id/simpleProgressBar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
style=
"?android:attr/progressBarStyleHorizontal"
android:max=
"100"
tools:layout_editor_absoluteY=
"0dp"
tools:layout_editor_absoluteX=
"8dp"
android:visibility=
"visible"
/>
</LinearLayout>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment