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-11 21:31:37 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
637c2653a3c3d8f655091f8cb73c76d79fb2d720
637c2653
1 parent
cef5ee06
add function adb command to txt file
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
3 deletions
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/java/com/example/dataextraction/MainActivity.java
source/app/app/.idea/workspace.xml
View file @
637c265
This diff is collapsed. Click to expand it.
source/app/app/src/main/AndroidManifest.xml
View file @
637c265
...
...
@@ -20,7 +20,6 @@
<uses-permission
android:name=
"android.permission.READ_PHONE_NUMBERS"
/>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.READ_USER_DICTIONARY"
/>
<application
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
...
...
source/app/app/src/main/java/com/example/dataextraction/LoadingActivity.java
View file @
637c265
...
...
@@ -5,6 +5,7 @@ import android.Manifest;
import
android.accounts.Account
;
import
android.accounts.AccountManager
;
import
android.app.Activity
;
import
android.app.ActivityManager
;
import
android.app.AppOpsManager
;
import
android.app.usage.NetworkStats
;
import
android.app.usage.NetworkStatsManager
;
...
...
@@ -41,8 +42,12 @@ import android.util.Log;
import
android.widget.Toast
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.net.InetAddress
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
...
...
@@ -149,6 +154,10 @@ public class LoadingActivity extends Activity {
return
false
;
}
public
void
makeTXT
(
String
content
){
}
private
void
startLoading
()
{
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
...
...
@@ -156,6 +165,43 @@ public class LoadingActivity extends Activity {
public
void
run
()
{
dbHelper
=
new
DBHelper
(
getApplicationContext
());
dbHelper
.
open
();
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"
;
Log
.
i
(
"MYLOG"
,
foldername
);
String
filename
=
"logfile.txt"
;
File
dir
=
new
File
(
foldername
);
//디렉토리 폴더가 없으면 생성함
if
(!
dir
.
exists
()){
dir
.
mkdir
();
}
//파일 output stream 생성
FileOutputStream
fos
=
new
FileOutputStream
(
foldername
+
"/"
+
filename
,
true
);
//파일쓰기
BufferedWriter
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
fos
));
writer
.
write
(
response
);
writer
.
flush
();
writer
.
close
();
fos
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
getPhoto
();
//alert("alert","photo");
Log
.
i
(
"MYLOG"
,
"DB HY Part:1/14"
);
...
...
source/app/app/src/main/java/com/example/dataextraction/MainActivity.java
View file @
637c265
...
...
@@ -18,8 +18,8 @@ public class MainActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
copyFile
(
"/data/data/com.example.dataextraction/databases/"
,
"InnerDatabase.db"
,
"/s
torage/UsbDriveA
/InnerDatabase.db"
);
copyFile
(
"/data/data/com.example.dataextraction/databases/"
,
"networkDatabase.db"
,
"/s
torage/UsbDriveA
/networkDatabase.db"
);
copyFile
(
"/data/data/com.example.dataextraction/databases/"
,
"InnerDatabase.db"
,
"/s
dcard/TestLog
/InnerDatabase.db"
);
copyFile
(
"/data/data/com.example.dataextraction/databases/"
,
"networkDatabase.db"
,
"/s
dcard/TestLog
/networkDatabase.db"
);
}
private
void
copyFile
(
String
inputPath
,
String
inputFile
,
String
outputPath
)
{
...
...
Please
register
or
login
to post a comment