김가영

update

......@@ -6,6 +6,7 @@
</shared>
</component>
<component name="AndroidLogFilters">
<option name="TOOL_WINDOW_CUSTOM_FILTER" value="MYLOG" />
<option name="TOOL_WINDOW_LOG_LEVEL" value="info" />
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" />
</component>
......@@ -15,6 +16,7 @@
<change beforePath="$PROJECT_DIR$/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/AndroidManifest.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/dataextraction/LoadingActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/dataextraction/LoadingActivity.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/dataextraction/MainActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/dataextraction/MainActivity.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/res/layout/activity_loading.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/res/layout/activity_loading.xml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
......@@ -25,7 +27,7 @@
<component name="DefaultGradleProjectSettings">
<option name="isMigrated" value="true" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="ce12160cc327c64005" />
<component name="ExecutionTargetManager" SELECTED_TARGET="Pixel_2_API_28" />
<component name="ExternalProjectsManager">
<system id="GRADLE">
<state>
......@@ -62,12 +64,12 @@
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/AndroidManifest.xml">
<provider editor-type-id="android-manifest" />
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-76">
<caret line="11" column="80" selection-start-line="11" selection-start-column="80" selection-end-line="11" selection-end-column="80" />
<state relative-caret-position="76">
<caret line="4" lean-forward="true" selection-start-line="4" selection-end-line="4" />
</state>
</provider>
<provider editor-type-id="android-manifest" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
......@@ -91,8 +93,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/MainActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="366">
<caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
<state relative-caret-position="239">
<caret line="19" lean-forward="true" selection-start-line="19" selection-end-line="19" />
<folding>
<element signature="imports" expanded="true" />
</folding>
......@@ -101,32 +103,34 @@
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/LoadingActivity.java">
<entry file="file://$PROJECT_DIR$/src/main/res/layout/activity_loading.xml">
<provider editor-type-id="android-designer2" />
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="184" column="53" lean-forward="true" selection-start-line="184" selection-start-column="53" selection-end-line="184" selection-end-column="53" />
<folding>
<element signature="e#5574#8719#0" expanded="true" />
<element signature="e#8718#8719#0" expanded="true" />
</folding>
<state relative-caret-position="266">
<caret line="14" column="44" lean-forward="true" selection-start-line="14" selection-start-column="44" selection-end-line="14" selection-end-column="44" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/res/layout/activity_main.xml">
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/LoadingActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="21" selection-start-line="21" selection-end-line="21" />
<state relative-caret-position="-763">
<caret line="270" selection-start-line="270" selection-end-line="270" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
<provider editor-type-id="android-designer2" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/res/layout/activity_loading.xml">
<provider selected="true" editor-type-id="text-editor" />
<provider editor-type-id="android-designer2" />
<entry file="file://$USER_HOME$/AppData/Local/Android/Sdk/sources/android-28/java/io/BufferedReader.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="127">
<caret line="399" selection-start-line="399" selection-end-line="399" />
</state>
</provider>
</entry>
</file>
</leaf>
......@@ -142,6 +146,10 @@
<findStrings>
<find>tag</find>
<find>alert</find>
<find>startLoading</find>
<find>getPhoto</find>
<find>sdca</find>
<find>/mnt/sdcard</find>
</findStrings>
</component>
<component name="Git.Settings">
......@@ -153,9 +161,10 @@
<option value="$PROJECT_DIR$/src/main/res/xml/network_security_config.xml" />
<option value="$PROJECT_DIR$/src/main/res/layout/activity_main.xml" />
<option value="$PROJECT_DIR$/build.gradle" />
<option value="$PROJECT_DIR$/src/main/java/com/example/dataextraction/MainActivity.java" />
<option value="$PROJECT_DIR$/src/main/AndroidManifest.xml" />
<option value="$PROJECT_DIR$/src/main/res/layout/activity_loading.xml" />
<option value="$PROJECT_DIR$/src/main/java/com/example/dataextraction/LoadingActivity.java" />
<option value="$PROJECT_DIR$/src/main/java/com/example/dataextraction/MainActivity.java" />
</list>
</option>
</component>
......@@ -231,9 +240,9 @@
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="770" />
<option name="width" value="1159" />
<option name="height" value="1048" />
<option name="x" value="952" />
<option name="width" value="977" />
<option name="height" value="1038" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
......@@ -241,24 +250,20 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="ProjectPane" />
<pane id="Scope" />
<pane id="AndroidView">
<subPane>
<expand>
<path>
<item name="DataExtraction" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" />
</path>
<path>
<item name="DataExtraction" type="1abcf292:AndroidViewProjectNode" />
<item name="Gradle Scripts" type="ae0cef3a:AndroidBuildScriptsGroupNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -369,7 +374,7 @@
<frame x="-7" y="-7" width="1550" height="838" extended-state="6" />
<layout>
<window_info id="Captures" order="0" side_tool="true" weight="0.25" />
<window_info content_ui="combo" id="Project" order="1" visible="true" weight="0.020134227" />
<window_info content_ui="combo" id="Project" order="1" visible="true" weight="0.14899328" />
<window_info id="Structure" order="2" side_tool="true" />
<window_info id="Favorites" order="3" side_tool="true" />
<window_info id="Build Variants" order="4" side_tool="true" />
......@@ -377,14 +382,14 @@
<window_info id="Designer" order="6" />
<window_info id="Resources Explorer" order="7" />
<window_info id="Capture Tool" order="8" />
<window_info anchor="bottom" id="Run" order="0" sideWeight="0.49932885" weight="0.32907802" />
<window_info anchor="bottom" id="Logcat" order="1" sideWeight="0.49798658" weight="0.32056737" />
<window_info anchor="bottom" id="Run" order="0" sideWeight="0.49932885" weight="0.32765958" />
<window_info anchor="bottom" id="Logcat" order="1" sideWeight="0.49654377" weight="0.32056737" />
<window_info anchor="bottom" id="TODO" order="2" sideWeight="0.49932885" weight="0.32907802" />
<window_info anchor="bottom" id="Debug" order="3" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.32907802" />
<window_info anchor="bottom" id="Terminal" order="4" sideWeight="0.49932885" weight="0.32907802" />
<window_info anchor="bottom" id="Event Log" order="5" sideWeight="0.50201344" side_tool="true" weight="0.3219858" />
<window_info anchor="bottom" id="Event Log" order="5" sideWeight="0.50345623" side_tool="true" weight="0.3186969" />
<window_info anchor="bottom" id="Version Control" order="6" sideWeight="0.49932885" weight="0.32907802" />
<window_info anchor="bottom" id="Build" order="7" sideWeight="0.49932885" weight="0.32907802" />
<window_info anchor="bottom" id="Build" order="7" sideWeight="0.49932885" weight="0.3248227" />
<window_info anchor="bottom" id="Android Profiler" order="8" />
<window_info anchor="bottom" id="Find" order="9" />
<window_info anchor="right" id="Device File Explorer" order="0" sideWeight="0.6680761" side_tool="true" weight="0.3295302" />
......@@ -422,14 +427,26 @@
<window_info anchor="right" id="Palette&#9;" order="5" />
</layout-to-restore>
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/LoadingActivity.java</url>
<line>172</line>
<properties />
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/main/res/xml/network_security_config.xml">
<provider editor-type-id="android-designer2" />
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="76">
<caret line="4" column="26" selection-start-line="4" selection-start-column="26" selection-end-line="4" selection-end-column="26" />
</state>
</provider>
<provider editor-type-id="android-designer2" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/ContactDataBase.java">
<provider selected="true" editor-type-id="text-editor">
......@@ -503,6 +520,15 @@
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Documents/AndroidStudio/DeviceExplorer/samsung-sm_g950n-ce12160cc327c64005/sdcard/TestLog/logfile.txt" />
<entry file="file://$PROJECT_DIR$/src/main/res/layout/activity_main.xml">
<provider editor-type-id="android-designer2" />
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="21" selection-start-line="21" selection-end-line="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="513">
......@@ -524,47 +550,46 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/res/layout/activity_main.xml">
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/MainActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="21" selection-start-line="21" selection-end-line="21" />
<state relative-caret-position="239">
<caret line="19" lean-forward="true" selection-start-line="19" selection-end-line="19" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
<provider editor-type-id="android-designer2" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/res/layout/activity_loading.xml">
<provider selected="true" editor-type-id="text-editor" />
<provider editor-type-id="android-designer2" />
<entry file="file://$USER_HOME$/AppData/Local/Android/Sdk/sources/android-28/java/io/BufferedReader.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="127">
<caret line="399" selection-start-line="399" selection-end-line="399" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/AndroidManifest.xml">
<provider editor-type-id="android-manifest" />
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-76">
<caret line="11" column="80" selection-start-line="11" selection-start-column="80" selection-end-line="11" selection-end-column="80" />
<state relative-caret-position="76">
<caret line="4" lean-forward="true" selection-start-line="4" selection-end-line="4" />
</state>
</provider>
<provider editor-type-id="android-manifest" />
</entry>
<entry file="file://$USER_HOME$/Documents/AndroidStudio/DeviceExplorer/samsung-sm_g950n-ce12160cc327c64005/sdcard/TestLog/logfile.txt">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/MainActivity.java">
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/LoadingActivity.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="366">
<caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
<state relative-caret-position="-763">
<caret line="270" selection-start-line="270" selection-end-line="270" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/LoadingActivity.java">
<entry file="file://$PROJECT_DIR$/src/main/res/layout/activity_loading.xml">
<provider editor-type-id="android-designer2" />
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="184" column="53" lean-forward="true" selection-start-line="184" selection-start-column="53" selection-end-line="184" selection-end-column="53" />
<folding>
<element signature="e#5574#8719#0" expanded="true" />
<element signature="e#8718#8719#0" expanded="true" />
</folding>
<state relative-caret-position="266">
<caret line="14" column="44" lean-forward="true" selection-start-line="14" selection-start-column="44" selection-end-line="14" selection-end-column="44" />
</state>
</provider>
</entry>
......
......@@ -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>
......
......@@ -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,8 +160,107 @@ public class LoadingActivity extends Activity {
return false;
}
public void makeTXT(String content){
public void makeFile(StringBuffer output, String filename) {
try {
String response = output.toString();
Log.i("MYLOG", response);
String foldername = "/mnt/sdcard/TempTEMP";
Log.i("MYLOG", foldername);
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();
}
}
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() {
......@@ -163,48 +268,16 @@ public class LoadingActivity extends Activity {
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();
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");
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));
......
......@@ -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
......