├── FileReader
├── app
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── layout
│ │ │ │ │ └── activity_main.xml
│ │ │ │ ├── drawable-v24
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ └── drawable
│ │ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ │ └── website
│ │ │ │ └── jace
│ │ │ │ └── filereader
│ │ │ │ └── MainActivity.java
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── website
│ │ │ │ └── jace
│ │ │ │ └── filereader
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── website
│ │ │ └── jace
│ │ │ └── filereader
│ │ │ └── ExampleInstrumentedTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── settings.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── build.gradle
├── gradle.properties
├── gradlew.bat
├── gradlew
└── .gitignore
├── FileAccessMonitor
├── app
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ ├── ic_folder_search.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── drawable-hdpi
│ │ │ │ │ ├── ic_build_white_24dp.png
│ │ │ │ │ ├── ic_delete_black_24dp.png
│ │ │ │ │ └── ic_save_white_24dp.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ │ ├── ic_build_white_24dp.png
│ │ │ │ │ ├── ic_delete_black_24dp.png
│ │ │ │ │ └── ic_save_white_24dp.png
│ │ │ │ ├── drawable-xhdpi
│ │ │ │ │ ├── ic_build_white_24dp.png
│ │ │ │ │ ├── ic_save_white_24dp.png
│ │ │ │ │ └── ic_delete_black_24dp.png
│ │ │ │ ├── drawable-xxhdpi
│ │ │ │ │ ├── ic_save_white_24dp.png
│ │ │ │ │ ├── ic_build_white_24dp.png
│ │ │ │ │ └── ic_delete_black_24dp.png
│ │ │ │ ├── drawable-xxxhdpi
│ │ │ │ │ ├── ic_build_white_24dp.png
│ │ │ │ │ ├── ic_save_white_24dp.png
│ │ │ │ │ └── ic_delete_black_24dp.png
│ │ │ │ ├── values-v21
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── values
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── dimens.xml
│ │ │ │ │ ├── styles.xml
│ │ │ │ │ └── strings.xml
│ │ │ │ ├── drawable
│ │ │ │ │ ├── side_nav_bar.xml
│ │ │ │ │ ├── ic_menu_send.xml
│ │ │ │ │ ├── ic_menu_slideshow.xml
│ │ │ │ │ ├── ic_menu_gallery.xml
│ │ │ │ │ ├── ic_menu_manage.xml
│ │ │ │ │ ├── ic_menu_camera.xml
│ │ │ │ │ ├── ic_menu_share.xml
│ │ │ │ │ └── ic_launcher_background.xml
│ │ │ │ ├── menu
│ │ │ │ │ ├── main.xml
│ │ │ │ │ └── activity_main_drawer.xml
│ │ │ │ ├── layout
│ │ │ │ │ ├── list_item.xml
│ │ │ │ │ ├── list_group.xml
│ │ │ │ │ ├── content_main.xml
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ ├── activity_rules.xml
│ │ │ │ │ ├── rule_row.xml
│ │ │ │ │ ├── app_bar_main.xml
│ │ │ │ │ ├── nav_header_main.xml
│ │ │ │ │ └── activity_settings.xml
│ │ │ │ └── drawable-v24
│ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── java
│ │ │ │ └── website
│ │ │ │ │ └── jace
│ │ │ │ │ └── fileaccessmonitor
│ │ │ │ │ ├── AppIdModel.java
│ │ │ │ │ ├── services
│ │ │ │ │ ├── JNILogFetchingService.java
│ │ │ │ │ └── KernLogFetchingService.java
│ │ │ │ │ ├── RuleModel.java
│ │ │ │ │ ├── dataItem
│ │ │ │ │ ├── JNIDataItem.java
│ │ │ │ │ ├── KernDataItem.java
│ │ │ │ │ └── DataItem.java
│ │ │ │ │ ├── RulesAdapter.java
│ │ │ │ │ ├── MyExpandableListAdapter.java
│ │ │ │ │ ├── Data.java
│ │ │ │ │ ├── RulesActivity.java
│ │ │ │ │ ├── SettingsActivity.java
│ │ │ │ │ └── MainActivity.java
│ │ │ └── AndroidManifest.xml
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── website
│ │ │ │ └── jace
│ │ │ │ └── fileaccessmonitor
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── website
│ │ │ └── jace
│ │ │ └── fileaccessmonitor
│ │ │ └── ExampleInstrumentedTest.java
│ ├── proguard-rules.pro
│ └── build.gradle
├── settings.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── build.gradle
├── gradle.properties
├── gradlew.bat
├── .gitignore
└── gradlew
├── docs
├── paper.pdf
├── fig-byapp.jpg
├── fig-byfiletype.jpg
└── android-file-access.jpg
└── README.md
/FileReader/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/FileReader/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/FileAccessMonitor/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/docs/paper.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/docs/paper.pdf
--------------------------------------------------------------------------------
/docs/fig-byapp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/docs/fig-byapp.jpg
--------------------------------------------------------------------------------
/docs/fig-byfiletype.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/docs/fig-byfiletype.jpg
--------------------------------------------------------------------------------
/docs/android-file-access.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/docs/android-file-access.jpg
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FileReader
3 |
4 |
--------------------------------------------------------------------------------
/FileReader/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/FileAccessMonitor/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileReader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-hdpi/ic_folder_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-hdpi/ic_folder_search.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-hdpi/ic_build_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-hdpi/ic_build_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-hdpi/ic_delete_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-hdpi/ic_delete_black_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-hdpi/ic_save_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-hdpi/ic_save_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-mdpi/ic_build_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-mdpi/ic_build_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-mdpi/ic_delete_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-mdpi/ic_delete_black_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-mdpi/ic_save_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-mdpi/ic_save_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xhdpi/ic_build_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xhdpi/ic_build_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xhdpi/ic_save_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xhdpi/ic_save_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xxhdpi/ic_save_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xxhdpi/ic_save_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xhdpi/ic_delete_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xhdpi/ic_delete_black_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xxhdpi/ic_build_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xxhdpi/ic_build_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xxhdpi/ic_delete_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xxhdpi/ic_delete_black_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xxxhdpi/ic_build_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xxxhdpi/ic_build_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xxxhdpi/ic_save_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xxxhdpi/ic_save_white_24dp.png
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yjlcoder/Android-file-access-monitor/HEAD/FileAccessMonitor/app/src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.png
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/FileReader/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Apr 05 13:40:43 MDT 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
7 |
--------------------------------------------------------------------------------
/FileAccessMonitor/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Mar 24 16:02:40 MDT 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #FF0000
7 | #000000
8 |
9 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 176dp
7 | 16dp
8 |
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/FileReader/app/src/test/java/website/jace/filereader/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package website.jace.filereader;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/test/java/website/jace/fileaccessmonitor/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android File Access Monitor
2 |
3 | This Android application helps you monitor all files accesses in your Android phone. This program only works with a custom kernel. The patch is located at [Github Gist](https://gist.github.com/Yjlcoder/9fd78d7b3f78776233205397ca03c99f).
4 |
5 | Read the full paper [here](docs/paper.pdf)
6 |
7 | # How files are accessed in Android system
8 |
9 | 
10 |
11 | # Interface
12 |
13 | ## By app
14 | 
15 |
16 | ## By file type
17 | 
18 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/list_group.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
14 |
15 |
--------------------------------------------------------------------------------
/FileAccessMonitor/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/FileReader/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 |
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.0'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 |
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/FileAccessMonitor/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/FileReader/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/FileReader/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/FileReader/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
--------------------------------------------------------------------------------
/FileReader/app/src/androidTest/java/website/jace/filereader/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package website.jace.filereader;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("website.jace.filereader", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/androidTest/java/website/jace/fileaccessmonitor/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("website.jace.fileaccessmonitor", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FileAccessMonitor
3 | Open navigation drawer
4 | Close navigation drawer
5 | Yang Liu
6 | yang.liu5@ucalgary.ca
7 | Navigation header
8 | Settings
9 | Settings Activity
10 | Service is not running
11 | Service is running
12 | Start Service
13 | Stop Service
14 | Kernel Log Tracking Service
15 | JNI Log Tracking Service
16 | Edit Rules
17 |
18 |
--------------------------------------------------------------------------------
/FileReader/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "website.jace.filereader"
7 | minSdkVersion 24
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:28.0.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28 | }
29 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/AppIdModel.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | public class AppIdModel implements Comparable {
6 | String appName;
7 | String packageName;
8 | int uid;
9 |
10 | public AppIdModel(int uid, String packageName, String appName) {
11 | this.uid = uid;
12 | this.appName = appName;
13 | this.packageName = packageName;
14 | }
15 |
16 | @Override
17 | public String toString() {
18 | return appName;
19 | }
20 |
21 | @Override
22 | public int compareTo(@NonNull Object o) {
23 | if (o.getClass() != AppIdModel.class) return -1;
24 | else {
25 | AppIdModel other = (AppIdModel) o;
26 | return appName.compareTo(other.appName);
27 | }
28 | }
29 |
30 | @Override
31 | public boolean equals(Object obj) {
32 | if (obj.getClass() != AppIdModel.class) {
33 | return false;
34 | }
35 | AppIdModel other = (AppIdModel) obj;
36 | return other.uid == this.uid;
37 | }
38 | }
39 |
40 |
41 |
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/activity_rules.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
15 |
16 |
25 |
26 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "website.jace.fileaccessmonitor"
7 | minSdkVersion 21
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | compileOptions {
20 | targetCompatibility 1.8
21 | sourceCompatibility 1.8
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | implementation 'com.android.support:appcompat-v7:28.0.0'
28 | implementation 'com.android.support:support-v4:28.0.0'
29 | implementation 'com.android.support:design:28.0.0'
30 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
31 | testImplementation 'junit:junit:4.12'
32 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
34 | }
35 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/rule_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
20 |
21 |
28 |
29 |
35 |
36 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/services/JNILogFetchingService.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor.services;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.Binder;
6 | import android.os.IBinder;
7 | import android.support.annotation.Nullable;
8 |
9 | import java.io.BufferedReader;
10 | import java.io.DataOutputStream;
11 | import java.io.IOException;
12 | import java.io.InputStreamReader;
13 |
14 | public class JNILogFetchingService extends Service {
15 | private final IBinder binder = new MyBinder();
16 | private Process p;
17 |
18 | @Nullable
19 | @Override
20 | public IBinder onBind(Intent intent) {
21 | return binder;
22 | }
23 |
24 | @Override
25 | public int onStartCommand(Intent intent, int flags, int startId) {
26 | int ret = super.onStartCommand(intent, flags, startId);
27 |
28 | try {
29 | this.p = Runtime.getRuntime().exec("su");
30 | DataOutputStream out = new DataOutputStream(this.p.getOutputStream());
31 | out.writeBytes("/system/bin/logcat | grep --line-buffered YANG >> /sdcard/log/jni.log\n");
32 | out.flush();
33 | } catch (IOException e) {
34 | e.printStackTrace();
35 | }
36 |
37 | return ret;
38 | }
39 |
40 | public class MyBinder extends Binder {
41 | public JNILogFetchingService getService() {
42 | return JNILogFetchingService.this;
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/FileReader/app/src/main/java/website/jace/filereader/MainActivity.java:
--------------------------------------------------------------------------------
1 | package website.jace.filereader;
2 |
3 | import android.os.Environment;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.widget.TextView;
7 |
8 | import java.io.BufferedReader;
9 | import java.io.FileNotFoundException;
10 | import java.io.FileReader;
11 | import java.io.IOException;
12 |
13 | public class MainActivity extends AppCompatActivity {
14 | private TextView textView = null;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_main);
20 |
21 | textView = findViewById(R.id.textview);
22 | StringBuffer somethingToWrite = new StringBuffer();
23 |
24 | try{
25 | BufferedReader reader = new BufferedReader(new FileReader(Environment.getExternalStorageDirectory() + "test/file.txt"));
26 | while(reader.ready()) {
27 | somethingToWrite.append(reader.readLine());
28 | somethingToWrite.append('\n');
29 | }
30 | reader.close();
31 | } catch (FileNotFoundException e) {
32 | somethingToWrite = new StringBuffer("Cannot find the file");
33 | e.printStackTrace();
34 | } catch (IOException e) {
35 | somethingToWrite = new StringBuffer("IOException");
36 | e.printStackTrace();
37 | }
38 |
39 | textView.setText(somethingToWrite.toString());
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/services/KernLogFetchingService.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor.services;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.Binder;
6 | import android.os.IBinder;
7 | import android.support.annotation.Nullable;
8 |
9 | import java.io.DataOutputStream;
10 | import java.io.IOException;
11 |
12 | public class KernLogFetchingService extends Service {
13 | private final IBinder binder = new MyBinder();
14 | private Process p = null;
15 |
16 | @Nullable
17 | @Override
18 | public IBinder onBind(Intent intent) {
19 | return binder;
20 | }
21 |
22 | @Override
23 | public int onStartCommand(Intent intent, int flags, int startId) {
24 | int ret = super.onStartCommand(intent, flags, startId);
25 |
26 | try {
27 | this.p = Runtime.getRuntime().exec("su");
28 | DataOutputStream out = new DataOutputStream(p.getOutputStream());
29 | out.writeBytes("/system/bin/dmesg -w | grep --line-buffered YANG >> /sdcard/log/kern.log\n");
30 | out.flush();
31 | } catch (IOException e) {
32 | e.printStackTrace();
33 | }
34 |
35 | return ret;
36 | }
37 |
38 | public class MyBinder extends Binder {
39 | public KernLogFetchingService getService() {
40 | return KernLogFetchingService.this;
41 | }
42 | }
43 |
44 | @Override
45 | public void onDestroy() {
46 | if(p != null) p.destroy();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/RuleModel.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | public class RuleModel {
4 |
5 | private String path;
6 | private String realPath;
7 | private AppIdModel appId;
8 |
9 | public RuleModel(String appName, String packageName, int uid, String path, String realPath) {
10 | this.appId = new AppIdModel(uid, packageName, appName);
11 | this.path = path;
12 | this.realPath = realPath;
13 | }
14 |
15 | public String getAppName() {
16 | return appId.appName;
17 | }
18 |
19 | public String getPackageName() {
20 | return appId.packageName;
21 | }
22 |
23 | public String getPath() {
24 | return path;
25 | }
26 |
27 | public String getRealPath() {
28 | return realPath;
29 | }
30 |
31 | public int getUid() {
32 | return appId.uid;
33 | }
34 |
35 | public void setAppName(String appName) {
36 | this.appId.appName = appName;
37 | }
38 |
39 | public void setPackageName(String packageName) {
40 | this.appId.packageName = packageName;
41 | }
42 |
43 | public void setPath(String path) {
44 | this.path = path;
45 | }
46 |
47 | public void setRealPath(String realPath) {
48 | this.realPath = realPath;
49 | }
50 |
51 | public void setUid(int uid) {
52 | this.appId.uid = uid;
53 | }
54 |
55 | public AppIdModel getAppId() {
56 | return appId;
57 | }
58 |
59 | public void setAppId(AppIdModel appId) {
60 | this.appId = appId;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
23 |
24 |
30 |
31 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/dataItem/JNIDataItem.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor.dataItem;
2 |
3 | import java.text.ParseException;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Date;
6 | import java.util.Map;
7 | import java.util.regex.Matcher;
8 | import java.util.regex.Pattern;
9 |
10 | public class JNIDataItem extends DataItem {
11 | private final static String TIMEFORMAT_STRING = "yyyy-MM-dd HH:mm:ss";
12 | private final static String PATTERN_STR = "^[\\s\\S]+YANG:\\s\\[(\\d+\\-\\d+\\-\\d+ \\d+:\\d+:\\d+)]\\s<(\\d+)>\\sOpen file\\s(\\S+)$";
13 | public final static Pattern PATTERN = Pattern.compile(PATTERN_STR);
14 | private final static SimpleDateFormat TIMEFORMAT = new SimpleDateFormat(TIMEFORMAT_STRING);
15 |
16 | public JNIDataItem(String logItem, Map packageList) {
17 | super(logItem, packageList);
18 | initialize(logItem, packageList);
19 | }
20 |
21 | @Override
22 | protected void initialize(String logItem, Map packageList) {
23 | Matcher matcher = PATTERN.matcher(logItem);
24 | if (matcher.find()) {
25 | String datetimeString = matcher.group(1);
26 | int uid = Integer.valueOf(matcher.group(2));
27 | String accessPath = matcher.group(3);
28 | String pack = packageList.get(uid);
29 |
30 | try {
31 | Date date = TIMEFORMAT.parse(datetimeString);
32 | setDatetime(date);
33 | } catch (ParseException e) {
34 | e.printStackTrace();
35 | }
36 |
37 | setAccessPath(accessPath);
38 | setUid(uid);
39 | setPackageName(pack);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/dataItem/KernDataItem.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor.dataItem;
2 |
3 | import java.text.ParseException;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Date;
6 | import java.util.Map;
7 | import java.util.regex.Matcher;
8 | import java.util.regex.Pattern;
9 |
10 | public class KernDataItem extends DataItem {
11 | private final static String TIMEFORMAT_STRING = "[yyyy-MM-dd HH:mm:ss]";
12 | private final static String PATTERN_STR = "(\\[\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}])\\s(OPEN)\\s(\\d+),\\s(\\d+),\\s(\\d+),\\s(\\d+),\\s(\\S+)";
13 | public final static Pattern PATTERN = Pattern.compile(PATTERN_STR);
14 | private final static SimpleDateFormat TIMEFORMAT = new SimpleDateFormat(TIMEFORMAT_STRING);
15 |
16 | public KernDataItem(String logItem, Map packageList) {
17 | super(logItem, packageList);
18 | }
19 |
20 | @Override
21 | protected void initialize(String logItem, Map packageList) {
22 | String logData = logItem.split("YANG: ")[1];
23 | Matcher matcher = PATTERN.matcher(logData);
24 | if (matcher.find()) {
25 | String datetimeString = matcher.group(1);
26 | int uid = Integer.valueOf(matcher.group(3));
27 | String accessPath = matcher.group(7);
28 | String pack = packageList.get(uid);
29 |
30 | try {
31 | Date date = TIMEFORMAT.parse(datetimeString);
32 | setDatetime(date);
33 | } catch (ParseException e) {
34 | e.printStackTrace();
35 | }
36 |
37 | setUid(Integer.valueOf(uid));
38 | setAccessPath(accessPath);
39 | setPackageName(pack);
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/FileReader/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/FileAccessMonitor/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
13 |
21 |
22 |
26 |
27 |
28 |
35 |
36 |
43 |
44 |
45 |
53 |
54 |
62 |
63 |
67 |
68 |
69 |
76 |
77 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/RulesAdapter.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageManager;
5 | import android.support.annotation.LayoutRes;
6 | import android.support.annotation.NonNull;
7 | import android.support.annotation.Nullable;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.AdapterView;
12 | import android.widget.ArrayAdapter;
13 | import android.widget.EditText;
14 | import android.widget.ImageButton;
15 | import android.widget.Spinner;
16 | import android.widget.SpinnerAdapter;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | public class RulesAdapter extends ArrayAdapter {
22 | private ArrayAdapter spinnerAdapater;
23 | private ArrayList dataSet;
24 | private Context mContext;
25 |
26 | public RulesAdapter(@NonNull Context context, ArrayList list) {
27 | super(context, 0, list);
28 | mContext = context;
29 | dataSet = list;
30 |
31 | spinnerAdapater = new ArrayAdapter(context, android.R.layout.simple_spinner_item);
32 | spinnerAdapater.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
33 | for (AppIdModel appId: Data.getInstance().appIdModelList) {
34 | spinnerAdapater.add(appId);
35 | }
36 | }
37 |
38 | @NonNull
39 | @Override
40 | public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
41 | View listItem = convertView;
42 | if (listItem == null)
43 | listItem = LayoutInflater.from(mContext).inflate(R.layout.rule_row, parent, false);
44 |
45 | RuleModel rule = dataSet.get(position);
46 | Spinner spinner = listItem.findViewById(R.id.app_name_dropdown);
47 | spinner.setAdapter(spinnerAdapater);
48 | spinner.setSelection(Data.getInstance().appIdModelList.indexOf(rule.getAppId()));
49 | spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
50 | @Override
51 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
52 | rule.setAppId(spinnerAdapater.getItem(position));
53 | }
54 |
55 | @Override
56 | public void onNothingSelected(AdapterView> parent) {
57 |
58 | }
59 | });
60 |
61 | EditText path = listItem.findViewById(R.id.file_path);
62 | path.setText(rule.getPath());
63 | path.setOnFocusChangeListener((v, hasFocus) -> {
64 | if (hasFocus) rule.setPath(path.getText().toString());
65 | });
66 |
67 | EditText realPath = listItem.findViewById(R.id.real_path);
68 | realPath.setText(rule.getRealPath());
69 | realPath.setOnFocusChangeListener((v, hasFocus) -> {
70 | if (hasFocus) rule.setRealPath(realPath.getText().toString());
71 | });
72 |
73 | ImageButton button = listItem.findViewById(R.id.delete_rule);
74 | button.setOnClickListener(v -> {
75 | dataSet.remove(position);
76 | notifyDataSetChanged();
77 | });
78 |
79 | return listItem;
80 | }
81 |
82 | public ArrayList getDataSet() {
83 | return dataSet;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/MyExpandableListAdapter.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import android.content.Context;
4 | import android.graphics.Typeface;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.BaseExpandableListAdapter;
9 | import android.widget.TextView;
10 |
11 | import java.util.HashMap;
12 | import java.util.List;
13 | import java.util.Map;
14 |
15 | public class MyExpandableListAdapter extends BaseExpandableListAdapter {
16 | private Context context;
17 | private List expandableListTitle;
18 | private Map> expandableListDetail;
19 |
20 | public MyExpandableListAdapter(Context context, List expandableListTitle, Map> expandableListDetail) {
21 | this.context = context;
22 | this.expandableListTitle = expandableListTitle;
23 | this.expandableListDetail = expandableListDetail;
24 | }
25 |
26 | @Override
27 | public int getGroupCount() {
28 | return this.expandableListTitle.size();
29 | }
30 |
31 | @Override
32 | public int getChildrenCount(int groupPosition) {
33 | return this.expandableListDetail.get(this.expandableListTitle.get(groupPosition)).size();
34 | }
35 |
36 | @Override
37 | public Object getGroup(int groupPosition) {
38 | return this.expandableListTitle.get(groupPosition);
39 | }
40 |
41 | @Override
42 | public Object getChild(int groupPosition, int childPosition) {
43 | return this.expandableListDetail.get(this.expandableListTitle.get(groupPosition)).get(childPosition);
44 | }
45 |
46 | @Override
47 | public long getGroupId(int groupPosition) {
48 | return groupPosition;
49 | }
50 |
51 | @Override
52 | public long getChildId(int groupPosition, int childPosition) {
53 | return childPosition;
54 | }
55 |
56 | @Override
57 | public boolean hasStableIds() {
58 | return false;
59 | }
60 |
61 | @Override
62 | public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
63 | String listTitle = (String) getGroup(groupPosition);
64 | if (convertView == null) {
65 | LayoutInflater layoutInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
66 | convertView = layoutInflater.inflate(R.layout.list_group, null);
67 | }
68 |
69 | TextView listTitleTextView = (TextView) convertView.findViewById(R.id.listTitle);
70 | listTitleTextView.setTypeface(null, Typeface.BOLD);
71 | listTitleTextView.setText(listTitle);
72 | return convertView;
73 | }
74 |
75 | @Override
76 | public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
77 | String listText = (String) getChild(groupPosition, childPosition);
78 | if (convertView == null) {
79 | LayoutInflater layoutInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
80 | convertView = layoutInflater.inflate(R.layout.list_item, null);
81 | }
82 |
83 | TextView listItemTextView = (TextView) convertView.findViewById(R.id.expandedListItem);
84 | listItemTextView.setText(listText);
85 | return convertView;
86 | }
87 |
88 | @Override
89 | public boolean isChildSelectable(int groupPosition, int childPosition) {
90 | return true;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/FileAccessMonitor/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.gitignore.io/api/android,androidstudio
3 | # Edit at https://www.gitignore.io/?templates=android,androidstudio
4 |
5 | ### Android ###
6 | # Built application files
7 | *.apk
8 | *.ap_
9 | *.aab
10 |
11 | # Files for the ART/Dalvik VM
12 | *.dex
13 |
14 | # Java class files
15 | *.class
16 |
17 | # Generated files
18 | bin/
19 | gen/
20 | out/
21 |
22 | # Gradle files
23 | .gradle/
24 | build/
25 |
26 | # Local configuration file (sdk path, etc)
27 | local.properties
28 |
29 | # Proguard folder generated by Eclipse
30 | proguard/
31 |
32 | # Log Files
33 | *.log
34 |
35 | # Android Studio Navigation editor temp files
36 | .navigation/
37 |
38 | # Android Studio captures folder
39 | captures/
40 |
41 | # IntelliJ
42 | *.iml
43 | .idea/workspace.xml
44 | .idea/tasks.xml
45 | .idea/gradle.xml
46 | .idea/assetWizardSettings.xml
47 | .idea/dictionaries
48 | .idea/libraries
49 | .idea/caches
50 | # Android Studio 3 in .gitignore file.
51 | .idea/caches/build_file_checksums.ser
52 | .idea/modules.xml
53 |
54 | # Keystore files
55 | # Uncomment the following lines if you do not want to check your keystore files in.
56 | #*.jks
57 | #*.keystore
58 |
59 | # External native build folder generated in Android Studio 2.2 and later
60 | .externalNativeBuild
61 |
62 | # Google Services (e.g. APIs or Firebase)
63 | # google-services.json
64 |
65 | # Freeline
66 | freeline.py
67 | freeline/
68 | freeline_project_description.json
69 |
70 | # fastlane
71 | fastlane/report.xml
72 | fastlane/Preview.html
73 | fastlane/screenshots
74 | fastlane/test_output
75 | fastlane/readme.md
76 |
77 | # Version control
78 | vcs.xml
79 |
80 | # lint
81 | lint/intermediates/
82 | lint/generated/
83 | lint/outputs/
84 | lint/tmp/
85 | # lint/reports/
86 |
87 | ### Android Patch ###
88 | gen-external-apklibs
89 | output.json
90 |
91 | ### AndroidStudio ###
92 | # Covers files to be ignored for android development using Android Studio.
93 |
94 | # Built application files
95 |
96 | # Files for the ART/Dalvik VM
97 |
98 | # Java class files
99 |
100 | # Generated files
101 |
102 | # Gradle files
103 | .gradle
104 |
105 | # Signing files
106 | .signing/
107 |
108 | # Local configuration file (sdk path, etc)
109 |
110 | # Proguard folder generated by Eclipse
111 |
112 | # Log Files
113 |
114 | # Android Studio
115 | /*/build/
116 | /*/local.properties
117 | /*/out
118 | /*/*/build
119 | /*/*/production
120 | *.ipr
121 | *~
122 | *.swp
123 |
124 | # Android Patch
125 |
126 | # External native build folder generated in Android Studio 2.2 and later
127 |
128 | # NDK
129 | obj/
130 |
131 | # IntelliJ IDEA
132 | *.iws
133 | /out/
134 |
135 | # User-specific configurations
136 | .idea/caches/
137 | .idea/libraries/
138 | .idea/shelf/
139 | .idea/.name
140 | .idea/compiler.xml
141 | .idea/copyright/profiles_settings.xml
142 | .idea/encodings.xml
143 | .idea/misc.xml
144 | .idea/scopes/scope_settings.xml
145 | .idea/vcs.xml
146 | .idea/jsLibraryMappings.xml
147 | .idea/datasources.xml
148 | .idea/dataSources.ids
149 | .idea/sqlDataSources.xml
150 | .idea/dynamic.xml
151 | .idea/uiDesigner.xml
152 |
153 | # OS-specific files
154 | .DS_Store
155 | .DS_Store?
156 | ._*
157 | .Spotlight-V100
158 | .Trashes
159 | ehthumbs.db
160 | Thumbs.db
161 |
162 | # Legacy Eclipse project files
163 | .classpath
164 | .project
165 | .cproject
166 | .settings/
167 |
168 | # Mobile Tools for Java (J2ME)
169 | .mtj.tmp/
170 |
171 | # Package Files #
172 | *.war
173 | *.ear
174 |
175 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
176 | hs_err_pid*
177 |
178 | ## Plugin-specific files:
179 |
180 | # mpeltonen/sbt-idea plugin
181 | .idea_modules/
182 |
183 | # JIRA plugin
184 | atlassian-ide-plugin.xml
185 |
186 | # Mongo Explorer plugin
187 | .idea/mongoSettings.xml
188 |
189 | # Crashlytics plugin (for Android Studio and IntelliJ)
190 | com_crashlytics_export_strings.xml
191 | crashlytics.properties
192 | crashlytics-build.properties
193 | fabric.properties
194 |
195 | ### AndroidStudio Patch ###
196 |
197 | !/gradle/wrapper/gradle-wrapper.jar
198 |
199 | # End of https://www.gitignore.io/api/android,androidstudio
200 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/dataItem/DataItem.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor.dataItem;
2 |
3 | import android.content.pm.PackageManager;
4 |
5 | import java.io.File;
6 | import java.text.DateFormat;
7 | import java.text.SimpleDateFormat;
8 | import java.util.Date;
9 | import java.util.Map;
10 |
11 | public abstract class DataItem {
12 |
13 | class FileType {
14 | public static final String IMAGE = "Image";
15 | public static final String VIDEO = "Video";
16 | public static final String RESOURCE = "Resource";
17 | public static final String LIBRARY = "Library";
18 | public static final String TEXT = "Text";
19 | public static final String AUDIO = "Audio";
20 | public static final String DATA = "Data";
21 | public static final String UNKNOWN = "Unknown";
22 | }
23 |
24 | private static final String[] IMAGE_EXTENSIONS = {"png", "jpg", "jpeg", "tif", "png", "bmp", "svg", "ico"};
25 | private static final String[] VIDEO_EXTENSIONS = {"mp4", "mkv", "webm", "flv", "ogg", "mov", "wmv", "rm", "rmvb", "m4v", "mpg", "3gp"};
26 | private static final String[] RESOURCE_EXTENSIONS = {"xml", "apk"};
27 | private static final String[] LIBRARY_EXTENSIONS = {"so", "a"};
28 | private static final String[] TEXT_EXTENSIONS = {"txt", "log"};
29 | private static final String[] AUDIO_EXTENSIONS = {"aac", "ape", "au", "flac", "mp3", "ogg", "raw", "wav", "wma"};
30 | private static final String[] DATA_EXTENSIONS = {"data", "db", "database", "databases"};
31 |
32 | private int uid;
33 | private String packageName;
34 | private Date datetime;
35 | private String accessPath;
36 |
37 | private String applicationName;
38 |
39 | private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
40 |
41 | public DataItem(String logItem, Map packageList) {
42 | initialize(logItem, packageList);
43 | }
44 |
45 | protected abstract void initialize(String logItem, Map packageList);
46 |
47 | public int getUid() {
48 | return uid;
49 | }
50 |
51 | public Date getDatetime() {
52 | return datetime;
53 | }
54 |
55 | public String getAccessPath() {
56 | return accessPath;
57 | }
58 |
59 | public String getPackageName() {
60 | return packageName;
61 | }
62 |
63 | public String getApplicationName() {
64 | return applicationName;
65 | }
66 |
67 | public void setAccessPath(String accessPath) {
68 | this.accessPath = accessPath;
69 | }
70 |
71 | public void setDatetime(Date datetime) {
72 | this.datetime = datetime;
73 | }
74 |
75 | public void setPackageName(String packageName) {
76 | this.packageName = packageName;
77 | }
78 |
79 | public void setUid(int uid) {
80 | this.uid = uid;
81 | }
82 |
83 | public void setApplicationName(String applicationName) {
84 | this.applicationName = applicationName;
85 | }
86 |
87 | public String getTimeString() {
88 | return dateFormat.format(datetime);
89 | }
90 |
91 | public String getFileType() {
92 | String[] folders = this.accessPath.split("\\/");
93 | if (folders.length <= 1) return FileType.UNKNOWN;
94 | String filename = folders[folders.length - 1];
95 | String[] parts = filename.split("\\.");
96 | if (parts.length <= 1) return FileType.UNKNOWN;
97 | String extension = parts[parts.length - 1].toLowerCase();
98 |
99 | for (String ext: IMAGE_EXTENSIONS) if (extension.equals(ext)) return FileType.IMAGE;
100 | for (String ext: VIDEO_EXTENSIONS) if (extension.equals(ext)) return FileType.VIDEO;
101 | for (String ext: AUDIO_EXTENSIONS) if (extension.equals(ext)) return FileType.AUDIO;
102 | for (String ext: RESOURCE_EXTENSIONS) if (extension.equals(ext)) return FileType.RESOURCE;
103 | for (String ext: LIBRARY_EXTENSIONS) if (extension.equals(ext)) return FileType.LIBRARY;
104 | for (String ext: TEXT_EXTENSIONS) if (extension.equals(ext)) return FileType.TEXT;
105 | for (String ext: DATA_EXTENSIONS) if (extension.equals(ext)) return FileType.DATA;
106 |
107 | return FileType.UNKNOWN;
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/Data.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import android.os.Environment;
4 | import android.util.Log;
5 | import website.jace.fileaccessmonitor.dataItem.DataItem;
6 | import website.jace.fileaccessmonitor.dataItem.JNIDataItem;
7 | import website.jace.fileaccessmonitor.dataItem.KernDataItem;
8 |
9 | import java.io.*;
10 | import java.util.ArrayList;
11 | import java.util.HashMap;
12 | import java.util.List;
13 | import java.util.Map;
14 |
15 | public class Data {
16 | private static Data single_instance = null;
17 |
18 | public static Data getInstance() {
19 | if (single_instance == null)
20 | single_instance = new Data();
21 |
22 | return single_instance;
23 | }
24 |
25 | private void init() {
26 | this.uidPackagesMap = new HashMap<>();
27 | this.uidOwnedFolderMap = new HashMap<>();
28 | this.kernDataItems = new ArrayList<>();
29 | this.jniDataItems = new ArrayList<>();
30 | this.packageApplicationNameMap = new HashMap<>();
31 | this.appIdModelList = new ArrayList<>();
32 | }
33 |
34 | private Data() {
35 | }
36 |
37 | private final static String kernelLogPath = Environment.getExternalStorageDirectory().getPath() + "/log/kern.log";
38 | private final static String jniLogPath = Environment.getExternalStorageDirectory().getPath() + "/log/jni.log";
39 | private final static String UIDListPath = "/data/system/packages.list";
40 |
41 | // uid list
42 | public Map uidPackagesMap;
43 | public Map uidOwnedFolderMap;
44 |
45 | // kernel log
46 | public List kernDataItems;
47 |
48 | // jni log
49 | public List jniDataItems;
50 |
51 | // packageName to ApplicationName
52 | public Map packageApplicationNameMap;
53 |
54 | // AppIDList
55 | public ArrayList appIdModelList;
56 |
57 | public void startBuild() {
58 | init();
59 | readUIDList();
60 | buildKernelLog();
61 | buildJNILog();
62 | }
63 |
64 | public void startReadUIDList() {
65 | if (this.uidPackagesMap == null) init();
66 | if (this.uidPackagesMap.size() == 0) readUIDList();
67 | }
68 |
69 | private void readUIDList() {
70 | try {
71 | Process p = Runtime.getRuntime().exec("su");
72 | DataOutputStream out = new DataOutputStream(p.getOutputStream());
73 | BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
74 | out.writeBytes("cat " + UIDListPath + "\n");
75 | out.flush();
76 | out.writeBytes("exit\n");
77 | out.flush();
78 |
79 | String line;
80 | while ((line = reader.readLine()) != null) {
81 | String[] segments = line.split(" ");
82 | String pack = segments[0];
83 | int uid = Integer.valueOf(segments[1]);
84 | String folder = segments[3];
85 |
86 | this.uidPackagesMap.put(uid, pack);
87 | this.uidOwnedFolderMap.put(uid, folder);
88 | }
89 |
90 | Log.d("File Access Monitor", "Read local user ids successfully, number of users: " + this.uidOwnedFolderMap.size());
91 | } catch (IOException e) {
92 | e.printStackTrace();
93 | }
94 | }
95 |
96 | private void buildKernelLog() {
97 | File file = new File(kernelLogPath);
98 | try {
99 | BufferedReader reader = new BufferedReader(new FileReader(file));
100 | while (reader.ready()) {
101 | String line = reader.readLine();
102 | if (line.contains("YANG: ") && line.contains("OPEN")) {
103 | KernDataItem kernDataItem = new KernDataItem(line, uidPackagesMap);
104 | if (kernDataItem.getPackageName() != null) {
105 | kernDataItems.add(kernDataItem);
106 | }
107 | }
108 | }
109 | } catch (IOException e) {
110 | e.printStackTrace();
111 | }
112 | }
113 |
114 | private void buildJNILog() {
115 | File file = new File(jniLogPath);
116 | try {
117 | BufferedReader reader = new BufferedReader(new FileReader(file));
118 | while (reader.ready()) {
119 | String line = reader.readLine();
120 | if (JNIDataItem.PATTERN.matcher(line).matches())
121 | jniDataItems.add(new JNIDataItem(line, uidPackagesMap));
122 | }
123 | } catch (IOException e) {
124 | e.printStackTrace();
125 | }
126 | }
127 | }
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/RulesActivity.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import android.content.pm.ApplicationInfo;
4 | import android.content.pm.PackageManager;
5 | import android.os.Bundle;
6 | import android.os.Environment;
7 | import android.support.annotation.Nullable;
8 | import android.support.design.widget.FloatingActionButton;
9 | import android.support.v7.app.AppCompatActivity;
10 | import android.widget.ListView;
11 | import android.widget.Toast;
12 |
13 | import java.io.BufferedReader;
14 | import java.io.BufferedWriter;
15 | import java.io.File;
16 | import java.io.FileNotFoundException;
17 | import java.io.FileReader;
18 | import java.io.FileWriter;
19 | import java.io.IOException;
20 | import java.util.ArrayList;
21 | import java.util.List;
22 |
23 | import static java.util.Collections.*;
24 |
25 | public class RulesActivity extends AppCompatActivity {
26 | private PackageManager pm;
27 | private FloatingActionButton fab;
28 |
29 | @Override
30 | public void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_rules);
33 |
34 | Data.getInstance().startReadUIDList();
35 | pm = getApplicationContext().getPackageManager();
36 | fab = findViewById(R.id.rules_save_button);
37 |
38 | for (String packageName: Data.getInstance().uidPackagesMap.values()) {
39 | if (!Data.getInstance().packageApplicationNameMap.keySet().contains(packageName)) {
40 | ApplicationInfo ai;
41 | try {
42 | ai = pm.getApplicationInfo(packageName, 0);
43 | } catch (PackageManager.NameNotFoundException e) {
44 | continue;
45 | }
46 | String applicationName = (String) pm.getApplicationLabel(ai);
47 | Data.getInstance().packageApplicationNameMap.put(packageName, applicationName);
48 | }
49 | }
50 |
51 | for (int uid: Data.getInstance().uidPackagesMap.keySet()) {
52 | String packageName = Data.getInstance().uidPackagesMap.get(uid);
53 | String applicationName = Data.getInstance().packageApplicationNameMap.get(packageName);
54 | Data.getInstance().appIdModelList.add(new AppIdModel(uid, packageName, applicationName));
55 | sort(Data.getInstance().appIdModelList);
56 | }
57 |
58 | ArrayList rules = new ArrayList<>();
59 | try {
60 | BufferedReader reader = new BufferedReader(new FileReader(new File(Environment.getExternalStorageDirectory().getPath() + "/log/rules.conf")));
61 | while (reader.ready()) {
62 | String line = reader.readLine();
63 | if (line.length() < 2) continue;
64 | String[] segments = line.split(",");
65 | int uid = Integer.valueOf(segments[0]);
66 | String path = segments[1];
67 | String real_path;
68 | if (segments.length <= 2) real_path = "";
69 | else real_path = segments[2];
70 | String packageName = Data.getInstance().uidPackagesMap.get(uid);
71 |
72 | String applicationName = Data.getInstance().packageApplicationNameMap.get(packageName);
73 | rules.add(new RuleModel(applicationName, packageName, uid, path, real_path));
74 | }
75 |
76 | } catch (FileNotFoundException e) {
77 | e.printStackTrace();
78 | } catch (IOException e) {
79 | e.printStackTrace();
80 | }
81 | RulesAdapter adapter = new RulesAdapter(RulesActivity.this, rules);
82 | ListView rulesListView = findViewById(R.id.rules_listview);
83 | rulesListView.setAdapter(adapter);
84 |
85 | fab.setOnClickListener(v -> {
86 | List ruleList = adapter.getDataSet();
87 |
88 | try{
89 | BufferedWriter writer = new BufferedWriter(new FileWriter(Environment.getExternalStorageDirectory().getPath() + "/log/rules.conf"));
90 | for (RuleModel rule: ruleList) {
91 | String toWrite = String.valueOf(rule.getUid()) + "," + rule.getPath() + "," + rule.getRealPath() + "\n";
92 | writer.write(toWrite);
93 | }
94 | writer.close();
95 | Toast.makeText(getApplicationContext(), "Save successfully", Toast.LENGTH_SHORT).show();
96 |
97 | } catch (IOException e) {
98 | e.printStackTrace();
99 | Toast.makeText(getApplicationContext(), "Failed to save: IOException", Toast.LENGTH_SHORT).show();
100 | }
101 | });
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import android.app.ActivityManager;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.support.annotation.Nullable;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.TextView;
12 | import website.jace.fileaccessmonitor.services.JNILogFetchingService;
13 | import website.jace.fileaccessmonitor.services.KernLogFetchingService;
14 |
15 | public class SettingsActivity extends AppCompatActivity {
16 | private TextView kernServiceStatus = null;
17 | private Button kernServiceStartButton = null;
18 | private Button kernServiceStopButton = null;
19 |
20 | private TextView jniServiceStatus = null;
21 | private Button jniServiceStartButton = null;
22 | private Button jniServiceStopButton = null;
23 |
24 | private boolean kernServiceRunning = false;
25 | private boolean jniServiceRunning = false;
26 |
27 | @Override
28 | protected void onCreate(@Nullable Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_settings);
31 |
32 | this.kernServiceStatus = findViewById(R.id.kern_service_status);
33 | this.kernServiceStartButton = findViewById(R.id.kern_service_start);
34 | this.kernServiceStopButton = findViewById(R.id.kern_service_stop);
35 |
36 | this.jniServiceStatus = findViewById(R.id.jni_service_status);
37 | this.jniServiceStartButton = findViewById(R.id.jni_service_start);
38 | this.jniServiceStopButton = findViewById(R.id.jni_service_stop);
39 |
40 | refreshStatus();
41 |
42 | this.kernServiceStartButton.setOnClickListener(v -> {
43 | if (!kernServiceRunning) {
44 | Intent serviceIntent = new Intent(SettingsActivity.this, KernLogFetchingService.class);
45 | startService(serviceIntent);
46 | refreshStatus();
47 | }
48 | });
49 |
50 | this.kernServiceStopButton.setOnClickListener(v -> {
51 | if (kernServiceRunning) {
52 | Intent serviceIntent = new Intent(SettingsActivity.this, KernLogFetchingService.class);
53 | stopService(serviceIntent);
54 | refreshStatus();
55 | }
56 | });
57 |
58 | this.jniServiceStartButton.setOnClickListener(v -> {
59 | if (!jniServiceRunning) {
60 | Intent serviceIntent = new Intent(SettingsActivity.this, JNILogFetchingService.class);
61 | startService(serviceIntent);
62 | refreshStatus();
63 | }
64 | });
65 |
66 | this.jniServiceStopButton.setOnClickListener(v -> {
67 | if (jniServiceRunning) {
68 | Intent serviceIntent = new Intent(SettingsActivity.this, JNILogFetchingService.class);
69 | stopService(serviceIntent);
70 | refreshStatus();
71 | }
72 | });
73 | }
74 |
75 | private void setServiceStatus(Boolean started, String service) {
76 | TextView serviceStatus;
77 | if (service.startsWith("kern")){
78 | serviceStatus = this.kernServiceStatus;
79 | kernServiceRunning = started;
80 | }
81 | else{
82 | serviceStatus = this.jniServiceStatus;
83 | jniServiceRunning = started;
84 | }
85 | if (started) {
86 | serviceStatus.setText(getResources().getText(R.string.service_running));
87 | serviceStatus.setTextColor(getResources().getColor(R.color.black));
88 | } else {
89 | serviceStatus.setText(getResources().getText(R.string.service_not_running));
90 | serviceStatus.setTextColor(getResources().getColor(R.color.red));
91 | }
92 | }
93 |
94 | private boolean isMyServiceRunning(Class> serviceClass) {
95 | ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
96 | for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
97 | if (serviceClass.getName().equals(service.service.getClassName())) {
98 | return true;
99 | }
100 | }
101 | return false;
102 | }
103 |
104 | private void refreshStatus() {
105 | if (isMyServiceRunning(KernLogFetchingService.class)) setServiceStatus(true, "kern");
106 | else setServiceStatus(false, "kern");
107 |
108 | if (isMyServiceRunning(JNILogFetchingService.class)) setServiceStatus(true, "jni");
109 | else setServiceStatus(false, "jni");
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
12 |
14 |
16 |
18 |
20 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
36 |
38 |
40 |
42 |
44 |
46 |
48 |
50 |
52 |
54 |
56 |
58 |
60 |
62 |
64 |
66 |
68 |
70 |
72 |
74 |
75 |
--------------------------------------------------------------------------------
/FileReader/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
12 |
14 |
16 |
18 |
20 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
36 |
38 |
40 |
42 |
44 |
46 |
48 |
50 |
52 |
54 |
56 |
58 |
60 |
62 |
64 |
66 |
68 |
70 |
72 |
74 |
75 |
--------------------------------------------------------------------------------
/FileReader/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/FileAccessMonitor/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/FileReader/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.gitignore.io/api/android,intellij+all,androidstudio
3 | # Edit at https://www.gitignore.io/?templates=android,intellij+all,androidstudio
4 |
5 | ### Android ###
6 | # Built application files
7 | *.apk
8 | *.ap_
9 | *.aab
10 |
11 | # Files for the ART/Dalvik VM
12 | *.dex
13 |
14 | # Java class files
15 | *.class
16 |
17 | # Generated files
18 | bin/
19 | gen/
20 | out/
21 |
22 | # Gradle files
23 | .gradle/
24 | build/
25 |
26 | # Local configuration file (sdk path, etc)
27 | local.properties
28 |
29 | # Proguard folder generated by Eclipse
30 | proguard/
31 |
32 | # Log Files
33 | *.log
34 |
35 | # Android Studio Navigation editor temp files
36 | .navigation/
37 |
38 | # Android Studio captures folder
39 | captures/
40 |
41 | # IntelliJ
42 | *.iml
43 | .idea/workspace.xml
44 | .idea/tasks.xml
45 | .idea/gradle.xml
46 | .idea/assetWizardSettings.xml
47 | .idea/dictionaries
48 | .idea/libraries
49 | .idea/caches
50 | # Android Studio 3 in .gitignore file.
51 | .idea/caches/build_file_checksums.ser
52 | .idea/modules.xml
53 |
54 | # Keystore files
55 | # Uncomment the following lines if you do not want to check your keystore files in.
56 | #*.jks
57 | #*.keystore
58 |
59 | # External native build folder generated in Android Studio 2.2 and later
60 | .externalNativeBuild
61 |
62 | # Google Services (e.g. APIs or Firebase)
63 | # google-services.json
64 |
65 | # Freeline
66 | freeline.py
67 | freeline/
68 | freeline_project_description.json
69 |
70 | # fastlane
71 | fastlane/report.xml
72 | fastlane/Preview.html
73 | fastlane/screenshots
74 | fastlane/test_output
75 | fastlane/readme.md
76 |
77 | # Version control
78 | vcs.xml
79 |
80 | # lint
81 | lint/intermediates/
82 | lint/generated/
83 | lint/outputs/
84 | lint/tmp/
85 | # lint/reports/
86 |
87 | ### Android Patch ###
88 | gen-external-apklibs
89 | output.json
90 |
91 | ### AndroidStudio ###
92 | # Covers files to be ignored for android development using Android Studio.
93 |
94 | # Built application files
95 |
96 | # Files for the ART/Dalvik VM
97 |
98 | # Java class files
99 |
100 | # Generated files
101 |
102 | # Gradle files
103 | .gradle
104 |
105 | # Signing files
106 | .signing/
107 |
108 | # Local configuration file (sdk path, etc)
109 |
110 | # Proguard folder generated by Eclipse
111 |
112 | # Log Files
113 |
114 | # Android Studio
115 | /*/build/
116 | /*/local.properties
117 | /*/out
118 | /*/*/build
119 | /*/*/production
120 | *.ipr
121 | *~
122 | *.swp
123 |
124 | # Android Patch
125 |
126 | # External native build folder generated in Android Studio 2.2 and later
127 |
128 | # NDK
129 | obj/
130 |
131 | # IntelliJ IDEA
132 | *.iws
133 | /out/
134 |
135 | # User-specific configurations
136 | .idea/caches/
137 | .idea/libraries/
138 | .idea/shelf/
139 | .idea/.name
140 | .idea/compiler.xml
141 | .idea/copyright/profiles_settings.xml
142 | .idea/encodings.xml
143 | .idea/misc.xml
144 | .idea/scopes/scope_settings.xml
145 | .idea/vcs.xml
146 | .idea/jsLibraryMappings.xml
147 | .idea/datasources.xml
148 | .idea/dataSources.ids
149 | .idea/sqlDataSources.xml
150 | .idea/dynamic.xml
151 | .idea/uiDesigner.xml
152 |
153 | # OS-specific files
154 | .DS_Store
155 | .DS_Store?
156 | ._*
157 | .Spotlight-V100
158 | .Trashes
159 | ehthumbs.db
160 | Thumbs.db
161 |
162 | # Legacy Eclipse project files
163 | .classpath
164 | .project
165 | .cproject
166 | .settings/
167 |
168 | # Mobile Tools for Java (J2ME)
169 | .mtj.tmp/
170 |
171 | # Package Files #
172 | *.war
173 | *.ear
174 |
175 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
176 | hs_err_pid*
177 |
178 | ## Plugin-specific files:
179 |
180 | # mpeltonen/sbt-idea plugin
181 | .idea_modules/
182 |
183 | # JIRA plugin
184 | atlassian-ide-plugin.xml
185 |
186 | # Mongo Explorer plugin
187 | .idea/mongoSettings.xml
188 |
189 | # Crashlytics plugin (for Android Studio and IntelliJ)
190 | com_crashlytics_export_strings.xml
191 | crashlytics.properties
192 | crashlytics-build.properties
193 | fabric.properties
194 |
195 | ### AndroidStudio Patch ###
196 |
197 | !/gradle/wrapper/gradle-wrapper.jar
198 |
199 | ### Intellij+all ###
200 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
201 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
202 |
203 | # User-specific stuff
204 | .idea/**/workspace.xml
205 | .idea/**/tasks.xml
206 | .idea/**/usage.statistics.xml
207 | .idea/**/dictionaries
208 | .idea/**/shelf
209 |
210 | # Generated files
211 | .idea/**/contentModel.xml
212 |
213 | # Sensitive or high-churn files
214 | .idea/**/dataSources/
215 | .idea/**/dataSources.ids
216 | .idea/**/dataSources.local.xml
217 | .idea/**/sqlDataSources.xml
218 | .idea/**/dynamic.xml
219 | .idea/**/uiDesigner.xml
220 | .idea/**/dbnavigator.xml
221 |
222 | # Gradle
223 | .idea/**/gradle.xml
224 | .idea/**/libraries
225 |
226 | # Gradle and Maven with auto-import
227 | # When using Gradle or Maven with auto-import, you should exclude module files,
228 | # since they will be recreated, and may cause churn. Uncomment if using
229 | # auto-import.
230 | # .idea/modules.xml
231 | # .idea/*.iml
232 | # .idea/modules
233 |
234 | # CMake
235 | cmake-build-*/
236 |
237 | # Mongo Explorer plugin
238 | .idea/**/mongoSettings.xml
239 |
240 | # File-based project format
241 |
242 | # IntelliJ
243 |
244 | # mpeltonen/sbt-idea plugin
245 |
246 | # JIRA plugin
247 |
248 | # Cursive Clojure plugin
249 | .idea/replstate.xml
250 |
251 | # Crashlytics plugin (for Android Studio and IntelliJ)
252 |
253 | # Editor-based Rest Client
254 | .idea/httpRequests
255 |
256 | # Android studio 3.1+ serialized cache file
257 |
258 | # JetBrains templates
259 | **___jb_tmp___
260 |
261 | ### Intellij+all Patch ###
262 | # Ignores the whole .idea folder and all .iml files
263 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
264 |
265 | .idea/
266 |
267 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
268 |
269 | modules.xml
270 |
271 | # Sonarlint plugin
272 | .idea/sonarlint
273 |
274 | # End of https://www.gitignore.io/api/android,intellij+all,androidstudio
275 |
--------------------------------------------------------------------------------
/FileAccessMonitor/app/src/main/java/website/jace/fileaccessmonitor/MainActivity.java:
--------------------------------------------------------------------------------
1 | package website.jace.fileaccessmonitor;
2 |
3 | import android.Manifest;
4 | import android.content.Intent;
5 | import android.content.pm.ApplicationInfo;
6 | import android.content.pm.PackageManager;
7 | import android.os.Bundle;
8 | import android.support.design.widget.FloatingActionButton;
9 | import android.support.design.widget.Snackbar;
10 | import android.support.v4.app.ActivityCompat;
11 | import android.support.v4.content.ContextCompat;
12 | import android.view.View;
13 | import android.support.design.widget.NavigationView;
14 | import android.support.v4.view.GravityCompat;
15 | import android.support.v4.widget.DrawerLayout;
16 | import android.support.v7.app.ActionBarDrawerToggle;
17 | import android.support.v7.app.AppCompatActivity;
18 | import android.support.v7.widget.Toolbar;
19 | import android.view.Menu;
20 | import android.view.MenuItem;
21 | import android.widget.ExpandableListView;
22 | import website.jace.fileaccessmonitor.dataItem.DataItem;
23 |
24 | import java.util.*;
25 |
26 | public class MainActivity extends AppCompatActivity
27 | implements NavigationView.OnNavigationItemSelectedListener {
28 |
29 | private class Target {
30 | final static int KERNEL = 1;
31 | final static int JNI = 2;
32 | }
33 |
34 | private class Type {
35 | final static int APPLICATION = 1;
36 | final static int TYPE = 2;
37 | }
38 |
39 | private ExpandableListView expandableListView;
40 | private PackageManager pm;
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | setContentView(R.layout.activity_main);
46 |
47 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
48 | expandableListView = findViewById(R.id.expandableListView);
49 | pm = getApplicationContext().getPackageManager();
50 | setSupportActionBar(toolbar);
51 |
52 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
53 | fab.setOnClickListener(new View.OnClickListener() {
54 | @Override
55 | public void onClick(View view) {
56 | if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
57 | != PackageManager.PERMISSION_GRANTED)
58 | ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
59 | if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)
60 | != PackageManager.PERMISSION_GRANTED)
61 | ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
62 | Snackbar.make(view, "Building file access data", Snackbar.LENGTH_LONG)
63 | .setAction("Action", null).show();
64 | Data.getInstance().startBuild();
65 | setApplicationNames(Data.getInstance().kernDataItems);
66 | setApplicationNames(Data.getInstance().jniDataItems);
67 | refreshData(Target.KERNEL, Type.APPLICATION);
68 | }
69 | });
70 |
71 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
72 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
73 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
74 | drawer.addDrawerListener(toggle);
75 | toggle.syncState();
76 |
77 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
78 | navigationView.setNavigationItemSelectedListener(this);
79 | }
80 |
81 | @Override
82 | public void onBackPressed() {
83 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
84 | if (drawer.isDrawerOpen(GravityCompat.START)) {
85 | drawer.closeDrawer(GravityCompat.START);
86 | } else {
87 | super.onBackPressed();
88 | }
89 | }
90 |
91 | @Override
92 | public boolean onCreateOptionsMenu(Menu menu) {
93 | // Inflate the menu; this adds items to the action bar if it is present.
94 | getMenuInflater().inflate(R.menu.main, menu);
95 | return true;
96 | }
97 |
98 | @Override
99 | public boolean onOptionsItemSelected(MenuItem item) {
100 | // Handle action bar item clicks here. The action bar will
101 | // automatically handle clicks on the Home/Up button, so long
102 | // as you specify a parent activity in AndroidManifest.xml.
103 | int id = item.getItemId();
104 |
105 | //noinspection SimplifiableIfStatement
106 | if (id == R.id.action_settings) {
107 | Intent intent = new Intent(this, SettingsActivity.class);
108 | startActivity(intent);
109 | return true;
110 | }
111 |
112 | return super.onOptionsItemSelected(item);
113 | }
114 |
115 | @SuppressWarnings("StatementWithEmptyBody")
116 | @Override
117 | public boolean onNavigationItemSelected(MenuItem item) {
118 | // Handle navigation view item clicks here.
119 | int id = item.getItemId();
120 |
121 | if (id == R.id.nav_application_kernel) {
122 | refreshData(Target.KERNEL, Type.APPLICATION);
123 | } else if (id == R.id.nav_application_jni) {
124 | refreshData(Target.JNI, Type.APPLICATION);
125 | } else if (id == R.id.nav_type_kernel) {
126 | refreshData(Target.KERNEL, Type.TYPE);
127 | } else if (id == R.id.nav_type_jni) {
128 | refreshData(Target.JNI, Type.TYPE);
129 | } else if (id == R.id.edit_rules) {
130 | Intent intent = new Intent(MainActivity.this, RulesActivity.class);
131 | startActivity(intent);
132 | }
133 |
134 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
135 | drawer.closeDrawer(GravityCompat.START);
136 | return true;
137 | }
138 |
139 | private void refreshData(int target, int type) {
140 | List list = null;
141 | if (target == Target.KERNEL) list = Data.getInstance().kernDataItems;
142 | else list = Data.getInstance().jniDataItems;
143 |
144 | if (type == Type.APPLICATION) {
145 | Set hashSet = new HashSet<>();
146 |
147 | for (DataItem item : list)
148 | hashSet.add(item.getApplicationName());
149 |
150 | List titles = new ArrayList<>(hashSet);
151 | Map> map = new HashMap<>();
152 | for (String title : titles)
153 | map.put(title, new ArrayList<>());
154 | for (DataItem item : list)
155 | map.get(item.getApplicationName()).add("[" + item.getTimeString() + "] <" + item.getFileType() + "> " + item.getAccessPath());
156 |
157 | this.expandableListView.setAdapter(new MyExpandableListAdapter(MainActivity.this, titles, map));
158 | } else if (type == Type.TYPE) {
159 | Set hashSet = new HashSet<>();
160 |
161 | for (DataItem item : list) hashSet.add(item.getFileType());
162 |
163 | List titles = new ArrayList<>(hashSet);
164 | Map> map = new HashMap<>();
165 | for (String title : titles) map.put(title, new ArrayList<>());
166 | for (DataItem item : list)
167 | map.get(item.getFileType()).add("[" + item.getTimeString() + "] <" + item.getApplicationName() + "> " + item.getAccessPath());
168 |
169 | this.expandableListView.setAdapter(new MyExpandableListAdapter(MainActivity.this, titles, map));
170 | }
171 | }
172 |
173 | private void setApplicationNames(List dataItems) {
174 | for (DataItem dataItem : dataItems) {
175 | String packageName = dataItem.getPackageName();
176 | String applicationName = Data.getInstance().packageApplicationNameMap.get(packageName);
177 | if (applicationName == null) {
178 | ApplicationInfo ai = null;
179 | try {
180 | ai = pm.getApplicationInfo(packageName, 0);
181 | } catch (PackageManager.NameNotFoundException e) {
182 | }
183 | applicationName = ai != null ? (String) pm.getApplicationLabel(ai) : "Unknown";
184 | Data.getInstance().packageApplicationNameMap.put(packageName, applicationName);
185 | }
186 | dataItem.setApplicationName(applicationName);
187 | }
188 | }
189 | }
190 |
--------------------------------------------------------------------------------