김가영

add function adb command to txt file

......@@ -25,7 +25,7 @@
<component name="DefaultGradleProjectSettings">
<option name="isMigrated" value="true" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="Pixel_2_API_28" />
<component name="ExecutionTargetManager" SELECTED_TARGET="ce12160cc327c64005" />
<component name="ExternalProjectsManager">
<system id="GRADLE">
<state>
......@@ -37,7 +37,12 @@
</task>
<projects_view>
<tree_state>
<expand />
<expand>
<path>
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
<item name="DataExtraction" type="f1a62948:ProjectNode" />
</path>
</expand>
<select />
</tree_state>
</projects_view>
......@@ -59,8 +64,8 @@
<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="207">
<caret line="38" column="71" selection-start-line="38" selection-start-column="71" selection-end-line="38" selection-end-column="71" />
<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>
</provider>
</entry>
......@@ -83,11 +88,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<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="342">
<caret line="20" column="110" selection-start-line="20" selection-start-column="110" selection-end-line="20" selection-end-column="110" />
<state relative-caret-position="366">
<caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
<folding>
<element signature="imports" expanded="true" />
</folding>
......@@ -95,11 +100,15 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<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="14193">
<caret line="813" column="26" selection-start-line="813" selection-start-column="21" selection-end-line="813" selection-end-column="26" />
<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>
</provider>
</entry>
......@@ -143,8 +152,8 @@
<list>
<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$/src/main/AndroidManifest.xml" />
<option value="$PROJECT_DIR$/build.gradle" />
<option value="$PROJECT_DIR$/src/main/AndroidManifest.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>
......@@ -222,9 +231,9 @@
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="952" />
<option name="width" value="977" />
<option name="height" value="1038" />
<option name="x" value="770" />
<option name="width" value="1159" />
<option name="height" value="1048" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
......@@ -232,20 +241,24 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane" />
<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">
......@@ -356,7 +369,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.13892618" />
<window_info content_ui="combo" id="Project" order="1" visible="true" weight="0.020134227" />
<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" />
......@@ -365,7 +378,7 @@
<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" visible="true" weight="0.3219858" />
<window_info anchor="bottom" id="Logcat" order="1" sideWeight="0.49798658" 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="Terminal" order="4" sideWeight="0.49932885" weight="0.32907802" />
......@@ -374,9 +387,9 @@
<window_info anchor="bottom" id="Build" order="7" sideWeight="0.49932885" weight="0.32907802" />
<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" side_tool="true" weight="0.74630874" />
<window_info anchor="right" id="Device File Explorer" order="0" sideWeight="0.6680761" side_tool="true" weight="0.3295302" />
<window_info anchor="right" id="Capture Analysis" order="1" />
<window_info anchor="right" id="Gradle" order="2" weight="0.3295302" />
<window_info anchor="right" id="Gradle" order="2" sideWeight="0.3319239" weight="0.3295302" />
<window_info anchor="right" id="Theme Preview" order="3" />
<window_info anchor="right" id="Preview" order="4" />
<window_info anchor="right" id="Palette&#9;" order="5" />
......@@ -476,6 +489,27 @@
<entry file="file://$USER_HOME$/AppData/Local/Android/Sdk/sources/android-29/android/provider/Browser.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$USER_HOME$/AppData/Local/Android/Sdk/sources/android-29/android/content/Context.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="223">
<caret line="4748" column="24" selection-start-line="4748" selection-start-column="24" selection-end-line="4748" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/AppData/Local/Android/Sdk/sources/android-29/android/content/ContextWrapper.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="777" column="43" selection-start-line="777" selection-start-column="43" selection-end-line="777" selection-end-column="43" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="513">
<caret line="27" column="60" selection-start-line="27" selection-start-column="60" selection-end-line="27" selection-end-column="60" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/example/dataextraction/SMSDataBase.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="76">
......@@ -505,45 +539,31 @@
<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="207">
<caret line="38" column="71" selection-start-line="38" selection-start-column="71" selection-end-line="38" selection-end-column="71" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/AppData/Local/Android/Sdk/sources/android-29/android/content/Context.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="223">
<caret line="4748" column="24" selection-start-line="4748" selection-start-column="24" selection-end-line="4748" selection-end-column="24" />
<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>
</provider>
</entry>
<entry file="file://$USER_HOME$/AppData/Local/Android/Sdk/sources/android-29/android/content/ContextWrapper.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="777" column="43" selection-start-line="777" selection-start-column="43" selection-end-line="777" selection-end-column="43" />
</state>
</provider>
<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$/build.gradle">
<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="513">
<caret line="27" column="60" selection-start-line="27" selection-start-column="60" selection-end-line="27" selection-end-column="60" />
<state relative-caret-position="366">
<caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<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="14193">
<caret line="813" column="26" selection-start-line="813" selection-start-column="21" selection-end-line="813" selection-end-column="26" />
</state>
</provider>
</entry>
<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="342">
<caret line="20" column="110" selection-start-line="20" selection-start-column="110" selection-end-line="20" selection-end-column="110" />
<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="imports" expanded="true" />
<element signature="e#5574#8719#0" expanded="true" />
<element signature="e#8718#8719#0" expanded="true" />
</folding>
</state>
</provider>
......
......@@ -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"
......
......@@ -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");
......
......@@ -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", "/storage/UsbDriveA/InnerDatabase.db");
copyFile("/data/data/com.example.dataextraction/databases/", "networkDatabase.db", "/storage/UsbDriveA/networkDatabase.db");
copyFile("/data/data/com.example.dataextraction/databases/", "InnerDatabase.db", "/sdcard/TestLog/InnerDatabase.db");
copyFile("/data/data/com.example.dataextraction/databases/", "networkDatabase.db", "/sdcard/TestLog/networkDatabase.db");
}
private void copyFile(String inputPath, String inputFile, String outputPath) {
......