mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 18:07:55 +00:00
Remove old code that used Android IDs as device IDs
This commit is contained in:
parent
0b03a66c37
commit
9c80cb9a40
@ -11,7 +11,6 @@ import android.content.res.Configuration
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
import android.provider.Settings
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.univocity.parsers.common.TextParsingException
|
import com.univocity.parsers.common.TextParsingException
|
||||||
import com.univocity.parsers.csv.CsvParser
|
import com.univocity.parsers.csv.CsvParser
|
||||||
@ -26,6 +25,7 @@ import java.io.InputStreamReader
|
|||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
import androidx.core.content.edit
|
||||||
|
|
||||||
object DeviceHelper {
|
object DeviceHelper {
|
||||||
const val ProtocolVersion = 8
|
const val ProtocolVersion = 8
|
||||||
@ -134,16 +134,8 @@ object DeviceHelper {
|
|||||||
return // We already have an ID
|
return // We already have an ID
|
||||||
}
|
}
|
||||||
@SuppressLint("HardwareIds")
|
@SuppressLint("HardwareIds")
|
||||||
val deviceName = if (preferenceKeys.isEmpty()) {
|
val deviceName = UUID.randomUUID().toString().replace("-", "")
|
||||||
// For new installations, use random IDs
|
preferences.edit { putString(KEY_DEVICE_ID_PREFERENCE, deviceName) }
|
||||||
Log.i("DeviceHelper","No device ID found and this looks like a new installation, creating a random ID")
|
|
||||||
UUID.randomUUID().toString().replace("-", "")
|
|
||||||
} else {
|
|
||||||
// Use the ANDROID_ID as device ID for existing installations, for backwards compatibility
|
|
||||||
Log.i("DeviceHelper", "No device ID found but this seems an existing installation, using the Android ID")
|
|
||||||
Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
|
||||||
}
|
|
||||||
preferences.edit().putString(KEY_DEVICE_ID_PREFERENCE, deviceName).apply()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
Loading…
x
Reference in New Issue
Block a user