Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fingerprint V6: update stable fingerprint #120

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ val FingerprintingSignal<*>.humanName: String
is ApplicationsListSignal -> "Applications List"
is AvailableLocalesSignal -> "Available Locales"
is BatteryFullCapacitySignal -> "Battery Full Capacity"
is BatteryFullCapacityV2Signal -> "Battery Full Capacity V2"
is BatteryHealthSignal -> "Battery Health"
is CameraListSignal -> "Camera List"
is CodecListSignal -> "Codec List"
Expand Down Expand Up @@ -70,6 +71,7 @@ val FingerprintingSignal<*>.jsonifiableValue: Any
is ApplicationsListSignal -> this.value.map { it.packageName }
is AvailableLocalesSignal -> this.value
is BatteryFullCapacitySignal -> this.value
is BatteryFullCapacityV2Signal -> this.value
is BatteryHealthSignal -> this.value
is CameraListSignal -> this.value.map {
CameraListSignalItemVo(
Expand Down Expand Up @@ -154,6 +156,7 @@ val FingerprintingSignal<*>.humanValue: String
is ApplicationsListSignal -> valueAsSimpleListString { appendLine(it) }
is AvailableLocalesSignal -> valueAsSimpleListString { appendLine(it) }
is BatteryFullCapacitySignal -> valueAsSimpleString()
is BatteryFullCapacityV2Signal -> valueAsSimpleString()
is BatteryHealthSignal -> valueAsSimpleString()
is CameraListSignal -> valueAsSeparatedListString {
appendLine(it.cameraName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ public class Fingerprinter internal constructor(
V_2(intValue = 2),
V_3(intValue = 3),
V_4(intValue = 4),
V_5(intValue = 5);
V_5(intValue = 5),
V_6(intValue = 6);

public companion object {
@get:Discouraged(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,34 @@ public class BatteryFullCapacitySignal(
public companion object {
public val info: Info = Info(
addedInVersion = Fingerprinter.Version.V_2,
removedInVersion = null,
removedInVersion = Fingerprinter.Version.V_6,
stabilityLevel = StabilityLevel.STABLE,
)
}
}

/**
* Same as [BatteryFullCapacitySignal], but [StabilityLevel] is downgraded to [StabilityLevel.OPTIMAL]
*/
public class BatteryFullCapacityV2Signal(
override val value: String,
) : FingerprintingSignal<String>() {
override val info: Info
get() = Companion.info

override fun getHashableString(): String {
return value
}

public companion object {
public val info: Info = Info(
addedInVersion = Fingerprinter.Version.V_6,
removedInVersion = null,
stabilityLevel = StabilityLevel.OPTIMAL,
)
}
}

public class CameraListSignal(
override val value: List<CameraInfo>,
) : FingerprintingSignal<List<CameraInfo>>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class FingerprintingSignalsProvider internal constructor(
InputDevicesV2Signal.info to { inputDevicesV2Signal },
BatteryHealthSignal.info to { batteryHealthSignal },
BatteryFullCapacitySignal.info to { batteryFullCapacitySignal },
BatteryFullCapacityV2Signal.info to { batteryFullCapacityV2Signal },
CameraListSignal.info to { cameraListSignal },
GlesVersionSignal.info to { glesVersionSignal },
AbiTypeSignal.info to { abiTypeSignal },
Expand Down Expand Up @@ -204,6 +205,11 @@ public class FingerprintingSignalsProvider internal constructor(
BatteryFullCapacitySignal(batteryInfoProvider.batteryTotalCapacity())
}

@get:WorkerThread
public val batteryFullCapacityV2Signal: BatteryFullCapacityV2Signal by lazy {
BatteryFullCapacityV2Signal(batteryInfoProvider.batteryTotalCapacity())
}

@get:WorkerThread
public val cameraListSignal: CameraListSignal by lazy {
CameraListSignal(cameraInfoProvider.getCameraInfo())
Expand Down
Loading