Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccc66f43 authored by William Escande's avatar William Escande
Browse files

AutoOnFeature: Prevent double metric log

The metric is reported unconditionally of the settings being already on
This change prevent to report double trigger of the feature

Bug: 311772251
Bug: 323060869
Test: None
Flag: com.android.bluetooth.flags.auto_on_feature
Change-Id: Id851b880f8c39936850f42484ecd0a6661101506
parent 10095dc5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -136,6 +136,10 @@ public fun setUserEnabled(
    if (!isUserSupported(context.contentResolver)) {
        throw IllegalStateException("AutoOnFeature not supported for user: ${context.getUser()}")
    }
    if (isFeatureEnabledForUser(context.contentResolver) && status == true) {
        Log.i(TAG, "setUserEnabled: Nothing to do, feature is already enabled")
        return
    }
    if (!setFeatureEnabledForUserUnchecked(context, status)) {
        throw IllegalStateException("AutoOnFeature database failure for user: ${context.getUser()}")
    }