Revision 4c49986e
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/helpers/BlockController.java | ||
---|---|---|
126 | 126 |
|
127 | 127 |
if( mTouchBlockTime>mPauseTime && touchBlocked>touchThreshhold ) |
128 | 128 |
{ |
129 |
TwistyActivity act = mAct.get(); |
|
130 |
boolean reallyBlocked = true; |
|
129 |
boolean running = EffectMessageSender.isRunning(); |
|
131 | 130 |
|
132 |
if( act!=null )
|
|
131 |
if( !running )
|
|
133 | 132 |
{ |
134 |
TwistyPreRender pre = act.getTwistyPreRender(); |
|
135 |
if( pre!=null ) |
|
133 |
reportThreadProblem(); |
|
134 |
EffectMessageSender.restartThread(); |
|
135 |
} |
|
136 |
else |
|
137 |
{ |
|
138 |
TwistyActivity act = mAct.get(); |
|
139 |
boolean reallyBlocked = true; |
|
140 |
|
|
141 |
if( act!=null ) |
|
136 | 142 |
{ |
137 |
reallyBlocked = pre.isTouchBlocked(); |
|
138 |
pre.unblockTouch(); |
|
143 |
TwistyPreRender pre = act.getTwistyPreRender(); |
|
144 |
if( pre!=null ) |
|
145 |
{ |
|
146 |
reallyBlocked = pre.isTouchBlocked(); |
|
147 |
pre.unblockTouch(); |
|
148 |
} |
|
139 | 149 |
} |
140 |
} |
|
141 | 150 |
|
142 |
reportTouchProblem(touchBlocked, reallyBlocked); |
|
151 |
reportTouchProblem(touchBlocked, reallyBlocked); |
|
152 |
} |
|
143 | 153 |
} |
144 | 154 |
|
145 | 155 |
long uiThreshhold = getThreshhold(mLastUIPlace); |
... | ... | |
147 | 157 |
|
148 | 158 |
if( mUIBlockTime>mPauseTime && uiBlocked>uiThreshhold ) |
149 | 159 |
{ |
150 |
TwistyActivity act = mAct.get(); |
|
151 |
boolean reallyBlocked = true; |
|
160 |
boolean running = EffectMessageSender.isRunning(); |
|
152 | 161 |
|
153 |
if( act!=null ) |
|
162 |
if( !running ) |
|
163 |
{ |
|
164 |
reportThreadProblem(); |
|
165 |
EffectMessageSender.restartThread(); |
|
166 |
} |
|
167 |
else |
|
154 | 168 |
{ |
155 |
TwistyPreRender pre = act.getTwistyPreRender(); |
|
156 |
if( pre!=null ) |
|
169 |
TwistyActivity act = mAct.get(); |
|
170 |
boolean reallyBlocked = true; |
|
171 |
|
|
172 |
if( act!=null ) |
|
157 | 173 |
{ |
158 |
reallyBlocked = !pre.isUINotBlocked(); |
|
159 |
pre.unblockUI(); |
|
174 |
TwistyPreRender pre = act.getTwistyPreRender(); |
|
175 |
if( pre!=null ) |
|
176 |
{ |
|
177 |
reallyBlocked = !pre.isUINotBlocked(); |
|
178 |
pre.unblockUI(); |
|
179 |
} |
|
160 | 180 |
} |
161 |
} |
|
162 | 181 |
|
163 |
reportUIProblem(uiBlocked, reallyBlocked); |
|
182 |
reportUIProblem(uiBlocked, reallyBlocked); |
|
183 |
} |
|
164 | 184 |
} |
165 | 185 |
} |
166 | 186 |
|
... | ... | |
200 | 220 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); |
201 | 221 |
crashlytics.setCustomKey("pause" , mPauseTime ); |
202 | 222 |
crashlytics.setCustomKey("resume", mResumeTime ); |
203 |
crashlytics.setCustomKey("thread", EffectMessageSender.reportState() ); |
|
223 |
crashlytics.recordException(ex); |
|
224 |
} |
|
225 |
} |
|
226 |
|
|
227 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
228 |
|
|
229 |
private void reportThreadProblem() |
|
230 |
{ |
|
231 |
String error = EffectMessageSender.reportState(); |
|
232 |
|
|
233 |
if( BuildConfig.DEBUG ) |
|
234 |
{ |
|
235 |
android.util.Log.e("D", error); |
|
236 |
} |
|
237 |
else |
|
238 |
{ |
|
239 |
Exception ex = new Exception(error); |
|
240 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); |
|
241 |
crashlytics.setCustomKey("pause" , mPauseTime ); |
|
242 |
crashlytics.setCustomKey("resume", mResumeTime ); |
|
204 | 243 |
crashlytics.recordException(ex); |
205 | 244 |
} |
206 | 245 |
} |
Also available in: Unified diff
1) add missing call to BlockController.onPause() / onResume() to the Tutorial activity
2) rearrange BlockController's error reporting to make the case where the MessageSender thread has died separate
3) in such case, resurrect the thread
4) simplify and harden the EffectMessageSender