Keep Android diagnostic device id stable
This commit is contained in:
@@ -30,8 +30,8 @@ android {
|
||||
applicationId "su.cin.rapvpn"
|
||||
minSdk 26
|
||||
targetSdk 35
|
||||
versionCode 206
|
||||
versionName "0.2.206"
|
||||
versionCode 207
|
||||
versionName "0.2.207"
|
||||
buildConfigField "String", "DEFAULT_BACKEND_URL", "\"${normalizeGradleString(defaultBackendUrl)}\""
|
||||
buildConfigField "String", "DEFAULT_CLUSTER_ID", "\"${normalizeGradleString(defaultClusterId)}\""
|
||||
buildConfigField "String", "DEFAULT_ORGANIZATION_ID", "\"${normalizeGradleString(defaultOrganizationId)}\""
|
||||
|
||||
@@ -1056,14 +1056,16 @@ public class RapDiagnosticService extends Service {
|
||||
}
|
||||
|
||||
private String diagnosticDeviceId(SharedPreferences prefs) {
|
||||
String trusted = prefs.getString(PREF_DEVICE_ID, "");
|
||||
if (trusted != null && !trusted.trim().isEmpty()) {
|
||||
return trusted.trim();
|
||||
}
|
||||
String cached = prefs.getString(PREF_DIAGNOSTIC_DEVICE_ID, "");
|
||||
if (cached != null && !cached.trim().isEmpty()) {
|
||||
return cached.trim();
|
||||
}
|
||||
String trusted = prefs.getString(PREF_DEVICE_ID, "");
|
||||
if (trusted != null && trusted.trim().startsWith("diag-")) {
|
||||
String stable = trusted.trim();
|
||||
prefs.edit().putString(PREF_DIAGNOSTIC_DEVICE_ID, stable).apply();
|
||||
return stable;
|
||||
}
|
||||
String androidId = "";
|
||||
try {
|
||||
androidId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
|
||||
Reference in New Issue
Block a user