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

Commit 90585260 authored by Jernej Virag's avatar Jernej Virag
Browse files

Trace registrations of content observers

Adds trace markers for calling out to ContentResolver.

Bug: 327359535
Test: n/a
Flag: NA
Change-Id: Iba98432561b4392c185896907eaee3969fec8d30
parent a66816b4
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -25,8 +25,11 @@ import android.net.Uri;
import android.os.UserHandle;
import android.provider.Settings;

import com.android.app.tracing.TraceUtils;
import com.android.systemui.settings.UserTracker;

import kotlin.Unit;

/**
 * Used to interact with per-user Settings.Secure and Settings.System settings (but not
 * Settings.Global, since those do not vary per-user)
@@ -123,8 +126,16 @@ public interface UserSettingsProxy extends SettingsProxy {
    default void registerContentObserverForUser(
            Uri uri, boolean notifyForDescendants, ContentObserver settingsObserver,
            int userHandle) {
        TraceUtils.trace(
                () -> {
                    // The limit for trace tags length is 127 chars, which leaves us 90 for Uri.
                    return "USP#registerObserver#[" + uri.toString() + "]";
                }, () -> {
                    getContentResolver().registerContentObserver(
                uri, notifyForDescendants, settingsObserver, getRealUserHandle(userHandle));
                            uri, notifyForDescendants, settingsObserver,
                            getRealUserHandle(userHandle));
                    return Unit.INSTANCE;
                });
    }

    /**