File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
app/src/main/java/com/osfans/trime/core Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,13 @@ class Rime : RimeApi, RimeLifecycleOwner {
138
138
Timber .w(" Skip stopping rime: not at ready state!" )
139
139
return
140
140
}
141
- dispatcher.stop()
141
+ lifecycleImpl.emitState(RimeLifecycle .State .STOPPING )
142
+ Timber .i(" Rime finalize()" )
143
+ dispatcher.stop().let {
144
+ if (it.isNotEmpty()) {
145
+ Timber .w(" ${it.size} job(s) didn't get a chance to run!" )
146
+ }
147
+ }
142
148
lifecycleImpl.emitState(RimeLifecycle .State .STOPPED )
143
149
unregisterRimeNotificationHandler(::handleRimeNotification)
144
150
}
Original file line number Diff line number Diff line change @@ -34,8 +34,12 @@ class RimeLifecycleImpl : RimeLifecycle {
34
34
checkAtState(RimeLifecycle .State .STARTING )
35
35
internalStateFlow.value = RimeLifecycle .State .READY
36
36
}
37
- RimeLifecycle .State .STOPPED -> {
37
+ RimeLifecycle .State .STOPPING -> {
38
38
checkAtState(RimeLifecycle .State .READY )
39
+ internalStateFlow.value = RimeLifecycle .State .STOPPING
40
+ }
41
+ RimeLifecycle .State .STOPPED -> {
42
+ checkAtState(RimeLifecycle .State .STOPPING )
39
43
internalStateFlow.value = RimeLifecycle .State .STOPPED
40
44
}
41
45
}
@@ -53,6 +57,7 @@ interface RimeLifecycle {
53
57
enum class State {
54
58
STARTING ,
55
59
READY ,
60
+ STOPPING ,
56
61
STOPPED ,
57
62
}
58
63
}
You can’t perform that action at this time.
0 commit comments