├── example_java
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── 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
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── org
│ │ │ └── flyve
│ │ │ └── example_java
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── org
│ │ └── flyve
│ │ └── example_java
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
├── build.gradle
└── google-services.json
├── example_kotlin
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── ids.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.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
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── org
│ │ │ └── flyve
│ │ │ └── example_kotlin
│ │ │ └── MainActivity.kt
│ ├── test
│ │ └── java
│ │ │ └── org
│ │ │ └── flyve
│ │ │ └── example_kotlin
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── org
│ │ └── flyve
│ │ └── example_kotlin
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle
├── .github
├── invite-contributors.yml
├── ISSUE_TEMPLATE.md
├── label-commenter-config.yml
├── settings.yml
├── PULL_REQUEST_TEMPLATE.md
├── ISSUE_TEMPLATE
│ └── Bug_report.md
└── workflows
│ ├── release-new-version.yml
│ └── continuous-integration.yml
├── settings.gradle
├── docs
└── glpi_network.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── inventory
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ └── strings.xml
│ │ │ └── xml
│ │ │ │ └── provider_paths.xml
│ │ ├── java
│ │ │ └── org
│ │ │ │ └── flyve
│ │ │ │ └── inventory
│ │ │ │ ├── GenericFileProvider.java
│ │ │ │ ├── categories
│ │ │ │ ├── Processes.java
│ │ │ │ ├── Envs.java
│ │ │ │ ├── LocationProviders.java
│ │ │ │ ├── StringUtils.java
│ │ │ │ ├── User.java
│ │ │ │ ├── Videos.java
│ │ │ │ ├── CategoryValue.java
│ │ │ │ ├── PhoneStatus.java
│ │ │ │ ├── Controllers.java
│ │ │ │ ├── Categories.java
│ │ │ │ └── Bluetooth.java
│ │ │ │ ├── FlyveException.java
│ │ │ │ ├── usbManager
│ │ │ │ ├── Validation.java
│ │ │ │ ├── UsbProperty.java
│ │ │ │ └── SysBusUsbManager.java
│ │ │ │ ├── InventoryLog.java
│ │ │ │ └── CryptoUtil.java
│ │ ├── assets
│ │ │ ├── cpu_manufacturer.json
│ │ │ ├── camera_vendors.json
│ │ │ └── cpu_family.json
│ │ └── AndroidManifest.xml
│ ├── androidTest
│ │ └── java
│ │ │ └── org
│ │ │ └── flyve
│ │ │ └── inventory
│ │ │ ├── UserTest.java
│ │ │ ├── ModemsTest.java
│ │ │ ├── VideosTest.java
│ │ │ ├── ControllersTest.java
│ │ │ ├── InputsTest.java
│ │ │ ├── MemoryTest.java
│ │ │ ├── BluetoothTest.java
│ │ │ ├── BatteryTest.java
│ │ │ ├── UsbTest.java
│ │ │ ├── OperatingSystemTest.java
│ │ │ ├── HardwareTest.java
│ │ │ ├── CreateFileTest.java
│ │ │ ├── InventoryTaskTest.java
│ │ │ ├── BiosTest.java
│ │ │ ├── CpusTest.java
│ │ │ ├── SensorsTest.java
│ │ │ ├── NetworksTest.java
│ │ │ ├── DrivesTest.java
│ │ │ └── SoftwareTest.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── flyve
│ │ └── inventory
│ │ └── FunctionUnitTest.java
├── proguard-rules.pro
└── build.gradle
├── gradle.properties
├── package.json
├── CREDITS
├── .gitignore
├── gradlew.bat
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── README.md
└── gradlew
/example_java/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/example_kotlin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/.github/invite-contributors.yml:
--------------------------------------------------------------------------------
1 | isOutside: true
2 | # Team Name
3 | contributors
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':inventory', ':example_java', ':example_kotlin', ':app'
--------------------------------------------------------------------------------
/docs/glpi_network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/docs/glpi_network.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_java/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/inventory/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | inventory
3 | (%1$s) - %2$s
4 |
5 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/glpi-project/android-inventory-library/HEAD/example_kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx4608m
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 | android.defaults.buildfeatures.buildconfig=true
5 | android.nonTransitiveRClass=false
6 | android.nonFinalResIds=false
7 |
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/GenericFileProvider.java:
--------------------------------------------------------------------------------
1 | package org.flyve.inventory;
2 |
3 |
4 | import androidx.core.content.FileProvider;
5 |
6 | public class GenericFileProvider extends FileProvider {
7 |
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/example_java/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 02 16:44:40 CET 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example_java/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | example_kotlin
3 | Select the format to share
4 |
5 | - XML
6 | - JSON
7 |
8 | OK
9 | Cancel
10 |
11 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | #### Observed Results:
4 |
5 |
6 |
7 | #### Expected behavior:
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example_java/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | example_java
3 |
4 | Select the format to share
5 |
6 | - XML
7 | - JSON
8 |
9 | OK
10 | Cancel
11 |
12 |
--------------------------------------------------------------------------------
/inventory/src/main/assets/cpu_manufacturer.json:
--------------------------------------------------------------------------------
1 | [
2 | {"id": ["mt", "mediatek"], "name": "Mediatek"},
3 | {"id": ["rk"], "name": "Rockchip"},
4 | {"id": ["qcom", "msm", "apq"], "name": "Qualcomm"},
5 | {"id": ["sc"], "name": "Spreadtrum"},
6 | {"id": ["exynos", "smdk", "samsung"], "name": "Samsung"},
7 | {"id": ["hi"], "name": "HiSilicon"},
8 | {"id": ["pxa"], "name": "Marvell"},
9 | {"id": ["amlogic"], "name": "Amlogic"}
10 | ]
11 |
--------------------------------------------------------------------------------
/example_java/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example_kotlin/src/test/java/org/flyve/example_kotlin/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package org.flyve.example_kotlin
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/inventory/src/main/res/xml/provider_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/inventory/src/main/assets/camera_vendors.json:
--------------------------------------------------------------------------------
1 | [
2 | {"id": "ov", "name": "OmniVision"},
3 | {"id": "imx", "name": "Sony"},
4 | {"id": "isx", "name": "Sony"},
5 | {"id": "s5k", "name": "Samsung"},
6 | {"id": "s5c", "name": "Samsung"},
7 | {"id": "gc", "name": "GalaxyCore"},
8 | {"id": "sp", "name": "SuperPix"},
9 | {"id": "hi", "name": "Hynix"},
10 | {"id": "hm", "name": "Himax"},
11 | {"id": "siv", "name": "Seti"},
12 | {"id": "t4k", "name": "Toshiba"},
13 | {"id": "mn", "name": "Panasonic"},
14 | {"id": "jx", "name": "SiliconOptronics"},
15 | {"id": "ar", "name": "OnSemi"},
16 | {"id": "sr", "name": "Siliconfile"},
17 | {"id": "m", "name": "Fujitsu"}
18 | ]
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@teclib/android-inventory-library",
3 | "version": "1.6.1",
4 | "description": "Android Inventory Library",
5 | "main": "index.js",
6 | "scripts": {
7 | "release": "standard-version -t ''"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/glpi-project/android-inventory-library.git"
12 | },
13 | "keywords": [
14 | "Android",
15 | "inventory",
16 | "library",
17 | "agent",
18 | "teclib"
19 | ],
20 | "author": "Ivan Del Pino (https://flyve-mdm.com)",
21 | "license": "GPL-3.0",
22 | "bugs": {
23 | "url": "https://github.com/glpi-project/android-inventory-library/issues"
24 | },
25 | "homepage": "https://github.com/glpi-project/android-inventory-library#readme"
26 | }
27 |
--------------------------------------------------------------------------------
/example_java/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 |
--------------------------------------------------------------------------------
/example_kotlin/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 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/CREDITS:
--------------------------------------------------------------------------------
1 | In this file is liste every person who has contributed to the project,
2 | whether to fix a typo or to implement an awesome feature.
3 |
4 | You made this project.
5 |
6 | To everyone Thank you.
7 |
8 |
9 | Legend:
10 |
11 | - N: name
12 | - E: email
13 | - D: description
14 | - U: GitHub user
15 | ---------------------------------------------------------------------------------
16 |
17 | N: Rafael Hernández
18 | E: rhernandez@teclib.com
19 | D: Android/iOS Developer
20 | U: rafaelje
21 |
22 | N: Iván del Pino
23 | E: idelpino@teclib.com
24 | D: Android Developer
25 | U: Ivans51
26 |
27 | N: Naylin Medina
28 | E: nmedina@teclib.com
29 | D: Technical Writer
30 | U: Naylin15
31 |
32 | N: Alexander Salas
33 | E: asalas@teclib.com
34 | D: Project Manager
35 | U: ajsb85
36 |
37 | N: Kevin Esaa
38 | U: kevinesaa
39 |
40 | N: Alan Grosz
41 | U: lalofrosz
42 |
43 | N: José Espinoza
44 | E: josemespiz@gmail.com
45 | U: JMEspiz
46 |
47 | E: mohd.hussayn@gmail.com
48 | U: MohamedHussein02
--------------------------------------------------------------------------------
/inventory/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/ajsb85/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Android Studio
3 | .idea
4 | .idea/libraries
5 | .idea/workspace.xml
6 | .idea/tasks.xml
7 | .idea/datasources.xml
8 | .idea/dataSources.ids
9 | .idea/.name
10 | .idea/gradle.xml
11 | .idea/modules.xml
12 | .idea/vcs.xml
13 | app/app.iml
14 |
15 | *.apk
16 | *.ap_
17 |
18 | # files for the dex VM
19 | *.dex
20 |
21 | # Java class files
22 | *.class
23 |
24 | # built native files (uncomment if you build your own)
25 | # *.o
26 | # *.so
27 |
28 | # generated files
29 | bin/
30 | gen/
31 |
32 | # Ignore gradle files
33 | .gradle/
34 | build/
35 |
36 | # Local configuration file (sdk path, etc)
37 | local.properties
38 |
39 | # Proguard folder generated by Eclipse
40 | proguard/
41 |
42 | # Eclipse Metadata
43 | .metadata/
44 |
45 | # Mac OS X clutter
46 | *.DS_Store
47 |
48 | # Windows clutter
49 | Thumbs.db
50 |
51 | # Node.js
52 | node_modules
53 |
54 | # Miscellaneous
55 | *.iml
56 | /local.properties
57 | /.idea/workspace.xml
58 | /.idea/libraries
59 | .DS_Store
60 | /build
61 | /inventory/build/
62 | /captures
63 | .externalNativeBuild
64 | /development
65 |
66 | /vendor/*
67 |
--------------------------------------------------------------------------------
/.github/label-commenter-config.yml:
--------------------------------------------------------------------------------
1 | labels:
2 | - name: "invalid"
3 | labeled:
4 | issue:
5 | body: |
6 | This issue has been closed because you did not provide the requested information.
7 | action: "close"
8 | - name: "support"
9 | labeled:
10 | issue:
11 | body: |
12 | This issue has been closed as we only track bugs here.
13 |
14 | You can get community support on [forums](https://forum.glpi-project.org/) or you can consider [taking a subscription](https://glpi-project.org/subscriptions/) to get professional support.
15 | You can also [contact GLPI editor team](https://portal.glpi-network.com/contact-us) directly.
16 | action: close
17 | - name: "feature suggestion"
18 | labeled:
19 | issue:
20 | body: |
21 | This issue has been closed as we only track bugs here.
22 |
23 | You can open a topic to discuss with community about this enhancement on [suggestion website](https://glpi.userecho.com/).
24 | You can also [contact GLPI editor team](https://portal.glpi-network.com/contact-us) directly if you are willing to sponsor this feature.
25 | action: close
26 |
--------------------------------------------------------------------------------
/example_java/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/example_java/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdk 34
5 | namespace = "org.flyve.example_java"
6 |
7 | defaultConfig {
8 | applicationId "org.flyve.example_java"
9 | minSdkVersion 21
10 | targetSdkVersion 34
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | lint {
25 | abortOnError false
26 | checkReleaseBuilds false
27 | }
28 |
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(include: ['*.jar'], dir: 'libs')
33 | implementation 'androidx.appcompat:appcompat:1.2.0'
34 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
35 | testImplementation 'junit:junit:4.13.2'
36 | androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
37 | exclude group: 'com.android.support', module: 'support-annotations'
38 | })
39 | implementation project(':inventory')
40 | }
41 |
--------------------------------------------------------------------------------
/.github/settings.yml:
--------------------------------------------------------------------------------
1 | repository:
2 | name: android-inventory-library
3 | description: Inventory client library written in Java for developing applications on Android
4 | homepage: http://flyve.org/android-inventory-library/
5 | topics: flyve-mdm, android-inventory, library
6 | private: false
7 | has_issues: true
8 | has_wiki: false
9 | has_downloads: true
10 | default_branch: develop
11 | allow_squash_merge: true
12 | allow_merge_commit: false
13 | allow_rebase_merge: true
14 | labels:
15 | - name: bug
16 | color: f44336
17 | - name: build
18 | color: 795548
19 | - name: cherry-pick
20 | color: af1c46
21 | - name: ci
22 | color: fbca04
23 | - name: documentation
24 | color: 607d8b
25 | - name: duplicate
26 | color: 9e9e9e
27 | - name: feature
28 | color: 3f51b5
29 | - name: hacktoberfest
30 | color: ff625f
31 | - name: invalid
32 | color: cddc39
33 | - name: performance
34 | color: 009688
35 | - name: question
36 | color: ff5722
37 | - name: refactor
38 | color: 9c27b0
39 | - name: style
40 | color: 2196f3
41 | - name: test
42 | color: 8bc34a
43 | - name: wontfix
44 | color: ffffff
45 | - name: help wanted
46 | color: 33aa3f
47 | - name: good first issue
48 | color: 7057ff
49 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | # Pull Request
2 |
3 | ## Description
4 | Provide a brief description of the changes made in this pull request. Include the problem this fixes or the feature it implements.
5 |
6 | ### Type of Change
7 | - [ ] Bug fix (non-breaking change that fixes an issue)
8 | - [ ] New feature (non-breaking change that adds functionality)
9 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10 | - [ ] Documentation update (improvements or additions to documentation)
11 |
12 | ---
13 |
14 | ## Related Issues
15 | List any related issues that are fixed or addressed by this pull request.
16 |
17 | Fixes: # [issue number]
18 |
19 | Closes: # [issue number]
20 |
21 | ---
22 |
23 | ## Testing
24 | Describe the testing performed for these changes:
25 | - Device/Emulator: [e.g., Pixel 5, Android 12]
26 | - Test Cases: [e.g., tested login functionality, navigation, etc.]
27 | - Results: [e.g., passed all tests, fixed rendering issue]
28 |
29 | ---
30 |
31 | ## Screenshots/Recordings
32 | If applicable, attach screenshots or recordings of the changes made.
33 |
34 | ---
35 |
36 | ## Checklist
37 | - [ ] I have tested these changes locally.
38 | - [ ] I have added tests that prove my fix is effective or my feature works.
39 | - [ ] I have updated documentation (if necessary).
40 | - [ ] I have ensured that this PR does not introduce unintended breaking changes.
41 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/Bug_report.md:
--------------------------------------------------------------------------------
1 | # Bug Report
2 |
3 | A clear and concise description of the bug.
4 |
5 | ## Steps to Reproduce
6 | Steps to reproduce the behavior:
7 | 1. Go to '...'
8 | 2. Perform action '...'
9 | 3. See error '...'
10 |
11 | ## Expected Behavior
12 | A clear and concise description of what you expected to happen.
13 |
14 | ## Actual Behavior
15 | Describe what actually happens instead.
16 |
17 | ## Screenshots
18 | If applicable, add screenshots to help explain your problem.
19 |
20 | ## Environment Details
21 | - **Library Version:** [e.g., 1.2.3]
22 | - **Android Version:** [e.g., Android 11]
23 | - **Device:** [e.g., Pixel 5]
24 | - **Any other relevant details:** [e.g., build environment, dependencies]
25 |
26 | ## Logs
27 | Please provide relevant logcat output or any other logs that may help in diagnosing the issue.
28 |
29 | ```text
30 | # Paste logs here
31 | ```
32 |
33 | ## Additional context
34 | Add any other context about the problem here, including links to documentation or issues that might be related.
35 |
36 | ## Possible Solution
37 | (Optional) If you have an idea of how to fix the bug, describe it here.
38 |
39 | ## Checklist
40 | - [ ] I have searched existing issues to see if the bug has already been reported.
41 | - [ ] I have provided sufficient details to reproduce the issue.
42 | - [ ] I have included relevant logs/screenshots.
43 |
44 |
45 |
--------------------------------------------------------------------------------
/example_kotlin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | compileSdk 34
6 | namespace = "org.flyve.example_kotlin"
7 |
8 | defaultConfig {
9 | applicationId "org.flyve.example_kotlin"
10 | minSdkVersion 21
11 | targetSdkVersion 34
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 |
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | lint {
26 | abortOnError false
27 | checkReleaseBuilds false
28 | }
29 |
30 | compileOptions {
31 | sourceCompatibility = JavaVersion.VERSION_17
32 | targetCompatibility = JavaVersion.VERSION_17
33 | }
34 |
35 | kotlinOptions {
36 | jvmTarget = JavaVersion.VERSION_17
37 | }
38 |
39 | }
40 |
41 | dependencies {
42 | implementation fileTree(include: ['*.jar'], dir: 'libs')
43 | implementation 'androidx.appcompat:appcompat:1.2.0'
44 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
45 | testImplementation 'junit:junit:4.13.2'
46 | androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
47 | exclude group: 'com.android.support', module: 'support-annotations'
48 | })
49 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.50'
50 | implementation project(':inventory')
51 | }
52 |
--------------------------------------------------------------------------------
/example_java/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "464602262569",
4 | "firebase_url": "https://android-inventory-librar-6398c.firebaseio.com",
5 | "project_id": "android-inventory-librar-6398c",
6 | "storage_bucket": "android-inventory-librar-6398c.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:464602262569:android:032a5675fb60ca1fa80038",
12 | "android_client_info": {
13 | "package_name": "org.flyve.example_java"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "464602262569-iqkse0dn6u58mncsg7fm9v51nn4jpqri.apps.googleusercontent.com",
19 | "client_type": 1,
20 | "android_info": {
21 | "package_name": "org.flyve.example_java",
22 | "certificate_hash": "4287d795b3ca467f0920cca3c9e461129d5f6af1"
23 | }
24 | },
25 | {
26 | "client_id": "464602262569-vsds504dcuk6kaqhm3bv7jbtcednae0q.apps.googleusercontent.com",
27 | "client_type": 3
28 | }
29 | ],
30 | "api_key": [
31 | {
32 | "current_key": "AIzaSyDaC1lyN-scvtY5eN_vQtoHLKs6N86sLeE"
33 | }
34 | ],
35 | "services": {
36 | "appinvite_service": {
37 | "other_platform_oauth_client": [
38 | {
39 | "client_id": "464602262569-vsds504dcuk6kaqhm3bv7jbtcednae0q.apps.googleusercontent.com",
40 | "client_type": 3
41 | }
42 | ]
43 | }
44 | }
45 | }
46 | ],
47 | "configuration_version": "1"
48 | }
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/categories/Processes.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.categories;
28 |
29 | public class Processes
30 | extends Category {
31 |
32 | public Processes(String xType, String tagName) {
33 | super(xType, tagName);
34 | // TODO review how to get all the processes
35 | }
36 |
37 | /**
38 | *
39 | */
40 | private static final long serialVersionUID = 5399654900099889897L;
41 |
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/example_java/src/test/java/org/flyve/example_java/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.example_java;
28 |
29 | import org.junit.Test;
30 |
31 | import static org.junit.Assert.*;
32 |
33 | /**
34 | * Example local unit test, which will execute on the development machine (host).
35 | *
36 | * @see Testing documentation
37 | */
38 | public class ExampleUnitTest {
39 | @Test
40 | public void addition_isCorrect() throws Exception {
41 | assertEquals(4, 2 + 2);
42 | }
43 | }
--------------------------------------------------------------------------------
/inventory/src/main/assets/cpu_family.json:
--------------------------------------------------------------------------------
1 | [
2 | {"vid": "0x41", "id": "0xc05", "name": "Cortex-A5"},
3 | {"vid": "0x41", "id": "0xc07", "name": "Cortex-A7"},
4 | {"vid": "0x41", "id": "0xc08", "name": "Cortex-A8"},
5 | {"vid": "0x41", "id": "0xc09", "name": "Cortex-A9"},
6 |
7 | {"vid": "0x41", "id": "0xc0d", "name": "Cortex-A12"},
8 | {"vid": "0x41", "id": "0xc0e", "name": "Cortex-A17"},
9 | {"vid": "0x41", "id": "0xc0f", "name": "Cortex-A15"},
10 |
11 | {"vid": "0x41", "id": "0xd01", "name": "Cortex-A32"},
12 | {"vid": "0x41", "id": "0xd01", "name": "Cortex-A32"},
13 | {"vid": "0x41", "id": "0xd03", "name": "Cortex-A53"},
14 | {"vid": "0x41", "id": "0xd04", "name": "Cortex-A35"},
15 | {"vid": "0x41", "id": "0xd05", "name": "Cortex-A55"},
16 | {"vid": "0x41", "id": "0xd07", "name": "Cortex-A57"},
17 | {"vid": "0x41", "id": "0xd08", "name": "Cortex-A72"},
18 | {"vid": "0x41", "id": "0xd09", "name": "Cortex-A73"},
19 |
20 | {"vid": "0x4e", "id": "0x0", "name": "Denver"},
21 |
22 | {"vid": "0x51", "id": "0xf", "name": "Scorpion"},
23 | {"vid": "0x51", "id": "0x2d", "name": "Scorpion"},
24 | {"vid": "0x51", "id": "0x4d", "name": "Krait"},
25 | {"vid": "0x51", "id": "0x6f", "name": "Krait"},
26 |
27 | {"vid": "0x51", "id": "0x201", "name": "Kryo"},
28 | {"vid": "0x51", "id": "0x205", "name": "Kryo"},
29 | {"vid": "0x51", "id": "0x211", "name": "Kryo"},
30 |
31 | {"vid": "0x51", "id": "0x800", "name": "Kryo-2xx"},
32 | {"vid": "0x51", "id": "0x801", "name": "Kryo-2xx"},
33 |
34 | {"vid": "0x51", "id": "0x802", "name": "Kryo-3xx"},
35 | {"vid": "0x51", "id": "0x803", "name": "Kryo-3xx"},
36 |
37 | {"vid": "0x53", "id": "0x1", "name": "Mongoose"},
38 | {"vid": "0x53", "id": "0x2", "name": "Mongoose-M3"},
39 |
40 | {"vid": "0x69", "id": "0x1", "name": "Intel"}
41 | ]
42 |
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/FlyveException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | public class FlyveException extends Exception
30 | {
31 |
32 | /**
33 | * Constructor of the class FlyveException
34 | * Call the superclass constructor
35 | */
36 | public FlyveException() {
37 | super();
38 | }
39 |
40 | /**
41 | * The superclass constructor with a matching argument is called
42 | * @param message String
43 | * @param cause Throwable
44 | */
45 | public FlyveException(String message, Throwable cause)
46 | {
47 | super(message, cause);
48 | }
49 | }
--------------------------------------------------------------------------------
/inventory/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 |
5 | android {
6 | compileSdk 34
7 |
8 | defaultConfig {
9 | minSdkVersion 21
10 | targetSdkVersion 34
11 |
12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13 | multiDexEnabled true
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | debug {
21 | minifyEnabled false
22 | enableUnitTestCoverage true
23 | enableAndroidTestCoverage true
24 | }
25 | }
26 |
27 | buildFeatures {
28 | viewBinding true
29 | }
30 | namespace 'org.flyve.inventory'
31 | }
32 |
33 | configurations {
34 | javadocDeps
35 | }
36 |
37 |
38 | dependencies {
39 | implementation fileTree(dir: 'libs', include: ['*.jar'])
40 |
41 | androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
42 | exclude group: 'com.android.support', module: 'support-annotations'
43 | })
44 | testImplementation 'androidx.test:runner:1.6.2' // Or latest version
45 | testImplementation 'androidx.test:core:1.3.0'
46 |
47 | implementation 'com.orhanobut:logger:2.2.0'
48 | implementation 'androidx.appcompat:appcompat:1.2.0'
49 | implementation 'androidx.core:core:1.3.1'
50 | implementation 'com.android.support:multidex:2.0.1'
51 |
52 | javadocDeps 'com.orhanobut:logger:2.2.0'
53 | javadocDeps 'androidx.appcompat:appcompat:1.2.0'
54 | javadocDeps 'androidx.core:core:1.3.1'
55 | javadocDeps 'com.android.support:multidex:2.0.1'
56 | }
57 |
58 |
59 | Properties properties = new Properties()
60 | if(project.rootProject.file('local.properties').exists()) {
61 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
62 | }
63 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/UserTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 |
33 | import org.flyve.inventory.categories.User;
34 | import org.junit.Test;
35 | import org.junit.runner.RunWith;
36 |
37 | import static org.junit.Assert.assertNotEquals;
38 |
39 | @RunWith(AndroidJUnit4ClassRunner.class)
40 | public class UserTest {
41 |
42 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
43 |
44 | @Test
45 | public void getClassTest() {
46 | User user = new User(appContext);
47 | assertNotEquals("", user.getUserName());
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/example_java/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/ModemsTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 | import org.flyve.inventory.categories.Modems;
33 | import org.junit.Test;
34 | import org.junit.runner.RunWith;
35 |
36 | import static org.junit.Assert.assertNotEquals;
37 |
38 | @RunWith(AndroidJUnit4ClassRunner.class)
39 | public class ModemsTest {
40 |
41 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
42 |
43 | @Test
44 | public void getDriver() {
45 | for (String imei : new Modems(appContext).getIMEI()) {
46 | assertNotEquals("", imei);
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/example_kotlin/src/androidTest/java/org/flyve/example_kotlin/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.example_kotlin
28 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
29 | import org.junit.Assert.assertEquals
30 | import org.junit.Test
31 | import org.junit.runner.RunWith
32 |
33 | /**
34 | * Instrumented test, which will execute on an Android device.
35 | *
36 | * See [testing documentation](http://d.android.com/tools/testing).
37 | */
38 | @RunWith(AndroidJUnit4ClassRunner::class)
39 | class ExampleInstrumentedTest {
40 | @Test
41 | fun useAppContext() {
42 | // Context of the app under test.
43 | val context= androidx.test.platform.app.InstrumentationRegistry.getInstrumentation().targetContext
44 | assertEquals("org.flyve.example_kotlin", context.packageName)
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/usbManager/Validation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.usbManager;
28 |
29 | import java.io.File;
30 |
31 | class Validation {
32 | Validation() {
33 | }
34 |
35 | public boolean isValidUsbDeviceCandidate(File file) {
36 | if (!file.exists()) {
37 | return false;
38 | }
39 | if (!file.isDirectory()) {
40 | return false;
41 | }
42 | if (".".equals(file.getName()) || "..".equals(file.getName())) {
43 | return false;
44 | }
45 | return true;
46 | }
47 |
48 | public File[] getListOfChildren( File path) {
49 | if (path.exists() && path.isDirectory() && path.listFiles() != null) {
50 | return path.listFiles();
51 | }
52 | return new File[0];
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/VideosTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 |
31 | import androidx.test.platform.app.InstrumentationRegistry;
32 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
33 |
34 | import org.flyve.inventory.categories.Videos;
35 |
36 | import org.junit.Test;
37 | import org.junit.runner.RunWith;
38 |
39 | import static org.junit.Assert.assertNotEquals;
40 |
41 | @RunWith(AndroidJUnit4ClassRunner.class)
42 | public class VideosTest {
43 |
44 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
45 |
46 | @Test
47 | public void getResolution() throws Exception {
48 | Videos videos = new Videos(appContext);
49 | assertNotEquals("", videos.getResolution());
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/inventory/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
27 |
32 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/ControllersTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 |
31 | import androidx.test.platform.app.InstrumentationRegistry;
32 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
33 |
34 | import org.flyve.inventory.categories.Controllers;
35 | import org.junit.Test;
36 | import org.junit.runner.RunWith;
37 |
38 | import java.util.ArrayList;
39 |
40 | import static org.junit.Assert.assertNotEquals;
41 |
42 | @RunWith(AndroidJUnit4ClassRunner.class)
43 | public class ControllersTest {
44 |
45 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
46 |
47 | @Test
48 | public void getDriver() {
49 | ArrayList drivers = new Controllers(appContext).getDrivers();
50 | for (String driver : drivers) {
51 | assertNotEquals("", driver);
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/example_java/src/androidTest/java/org/flyve/example_java/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.example_java;
28 |
29 | import android.content.Context;
30 |
31 | import androidx.test.platform.app.InstrumentationRegistry;
32 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
33 |
34 | import org.junit.Test;
35 | import org.junit.runner.RunWith;
36 |
37 | import static org.junit.Assert.*;
38 |
39 | /**
40 | * Instrumented test, which will execute on an Android device.
41 | *
42 | * @see Testing documentation
43 | */
44 | @RunWith(AndroidJUnit4ClassRunner.class)
45 | public class ExampleInstrumentedTest {
46 | @Test
47 | public void useAppContext() throws Exception {
48 | // Context of the app under test.
49 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
50 |
51 | assertEquals("org.flyve.example_java", appContext.getPackageName());
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/InputsTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 |
31 | import androidx.test.platform.app.InstrumentationRegistry;
32 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
33 | import org.flyve.inventory.categories.Inputs;
34 |
35 | import org.junit.Test;
36 | import org.junit.runner.RunWith;
37 |
38 | import static org.junit.Assert.assertNotEquals;
39 | import static org.junit.Assert.assertNotNull;
40 |
41 | @RunWith(AndroidJUnit4ClassRunner.class)
42 | public class InputsTest {
43 |
44 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
45 |
46 | @Test
47 | public void getKeyboard() throws Exception {
48 | Inputs inputs = new Inputs(appContext);
49 | assertNotNull(inputs.getKeyboard());
50 | }
51 |
52 | @Test
53 | public void getTouchscreen() throws Exception {
54 | Inputs inputs = new Inputs(appContext);
55 | assertNotEquals("", inputs.getTouchscreen());
56 | }
57 |
58 | }
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/MemoryTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 |
33 | import org.flyve.inventory.categories.Memory;
34 |
35 | import org.junit.Test;
36 | import org.junit.runner.RunWith;
37 |
38 | import static org.junit.Assert.assertNotEquals;
39 |
40 | @RunWith(AndroidJUnit4ClassRunner.class)
41 | public class MemoryTest {
42 |
43 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
44 |
45 | @Test
46 | public void getCapacity() throws Exception {
47 | Memory memory = new Memory(appContext);
48 | assertNotEquals("", memory.getCapacity());
49 | }
50 |
51 | @Test
52 | public void getType() throws Exception {
53 | Memory memory = new Memory(appContext);
54 | assertNotEquals("", memory.getType());
55 | }
56 |
57 | @Test
58 | public void getSpeed() throws Exception {
59 | Memory memory = new Memory(appContext);
60 | assertNotEquals("", memory.getSpeed());
61 | }
62 |
63 | }
--------------------------------------------------------------------------------
/inventory/src/test/java/org/flyve/inventory/FunctionUnitTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import org.flyve.inventory.categories.StringUtils;
30 |
31 | import org.junit.Test;
32 |
33 | import java.util.ArrayList;
34 |
35 | import static org.junit.Assert.assertTrue;
36 |
37 | public class FunctionUnitTest {
38 |
39 | @Test
40 | public void createIP_correct() throws Exception {
41 | int ip = 19216801;
42 | String formatIp = StringUtils.intToIp(ip);
43 | assertTrue(formatIp.split("\\.").length==4);
44 | }
45 |
46 | @Test
47 | public void intToByte_correct() throws Exception {
48 | int byteNumber = 19216801;
49 |
50 | try {
51 | byte[] byteFormat = StringUtils.intToByte(byteNumber);
52 | assertTrue(true);
53 | } catch (Exception ex) {
54 | assertTrue(false);
55 | }
56 | }
57 |
58 | @Test
59 | public void join_correct() throws Exception {
60 | ArrayList arr = new ArrayList();
61 | for (int i =2; i <= 12; i++) {
62 | arr.add(String.valueOf(i*12345));
63 | }
64 |
65 | assertTrue(StringUtils.join(arr, "#").split("#").length==11);
66 | }
67 | }
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/usbManager/UsbProperty.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.usbManager;
28 |
29 | public enum UsbProperty {
30 | PID("idProduct"),
31 | VID("idVendor"),
32 | MANUFACTURER("manufacturer"),
33 | PRODUCT("product"),
34 | VERSION("version"),
35 | DEVICE_CLASS("bDeviceClass"),
36 | DEVICE_SUBCLASS("bDeviceSubClass"),
37 | DEVICE_NUMBER("devnum"),
38 | DEVICE_PROTOCOL("bDeviceProtocol"),
39 | MAX_POWER("bMaxPower"),
40 | BUS_NUMBER("busnum"),
41 | SERIAL("serial"),
42 | SPEED("speed"),
43 | SUPPORTS_AUTOSUSPEND("supports_autosuspend"),
44 | AUTHORIZED("authorized"),
45 | MODALIAS("modalias"),
46 | ALTERNATIVE_SETTING("bAlternateSetting"),
47 | NUM_INTERFACES("bNumInterfaces"),
48 | NUM_ENDPOINTS("bNumEndpoints"),
49 | INTERFACE("interface"),
50 | INTERFACE_CLASS("bInterfaceClass"),
51 | INTERFACE_NUMBER("bInterfaceNumber"),
52 | INTERFACE_PROTOCOL("bInterfaceProtocol"),
53 | INTERFACE_SUBCLASS("bInterfaceSubClass");
54 |
55 | private final String fileName;
56 |
57 | private UsbProperty(String fileName) {
58 | this.fileName = fileName;
59 | }
60 |
61 | public String getFileName() {
62 | return this.fileName;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/BluetoothTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 |
33 | import org.flyve.inventory.categories.Bluetooth;
34 |
35 | import org.junit.Test;
36 | import org.junit.runner.RunWith;
37 |
38 | import static org.junit.Assert.assertNotEquals;
39 | import static org.junit.Assert.assertTrue;
40 |
41 | @RunWith(AndroidJUnit4ClassRunner.class)
42 | public class BluetoothTest {
43 |
44 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
45 |
46 | @Test
47 | public void getHardware_address() throws Exception {
48 | if(!Utils.isEmulator()) {
49 | Bluetooth bluetooth = new Bluetooth(appContext);
50 | assertNotEquals("", bluetooth.getHardwareAddress());
51 | } else {
52 | assertTrue(true);
53 | }
54 | }
55 |
56 | @Test
57 | public void getName() throws Exception {
58 | if(!Utils.isEmulator()) {
59 | Bluetooth bluetooth = new Bluetooth(appContext);
60 | assertNotEquals("", bluetooth.getName());
61 | } else {
62 | assertTrue(true);
63 | }
64 |
65 |
66 | }
67 |
68 | }
--------------------------------------------------------------------------------
/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/usbManager/SysBusUsbManager.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.usbManager;
28 |
29 | import java.io.File;
30 | import java.util.Collections;
31 | import java.util.HashMap;
32 | import java.util.Map;
33 |
34 | public class SysBusUsbManager {
35 | private final HashMap myUsbDevices;
36 | private final SysBusUsbDeviceFactory sysBusUsbDeviceFactory;
37 | private final String usbSysPath;
38 | private final Validation validation;
39 |
40 | public SysBusUsbManager() {
41 | this("/sys/bus/usb/devices/");
42 | }
43 |
44 | public SysBusUsbManager(String usbSysPath) {
45 | this.usbSysPath = usbSysPath;
46 | this.myUsbDevices = new HashMap<>();
47 | this.sysBusUsbDeviceFactory = new SysBusUsbDeviceFactory();
48 | this.validation = new Validation();
49 | }
50 |
51 | public Map getUsbDevices() {
52 | populateList(this.usbSysPath);
53 | return Collections.unmodifiableMap(this.myUsbDevices);
54 | }
55 |
56 | private void populateList(String path) {
57 | this.myUsbDevices.clear();
58 | for (File child : this.validation.getListOfChildren(new File(path))) {
59 | if (this.validation.isValidUsbDeviceCandidate(child)) {
60 | SysBusUsbDevice usb = this.sysBusUsbDeviceFactory.create(child.getAbsoluteFile());
61 | if (usb != null) {
62 | this.myUsbDevices.put(child.getName(), usb);
63 | }
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/BatteryTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 |
31 | import androidx.test.platform.app.InstrumentationRegistry;
32 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
33 |
34 | import org.flyve.inventory.categories.Battery;
35 | import org.junit.Test;
36 | import org.junit.runner.RunWith;
37 |
38 | import static org.junit.Assert.assertNotEquals;
39 |
40 | @RunWith(AndroidJUnit4ClassRunner.class)
41 | public class BatteryTest {
42 |
43 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
44 |
45 | @Test
46 | public void getTechnology() {
47 | assertNotEquals("", new Battery(appContext).getTechnology());
48 | }
49 |
50 | @Test
51 | public void getTemperature() {
52 | assertNotEquals("", new Battery(appContext).getTemperature());
53 | }
54 |
55 | @Test
56 | public void getVoltage() {
57 | assertNotEquals("", new Battery(appContext).getVoltage());
58 | }
59 |
60 | @Test
61 | public void getLevel() {
62 | assertNotEquals("", new Battery(appContext).getLevel());
63 | }
64 |
65 | @Test
66 | public void getBatteryHealth() {
67 | assertNotEquals("", new Battery(appContext).getBatteryHealth());
68 | }
69 |
70 | @Test
71 | public void getBatteryStatus() {
72 | assertNotEquals("", new Battery(appContext).getBatteryStatus());
73 | }
74 |
75 | @Test
76 | public void getCapacity() {
77 | assertNotEquals("", new Battery(appContext).getCapacity());
78 | }
79 | }
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/UsbTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 |
33 | import org.flyve.inventory.categories.Usb;
34 | import org.junit.Test;
35 | import org.junit.runner.RunWith;
36 |
37 | import static org.junit.Assert.assertNotEquals;
38 |
39 | @RunWith(AndroidJUnit4ClassRunner.class)
40 | public class UsbTest {
41 |
42 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
43 |
44 | @Test
45 | public void getClassTest() {
46 | Usb usb = new Usb(appContext);
47 | assertNotEquals("", usb.getServiceClass());
48 | }
49 |
50 | @Test
51 | public void getProductid() {
52 | Usb usb = new Usb(appContext);
53 | assertNotEquals("", usb.getPid());
54 | }
55 |
56 | @Test
57 | public void getVendorid() {
58 | Usb usb = new Usb(appContext);
59 | assertNotEquals("", usb.getVid());
60 | }
61 |
62 | @Test
63 | public void getSubclass() {
64 | Usb usb = new Usb(appContext);
65 | assertNotEquals("", usb.getDeviceSubClass());
66 | }
67 |
68 | @Test
69 | public void getManufacturer() {
70 | Usb usb = new Usb(appContext);
71 | assertNotEquals("", usb.getReportedProductName());
72 | }
73 |
74 | @Test
75 | public void getCaption() {
76 | Usb usb = new Usb(appContext);
77 | assertNotEquals("", usb.getUsbVersion());
78 | }
79 |
80 | @Test
81 | public void getSerialNumber() {
82 | Usb usb = new Usb(appContext);
83 | assertNotEquals("", usb.getSerialNumber());
84 | }
85 |
86 | }
--------------------------------------------------------------------------------
/example_kotlin/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
21 |
22 |
34 |
35 |
40 |
41 |
46 |
47 |
56 |
57 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/categories/Envs.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.categories;
28 |
29 | import android.content.Context;
30 |
31 | import org.flyve.inventory.InventoryLog;
32 |
33 | import java.util.Map;
34 |
35 | /**
36 | * This class get all the information of the Environment
37 | */
38 | public class Envs extends Categories {
39 |
40 | /*
41 | * The serialization runtime associates with each serializable class a version number,
42 | * called a serialVersionUID, which is used during deserialization to verify that the sender
43 | * and receiver of a serialized object have loaded classes for that object that are compatible
44 | * with respect to serialization. If the receiver has loaded a class for the object that has a
45 | * different serialVersionUID than that of the corresponding sender's class, then deserialization
46 | * will result in an InvalidClassException
47 | *
48 | * from: https://stackoverflow.com/questions/285793/what-is-a-serialversionuid-and-why-should-i-use-it
49 | */
50 | private static final long serialVersionUID = -6210390594988309754L;
51 |
52 | /**
53 | * This constructor load the context and the Environment information
54 | * @param xCtx Context where this class work
55 | */
56 | public Envs(Context xCtx) {
57 | super(xCtx);
58 |
59 | try {
60 | //get all envs vars
61 | Map envs = System.getenv();
62 | for (Map.Entry entry : envs.entrySet()) {
63 | Category c = new Category("ENVS", "envs");
64 | c.put("KEY", new CategoryValue(entry.getKey(), "KEY", "key"));
65 | c.put("VAL", new CategoryValue(envs.get(entry.getKey()), "VAL", "Value"));
66 | this.add(c);
67 | }
68 | } catch (Exception ex) {
69 | InventoryLog.e(ex.getMessage());
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/OperatingSystemTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 | import org.flyve.inventory.categories.OperatingSystem;
33 | import org.junit.Test;
34 | import org.junit.runner.RunWith;
35 |
36 | import static org.junit.Assert.assertNotEquals;
37 | import static org.junit.Assert.assertNotNull;
38 | import static org.junit.Assert.assertTrue;
39 |
40 |
41 | @RunWith(AndroidJUnit4ClassRunner.class)
42 | public class OperatingSystemTest {
43 |
44 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
45 |
46 | @Test
47 | public void getBootTime() {
48 | assertNotEquals("", new OperatingSystem(appContext).getBootTime());
49 | }
50 |
51 | @Test
52 | public void getKernelVersion() {
53 | assertNotEquals("", new OperatingSystem(appContext).getKernelVersion());
54 | }
55 |
56 | @Test
57 | public void getTimeZoneShortName() {
58 | assertNotEquals("", new OperatingSystem(appContext).getTimeZoneShortName());
59 | }
60 |
61 | @Test
62 | public void getCurrentTimezoneOffset() {
63 | assertNotEquals("", new OperatingSystem(appContext).getCurrentTimezoneOffset());
64 |
65 | OperatingSystem operatingSystem = new OperatingSystem(appContext);
66 | String timezoneOffset = operatingSystem.getCurrentTimezoneOffset();
67 |
68 | assertNotNull("Timezone offset should not be null", timezoneOffset);
69 | assertNotEquals("Timezone offset should not be empty", "", timezoneOffset);
70 | assertTrue("Timezone offset should match the format [+/-]HHMM", timezoneOffset.matches("[+-]\\d{4}"));
71 | }
72 |
73 | @Test
74 | public void getSSHKey() {
75 | assertNotEquals("", new OperatingSystem(appContext).getSSHKey());
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/HardwareTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 |
31 | import androidx.test.platform.app.InstrumentationRegistry;
32 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
33 |
34 | import org.flyve.inventory.categories.Hardware;
35 |
36 | import org.junit.Test;
37 | import org.junit.runner.RunWith;
38 |
39 | import static org.junit.Assert.assertNotEquals;
40 |
41 | @RunWith(AndroidJUnit4ClassRunner.class)
42 | public class HardwareTest {
43 |
44 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
45 |
46 | @Test
47 | public void getDatelastloggeduser() throws Exception {
48 | Hardware hardware = new Hardware(appContext);
49 | assertNotEquals("", hardware.getDateLastLoggedUser());
50 |
51 | }
52 |
53 | @Test
54 | public void getLastloggeduser() throws Exception {
55 | Hardware hardware = new Hardware(appContext);
56 | assertNotEquals("", hardware.getLastLoggedUser());
57 | }
58 |
59 | @Test
60 | public void getUser() throws Exception {
61 | Hardware hardware = new Hardware(appContext);
62 | assertNotEquals("", hardware.getUserId());
63 | }
64 |
65 | @Test
66 | public void getName() throws Exception {
67 | Hardware hardware = new Hardware(appContext);
68 | assertNotEquals("", hardware.getName());
69 | }
70 |
71 | @Test
72 | public void getOsversion() throws Exception {
73 | Hardware hardware = new Hardware(appContext);
74 | assertNotEquals("", hardware.getOsVersion());
75 | }
76 |
77 | @Test
78 | public void getArchname() throws Exception {
79 | Hardware hardware = new Hardware(appContext);
80 | assertNotEquals("", hardware.getArchName());
81 | }
82 |
83 | @Test
84 | public void getUUID() throws Exception {
85 | Hardware hardware = new Hardware(appContext);
86 | assertNotEquals("", hardware.getUUID());
87 | }
88 |
89 | }
--------------------------------------------------------------------------------
/.github/workflows/release-new-version.yml:
--------------------------------------------------------------------------------
1 | name: "GLPI Android Inventory Library Release"
2 |
3 | env:
4 | module_java: example_java
5 | module_kotlin: example_kotlin
6 | module_inventory: inventory
7 |
8 | on:
9 | push:
10 | tags:
11 | - '*'
12 |
13 | jobs:
14 | build:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - name: Fetch Android-Inventory-Library Repository
18 | uses: actions/checkout@v3
19 | with:
20 | ref: main
21 | fetch-depth: 0 #To Fetch All Tags and Branches
22 |
23 | - name: "Extract Current Tag Name"
24 | run: echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
25 |
26 | - name: "Update Release Version"
27 | run: echo "$(jq '.version = "${{ env.tag_name }}"' package.json)" > package.json
28 |
29 | - name: Extract Previous Tag Name
30 | run: echo "previous_tag_name=$(git tag --sort=taggerdate | tail -1)" >> $GITHUB_ENV
31 |
32 | - name: Set Up JDK 17
33 | uses: actions/setup-java@v3
34 | with:
35 | java-version: '17'
36 | distribution: 'temurin'
37 | cache: gradle
38 |
39 | ##############################################
40 | # Prepare / Build project APK / AAR / JAR #
41 | ##############################################
42 | # Grant execute permission for gradlew
43 | - name: Grant Execute Permission For Gradlew
44 | run: chmod +x gradlew
45 | # Build app
46 | - name: Build for run tests or static analysis
47 | run: ./gradlew build
48 |
49 |
50 | #####################
51 | # Prepare release #
52 | #####################
53 | - name: Update main branch
54 | uses: EndBug/add-and-commit@v9
55 | with:
56 | default_author: github_actions
57 | add: "['CHANGELOG.md', 'package.json']"
58 | push: origin HEAD:main
59 | message: "ci(release): release new version ${{ env.tag_name }}"
60 |
61 | - name: "Rename ${{ env.module_java }} APK"
62 | run: mv ${{ env.module_java }}/build/outputs/apk/release/${{ env.module_java }}-release-unsigned.apk ${{ env.module_java }}/build/outputs/apk/release/${{ env.module_java }}-v${{ env.tag_name }}.apk
63 |
64 | - name: "Rename ${{ env.module_kotlin }} APK"
65 | run: mv ${{ env.module_kotlin }}/build/outputs/apk/release/${{ env.module_kotlin }}-release-unsigned.apk ${{ env.module_kotlin }}/build/outputs/apk/release/${{ env.module_kotlin }}-v${{ env.tag_name }}.apk
66 |
67 | - name: "Rename ${{ env.module_inventory }} AAR"
68 | run: mv ${{ env.module_inventory }}/build/outputs/aar/${{ env.module_inventory }}-release.aar ${{ env.module_inventory }}/build/outputs/aar/${{ env.module_inventory }}-release-v${{ env.tag_name }}.aar
69 |
70 | - name: Create Release
71 | uses: softprops/action-gh-release@v1
72 | if: startsWith(github.ref, 'refs/tags/')
73 | with:
74 | name : Inventory Engine v${{ env.tag_name }}
75 | draft : true
76 | body : See CHANGELOG.md
77 | files: |
78 | ${{ env.module_java }}/build/outputs/apk/release/${{ env.module_java }}-v${{ env.tag_name }}.apk
79 | ${{ env.module_kotlin }}/build/outputs/apk/release/${{ env.module_kotlin }}-v${{ env.tag_name }}.apk
80 | ${{ env.module_inventory }}/build/outputs/aar/${{ env.module_inventory }}-release-v${{ env.tag_name }}.aar
81 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@teclib.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/example_java/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
22 |
23 |
35 |
36 |
41 |
42 |
47 |
48 |
49 |
62 |
63 |
78 |
79 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/CreateFileTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 |
33 | import org.flyve.inventory.categories.Categories;
34 | import org.flyve.inventory.categories.Category;
35 |
36 | import org.flyve.inventory.categories.CategoryValue;
37 | import org.json.JSONObject;
38 | import org.junit.Test;
39 | import org.junit.runner.RunWith;
40 |
41 | import java.util.ArrayList;
42 |
43 | import static org.junit.Assert.assertTrue;
44 |
45 | @RunWith(AndroidJUnit4ClassRunner.class)
46 | public class CreateFileTest {
47 |
48 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
49 |
50 | @Test
51 | public void createXMLTest() throws Exception {
52 | ArrayList mContent = new ArrayList();
53 | Category category = new Category("CAMERAS", "cameras");
54 | category.put("RESOLUTION", new CategoryValue("3264x2448", "RESOLUTION", "resolution"));
55 |
56 | Categories categories = new Categories(appContext);
57 | categories.add(category);
58 |
59 | mContent.add(categories);
60 |
61 | try {
62 | String xml = Utils.createXML(appContext, mContent, "Agent", false, "test-tag", "Computer");
63 | assertTrue(true);
64 | } catch (Exception ex) {
65 | assertTrue(false);
66 | }
67 | }
68 |
69 | @Test
70 | public void createJSONTest() throws Exception {
71 | ArrayList mContent = new ArrayList();
72 | Category category = new Category("CAMERAS", "cameras");
73 | category.put("RESOLUTION", new CategoryValue("3264x2448", "RESOLUTION", "resolution"));
74 |
75 | Categories categories = new Categories(appContext);
76 | categories.add(category);
77 |
78 | mContent.add(categories);
79 |
80 | String json = Utils.createJSON(appContext, mContent, "Agent", false, "test-tag", "Computer");
81 |
82 | try {
83 | JSONObject objJson = new JSONObject(json);
84 | assertTrue(true);
85 | } catch (Exception ex) {
86 | assertTrue(false);
87 | }
88 | }
89 |
90 | }
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/InventoryTaskTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 | import android.util.Log;
33 |
34 | import org.junit.Test;
35 | import org.junit.runner.RunWith;
36 |
37 | import static org.junit.Assert.assertNotEquals;
38 | import static org.junit.Assert.assertTrue;
39 |
40 | @RunWith(AndroidJUnit4ClassRunner.class)
41 | public class InventoryTaskTest {
42 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
43 |
44 | @Test
45 | public void getJSONTest() throws Exception {
46 | InventoryTask task = new InventoryTask(appContext, "test", true);
47 | task.getJSON(new InventoryTask.OnTaskCompleted() {
48 | @Override
49 | public void onTaskSuccess(String data) {
50 | Log.d("Success Library JSON: ", data);
51 | assertNotEquals("", data);
52 | }
53 |
54 | @Override
55 | public void onTaskError(Throwable error) {
56 | assertTrue(true);
57 | }
58 | });
59 | }
60 |
61 | @Test
62 | public void getXMLTest() throws Exception {
63 | InventoryTask task = new InventoryTask(appContext, "test", true);
64 | task.getXML(new InventoryTask.OnTaskCompleted() {
65 | @Override
66 | public void onTaskSuccess(String data) {
67 | Log.d("Success Library XML: ", data);
68 | assertNotEquals("", data);
69 | }
70 |
71 | @Override
72 | public void onTaskError(Throwable error) {
73 | assertTrue(true);
74 | }
75 | });
76 | }
77 |
78 | @Test
79 | public void getJSONsyncTest() throws Exception {
80 | InventoryTask task = new InventoryTask(appContext, "test", true);
81 | String data = task.getJSONSync();
82 | assertNotEquals("", data);
83 | }
84 |
85 | @Test
86 | public void getXMLsyncTest() throws Exception {
87 | InventoryTask task = new InventoryTask(appContext, "test", true);
88 | String data = task.getXMLSyn();
89 | Log.d("Success Library XML: ", data);
90 | assertNotEquals("", data);
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Android Inventory Library
2 |
3 | Thank you for considering contributing to the Android Inventory Library! Your contributions help improve the project and ensure its success. Please follow the guidelines below to ensure a smooth and productive collaboration.
4 |
5 | ---
6 |
7 | ## Table of Contents
8 |
9 | 1. [Code of Conduct](#code-of-conduct)
10 | 2. [How to Contribute](#how-to-contribute)
11 | - [Bug Reports](#bug-reports)
12 | - [Pull Requests](#pull-requests)
13 | 3. [Development Environment](#development-environment)
14 | 4. [Code Style](#code-style)
15 | 5. [Testing](#testing)
16 | 6. [Contact](#contact)
17 |
18 | ---
19 |
20 | ## Code of Conduct
21 |
22 | By participating in this project, you agree to abide by the [Code of Conduct](CODE_OF_CONDUCT.md). Please treat others with respect and professionalism.
23 |
24 | ---
25 |
26 | ## How to Contribute
27 |
28 | ### Bug Reports
29 |
30 | 1. **Search existing issues**: Before reporting a bug, check if it has already been reported.
31 | 2. **Create a new issue**: If no similar issue exists, open a new issue and provide:
32 | - A clear and descriptive title.
33 | - Steps to reproduce the issue.
34 | - Expected vs. actual behavior.
35 | - Environment details (e.g., Android version, device model).
36 | 3. **Attach logs and screenshots**: If applicable, include logs or screenshots to help diagnose the issue.
37 |
38 | ### Pull Requests
39 |
40 | 1. Fork the repository and create a new branch for your changes:
41 | ```bash
42 | git checkout -b feature/your-feature-name
43 | ```
44 | 2. Make your changes while adhering to the [Code Style](#code-style) guidelines.
45 | 3. Ensure all tests pass and write new tests for your changes.
46 | 4. Commit your changes with clear and descriptive messages:
47 | ```bash
48 | git commit -m "feat: add new feature description"
49 | ```
50 | 5. Push your branch and create a Pull Request against the `main` branch.
51 |
52 | ---
53 |
54 | ## Development Environment
55 |
56 | To set up the project locally:
57 |
58 | 1. Clone the repository:
59 | ```bash
60 | git clone https://github.com/glpi-project/android-inventory-library.git
61 | ```
62 | 2. Open the project in **Android Studio**.
63 | 3. Sync Gradle and resolve dependencies.
64 | 4. Build and run the project using the preferred emulator or physical device.
65 |
66 | ---
67 |
68 | ## Code Style
69 |
70 | - Follow **Android's official Kotlin/Java coding standards**.
71 | - Use meaningful variable, method, and class names.
72 | - Format your code using Android Studio's built-in formatter.
73 | - Add comments to explain complex logic or algorithms.
74 |
75 | ---
76 |
77 | ## Testing
78 |
79 | ### Writing Tests
80 | - Use **JUnit** and / or **Espresso** for writing unit and UI tests.
81 | - Place your tests in the appropriate directories:
82 | - `/src/test/` for unit tests.
83 | - `/src/androidTest/` for instrumentation tests.
84 |
85 | ### Running Tests
86 | - To run all tests, execute the following command:
87 | ```bash
88 | ./gradlew test
89 | ./gradlew connectedAndroidTest
90 | ```
91 |
92 | ### Firebase Test Lab (Optional)
93 | - Tests are automatically run using Firebase Test Lab via GitHub Actions for all Pull Requests.
94 |
95 | ---
96 |
97 | ## Contact
98 |
99 | For questions or discussions, feel free to:
100 | - Open an issue.
101 | - Join the [GLPI community forums](https://forum.glpi-project.org/).
102 | - Reach out to the maintainers directly on GitHub.
103 |
104 | ---
105 |
106 | We appreciate your interest in improving Android Inventory Library. Thank you for contributing!
107 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/BiosTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 |
31 |
32 | import androidx.test.platform.app.InstrumentationRegistry;
33 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
34 |
35 | import org.flyve.inventory.categories.Bios;
36 |
37 | import org.junit.Test;
38 | import org.junit.runner.RunWith;
39 | import static org.junit.Assert.*;
40 |
41 | @RunWith(AndroidJUnit4ClassRunner.class)
42 | public class BiosTest {
43 | private Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();;
44 |
45 | @Test
46 | public void getAssesTag() {
47 | Bios bios = new Bios(appContext);
48 | assertNotEquals("", bios.getAssetTag() );
49 | }
50 |
51 | @Test
52 | public void getBiosDate() {
53 | Bios bios = new Bios(appContext);
54 | assertNotEquals("", bios.getBiosDate());
55 | }
56 |
57 | @Test
58 | public void getBiosManufacturer() {
59 | Bios bios = new Bios(appContext);
60 | assertNotEquals("", bios.getBiosManufacturer());
61 | }
62 |
63 | @Test
64 | public void getBiosVersion() {
65 | Bios bios = new Bios(appContext);
66 | assertNotEquals("", bios.getBiosVersion());
67 | }
68 |
69 | @Test
70 | public void getMotherBoardManufacturer() {
71 | Bios bios = new Bios(appContext);
72 | assertNotEquals("", bios.getManufacturer() );
73 | }
74 |
75 | @Test
76 | public void getMotherBoardModel() {
77 | Bios bios = new Bios(appContext);
78 | assertNotEquals("", bios.getModel() );
79 | }
80 |
81 | @Test
82 | public void getMotherBoardSerialNumber() {
83 | Bios bios = new Bios(appContext);
84 | assertNotEquals("", bios.getMotherBoardSerial() );
85 | }
86 |
87 | @Test
88 | public void getSystemManufacturer() {
89 | Bios bios = new Bios(appContext);
90 | assertNotEquals("", bios.getManufacturer() );
91 | }
92 |
93 | @Test
94 | public void getSystemModel() {
95 | Bios bios = new Bios(appContext);
96 | assertNotEquals("", bios.getModel() );
97 | }
98 |
99 | @Test
100 | public void getSystemSerialNumber() {
101 | Bios bios = new Bios(appContext);
102 | assertNotEquals("", bios.getSystemSerialNumber() );
103 | }
104 |
105 | }
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/CpusTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 |
33 | import org.flyve.inventory.categories.Cpus;
34 |
35 | import org.junit.Test;
36 | import org.junit.runner.RunWith;
37 |
38 | import static org.junit.Assert.assertNotEquals;
39 | import static org.junit.Assert.assertTrue;
40 |
41 | @RunWith(AndroidJUnit4ClassRunner.class)
42 | public class CpusTest {
43 |
44 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
45 |
46 | @Test
47 | public void getArch() throws Exception {
48 | Cpus cpus = new Cpus(appContext);
49 | assertNotEquals("", cpus.getArch());
50 | }
51 |
52 | @Test
53 | public void getCPUCore() throws Exception {
54 | Cpus cpus = new Cpus(appContext);
55 | assertNotEquals("", cpus.getCPUCore());
56 | }
57 |
58 | @Test
59 | public void getFamilyName() throws Exception {
60 | Cpus cpus = new Cpus(appContext);
61 | assertNotEquals("", cpus.getFamilyName());
62 | }
63 |
64 | @Test
65 | public void getFamilyNumber() throws Exception {
66 | Cpus cpus = new Cpus(appContext);
67 | assertNotEquals("", cpus.getFamilyNumber());
68 | }
69 |
70 | @Test
71 | public void getManufacturer() throws Exception {
72 | Cpus cpus = new Cpus(appContext);
73 | assertNotEquals("", cpus.getManufacturer());
74 | }
75 |
76 | @Test
77 | public void getModel() throws Exception {
78 | Cpus cpus = new Cpus(appContext);
79 | assertNotEquals("", cpus.getModel());
80 | }
81 |
82 | @Test
83 | public void getCpuName() throws Exception {
84 | Cpus cpus = new Cpus(appContext);
85 | assertNotEquals("", cpus.getCpuName());
86 | }
87 |
88 | @Test
89 | public void getCpuThread() throws Exception {
90 | Cpus cpus = new Cpus(appContext);
91 | assertNotEquals("", cpus.getCpuThread());
92 | }
93 |
94 | @Test
95 | public void getCpuFrequency() throws Exception {
96 | // work on real device
97 | if(!Utils.isEmulator()) {
98 | Cpus cpus = new Cpus(appContext);
99 | assertNotEquals("", cpus.getCpuFrequency());
100 | } else {
101 | assertTrue(true);
102 | }
103 | }
104 | }
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/InventoryLog.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import android.content.res.Resources;
31 | import android.util.Log;
32 |
33 | import com.orhanobut.logger.Logger;
34 |
35 | /**
36 | * This is a Utils class grapper for Log
37 | */
38 | public final class InventoryLog {
39 |
40 | // This is the tag to search on console
41 | static final String TAG = "InventoryLibrary";
42 |
43 | /**
44 | * private constructor to prevent instances of this class
45 | */
46 | private InventoryLog() {
47 | }
48 |
49 | /**
50 | * Sends a DEBUG log message
51 | * @param message to log
52 | */
53 | public static void d(String message) {
54 | if(message != null) {
55 | Log.d(TAG, message);
56 | }
57 | }
58 |
59 | /**
60 | * Sends a VERBOSE log message
61 | * @param message to log
62 | */
63 | public static void v(String message) {
64 | if(message != null) {
65 | Log.v(TAG, message);
66 | }
67 | }
68 |
69 | /**
70 | * Sends an INFO log message
71 | * @param message to log
72 | */
73 | public static void i(String message) {
74 | if(message != null) {
75 | Log.i(TAG, message);
76 | }
77 | }
78 |
79 | /**
80 | * Sends an ERROR log message
81 | * @param message to log
82 | */
83 | public static void e(String message) {
84 | if(message != null) {
85 | Log.e(TAG, message);
86 | }
87 | }
88 |
89 | /**
90 | * Sends a low level calling log
91 | * @param obj the name of the class
92 | * @param msg the log message
93 | * @param level the priority/type of the log message
94 | */
95 | public static void log(Object obj, String msg, int level) {
96 | String final_msg = String.format("[%s] %s", obj.getClass().getName(), msg);
97 | Log.println(level, "InventoryAgent", final_msg);
98 | }
99 |
100 | public static String getMessage(Context context, int type, String message) {
101 | Resources resource = context.getResources();
102 | return resource.getString(R.string.error_message_with_number, String.valueOf(type), message);
103 | }
104 |
105 | public static String getMessage(String type, String message) {
106 | String resource = Resources.getSystem().getString(R.string.error_message_with_number);
107 | return String.format(resource, type, message);
108 | }
109 | }
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/SensorsTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import android.hardware.Sensor;
31 | import android.hardware.SensorManager;
32 | import androidx.test.platform.app.InstrumentationRegistry;
33 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
34 |
35 | import org.flyve.inventory.categories.Sensors;
36 |
37 | import org.junit.Test;
38 | import org.junit.runner.RunWith;
39 |
40 | import java.util.List;
41 |
42 | import static org.junit.Assert.assertNotEquals;
43 |
44 | @RunWith(AndroidJUnit4ClassRunner.class)
45 | public class SensorsTest {
46 |
47 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
48 | Sensors csensors = new Sensors(appContext);
49 |
50 | @Test
51 | public void getName() throws Exception {
52 | SensorManager sensorManager = (SensorManager) appContext.getSystemService(Context.SENSOR_SERVICE);
53 | List sensors = sensorManager.getSensorList(Sensor.TYPE_ALL);
54 |
55 | for (Sensor s : sensors) {
56 | assertNotEquals("", csensors.getName(s));
57 | }
58 | }
59 |
60 | @Test
61 | public void getManufacturer() throws Exception {
62 | SensorManager sensorManager = (SensorManager) appContext.getSystemService(Context.SENSOR_SERVICE);
63 | List sensors = sensorManager.getSensorList(Sensor.TYPE_ALL);
64 |
65 | for (Sensor s : sensors) {
66 | assertNotEquals("", csensors.getManufacturer(s));
67 | }
68 | }
69 |
70 | @Test
71 | public void getType() throws Exception {
72 | SensorManager sensorManager = (SensorManager) appContext.getSystemService(Context.SENSOR_SERVICE);
73 | List sensors = sensorManager.getSensorList(Sensor.TYPE_ALL);
74 |
75 | for (Sensor s : sensors) {
76 | assertNotEquals("", csensors.getType(s));
77 | }
78 | }
79 |
80 | @Test
81 | public void getPower() throws Exception {
82 | SensorManager sensorManager = (SensorManager) appContext.getSystemService(Context.SENSOR_SERVICE);
83 | List sensors = sensorManager.getSensorList(Sensor.TYPE_ALL);
84 |
85 | for (Sensor s : sensors) {
86 | assertNotEquals("", csensors.getPower(s));
87 | }
88 | }
89 |
90 | @Test
91 | public void getVersion() throws Exception {
92 | SensorManager sensorManager = (SensorManager) appContext.getSystemService(Context.SENSOR_SERVICE);
93 | List sensors = sensorManager.getSensorList(Sensor.TYPE_ALL);
94 |
95 | for (Sensor s : sensors) {
96 | assertNotEquals("", csensors.getVersion(s));
97 | }
98 | }
99 |
100 | }
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/categories/LocationProviders.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.categories;
28 |
29 | import android.app.Service;
30 | import android.content.Context;
31 | import android.location.LocationManager;
32 | import android.location.LocationProvider;
33 |
34 | import org.flyve.inventory.CommonErrorType;
35 | import org.flyve.inventory.InventoryLog;
36 |
37 | import java.util.List;
38 |
39 | /**
40 | * This class get all the information of the Location Providers
41 | */
42 | public class LocationProviders extends Categories {
43 |
44 | /*
45 | * The serialization runtime associates with each serializable class a version number,
46 | * called a serialVersionUID, which is used during deserialization to verify that the sender
47 | * and receiver of a serialized object have loaded classes for that object that are compatible
48 | * with respect to serialization. If the receiver has loaded a class for the object that has a
49 | * different serialVersionUID than that of the corresponding sender's class, then deserialization
50 | * will result in an InvalidClassException
51 | *
52 | * from: https://stackoverflow.com/questions/285793/what-is-a-serialversionuid-and-why-should-i-use-it
53 | */
54 | private static final long serialVersionUID = 6066226866162586918L;
55 | private final Context context;
56 |
57 | /**
58 | * This constructor load the context and the Location Providers information
59 | * @param xCtx Context where this class work
60 | */
61 | public LocationProviders(Context xCtx) {
62 | super(xCtx);
63 |
64 | context = xCtx;
65 |
66 | try {
67 | LocationManager lLocationMgr = (LocationManager) context.getSystemService(Service.LOCATION_SERVICE);
68 |
69 | if (lLocationMgr != null) {
70 | List lProvidersName = lLocationMgr.getAllProviders();
71 |
72 | for (String p : lProvidersName) {
73 | Category c = new Category("LOCATION_PROVIDERS", "locationProviders");
74 |
75 | LocationProvider lProvider = lLocationMgr.getProvider(p);
76 | c.put("NAME", new CategoryValue(getName(lProvider), "NAME", "name"));
77 |
78 | this.add(c);
79 | }
80 | }
81 | } catch (Exception ex) {
82 | InventoryLog.e(InventoryLog.getMessage(context, CommonErrorType.LOCATION, ex.getMessage()));
83 | }
84 | }
85 |
86 | /**
87 | * Get the provider name
88 | * @param lProvider LocationProvider
89 | * @return string the name of the provider
90 | */
91 | public String getName(LocationProvider lProvider) {
92 | String value = "N/A";
93 | try {
94 | value = lProvider.getName();
95 | } catch (Exception ex) {
96 | InventoryLog.e(InventoryLog.getMessage(context, CommonErrorType.LOCATION_NAME, ex.getMessage()));
97 | }
98 | return value;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/NetworksTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import androidx.test.platform.app.InstrumentationRegistry;
31 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
32 | import org.flyve.inventory.categories.Networks;
33 |
34 | import org.junit.Test;
35 | import org.junit.runner.RunWith;
36 |
37 | import static org.junit.Assert.assertNotEquals;
38 |
39 | @RunWith(AndroidJUnit4ClassRunner.class)
40 | public class NetworksTest {
41 |
42 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
43 |
44 | @Test
45 | public void getMacaddr() {
46 | Networks networks = new Networks(appContext);
47 | assertNotEquals("", networks.getMacAddress());
48 | }
49 |
50 | @Test
51 | public void getSpeed() {
52 | Networks networks = new Networks(appContext);
53 | assertNotEquals("", networks.getSpeed());
54 | }
55 |
56 | @Test
57 | public void getBSSID() {
58 | Networks networks = new Networks(appContext);
59 | assertNotEquals("", networks.getBSSID());
60 | }
61 |
62 | @Test
63 | public void getSSID() {
64 | Networks networks = new Networks(appContext);
65 | assertNotEquals("", networks.getSSID());
66 | }
67 |
68 | @Test
69 | public void getIpgateway() {
70 | Networks networks = new Networks(appContext);
71 | assertNotEquals("", networks.getIpgateway());
72 | }
73 |
74 | @Test
75 | public void getIpaddress() {
76 | Networks networks = new Networks(appContext);
77 | assertNotEquals("", networks.getIpAddress());
78 | }
79 |
80 | @Test
81 | public void getIpmask() {
82 | Networks networks = new Networks(appContext);
83 | assertNotEquals("", networks.getIpMask());
84 | }
85 |
86 | @Test
87 | public void getIpdhcp() {
88 | Networks networks = new Networks(appContext);
89 | assertNotEquals("", networks.getIpDhCp());
90 | }
91 |
92 | @Test
93 | public void getIpSubnet() {
94 | Networks networks = new Networks(appContext);
95 | assertNotEquals("", networks.getIpSubnet());
96 | }
97 |
98 | @Test
99 | public void getStatus() {
100 | Networks networks = new Networks(appContext);
101 | assertNotEquals("", networks.getStatus());
102 | }
103 |
104 | @Test
105 | public void getDescription() {
106 | Networks networks = new Networks(appContext);
107 | assertNotEquals("", networks.getDescription());
108 | }
109 |
110 | @Test
111 | public void getAddressIpV6() {
112 | Networks networks = new Networks(appContext);
113 | assertNotEquals("", networks.getAddressIpV6());
114 | }
115 |
116 | @Test
117 | public void getMaskIpV6() {
118 | Networks networks = new Networks(appContext);
119 | assertNotEquals("", networks.getMaskIpV6());
120 | }
121 |
122 | @Test
123 | public void getSubnetIpV6() {
124 | Networks networks = new Networks(appContext);
125 | assertNotEquals("", networks.getSubnetIpV6());
126 | }
127 |
128 | }
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/categories/StringUtils.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.categories;
28 |
29 | import java.util.ArrayList;
30 | import java.util.Collection;
31 | import java.util.Iterator;
32 |
33 | /**
34 | * This is a Utility class for String management
35 | */
36 | public class StringUtils {
37 |
38 | private StringUtils() {
39 |
40 | }
41 |
42 | /**
43 | * This method can join a Collection of String in a single String separated by delimiter character,
44 | * can be forward or reversed
45 | *
46 | * @param collection Collection of String
47 | * @param delimiter This is the character that join the String
48 | * @param reversed Indicate if is forward or reversed the join of the String
49 | * @return Joined String
50 | */
51 | public static String join(Collection collection, String delimiter, boolean reversed) {
52 | if (collection != null) {
53 | StringBuilder buffer = new StringBuilder();
54 | Iterator iter = collection.iterator();
55 | while (iter.hasNext()) {
56 | if (!reversed) {
57 | buffer.append(iter.next());
58 | if (iter.hasNext()) {
59 | buffer.append(delimiter);
60 | }
61 | } else {
62 | buffer.insert(0, iter.next());
63 | if (iter.hasNext()) {
64 | buffer.insert(0, delimiter);
65 |
66 | }
67 | }
68 | }
69 | return buffer.toString();
70 | } else {
71 | return null;
72 | }
73 | }
74 |
75 | /**
76 | * This method can join a Collection of String in a single String separated by delimiter character
77 | * @param collection Collection of String
78 | * @param delimiter This is the character that join the String
79 | * @return Joined String
80 | */
81 | public static String join(Collection collection, String delimiter) {
82 |
83 | return StringUtils.join(collection, delimiter, false);
84 |
85 | }
86 |
87 | /**
88 | * Convert int value to byte[]
89 | * @param value Integer value to convert
90 | * @return byte[]
91 | */
92 | public static byte[] intToByte(int value) {
93 | return new byte[] { (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) value };
94 | }
95 |
96 | /**
97 | * Convert int to IP
98 | * @param value Integer value
99 | * @return String
100 | */
101 | public static String intToIp(int value) {
102 | byte[] b = intToByte(value);
103 | ArrayList stack = new ArrayList();
104 | for (byte c : b) {
105 | stack.add(String.valueOf(0xFF & c));
106 | }
107 |
108 | return (StringUtils.join(stack, ".", true));
109 | }
110 |
111 | /**
112 | * Convert ipAddress int to SubNetMask
113 | * @param ipAddress Integer value
114 | * @return String
115 | */
116 | public static String getSubNet(int ipAddress) {
117 | return ((ipAddress & 0xFF) + "." +
118 | ((ipAddress >>>= 8) & 0xFF) + "." +
119 | ((ipAddress >>>= 8) & 0xFF) + "." +
120 | ((ipAddress >>>= 8) & 0xFF));
121 | }
122 | }
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/categories/User.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.categories;
28 |
29 | import android.content.Context;
30 | import android.os.Build;
31 | import android.os.UserManager;
32 |
33 | import org.flyve.inventory.CommonErrorType;
34 | import org.flyve.inventory.InventoryLog;
35 |
36 | import java.util.Properties;
37 |
38 | /**
39 | * This class get all the information of the Environment
40 | */
41 | public class User extends Categories {
42 |
43 | /*
44 | * The serialization runtime associates with each serializable class a version number,
45 | * called a serialVersionUID, which is used during deserialization to verify that the sender
46 | * and receiver of a serialized object have loaded classes for that object that are compatible
47 | * with respect to serialization. If the receiver has loaded a class for the object that has a
48 | * different serialVersionUID than that of the corresponding sender's class, then deserialization
49 | * will result in an InvalidClassException
50 | *
51 | * from: https://stackoverflow.com/questions/285793/what-is-a-serialversionuid-and-why-should-i-use-it
52 | */
53 | private static final long serialVersionUID = 3528873342443549732L;
54 |
55 | private Properties props;
56 | private Context context;
57 |
58 | /**
59 | * Indicates whether some other object is "equal to" this one
60 | * @param obj the reference object with which to compare
61 | * @return boolean true if the object is the same as the one given in argument
62 | */
63 | @Override
64 | public boolean equals(Object obj) {
65 | if (obj == null) {
66 | return false;
67 | }
68 | if (getClass() != obj.getClass()) {
69 | return false;
70 | }
71 | return (!super.equals(obj));
72 | }
73 |
74 | /**
75 | * Returns a hash code value for the object
76 | * @return int a hash code value for the object
77 | */
78 | @Override
79 | public int hashCode() {
80 | int hash = super.hashCode();
81 | hash = 89 * hash + (this.context != null ? this.context.hashCode() : 0);
82 | hash = 89 * hash + (this.props != null ? this.props.hashCode() : 0);
83 | return hash;
84 | }
85 |
86 | /**
87 | * This constructor load the context and the Hardware information
88 | * @param xCtx Context where this class work
89 | */
90 | public User(Context xCtx) {
91 | super(xCtx);
92 |
93 | this.context = xCtx;
94 |
95 | try {
96 | props = System.getProperties();
97 |
98 | Category c = new Category("USER", "user");
99 | c.put("LOGIN", new CategoryValue(getUserName(), "LOGIN", "login"));
100 |
101 | this.add(c);
102 | } catch (Exception ex) {
103 | InventoryLog.e(InventoryLog.getMessage(context, CommonErrorType.USER, ex.getMessage()));
104 | }
105 |
106 | }
107 |
108 | /**
109 | * Get the user name
110 | * @return string userName
111 | */
112 | public String getUserName() {
113 | String userName = "N/A";
114 | try {
115 | userName = Build.USER;
116 | } catch (Exception ex) {
117 | InventoryLog.e(InventoryLog.getMessage(context, CommonErrorType.USER_NAME, ex.getMessage()));
118 | }
119 |
120 | return userName;
121 | }
122 |
123 | }
124 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Inventory Library for Android
2 |
3 | 
4 |
5 | [](https://github.com/glpi-project/android-inventory-library/blob/develop/LICENSE.md)
6 | [](https://creativecommons.org/licenses/by/4.0/)
7 | [](https://twitter.com/teclib)
8 | [](https://t.me/glpien)
9 | [](http://www.repostatus.org/#active)
10 | [](https://conventionalcommits.org)
11 | [](https://greenkeeper.io)
12 | [](https://github.com/glpi-project/android-inventory-library/releases)
13 | [](https://circleci.com/gh/glpi-project/android-inventory-library/)
14 |
15 | GLPI Android Inventory Library is an android inventory library written in Java
16 |
17 | ## Table of contents
18 | * [Synopsis](#synopsis)
19 | * [Build Status](#build-status)
20 | * [Installation](#installation)
21 | * [Code Example](#code-example)
22 | * [Documentation](#documentation)
23 | * [Versioning](#versioning)
24 | * [Contribute](#contribute)
25 | * [Contact](#contact)
26 | * [Professional Services](#professional-services)
27 | * [Copying](#copying)
28 |
29 | ## Synopsis
30 |
31 | The Inventory Library for Android collects a complete inventory of your Android devices. It allows you to export your inventory in a beautiful XML or JSON as protocol compatible GLPI Native Inventory.
32 |
33 | You can find more information about the GLPI Native Inventory Protocol here:
34 |
35 |
36 | ### Data collected
37 |
38 | - Account Info
39 | - Accesslog
40 | - Hardware
41 | - User
42 | - Storages
43 | - Operating System
44 | - BIOS
45 | - Memories
46 | - Inputs
47 | - Sensors
48 | - Drives
49 | - CPUs
50 | - Videos
51 | - Cameras
52 | - Networks
53 | - Environments variables
54 | - JVMS
55 | - Softwares
56 | - USB
57 | - Battery
58 | - Controllers
59 |
60 | ## Installation
61 |
62 | Download the latest AAR and include it in your Android project as an external library
63 |
64 | ## Code Example
65 |
66 | It's easy to implement in your code, as you can see in the following examples
67 |
68 | ### Java
69 |
70 | ```java
71 | InventoryTask inventoryTask = new InventoryTask(MainActivity.this, "Agent_v1.0", new InventoryTask.OnTaskCompleted() {
72 | @Override
73 | public void onTaskCompleted(String data) {
74 | Log.d("XML", data);
75 | }
76 | });
77 |
78 | inventoryTask.execute();
79 | ```
80 |
81 | ### Kotlin
82 |
83 | ```kotlin
84 | val inventoryTask = InventoryTask(this@MainActivity, "Agent_v1.0", object : InventoryTask.OnTaskCompleted() {
85 | override fun onTaskCompleted(data: String) {
86 | Log.d("XML", data)
87 | }
88 | })
89 |
90 | inventoryTask.execute()
91 | ```
92 |
93 |
94 | ## Contact
95 |
96 | For notices about major changes and general discussion of fields, subscribe to the [/r/glpi](https://www.reddit.com/r/glpi/) subreddit.
97 | You can also chat with us via [@glpi on Telegram](https://t.me/glpien).
98 |
99 | ## Professional Services
100 |
101 | 
102 |
103 | The GLPI Network services are available through our [Partner's Network](http://www.teclib-edition.com/en/partners/).
104 | We provide special training, bug fixes with editor subscription, contributions for new features, and more.
105 |
106 | Obtain a personalized service experience, associated with benefits and opportunities.
107 |
108 | ## Contribute
109 |
110 | * Open a ticket for each bug so it can be discussed
111 | * Follow [development guidelines](http://glpi-developer-documentation.readthedocs.io/en/latest/plugins/index.html)
112 | * Refer to [GitFlow](http://git-flow.readthedocs.io/) process for branching
113 | * Work on a new branch on your own fork
114 | * Open a PR that will be reviewed by a developer
115 |
116 | ## Copying
117 |
118 | * **Code**: you can redistribute it and/or modify it under the terms of the GNU General Public License ([GPL-2.0](https://www.gnu.org/licenses/gpl-2.0.en.html)).
119 |
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/categories/Videos.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.categories;
28 |
29 | import android.app.Service;
30 | import android.content.Context;
31 | import android.graphics.Point;
32 | import android.view.WindowManager;
33 |
34 | import org.flyve.inventory.CommonErrorType;
35 | import org.flyve.inventory.InventoryLog;
36 |
37 | /**
38 | * This class get all the information of the Video
39 | */
40 | public class Videos extends Categories {
41 |
42 | /*
43 | * The serialization runtime associates with each serializable class a version number,
44 | * called a serialVersionUID, which is used during deserialization to verify that the sender
45 | * and receiver of a serialized object have loaded classes for that object that are compatible
46 | * with respect to serialization. If the receiver has loaded a class for the object that has a
47 | * different serialVersionUID than that of the corresponding sender's class, then deserialization
48 | * will result in an InvalidClassException
49 | *
50 | * from: https://stackoverflow.com/questions/285793/what-is-a-serialversionuid-and-why-should-i-use-it
51 | */
52 | private static final long serialVersionUID = 6953895287405000489L;
53 | private Context context;
54 |
55 | /**
56 | * Indicates whether some other object is "equal to" this one
57 | * @param obj Object the reference object with which to compare
58 | * @return boolean true if the object is the same as the one given in argument
59 | */
60 | @Override
61 | public boolean equals(Object obj) {
62 | if (obj == null) {
63 | return false;
64 | }
65 | if (getClass() != obj.getClass()) {
66 | return false;
67 | }
68 | return (!super.equals(obj));
69 | }
70 |
71 | /**
72 | * Returns a hash code value for the object
73 | * @return int a hash code value for the object
74 | */
75 | @Override
76 | public int hashCode() {
77 | int hash = super.hashCode();
78 | hash = 89 * hash + (this.context != null ? this.context.hashCode() : 0);
79 | return hash;
80 | }
81 |
82 | /**
83 | * This constructor load the context and the Video information
84 | * @param xCtx Context where this class work
85 | */
86 | public Videos(Context xCtx) {
87 | super(xCtx);
88 | this.context = xCtx;
89 |
90 | try {
91 | Category c = new Category("VIDEOS", "videos");
92 | c.put("RESOLUTION", new CategoryValue(getResolution(), "RESOLUTION", "resolution"));
93 | this.add(c);
94 | } catch (Exception ex) {
95 | InventoryLog.e(InventoryLog.getMessage(context, CommonErrorType.VIDEOS, ex.getMessage()));
96 | }
97 | }
98 |
99 | /**
100 | * Get the video resolutions
101 | * @return string the width and height
102 | */
103 | public String getResolution() {
104 | String value = "N/A";
105 | try {
106 | WindowManager lWinMgr = (WindowManager) context.getSystemService(Service.WINDOW_SERVICE);
107 | Point size = new Point();
108 | lWinMgr.getDefaultDisplay().getSize(size);
109 |
110 | int width = size.x;
111 | int height = size.y;
112 |
113 | value = String.format("%dx%d", width, height);
114 | return value;
115 | } catch (Exception ex) {
116 | InventoryLog.e(InventoryLog.getMessage(context, CommonErrorType.VIDEOS_RESOLUTION, ex.getMessage()));
117 | }
118 | return value;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/inventory/src/androidTest/java/org/flyve/inventory/DrivesTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.content.Context;
30 | import android.os.Environment;
31 |
32 | import org.flyve.inventory.categories.Drives;
33 |
34 | import org.junit.Test;
35 |
36 | import java.io.File;
37 |
38 | import static org.junit.Assert.assertNotEquals;
39 |
40 | import androidx.test.platform.app.InstrumentationRegistry;
41 |
42 | public class DrivesTest {
43 |
44 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
45 |
46 | File froot = Environment.getRootDirectory();
47 | File fexternal = Environment.getExternalStorageDirectory();
48 | File fdata = Environment.getDataDirectory();
49 | File fcache = Environment.getDownloadCacheDirectory();
50 |
51 | @Test
52 | public void getVolumn() throws Exception {
53 | Drives drives = new Drives(appContext);
54 | assertNotEquals("", drives.getVolume(froot));
55 | assertNotEquals("", drives.getVolume(fexternal));
56 | assertNotEquals("", drives.getVolume(fdata));
57 | String secondaryStorage = System.getenv("SECONDARY_STORAGE");
58 | if (secondaryStorage != null) {
59 | assertNotEquals("", drives.getVolume(new File(secondaryStorage)));
60 | }
61 | }
62 |
63 | @Test
64 | public void getTotal() throws Exception {
65 | Drives drives = new Drives(appContext);
66 | assertNotEquals("", drives.getTotal(froot));
67 | assertNotEquals("", drives.getTotal(fexternal));
68 | assertNotEquals("", drives.getTotal(fdata));
69 | assertNotEquals("", drives.getTotal(fcache));
70 | String secondaryStorage = System.getenv("SECONDARY_STORAGE");
71 | if (secondaryStorage != null) {
72 | assertNotEquals("", drives.getTotal(new File(secondaryStorage)));
73 | }
74 | }
75 |
76 | @Test
77 | public void getFree() throws Exception {
78 | Drives drives = new Drives(appContext);
79 | assertNotEquals("", drives.getFreeSpace(froot));
80 | assertNotEquals("", drives.getFreeSpace(fexternal));
81 | assertNotEquals("", drives.getFreeSpace(fdata));
82 | assertNotEquals("", drives.getFreeSpace(fcache));
83 | String secondaryStorage = System.getenv("SECONDARY_STORAGE");
84 | if (secondaryStorage != null) {
85 | assertNotEquals("", drives.getFreeSpace(new File(secondaryStorage)));
86 | }
87 | }
88 |
89 | @Test
90 | public void getFileSystem() throws Exception {
91 | Drives drives = new Drives(appContext);
92 | assertNotEquals("", drives.getFileSystem(froot));
93 | assertNotEquals("", drives.getFileSystem(fexternal));
94 | assertNotEquals("", drives.getFileSystem(fdata));
95 | assertNotEquals("", drives.getFileSystem(fcache));
96 | String secondaryStorage = System.getenv("SECONDARY_STORAGE");
97 | if (secondaryStorage != null) {
98 | assertNotEquals("", drives.getFileSystem(new File(secondaryStorage)));
99 | }
100 | }
101 |
102 | @Test
103 | public void getType() throws Exception {
104 | Drives drives = new Drives(appContext);
105 | assertNotEquals("", drives.getType(froot));
106 | assertNotEquals("", drives.getType(fexternal));
107 | assertNotEquals("", drives.getType(fdata));
108 | assertNotEquals("", drives.getType(fcache));
109 | String secondaryStorage = System.getenv("SECONDARY_STORAGE");
110 | if (secondaryStorage != null) {
111 | assertNotEquals("", drives.getType(new File(secondaryStorage)));
112 | }
113 | }
114 |
115 | }
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/CryptoUtil.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory;
28 |
29 | import android.util.Base64;
30 |
31 | import java.nio.charset.StandardCharsets;
32 | import java.security.InvalidKeyException;
33 | import java.security.KeyFactory;
34 | import java.security.KeyPair;
35 | import java.security.KeyPairGenerator;
36 | import java.security.NoSuchAlgorithmException;
37 | import java.security.PrivateKey;
38 | import java.security.PublicKey;
39 | import java.security.spec.InvalidKeySpecException;
40 | import java.security.spec.PKCS8EncodedKeySpec;
41 | import java.security.spec.X509EncodedKeySpec;
42 | import java.util.HashMap;
43 | import java.util.Map;
44 |
45 | import javax.crypto.BadPaddingException;
46 | import javax.crypto.Cipher;
47 | import javax.crypto.IllegalBlockSizeException;
48 | import javax.crypto.NoSuchPaddingException;
49 |
50 | public class CryptoUtil {
51 |
52 | private final static String CRYPTO_METHOD = "RSA";
53 | private final static int CRYPTO_BITS = 2048;
54 |
55 | public static Map generateKeyPair()
56 | throws NoSuchAlgorithmException,
57 | NoSuchPaddingException,
58 | InvalidKeyException,
59 | IllegalBlockSizeException,
60 | BadPaddingException {
61 |
62 | KeyPairGenerator kpg = KeyPairGenerator.getInstance(CRYPTO_METHOD);
63 | kpg.initialize(CRYPTO_BITS);
64 | KeyPair kp = kpg.genKeyPair();
65 | PublicKey publicKey = kp.getPublic();
66 | PrivateKey privateKey = kp.getPrivate();
67 |
68 | Map map = new HashMap<>();
69 | map.put("privateKey", Base64.encodeToString(privateKey.getEncoded(), Base64.DEFAULT));
70 | map.put("publicKey", Base64.encodeToString(publicKey.getEncoded(), Base64.DEFAULT));
71 | return map;
72 | }
73 |
74 | public static String encrypt(String plain, String pubk)
75 | throws NoSuchAlgorithmException,
76 | NoSuchPaddingException,
77 | InvalidKeyException,
78 | IllegalBlockSizeException,
79 | BadPaddingException,
80 | InvalidKeySpecException {
81 |
82 | Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
83 | cipher.init(Cipher.ENCRYPT_MODE, stringToPublicKey(pubk));
84 | byte[] encryptedBytes = cipher.doFinal(plain.getBytes(StandardCharsets.UTF_8));
85 |
86 | return Base64.encodeToString(encryptedBytes, Base64.DEFAULT);
87 | }
88 |
89 | public static String decrypt(String result, String privk)
90 | throws NoSuchPaddingException,
91 | NoSuchAlgorithmException,
92 | BadPaddingException,
93 | IllegalBlockSizeException,
94 | InvalidKeySpecException,
95 | InvalidKeyException {
96 |
97 | Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
98 | cipher.init(Cipher.DECRYPT_MODE, stringToPrivateKey(privk));
99 | byte[] decryptedBytes = cipher.doFinal(Base64.decode(result, Base64.DEFAULT));
100 | return new String(decryptedBytes);
101 | }
102 |
103 | private static PublicKey stringToPublicKey(String publicKeyString)
104 | throws InvalidKeySpecException,
105 | NoSuchAlgorithmException {
106 |
107 | byte[] keyBytes = Base64.decode(publicKeyString, Base64.DEFAULT);
108 | X509EncodedKeySpec spec = new X509EncodedKeySpec(keyBytes);
109 | KeyFactory keyFactory = KeyFactory.getInstance(CRYPTO_METHOD);
110 | return keyFactory.generatePublic(spec);
111 | }
112 |
113 | private static PrivateKey stringToPrivateKey(String privateKeyString)
114 | throws InvalidKeySpecException,
115 | NoSuchAlgorithmException {
116 |
117 | byte [] pkcs8EncodedBytes = Base64.decode(privateKeyString, Base64.DEFAULT);
118 | PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8EncodedBytes);
119 | KeyFactory kf = KeyFactory.getInstance(CRYPTO_METHOD);
120 | return kf.generatePrivate(keySpec);
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/inventory/src/main/java/org/flyve/inventory/categories/CategoryValue.java:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.inventory.categories;
28 |
29 | import java.util.ArrayList;
30 | import java.util.List;
31 |
32 | public class CategoryValue {
33 |
34 | private String value;
35 | private String jsonName;
36 | private String xmlName;
37 | private Boolean isPrivate;
38 | private Boolean hasCDATA;
39 | private Category category;
40 | private List values;
41 |
42 | private static final String REGEX="[<>&]";
43 | /** Normal category
44 | * @param value String value
45 | * @param xmlName String xml name
46 | * @param jsonName String json name
47 | */
48 | public CategoryValue(String value, String xmlName, String jsonName) {
49 | if (value == null) {
50 | value = "";
51 | }
52 |
53 | if (xmlName == null) {
54 | xmlName = "";
55 | }
56 |
57 | if (jsonName == null) {
58 | jsonName = "";
59 | }
60 |
61 | if (hasCharToReplace(value)) {
62 | value = value.replaceAll(REGEX, "");
63 | }
64 |
65 | this.value = value;
66 | this.jsonName = jsonName;
67 | this.xmlName = xmlName;
68 | this.isPrivate = false;
69 | this.hasCDATA = false;
70 | }
71 |
72 | public CategoryValue(String value, String xmlName, String jsonName, Boolean isPrivate, Boolean hasCDATA) {
73 | if (value == null) {
74 | value = "";
75 | }
76 |
77 | if (xmlName == null) {
78 | xmlName = "";
79 | }
80 |
81 | if (jsonName == null) {
82 | jsonName = "";
83 | }
84 |
85 | if (hasCharToReplace(value)) {
86 | value = value.replaceAll(REGEX, "");
87 | }
88 |
89 | this.value = value;
90 | this.jsonName = jsonName;
91 | this.xmlName = xmlName;
92 | this.isPrivate = isPrivate;
93 | this.hasCDATA = hasCDATA;
94 | }
95 |
96 | /** Insert list of values to the Category
97 | * @param values List list of values
98 | * @param xmlName String xml name
99 | * @param jsonName String json name
100 | */
101 | public CategoryValue(List values, String xmlName, String jsonName) {
102 | if (values == null) {
103 | values = new ArrayList<>();
104 | }
105 |
106 | if (xmlName == null) {
107 | xmlName = "";
108 | }
109 |
110 | if (jsonName == null) {
111 | jsonName = "";
112 | }
113 |
114 | for (int i = 0; i < values.size(); i++) {
115 | String value = values.get(i);
116 | if (hasCharToReplace(value)) {
117 | String s = value.replaceAll(REGEX, "");
118 | values.add(i, s);
119 | }
120 | }
121 |
122 | this.values = values;
123 | this.jsonName = jsonName;
124 | this.xmlName = xmlName;
125 | this.isPrivate = false;
126 | this.hasCDATA = false;
127 | }
128 |
129 | /** Embed an category inside in another category
130 | * @param category instance of the same class CategoryValue
131 | */
132 | public CategoryValue(Category category){
133 | this.category = category;
134 | }
135 |
136 | public CategoryValue(String value) {
137 | this.value = value;
138 | }
139 |
140 | public String getValue() {
141 | return value;
142 | }
143 |
144 | public void setValue(String newValue) {
145 | this.value = newValue;
146 | }
147 |
148 | public String getJsonName() {
149 | return jsonName;
150 | }
151 |
152 | public String getXmlName() {
153 | return xmlName;
154 | }
155 |
156 | public Boolean isPrivate() {
157 | return isPrivate;
158 | }
159 |
160 | public Boolean hasCDATA() {
161 | return hasCDATA;
162 | }
163 |
164 | public Category getCategory() {
165 | return category;
166 | }
167 |
168 | public List getValues() {
169 | return values;
170 | }
171 |
172 | private boolean hasCharToReplace(final String val) {
173 | return val.matches(REGEX);
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/example_kotlin/src/main/java/org/flyve/example_kotlin/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * LICENSE
3 | *
4 | * This file is part of Flyve MDM Inventory Library for Android.
5 | *
6 | * Inventory Library for Android is a subproject of Flyve MDM.
7 | * Flyve MDM is a mobile device management software.
8 | *
9 | * Flyve MDM is free software: you can redistribute it and/or
10 | * modify it under the terms of the GNU General Public License
11 | * as published by the Free Software Foundation; either version 3
12 | * of the License, or (at your option) any later version.
13 | *
14 | * Flyve MDM is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * ---------------------------------------------------------------------
19 | * @copyright Copyright © 2018 Teclib. All rights reserved.
20 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
21 | * @link https://github.com/flyve-mdm/android-inventory-library
22 | * @link https://flyve-mdm.com
23 | * @link http://flyve.org/android-inventory-library
24 | * ---------------------------------------------------------------------
25 | */
26 |
27 | package org.flyve.example_kotlin
28 |
29 | import android.Manifest
30 | import android.content.Context
31 | import android.content.Intent
32 | import android.os.Bundle
33 | import android.util.Log
34 | import android.view.View
35 | import android.widget.Button
36 | import android.widget.RadioButton
37 | import androidx.appcompat.app.AlertDialog
38 | import androidx.appcompat.app.AppCompatActivity
39 | import androidx.core.app.ActivityCompat
40 | import org.flyve.inventory.InventoryTask
41 |
42 | class MainActivity : AppCompatActivity() {
43 |
44 | val LOG = "inventory.example"
45 |
46 | fun showDialogShare(context: Context) {
47 | val builder = AlertDialog.Builder(this)
48 | builder.setTitle(R.string.dialog_share_title)
49 | val type = IntArray(1)
50 | //list of items
51 | val items = context.resources.getStringArray(R.array.export_list)
52 | builder.setSingleChoiceItems(items, 0
53 | ) { _, which -> type[0] = which }
54 | val positiveText = context.getString(android.R.string.ok)
55 | builder.setPositiveButton(positiveText
56 | ) { _, _ ->
57 | // positive button logic
58 | InventoryTask(this@MainActivity, this@MainActivity.LOG, false).shareInventory(type[0])
59 | }
60 | val negativeText = context.getString(android.R.string.cancel)
61 | builder.setNegativeButton(negativeText
62 | ) { _, _ ->
63 | // negative button logic
64 | }
65 | val dialog = builder.create()
66 | // display dialog
67 | dialog.show()
68 | }
69 |
70 | public override fun onCreate(savedInstanceState: Bundle?) {
71 | super.onCreate(savedInstanceState)
72 |
73 | setContentView(R.layout.activity_main)
74 | permission()
75 |
76 | val btnShare = findViewById