Skip to content

Commit 4f9e756

Browse files
support Motorola Moto Tag Name Detection and Owner Device Retrieval Explanation
1 parent 2ba7810 commit 4f9e756

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

app/src/main/java/de/seemoo/at_tracking_detection/database/models/device/types/GoogleFindMyNetwork.kt

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ class GoogleFindMyNetwork(val id: Int) : Device(), Connectable {
205205

206206
fun getSubType(wrappedScanResult: ScanResultWrapper): GoogleFindMyNetworkType {
207207
return when (wrappedScanResult.advertisementFlags) {
208-
0x02 -> GoogleFindMyNetworkType.SMARTPHONE
209-
0x06 -> GoogleFindMyNetworkType.TAG
210-
else -> GoogleFindMyNetworkType.UNKNOWN
208+
0x02 -> SMARTPHONE
209+
0x06 -> TAG
210+
else -> UNKNOWN
211211
}
212212
}
213213

@@ -234,9 +234,9 @@ class GoogleFindMyNetwork(val id: Int) : Device(), Connectable {
234234
// If receivedValue is not empty, return the device name, else fallback to error case
235235
receivedValue?.let {
236236
val nameBytes = it.drop(2).toByteArray() // Drop the first two bytes
237-
val finalResult = String(nameBytes, Charsets.UTF_8)
238-
ScanFragment.deviceNameMap[wrappedScanResult.uniqueIdentifier] = finalResult
239-
finalResult
237+
val decodedBytes = String(nameBytes, Charsets.UTF_8)
238+
ScanFragment.deviceNameMap[wrappedScanResult.uniqueIdentifier] = decodedBytes
239+
nameReplacementLayer(decodedBytes)
240240
} ?: errorCaseName
241241
} catch (e: Exception) {
242242
Timber.e("Error during connectAndWrite: ${e.message}")
@@ -401,13 +401,21 @@ class GoogleFindMyNetwork(val id: Int) : Device(), Connectable {
401401
return ConnectionState.UNKNOWN
402402
}
403403

404+
fun nameReplacementLayer(name: String): String {
405+
return when {
406+
name.contains("motorola", ignoreCase = true) -> "Motorola Moto Tag"
407+
else -> name
408+
}
409+
}
410+
404411
fun getGoogleManufacturerFromNameString(name: String): GoogleFindMyNetworkManufacturer {
405412
Timber.d("Name: $name")
406413
return when {
407414
name.contains("pebblebee", ignoreCase = true) -> GoogleFindMyNetworkManufacturer.PEBBLEBEE
408415
name.contains("chipolo", ignoreCase = true) -> GoogleFindMyNetworkManufacturer.CHIPOLO
409-
name.contains("eufy", ignoreCase = true) -> GoogleFindMyNetworkManufacturer.EUFY
410416
name.contains("motorola", ignoreCase = true) -> GoogleFindMyNetworkManufacturer.MOTOROLA
417+
name.contains("moto", ignoreCase = true) -> GoogleFindMyNetworkManufacturer.MOTOROLA
418+
name.contains("eufy", ignoreCase = true) -> GoogleFindMyNetworkManufacturer.EUFY
411419
name.contains("jio", ignoreCase = true) -> GoogleFindMyNetworkManufacturer.JIO
412420
name.contains("rolling square", ignoreCase = true) -> GoogleFindMyNetworkManufacturer.ROLLING_SQUARE
413421
else -> GoogleFindMyNetworkManufacturer.UNKNOWN
@@ -427,6 +435,7 @@ class GoogleFindMyNetwork(val id: Int) : Device(), Connectable {
427435
return when (manufacturer) {
428436
GoogleFindMyNetworkManufacturer.PEBBLEBEE -> ATTrackingDetectionApplication.getAppContext().resources.getString(R.string.retrieve_owner_information_explanation_pebblebee)
429437
GoogleFindMyNetworkManufacturer.CHIPOLO -> ATTrackingDetectionApplication.getAppContext().resources.getString(R.string.retrieve_owner_information_explanation_chipolo)
438+
GoogleFindMyNetworkManufacturer.MOTOROLA -> ATTrackingDetectionApplication.getAppContext().resources.getString(R.string.retrieve_owner_information_explanation_motorola)
430439
else -> ATTrackingDetectionApplication.getAppContext().resources.getString(R.string.retrieve_owner_information_explanation_unknown)
431440
}
432441
}

app/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@
380380
<string name="retrieve_owner_information_explanation_unknown">Um Informationen zum Besitzer des Trackers zu erhalten musst du den Tracker gefunden und physisch vor dir haben. Wenn du den Tracker gefunden hast, musst du ihn in einem speziellen Modus versetzen. Wie dieser Modus erreicht wird ist unterschiedlich und könnte durch 30 Sekunden den Button drücken oder dreimal den Button drücken geschehen. Der Modus wird durch ein piepsen bestätigt. Danach drücke auf \"weiter\".</string>
381381
<string name="retrieve_owner_information_explanation_pebblebee">Um Informationen zum Besitzer des Trackers zu erhalten musst du den Tracker gefunden und physisch vor dir haben. Wenn du den Tracker gefunden hast, dann drücke den Knopf auf dem Tracker dreimal. Dies sollte durch ein piepsen bestätigt werden. Danach drücke auf \"weiter\".</string>
382382
<string name="retrieve_owner_information_explanation_chipolo">Um Informationen zum Besitzer des Trackers zu erhalten musst du den Tracker gefunden und physisch vor dir haben. Wenn du den Tracker gefunden hast, dann halten den Knopf für 30 Sekunden gedrückt. Lasse den Knopf exakt nach dem zweiten piepsen los. Dies wird durch einen weiteren Ton bestätigt. Danach drücke auf \"weiter\".</string>
383+
<string name="retrieve_owner_information_explanation_motorola">Um Informationen zum Besitzer des Trackers zu erhalten musst du den Tracker gefunden und physisch vor dir haben. Wenn du den Tracker gefunden hast, halte den Button für 10 Sekunden gedrückt, bis ein Piepton ertönt. Lasse den Button dann los, drücke ihn erneut, und lasse sofort wieder los. Danach drücke auf \"weiter\".</string>
383384
<string name="retrieve_owner_information_alert_next">Weiter</string>
384385
<string name="retrieve_owner_information_alert_close">Beenden</string>
385386

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@
421421
<string name="retrieve_owner_information_explanation_unknown">To get information about the owner you have to physically have found the Tracker. Once you have found it you have to get it in a special mode. This can be something like pressing the button three times or holding the button for 30 seconds. If successful this will be confirmed by a sound. Afterwards press \"next\".</string>
422422
<string name="retrieve_owner_information_explanation_pebblebee">To get information about the owner you have to physically have found the Tracker. Once you have found it press the button on the tracker three times. This will be confirmed by a sound. Afterwards press \"next\".</string>
423423
<string name="retrieve_owner_information_explanation_chipolo">To get information about the owner you have to physically have found the Tracker. Once you have found it press the button on the tracker for 30 seconds and release the button exactly after the second beep. This will be confirmed by a sound indicating success. Afterwards press \"next\".</string>
424+
<string name="retrieve_owner_information_explanation_motorola">To get information about the owner you have to physically have found the Tracker. Once you have found it press and hold the button for 10 seconds until you hear a beep. Afterward, release the button and press &amp; release again immediately. Afterwards press \"next\".</string>
424425
<string name="retrieve_owner_information_alert_next">Next</string>
425426
<string name="retrieve_owner_information_alert_close">Close</string>
426427

0 commit comments

Comments
 (0)