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

Commit 18cdf526 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Deprecate the `unsafeAssertInNewMode` method to avod people using it.

Bug: 369603511
Test: presubmit
Flag: EXEMPT deprecation
Change-Id: I7c9d35bcb34c7d800d5a08341bd0789d436429fe
parent bdf3b189
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ object RefactorFlagUtils {
     * }
     * ````
     */
    @Deprecated("Avoid crashing.", ReplaceWith("if (this.isUnexpectedlyInLegacyMode()) return"))
    inline fun unsafeAssertInNewMode(isEnabled: Boolean, flagName: Any) =
        check(isEnabled) { "New code path not supported when $flagName is disabled." }

+3 −1
Original line number Diff line number Diff line
@@ -42,7 +42,9 @@ object ModesUi {
     * Caution!! Using this check incorrectly will cause crashes in nextfood builds!
     */
    @JvmStatic
    inline fun unsafeAssertInNewMode() = RefactorFlagUtils.unsafeAssertInNewMode(isEnabled, Flags.FLAG_MODES_UI)
    @Deprecated("Avoid crashing.", ReplaceWith("if (this.isUnexpectedlyInLegacyMode()) return"))
    inline fun unsafeAssertInNewMode() =
        RefactorFlagUtils.unsafeAssertInNewMode(isEnabled, Flags.FLAG_MODES_UI)

    /**
     * Called to ensure code is only run when the flag is disabled. This will throw an exception if
+3 −1
Original line number Diff line number Diff line
@@ -81,7 +81,9 @@ object QsDetailedView {
     * Caution!! Using this check incorrectly will cause crashes in nextfood builds!
     */
    @JvmStatic
    inline fun unsafeAssertInNewMode() = RefactorFlagUtils.unsafeAssertInNewMode(isEnabled, FLAG_NAME)
    @Deprecated("Avoid crashing.", ReplaceWith("if (this.isUnexpectedlyInLegacyMode()) return"))
    inline fun unsafeAssertInNewMode() =
        RefactorFlagUtils.unsafeAssertInNewMode(isEnabled, FLAG_NAME)

    /** Returns a developer-readable string that describes the current requirement list. */
    @JvmStatic
+3 −1
Original line number Diff line number Diff line
@@ -83,7 +83,9 @@ object SceneContainerFlag {
     * testing.
     */
    @JvmStatic
    inline fun unsafeAssertInNewMode() = RefactorFlagUtils.unsafeAssertInNewMode(isEnabled, DESCRIPTION)
    @Deprecated("Avoid crashing.", ReplaceWith("if (this.isUnexpectedlyInLegacyMode()) return"))
    inline fun unsafeAssertInNewMode() =
        RefactorFlagUtils.unsafeAssertInNewMode(isEnabled, DESCRIPTION)

    /** Returns a developer-readable string that describes the current requirement list. */
    @JvmStatic
+3 −1
Original line number Diff line number Diff line
@@ -50,7 +50,9 @@ object ShadeExpandsOnStatusBarLongPress {
     * Caution!! Using this check incorrectly will cause crashes in nextfood builds!
     */
    @JvmStatic
    inline fun unsafeAssertInNewMode() = RefactorFlagUtils.unsafeAssertInNewMode(isEnabled, FLAG_NAME)
    @Deprecated("Avoid crashing.", ReplaceWith("if (this.isUnexpectedlyInLegacyMode()) return"))
    inline fun unsafeAssertInNewMode() =
        RefactorFlagUtils.unsafeAssertInNewMode(isEnabled, FLAG_NAME)

    /**
     * Called to ensure code is only run when the flag is disabled. This will throw an exception if
Loading