Skip to content

Commit b24a2cd

Browse files
Merge pull request #97 from SanoopC/MSUE-101
Remove deprecated fields from being sent to Sift for Android
2 parents d38b400 + cb339e1 commit b24a2cd

File tree

9 files changed

+101
-308
lines changed

9 files changed

+101
-308
lines changed

DESIGNDOC.md

Lines changed: 97 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,53 @@ This document describes the data models,classes for handling events, and specifi
4545

4646
## 2 High Level Class Diagram
4747

48-
**![{"theme":"neutral","source":"classDiagram\n\nclass AndroidDeviceLocation {\n +Long time\n +Double latitude\n +Double longitude\n +Double accuracy\n}\n\nclass AndroidAppState {\n +String activityClassName\n +AndroidDeviceLocation location\n +String sdkVersion\n +Double batteryLevel\n +Long batteryState\n +Long batteryHealth\n +Long plugState\n +List~String~ networkAddresses\n}\n\nclass AndroidDeviceProperties {\n +String appName\n +String appVersion\n +String sdkVersion\n +String mobileCarrierName\n +String mobileIsoCountryCode\n +String deviceManufacturer\n +String deviceModel\n +String deviceSystemVersion\n +String androidId\n +String buildTags\n +List~String~ evidenceFilesPresent\n +List~String~ evidencePackagesPresent\n +List~String~ evidenceProperties\n +List~String~ evidenceDirectoriesWritable\n +String buildBrand\n +String buildDevice\n +String buildFingerprint\n +String buildHardware\n +String buildProduct\n}\n\nclass MobileEvent {\n +Long time\n +String userId\n +String installationId\n +AndroidDeviceProperties androidDeviceProperties\n +AndroidAppState androidAppState\n}\n\nAndroidDeviceLocation ..> AndroidAppState\nAndroidAppState ..> MobileEvent\nAndroidDeviceProperties ..> MobileEvent"}](/images/overall-class-diadram.png "mermaid-graph")**
48+
```mermaid
49+
classDiagram
50+
class AndroidDeviceLocation {
51+
+Double latitude
52+
+Double longitude
53+
}
54+
55+
class AndroidAppState {
56+
+String activityClassName
57+
+AndroidDeviceLocation location
58+
+String sdkVersion
59+
+Double batteryLevel
60+
+Long batteryState
61+
+Long batteryHealth
62+
+Long plugState
63+
+List~String~ networkAddresses
64+
}
65+
66+
class AndroidDeviceProperties {
67+
+String appName
68+
+String appVersion
69+
+String sdkVersion
70+
+String mobileCarrierName
71+
+String mobileIsoCountryCode
72+
+String deviceManufacturer
73+
+String deviceModel
74+
+String deviceSystemVersion
75+
+String androidId
76+
+String buildTags
77+
+List~String~ evidenceFilesPresent
78+
+List~String~ evidencePackagesPresent
79+
+List~String~ evidenceProperties
80+
+List~String~ evidenceDirectoriesWritable
81+
}
82+
83+
class MobileEvent {
84+
+Long time
85+
+String userId
86+
+String installationId
87+
+AndroidDeviceProperties androidDeviceProperties
88+
+AndroidAppState androidAppState
89+
}
90+
91+
AndroidDeviceLocation ..> AndroidAppState
92+
AndroidAppState ..> MobileEvent
93+
AndroidDeviceProperties ..> MobileEvent
94+
```
4995

5096
## 3 Data Models
5197

@@ -55,17 +101,25 @@ The data models used in this SDK are auto-generated from 'yaml' files. T
55101

56102
The AndroidDeviceLocation consist of the following information:
57103

58-
- **time** : {type: integer, required: false}
59-
- It indicates the time at which the location data was collected.
60104
- **latitude** : {type: number, required: false}
61105
- Which indicates the latitude of the collected location.
62106
- **longitude** : {type: number, required: false}
63107
- Which indicates the longitude of the collected location.
64-
- **accuracy** : {type: number, required: false}
65-
- Indicates the accuracy of the collected latitude and longitude.
66108

67109
Class diagram of AndroidDeviceLocation
68-
**![{"theme":"neutral","source":"classDiagram\n\nclass AndroidDeviceLocation{\n +Long time\n +Double latitude\n +Double longitude\n +Double accuracy\n\n +withTime(time)\n +withLatitude(latitude)\n +withLongitude(longitude)\n +withAccuracy(accuracy)\n +toString() string\n +hashCode() int\n +equals() boolean\n}"}](/images/android-device-location.png "mermaid-graph")**
110+
```mermaid
111+
classDiagram
112+
class AndroidDeviceLocation{
113+
+Double latitude
114+
+Double longitude
115+
116+
+withLatitude(latitude)
117+
+withLongitude(longitude)
118+
+toString() string
119+
+hashCode() int
120+
+equals() boolean
121+
}
122+
```
69123

70124
### 3.2 AndroidAppState
71125

@@ -146,19 +200,45 @@ The AndroidDeviceProperties collects the following information:
146200
- **evidence\_directories\_writable** : {type: array, items: {type: string}, required: false}
147201
- It may contain a list of path to common system directories which have write permissions that indicate rooted devices.
148202
- If it is an empty list then the device is not a rooted device.
149-
- **build\_brand** : {type: string, required: false}
150-
- The build brand indicates the consumer-visible brand with which the product/hardware will be associated, if any.
151-
- **build\_device** : {type: string, required: false}
152-
- The build device indicates the name of the industrial design.
153-
- **build\_fingerprint** : {type: string, required: false}
154-
- The build fingerprint indicated a string that uniquely identifies this build.
155-
- **build\_hardware** : {type: string, required: false}
156-
- The build hardware indicates the name of the hardware (from the kernel command line or /proc).
157-
- **build\_product** : {type: string, required: false}
158-
- The build product indicates the name of the overall product.
159203

160204
Class diagram of AndroidDeviceProperties
161-
**![{"theme":"neutral","source":"classDiagram\n\nclass AndroidDeviceProperties {\n +String appName\n +String appVersion\n +String sdkVersion\n +String mobileCarrierName\n +String mobileIsoCountryCode\n +String deviceManufacturer\n +String deviceModel\n +String deviceSystemVersion\n +String androidId\n +String buildTags\n +List~String~ evidenceFilesPresent\n +List~String~ evidencePackagesPresent\n +List~String~ evidenceProperties\n +List~String~ evidenceDirectoriesWritable\n +String buildBrand\n +String buildDevice\n +String buildFingerprint\n +String buildHardware\n +String buildProduct\n\n +withAppName(appName)\n +withAppVersion(appVersion)\n +withSdkVersion(sdkVersion)\n +withMobileCarrierName(mobileCarrierName)\n +withMobileIsoCountryCode(mobileIsoCountryCode)\n +withDeviceManufacturer(deviceManufacturer)\n +withDeviceModel(deviceModel)\n +withDeviceSystemVersion(deviceSystemVersion)\n +withAndroidId(androidId)\n +withBuildTags(buildTags)\n +withEvidenceFilesPresent(evidenceFilesPresent)\n +withEvidencePackagesPresent(evidencePackagesPresent) \n +withEvidenceProperties(evidenceProperties)\n +withEvidenceDirectoriesWritable(evidenceDirectoriesWritable)\n +withBuildBrand(buildBrand)\n +withBuildDevice(buildDevice)\n +withBuildFingerprint(buildFingerprint)\n +withBuildHardware(buildHardware)\n +withBuildProduct(buildProduct)\n +toString() string\n +hashCode() int\n +equals() boolean\n}"}](/images/android-device-properties.png "mermaid-graph")**
205+
```mermaid
206+
classDiagram
207+
class AndroidDeviceProperties {
208+
+String appName
209+
+String appVersion
210+
+String sdkVersion
211+
+String mobileCarrierName
212+
+String mobileIsoCountryCode
213+
+String deviceManufacturer
214+
+String deviceModel
215+
+String deviceSystemVersion
216+
+String androidId
217+
+String buildTags
218+
+List~String~ evidenceFilesPresent
219+
+List~String~ evidencePackagesPresent
220+
+List~String~ evidenceProperties
221+
+List~String~ evidenceDirectoriesWritable
222+
223+
+withAppName(appName)
224+
+withAppVersion(appVersion)
225+
+withSdkVersion(sdkVersion)
226+
+withMobileCarrierName(mobileCarrierName)
227+
+withMobileIsoCountryCode(mobileIsoCountryCode)
228+
+withDeviceManufacturer(deviceManufacturer)
229+
+withDeviceModel(deviceModel)
230+
+withDeviceSystemVersion(deviceSystemVersion)
231+
+withAndroidId(androidId)
232+
+withBuildTags(buildTags)
233+
+withEvidenceFilesPresent(evidenceFilesPresent)
234+
+withEvidencePackagesPresent(evidencePackagesPresent)
235+
+withEvidenceProperties(evidenceProperties)
236+
+withEvidenceDirectoriesWritable(evidenceDirectoriesWritable)
237+
+toString() string
238+
+hashCode() int
239+
+equals() boolean
240+
}
241+
```
162242

163243

164244
###
@@ -445,11 +525,6 @@ It provides only one instance method:
445525
- Other build and device informations are collected from android.os.Build provider:
446526
- The device manufacturer detail is collected from _Build.MANUFACTURER_ which provides the manufacturer of the product/hardware.
447527
- The device model from _Build.MODEL_ which provides the end-user-visible name for the end product.
448-
- The build brand from _Build.BRAND_ which provide the consumer-visible brand with which the product/hardware will be associated
449-
- The build device from _Build.DEVICE_ which provides the name of the industrial design.
450-
- The build fingerprint from _Build.FINGERPRINT_ which provides a string that uniquely identifies this build. Do not attempt to parse this value.
451-
- The build hardware from _Build.HARDWARE_ which provides the name of the hardware (from the kernel command line or /proc).
452-
- The build product from _Build.PRODUCT_ which provides the name of the overall product.
453528
- The build tag from _Build.TAGS_ which provides comma-separated tags describing the build, like "unsigned,debug".
454529
- It will check and collect evidence from the device which indicates whether the device is rooted with the following different approaches:
455530
- existingRootFiles()

sift/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ buildscript {
1212
}
1313

1414
android {
15-
compileSdkVersion 30
15+
compileSdkVersion 31
1616
buildToolsVersion '30.0.0'
1717

1818
defaultConfig {
1919
minSdkVersion 16 // Jelly Bean 4.1.x (basically Java 6)
20-
targetSdkVersion 30
20+
targetSdkVersion 31
2121
versionCode 22
2222
versionName '1.1.0'
2323

sift/src/main/java/siftscience/android/AppStateCollector.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,8 @@ private AndroidDeviceLocationJson getLocation() {
250250
Location location = this.acquiredNewLocation ? this.location : this.lastLocation;
251251

252252
return new AndroidDeviceLocationJson()
253-
.withTime(location.getTime())
254253
.withLatitude(location.getLatitude())
255-
.withLongitude(location.getLongitude())
256-
.withAccuracy(new BigDecimal(location.getAccuracy()).doubleValue());
254+
.withLongitude(location.getLongitude());
257255
}
258256

259257
@SuppressLint("MissingPermission")

sift/src/main/java/siftscience/android/DevicePropertiesCollector.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ private AndroidDevicePropertiesJson get() {
142142
.withMobileCarrierName(mobileCarrierName)
143143
.withMobileIsoCountryCode(mobileCarrierIsoCountryCode)
144144
.withDeviceSystemVersion(systemVersion)
145-
.withBuildBrand(Build.BRAND)
146-
.withBuildDevice(Build.DEVICE)
147-
.withBuildFingerprint(Build.FINGERPRINT)
148-
.withBuildHardware(Build.HARDWARE)
149-
.withBuildProduct(Build.PRODUCT)
150145
.withBuildTags(Build.TAGS)
151146
.withEvidenceFilesPresent(evidenceFiles)
152147
.withEvidencePackagesPresent(evidencePackages)

sift/src/main/json/android_device_location.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: Android Device Location
33
type: object
44
javaType: com.sift.api.representations.AndroidDeviceLocationJson
55
properties:
6-
time: {type: integer, required: false}
76
latitude: {type: number, required: false}
87
longitude: {type: number, required: false}
9-
accuracy: {type: number, required: false}
108
additionalProperties: false

sift/src/main/json/ios_device_heading.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

sift/src/main/json/ios_device_location.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)