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

Commit 5a775198 authored by Matías Hernández's avatar Matías Hernández
Browse files

Add test-only ZenModesBackend.setInstance()

To be used in tests where supplying an alternate backend otherwise is not practical.

Bug: 356334282
Test: N/A
Flag: android.app.modes_ui
Change-Id: I6034b627b277e0b0653066757129f416f2f1aaa2
parent 7ef1ce6e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.service.notification.ZenModeConfig;
import android.util.Log;

import androidx.annotation.DrawableRes;
import androidx.annotation.VisibleForTesting;

import com.android.settingslib.R;

@@ -61,6 +62,12 @@ public class ZenModesBackend {
        return sInstance;
    }

    /** Replaces the singleton instance of {@link ZenModesBackend} by the provided one. */
    @VisibleForTesting(otherwise = VisibleForTesting.NONE)
    public static void setInstance(@Nullable ZenModesBackend backend) {
        sInstance = backend;
    }

    ZenModesBackend(Context context) {
        mContext = context;
        mNotificationManager = context.getSystemService(NotificationManager.class);