kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
chore: Unused code cleanup (#1612)
* Remove unused SoftwareUpdateService code and commented out service reg in manifest * Remove unused methods that had unnecessary version checks * Regenerate baseline to remove detekt issues that are no longer presentpull/1627/head
rodzic
4242afef9c
commit
2f48e8e68a
|
@ -108,15 +108,6 @@
|
|||
android:name="firebase_analytics_collection_enabled"
|
||||
android:value="false" />
|
||||
|
||||
<!-- we need bind job service for oreo -->
|
||||
<!--
|
||||
<service
|
||||
android:name="com.geeksville.mesh.service.SoftwareUpdateService"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||
-->
|
||||
|
||||
<!-- This is the public API for doing mesh radio operations from android apps -->
|
||||
<service
|
||||
android:name="com.geeksville.mesh.service.MeshService"
|
||||
|
|
|
@ -23,19 +23,6 @@ import android.os.Build
|
|||
* Created by kevinh on 1/14/16.
|
||||
*/
|
||||
object BuildUtils : Logging {
|
||||
|
||||
fun is64Bit(): Boolean {
|
||||
if (Build.VERSION.SDK_INT < 21)
|
||||
return false
|
||||
else
|
||||
return Build.SUPPORTED_64_BIT_ABIS.size > 0
|
||||
}
|
||||
|
||||
fun isBuggyMoto(): Boolean {
|
||||
debug("Device type is: ${Build.DEVICE}")
|
||||
return Build.DEVICE == "osprey_u2" // Moto G
|
||||
}
|
||||
|
||||
// Are we running on the emulator?
|
||||
val isEmulator
|
||||
get() = Build.FINGERPRINT.startsWith("generic") ||
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2025 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.geeksville.mesh.service
|
||||
|
||||
import android.bluetooth.BluetoothGattCharacteristic
|
||||
|
||||
/**
|
||||
* Some misformatted ESP32s have problems
|
||||
*/
|
||||
class DeviceRejectedException : BLEException("Device rejected filesize")
|
||||
|
||||
/**
|
||||
* Move this somewhere as a generic network byte order function
|
||||
*/
|
||||
fun toNetworkByteArray(value: Int, formatType: Int): ByteArray {
|
||||
|
||||
val len = when (formatType) {
|
||||
BluetoothGattCharacteristic.FORMAT_UINT8 -> 1
|
||||
BluetoothGattCharacteristic.FORMAT_UINT32 -> 4
|
||||
else -> TODO()
|
||||
}
|
||||
|
||||
val mValue = ByteArray(len)
|
||||
|
||||
when (formatType) {
|
||||
/* BluetoothGattCharacteristic.FORMAT_SINT8 -> {
|
||||
value = intToSignedBits(value, 8)
|
||||
mValue.get(offset) = (value and 0xFF).toByte()
|
||||
}
|
||||
BluetoothGattCharacteristic.FORMAT_UINT8 -> mValue.get(offset) =
|
||||
(value and 0xFF).toByte()
|
||||
BluetoothGattCharacteristic.FORMAT_SINT16 -> {
|
||||
value = intToSignedBits(value, 16)
|
||||
mValue.get(offset++) = (value and 0xFF).toByte()
|
||||
mValue.get(offset) = (value shr 8 and 0xFF).toByte()
|
||||
}
|
||||
BluetoothGattCharacteristic.FORMAT_UINT16 -> {
|
||||
mValue.get(offset++) = (value and 0xFF).toByte()
|
||||
mValue.get(offset) = (value shr 8 and 0xFF).toByte()
|
||||
}
|
||||
BluetoothGattCharacteristic.FORMAT_SINT32 -> {
|
||||
value = intToSignedBits(value, 32)
|
||||
mValue.get(offset++) = (value and 0xFF).toByte()
|
||||
mValue.get(offset++) = (value shr 8 and 0xFF).toByte()
|
||||
mValue.get(offset++) = (value shr 16 and 0xFF).toByte()
|
||||
mValue.get(offset) = (value shr 24 and 0xFF).toByte()
|
||||
} */
|
||||
BluetoothGattCharacteristic.FORMAT_UINT8 ->
|
||||
mValue[0] = (value and 0xFF).toByte()
|
||||
|
||||
BluetoothGattCharacteristic.FORMAT_UINT32 -> {
|
||||
mValue[0] = (value and 0xFF).toByte()
|
||||
mValue[1] = (value shr 8 and 0xFF).toByte()
|
||||
mValue[2] = (value shr 16 and 0xFF).toByte()
|
||||
mValue[3] = (value shr 24 and 0xFF).toByte()
|
||||
}
|
||||
else -> TODO()
|
||||
}
|
||||
return mValue
|
||||
}
|
||||
|
||||
data class UpdateFilenames(val appLoad: String?, val littlefs: String?)
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" ?>
|
||||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues></ManuallySuppressedIssues>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>AbsentOrWrongFileLicense:LazyColumnDragAndDropDemo.kt$com.geeksville.mesh.ui.components.LazyColumnDragAndDropDemo.kt</ID>
|
||||
<ID>ChainWrapping:Channel.kt$Channel$&&</ID>
|
||||
|
@ -126,7 +126,6 @@
|
|||
<ID>FinalNewline:SerialConnectionListener.kt$com.geeksville.mesh.repository.usb.SerialConnectionListener.kt</ID>
|
||||
<ID>FinalNewline:SerialInterface.kt$com.geeksville.mesh.repository.radio.SerialInterface.kt</ID>
|
||||
<ID>FinalNewline:SerialInterfaceFactory.kt$com.geeksville.mesh.repository.radio.SerialInterfaceFactory.kt</ID>
|
||||
<ID>FinalNewline:SoftwareUpdateService.kt$com.geeksville.mesh.service.SoftwareUpdateService.kt</ID>
|
||||
<ID>FinalNewline:SqlTileWriterExt.kt$com.geeksville.mesh.util.SqlTileWriterExt.kt</ID>
|
||||
<ID>FinalNewline:TCPInterfaceFactory.kt$com.geeksville.mesh.repository.radio.TCPInterfaceFactory.kt</ID>
|
||||
<ID>FinalNewline:UsbBroadcastReceiver.kt$com.geeksville.mesh.repository.usb.UsbBroadcastReceiver.kt</ID>
|
||||
|
@ -186,7 +185,6 @@
|
|||
<ID>MagicNumber:BluetoothInterface.kt$BluetoothInterface$1500</ID>
|
||||
<ID>MagicNumber:BluetoothInterface.kt$BluetoothInterface$500</ID>
|
||||
<ID>MagicNumber:BluetoothInterface.kt$BluetoothInterface$512</ID>
|
||||
<ID>MagicNumber:BuildUtils.kt$BuildUtils$21</ID>
|
||||
<ID>MagicNumber:Channel.kt$0xff</ID>
|
||||
<ID>MagicNumber:ChannelOption.kt$.03125f</ID>
|
||||
<ID>MagicNumber:ChannelOption.kt$.0625f</ID>
|
||||
|
@ -336,12 +334,6 @@
|
|||
<ID>MagicNumber:SerialConnectionImpl.kt$SerialConnectionImpl$115200</ID>
|
||||
<ID>MagicNumber:SerialConnectionImpl.kt$SerialConnectionImpl$200</ID>
|
||||
<ID>MagicNumber:ServiceClient.kt$ServiceClient$500</ID>
|
||||
<ID>MagicNumber:SoftwareUpdateService.kt$0xFF</ID>
|
||||
<ID>MagicNumber:SoftwareUpdateService.kt$16</ID>
|
||||
<ID>MagicNumber:SoftwareUpdateService.kt$24</ID>
|
||||
<ID>MagicNumber:SoftwareUpdateService.kt$3</ID>
|
||||
<ID>MagicNumber:SoftwareUpdateService.kt$4</ID>
|
||||
<ID>MagicNumber:SoftwareUpdateService.kt$8</ID>
|
||||
<ID>MagicNumber:StreamInterface.kt$StreamInterface$0xff</ID>
|
||||
<ID>MagicNumber:StreamInterface.kt$StreamInterface$3</ID>
|
||||
<ID>MagicNumber:StreamInterface.kt$StreamInterface$4</ID>
|
||||
|
@ -460,8 +452,6 @@
|
|||
<ID>MultiLineIfElse:BluetoothInterface.kt$BluetoothInterface$warn("Not connecting, because safe==null, someone must have closed us")</ID>
|
||||
<ID>MultiLineIfElse:BluetoothRepository.kt$BluetoothRepository$bondedDevices.filter { it.name?.matches(Regex(BLE_NAME_PATTERN)) == true }</ID>
|
||||
<ID>MultiLineIfElse:BluetoothRepository.kt$BluetoothRepository$emptyList()</ID>
|
||||
<ID>MultiLineIfElse:BuildUtils.kt$BuildUtils$return Build.SUPPORTED_64_BIT_ABIS.size > 0</ID>
|
||||
<ID>MultiLineIfElse:BuildUtils.kt$BuildUtils$return false</ID>
|
||||
<ID>MultiLineIfElse:Channel.kt$Channel$"Custom"</ID>
|
||||
<ID>MultiLineIfElse:Channel.kt$Channel$when (loraConfig.modemPreset) { ModemPreset.SHORT_TURBO -> "ShortTurbo" ModemPreset.SHORT_FAST -> "ShortFast" ModemPreset.SHORT_SLOW -> "ShortSlow" ModemPreset.MEDIUM_FAST -> "MediumFast" ModemPreset.MEDIUM_SLOW -> "MediumSlow" ModemPreset.LONG_FAST -> "LongFast" ModemPreset.LONG_SLOW -> "LongSlow" ModemPreset.LONG_MODERATE -> "LongMod" ModemPreset.VERY_LONG_SLOW -> "VLongSlow" else -> "Invalid" }</ID>
|
||||
<ID>MultiLineIfElse:ChannelFragment.kt$channelSet = copy { settings.add(it) }</ID>
|
||||
|
@ -561,7 +551,6 @@
|
|||
<ID>NewLineAtEndOfFile:SerialConnectionListener.kt$com.geeksville.mesh.repository.usb.SerialConnectionListener.kt</ID>
|
||||
<ID>NewLineAtEndOfFile:SerialInterface.kt$com.geeksville.mesh.repository.radio.SerialInterface.kt</ID>
|
||||
<ID>NewLineAtEndOfFile:SerialInterfaceFactory.kt$com.geeksville.mesh.repository.radio.SerialInterfaceFactory.kt</ID>
|
||||
<ID>NewLineAtEndOfFile:SoftwareUpdateService.kt$com.geeksville.mesh.service.SoftwareUpdateService.kt</ID>
|
||||
<ID>NewLineAtEndOfFile:SqlTileWriterExt.kt$com.geeksville.mesh.util.SqlTileWriterExt.kt</ID>
|
||||
<ID>NewLineAtEndOfFile:TCPInterfaceFactory.kt$com.geeksville.mesh.repository.radio.TCPInterfaceFactory.kt</ID>
|
||||
<ID>NewLineAtEndOfFile:UsbBroadcastReceiver.kt$com.geeksville.mesh.repository.usb.UsbBroadcastReceiver.kt</ID>
|
||||
|
@ -597,7 +586,6 @@
|
|||
<ID>NoTrailingSpaces:ExpireChecker.kt$ExpireChecker$ </ID>
|
||||
<ID>NoWildcardImports:BluetoothInterface.kt$import com.geeksville.mesh.service.*</ID>
|
||||
<ID>NoWildcardImports:DeviceVersionTest.kt$import org.junit.Assert.*</ID>
|
||||
<ID>NoWildcardImports:ExampleUnitTest.kt$import org.junit.Assert.*</ID>
|
||||
<ID>NoWildcardImports:MockInterface.kt$import com.geeksville.mesh.*</ID>
|
||||
<ID>NoWildcardImports:PreferenceFooter.kt$import androidx.compose.foundation.layout.*</ID>
|
||||
<ID>NoWildcardImports:PreferenceFooter.kt$import androidx.compose.material.*</ID>
|
||||
|
@ -710,7 +698,6 @@
|
|||
<ID>VariableNaming:SafeBluetooth.kt$SafeBluetooth$private val STATUS_TIMEOUT = 4404</ID>
|
||||
<ID>WildcardImport:BluetoothInterface.kt$import com.geeksville.mesh.service.*</ID>
|
||||
<ID>WildcardImport:DeviceVersionTest.kt$import org.junit.Assert.*</ID>
|
||||
<ID>WildcardImport:ExampleUnitTest.kt$import org.junit.Assert.*</ID>
|
||||
<ID>WildcardImport:MockInterface.kt$import com.geeksville.mesh.*</ID>
|
||||
<ID>WildcardImport:PreferenceFooter.kt$import androidx.compose.foundation.layout.*</ID>
|
||||
<ID>WildcardImport:PreferenceFooter.kt$import androidx.compose.material.*</ID>
|
||||
|
|
Ładowanie…
Reference in New Issue