• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License
15  */
16 
17 package com.android.systemui.keyguard.domain.interactor
18 /**
19  * Each TransitionInteractor is responsible for determining under which conditions to notify
20  * [KeyguardTransitionRepository] to signal a transition. When (and if) the transition occurs is
21  * determined by [KeyguardTransitionRepository].
22  *
23  * [name] field should be a unique identifiable string representing this state, used primarily for
24  * logging
25  *
26  * MUST list implementing classes in dagger module [StartKeyguardTransitionModule] and also in the
27  * 'when' clause of [KeyguardTransitionCoreStartable]
28  */
29 sealed class TransitionInteractor(val name: String) {
30 
startnull31     abstract fun start()
32 
33     fun <A, B, C> toTriple(a: A, b: B, c: C) = Triple(a, b, c)
34 
35     fun <A, B, C> toTriple(a: A, bc: Pair<B, C>) = Triple(a, bc.first, bc.second)
36 
37     fun <A, B, C> toTriple(ab: Pair<A, B>, c: C) = Triple(ab.first, ab.second, c)
38 
39     fun <A, B, C, D> toQuad(a: A, b: B, c: C, d: D) = Quad(a, b, c, d)
40 
41     fun <A, B, C, D> toQuad(a: A, bcd: Triple<B, C, D>) = Quad(a, bcd.first, bcd.second, bcd.third)
42 
43     fun <A, B, C, D, E> toQuint(a: A, bcde: Quad<B, C, D, E>) =
44         Quint(a, bcde.first, bcde.second, bcde.third, bcde.fourth)
45 }
46 
47 data class Quad<A, B, C, D>(val first: A, val second: B, val third: C, val fourth: D)
48 
49 data class Quint<A, B, C, D, E>(
50     val first: A,
51     val second: B,
52     val third: C,
53     val fourth: D,
54     val fifth: E
55 )
56