Revision d887aa16
Added by Leszek Koltunski over 2 years ago
build.gradle | ||
---|---|---|
24 | 24 |
|
25 | 25 |
dependencies { |
26 | 26 |
api project(':distorted-library') |
27 |
implementation 'com.google.firebase:firebase-crashlytics:18.2.3' |
|
28 |
implementation 'androidx.appcompat:appcompat:1.3.1' |
|
29 | 27 |
implementation project(path: ':distorted-puzzle-dmesh') |
30 | 28 |
implementation project(path: ':distorted-puzzle-jsons') |
31 | 29 |
} |
src/main/java/org/distorted/objectlib/helpers/BlockController.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.objectlib.helpers; |
21 | 21 |
|
22 |
import android.app.Activity; |
|
23 |
|
|
24 |
import com.google.firebase.crashlytics.FirebaseCrashlytics; |
|
25 |
|
|
26 | 22 |
import java.util.Timer; |
27 | 23 |
import java.util.TimerTask; |
28 | 24 |
|
25 |
import android.app.Activity; |
|
26 |
|
|
29 | 27 |
import org.distorted.library.message.EffectMessageSender; |
30 |
import org.distorted.objectlib.BuildConfig; |
|
31 | 28 |
import org.distorted.objectlib.main.ObjectPreRender; |
32 | 29 |
|
33 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 31 |
|
35 | 32 |
public class BlockController |
36 | 33 |
{ |
34 |
public static final int TYPE_UI = 0; |
|
35 |
public static final int TYPE_TOUCH = 1; |
|
36 |
public static final int TYPE_THREAD = 2; |
|
37 |
|
|
37 | 38 |
public static final int PLACE_0 =0; |
38 | 39 |
public static final int PLACE_1 =1; |
39 | 40 |
public static final int PLACE_2 =2; |
... | ... | |
121 | 122 |
if( mTouchBlockTime>mPauseTime && touchBlocked>touchThreshhold ) |
122 | 123 |
{ |
123 | 124 |
boolean running = EffectMessageSender.isRunning(); |
125 |
ObjectLibInterface libInterface = mPre.getInterface(); |
|
124 | 126 |
|
125 | 127 |
if( !running ) |
126 | 128 |
{ |
127 |
reportThreadProblem();
|
|
129 |
libInterface.reportBlockProblem(TYPE_THREAD,0,mPauseTime,mResumeTime,0);
|
|
128 | 130 |
EffectMessageSender.restartThread(); |
129 | 131 |
} |
130 | 132 |
else |
131 | 133 |
{ |
132 |
boolean reallyBlocked = mPre.isTouchBlocked(); |
|
133 | 134 |
mPre.unblockTouch(); |
134 |
reportTouchProblem(touchBlocked, reallyBlocked);
|
|
135 |
libInterface.reportBlockProblem(TYPE_TOUCH,mLastTouchPlace,mPauseTime,mResumeTime,mTouchBlockTime);
|
|
135 | 136 |
} |
136 | 137 |
} |
137 | 138 |
|
... | ... | |
141 | 142 |
if( mUIBlockTime>mPauseTime && uiBlocked>uiThreshhold ) |
142 | 143 |
{ |
143 | 144 |
boolean running = EffectMessageSender.isRunning(); |
145 |
ObjectLibInterface libInterface = mPre.getInterface(); |
|
144 | 146 |
|
145 | 147 |
if( !running ) |
146 | 148 |
{ |
147 |
reportThreadProblem();
|
|
149 |
libInterface.reportBlockProblem(TYPE_THREAD,0,mPauseTime,mResumeTime,0);
|
|
148 | 150 |
EffectMessageSender.restartThread(); |
149 | 151 |
} |
150 | 152 |
else |
151 | 153 |
{ |
152 |
boolean reallyBlocked = !mPre.isUINotBlocked(); |
|
153 | 154 |
mPre.unblockUI(); |
154 |
reportUIProblem(uiBlocked, reallyBlocked);
|
|
155 |
libInterface.reportBlockProblem(TYPE_UI,mLastUIPlace,mPauseTime,mResumeTime,mUIBlockTime);
|
|
155 | 156 |
} |
156 | 157 |
} |
157 | 158 |
} |
158 | 159 |
|
159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
160 |
|
|
161 |
private void reportUIProblem(long time, boolean reallyBlocked) |
|
162 |
{ |
|
163 |
String error = "UI BLOCK "+mLastUIPlace+" blocked for "+time+" milliseconds ("+reallyBlocked+")"; |
|
164 |
|
|
165 |
if( BuildConfig.DEBUG ) |
|
166 |
{ |
|
167 |
android.util.Log.e("D", error); |
|
168 |
} |
|
169 |
else |
|
170 |
{ |
|
171 |
Exception ex = new Exception(error); |
|
172 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); |
|
173 |
crashlytics.setCustomKey("pause" , mPauseTime ); |
|
174 |
crashlytics.setCustomKey("resume", mResumeTime ); |
|
175 |
crashlytics.recordException(ex); |
|
176 |
} |
|
177 |
} |
|
178 |
|
|
179 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
180 |
|
|
181 |
private void reportTouchProblem(long time, boolean reallyBlocked) |
|
182 |
{ |
|
183 |
String error = "TOUCH BLOCK "+mLastTouchPlace+" blocked for "+time+" milliseconds ("+reallyBlocked+")"; |
|
184 |
|
|
185 |
if( BuildConfig.DEBUG ) |
|
186 |
{ |
|
187 |
android.util.Log.e("D", error); |
|
188 |
} |
|
189 |
else |
|
190 |
{ |
|
191 |
Exception ex = new Exception(error); |
|
192 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); |
|
193 |
crashlytics.setCustomKey("pause" , mPauseTime ); |
|
194 |
crashlytics.setCustomKey("resume", mResumeTime ); |
|
195 |
crashlytics.recordException(ex); |
|
196 |
} |
|
197 |
} |
|
198 |
|
|
199 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
200 |
|
|
201 |
private void reportThreadProblem() |
|
202 |
{ |
|
203 |
String error = EffectMessageSender.reportState(); |
|
204 |
|
|
205 |
if( BuildConfig.DEBUG ) |
|
206 |
{ |
|
207 |
android.util.Log.e("D", error); |
|
208 |
} |
|
209 |
else |
|
210 |
{ |
|
211 |
Exception ex = new Exception(error); |
|
212 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); |
|
213 |
crashlytics.setCustomKey("pause" , mPauseTime ); |
|
214 |
crashlytics.setCustomKey("resume", mResumeTime ); |
|
215 |
crashlytics.recordException(ex); |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 | 160 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
220 | 161 |
|
221 | 162 |
public void touchBlocked(int place) |
src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java | ||
---|---|---|
33 | 33 |
void failedToDrag(); |
34 | 34 |
void onSolved(); |
35 | 35 |
void onObjectCreated(long time); |
36 |
void reportBlockProblem(int type, int place, long pause, long resume, long time); |
|
37 |
void reportProblem(String problem); |
|
36 | 38 |
|
37 | 39 |
// objectlib calls those to figure out app's state |
38 | 40 |
int getCurrentColor(); |
src/main/java/org/distorted/objectlib/main/ObjectPreRender.java | ||
---|---|---|
128 | 128 |
|
129 | 129 |
if( mNewObject!=null ) |
130 | 130 |
{ |
131 |
mNewObject.setLibInterface(mInterface); |
|
131 | 132 |
TwistyObjectNode node = mController.getNode(); |
132 | 133 |
if( node!=null ) mNewObject.setObjectRatioNow( 1.0f, node.getScaleFactor() ); |
133 | 134 |
mController.setMovement(mNewObject.getMovement()); |
... | ... | |
386 | 387 |
return mMoveY; |
387 | 388 |
} |
388 | 389 |
|
390 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
391 |
|
|
392 |
public ObjectLibInterface getInterface() |
|
393 |
{ |
|
394 |
return mInterface; |
|
395 |
} |
|
396 |
|
|
389 | 397 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
390 | 398 |
// PUBLIC API |
391 | 399 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
24 | 24 |
import android.graphics.Canvas; |
25 | 25 |
import android.graphics.Paint; |
26 | 26 |
|
27 |
import com.google.firebase.crashlytics.FirebaseCrashlytics; |
|
28 |
|
|
29 | 27 |
import org.distorted.library.effect.Effect; |
30 | 28 |
import org.distorted.library.effect.MatrixEffectMove; |
31 | 29 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
... | ... | |
46 | 44 |
import org.distorted.library.type.Static3D; |
47 | 45 |
import org.distorted.library.type.Static4D; |
48 | 46 |
|
49 |
import org.distorted.objectlib.BuildConfig; |
|
50 | 47 |
import org.distorted.objectlib.helpers.FactoryCubit; |
51 | 48 |
import org.distorted.objectlib.helpers.FactorySticker; |
49 |
import org.distorted.objectlib.helpers.ObjectLibInterface; |
|
52 | 50 |
import org.distorted.objectlib.helpers.ObjectShape; |
53 | 51 |
import org.distorted.objectlib.helpers.ObjectSticker; |
54 | 52 |
import org.distorted.objectlib.helpers.ScrambleState; |
... | ... | |
135 | 133 |
private boolean[][] mLayerRotatable; |
136 | 134 |
private int[][][] mEnabled; |
137 | 135 |
private DistortedNode mNode; |
136 |
private ObjectLibInterface mInterface; |
|
138 | 137 |
|
139 | 138 |
//////////////////// SOLVED1 //////////////////////// |
140 | 139 |
|
... | ... | |
857 | 856 |
} |
858 | 857 |
else |
859 | 858 |
{ |
860 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); |
|
861 |
crashlytics.log("points in RotationAngle: "+pointNum); |
|
859 |
mInterface.reportProblem("points in RotationAngle: "+pointNum); |
|
862 | 860 |
return 0; |
863 | 861 |
} |
864 | 862 |
} |
... | ... | |
876 | 874 |
} |
877 | 875 |
|
878 | 876 |
String name = intGetObjectType(mNumLayers).name(); |
877 |
mInterface.reportProblem("obj: "+name+" quats: "+quats.toString()); |
|
878 |
} |
|
879 | 879 |
|
880 |
if( BuildConfig.DEBUG ) |
|
881 |
{ |
|
882 |
android.util.Log.e("quats" , quats.toString()); |
|
883 |
android.util.Log.e("object", name); |
|
884 |
} |
|
885 |
else |
|
886 |
{ |
|
887 |
Exception ex = new Exception(message); |
|
888 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); |
|
889 |
crashlytics.setCustomKey("quats" , quats.toString()); |
|
890 |
crashlytics.setCustomKey("object", name); |
|
891 |
crashlytics.recordException(ex); |
|
892 |
} |
|
880 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
881 |
|
|
882 |
void setLibInterface(ObjectLibInterface inter) |
|
883 |
{ |
|
884 |
mInterface = inter; |
|
893 | 885 |
} |
894 | 886 |
|
895 | 887 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
1132 | 1124 |
if( !mTexture.setTexture(bitmap) ) |
1133 | 1125 |
{ |
1134 | 1126 |
int max = DistortedLibrary.getMaxTextureSize(); |
1135 |
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance(); |
|
1136 |
crashlytics.log("failed to set texture of size "+bitmap.getWidth()+"x"+bitmap.getHeight()+" max is "+max); |
|
1127 |
mInterface.reportProblem("failed to set texture of size "+bitmap.getWidth()+"x"+bitmap.getHeight()+" max is "+max); |
|
1137 | 1128 |
} |
1138 | 1129 |
} |
1139 | 1130 |
|
Also available in: Unified diff
Remove dependancies on Firebase from objectlib.
Report such errors to the application via the Interface.