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

Commit 4d9d7a73 authored by Devarshi Bhatt's avatar Devarshi Bhatt Committed by Android (Google) Code Review
Browse files

Merge "Refactor Settings/UserSettingsProxy APIs with 'Sync' suffix." into main

parents 899fcff3 4903606a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -308,14 +308,14 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        mStatusArea = mView.findViewById(R.id.keyguard_status_area);

        mBgExecutor.execute(() -> {
            mSecureSettings.registerContentObserverForUser(
            mSecureSettings.registerContentObserverForUserSync(
                    Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK,
                    false, /* notifyForDescendants */
                    mDoubleLineClockObserver,
                    UserHandle.USER_ALL
            );

            mSecureSettings.registerContentObserverForUser(
            mSecureSettings.registerContentObserverForUserSync(
                    Settings.Secure.LOCK_SCREEN_WEATHER_ENABLED,
                    false, /* notifyForDescendants */
                    mShowWeatherObserver,
@@ -372,8 +372,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        setClock(null);

        mBgExecutor.execute(() -> {
            mSecureSettings.unregisterContentObserver(mDoubleLineClockObserver);
            mSecureSettings.unregisterContentObserver(mShowWeatherObserver);
            mSecureSettings.unregisterContentObserverSync(mDoubleLineClockObserver);
            mSecureSettings.unregisterContentObserverSync(mShowWeatherObserver);
        });

        mKeyguardUnlockAnimationController.removeKeyguardUnlockAnimationListener(
+2 −2
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest
        }

        // Unregister observer before removing view
        mSecureSettings.unregisterContentObserver(mMagnificationCapabilityObserver);
        mSecureSettings.unregisterContentObserverSync(mMagnificationCapabilityObserver);
        mWindowManager.removeView(mSettingView);
        mIsVisible = false;
        if (resetPosition) {
@@ -380,7 +380,7 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest

            mWindowManager.addView(mSettingView, mParams);

            mSecureSettings.registerContentObserverForUser(
            mSecureSettings.registerContentObserverForUserSync(
                    Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY,
                    mMagnificationCapabilityObserver,
                    UserHandle.USER_CURRENT);
+5 −5
Original line number Diff line number Diff line
@@ -240,26 +240,26 @@ class MenuInfoRepository {
    }

    void registerObserversAndCallbacks() {
        mSecureSettings.registerContentObserverForUser(
        mSecureSettings.registerContentObserverForUserSync(
                mSecureSettings.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS),
                /* notifyForDescendants */ false, mMenuTargetFeaturesContentObserver,
                UserHandle.USER_CURRENT);
        if (!com.android.systemui.Flags.floatingMenuNarrowTargetContentObserver()) {
            mSecureSettings.registerContentObserverForUser(
            mSecureSettings.registerContentObserverForUserSync(
                    mSecureSettings.getUriFor(ENABLED_ACCESSIBILITY_SERVICES),
                    /* notifyForDescendants */ false,
                    mMenuTargetFeaturesContentObserver,
                    UserHandle.USER_CURRENT);
        }
        mSecureSettings.registerContentObserverForUser(
        mSecureSettings.registerContentObserverForUserSync(
                mSecureSettings.getUriFor(Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE),
                /* notifyForDescendants */ false, mMenuSizeContentObserver,
                UserHandle.USER_CURRENT);
        mSecureSettings.registerContentObserverForUser(
        mSecureSettings.registerContentObserverForUserSync(
                mSecureSettings.getUriFor(ACCESSIBILITY_FLOATING_MENU_FADE_ENABLED),
                /* notifyForDescendants */ false, mMenuFadeOutContentObserver,
                UserHandle.USER_CURRENT);
        mSecureSettings.registerContentObserverForUser(
        mSecureSettings.registerContentObserverForUserSync(
                mSecureSettings.getUriFor(ACCESSIBILITY_FLOATING_MENU_OPACITY),
                /* notifyForDescendants */ false, mMenuFadeOutContentObserver,
                UserHandle.USER_CURRENT);
+9 −7
Original line number Diff line number Diff line
@@ -29,12 +29,12 @@ import android.widget.SeekBar
import android.widget.TextView
import androidx.annotation.MainThread
import androidx.annotation.WorkerThread
import com.android.systemui.res.R
import com.android.systemui.common.ui.view.SeekBarWithIconButtonsView
import com.android.systemui.common.ui.view.SeekBarWithIconButtonsView.OnSeekBarWithIconButtonsChangeListener
import com.android.systemui.common.ui.view.SeekBarWithIconButtonsView.OnSeekBarWithIconButtonsChangeListener.ControlUnitType
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.res.R
import com.android.systemui.settings.UserTracker
import com.android.systemui.statusbar.phone.SystemUIDialog
import com.android.systemui.util.concurrency.DelayableExecutor
@@ -46,7 +46,9 @@ import javax.inject.Inject
import kotlin.math.roundToInt

/** The Dialog that contains a seekbar for changing the font size. */
class FontScalingDialogDelegate @Inject constructor(
class FontScalingDialogDelegate
@Inject
constructor(
    private val context: Context,
    private val systemUIDialogFactory: SystemUIDialog.Factory,
    private val layoutInflater: LayoutInflater,
@@ -142,7 +144,7 @@ class FontScalingDialogDelegate @Inject constructor(
            }
        )
        doneButton.setOnClickListener { dialog.dismiss() }
        systemSettings.registerContentObserver(Settings.System.FONT_SCALE, fontSizeObserver)
        systemSettings.registerContentObserverSync(Settings.System.FONT_SCALE, fontSizeObserver)
    }

    /**
@@ -165,7 +167,7 @@ class FontScalingDialogDelegate @Inject constructor(
    override fun onStop(dialog: SystemUIDialog) {
        cancelUpdateFontScaleRunnable?.run()
        cancelUpdateFontScaleRunnable = null
        systemSettings.unregisterContentObserver(fontSizeObserver)
        systemSettings.unregisterContentObserverSync(fontSizeObserver)
    }

    @MainThread
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ private fun SecureSettings.watch(
) {
    fun fetch(): Boolean = getIntForUser(key, if (defaultValue) 1 else 0, userId) > 0

    registerContentObserverForUser(
    registerContentObserverForUserSync(
        key,
        false /* notifyForDescendants */,
        object : ContentObserver(handler) {
Loading