Project

General

Profile

Download (21.5 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / network / RubikNetwork.java @ 1fa125c2

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.network;
21

    
22
import java.io.BufferedReader;
23
import java.io.InputStream;
24
import java.io.InputStreamReader;
25
import java.net.HttpURLConnection;
26
import java.net.URL;
27
import java.net.UnknownHostException;
28
import java.security.MessageDigest;
29
import java.security.NoSuchAlgorithmException;
30

    
31
import android.app.Activity;
32
import android.content.pm.PackageInfo;
33
import android.content.pm.PackageManager;
34

    
35
import androidx.appcompat.app.AppCompatActivity;
36
import androidx.fragment.app.FragmentActivity;
37

    
38
import org.distorted.library.main.DistortedLibrary;
39
import org.distorted.objects.RubikObjectList;
40

    
41
import static org.distorted.objects.RubikObjectList.MAX_LEVEL;
42

    
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44

    
45
public class RubikNetwork implements Runnable
46
  {
47
  public interface Receiver
48
    {
49
    void receive(String[][][] country, String[][][] name, float[][][] time);
50
    void message(String mess);
51
    void error(String error);
52
    }
53

    
54
  public static final int MAX_PLACES = 10;
55

    
56
  private static final int DOWNLOAD   = 0;
57
  private static final int SUBMIT     = 1;
58
  private static final int DEBUG      = 2;
59
  private static final int SUSPICIOUS = 3;
60
  private static final int IDLE       = 4;
61

    
62
  private static final int REND_ADRENO= 0;
63
  private static final int REND_MALI  = 1;
64
  private static final int REND_POWER = 2;
65
  private static final int REND_OTHER = 3;
66

    
67
  private final String[] hex = {
68
    "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
69
    "%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f",
70
    "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
71
    "%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f",
72
    "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27",
73
    "%28", "%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f",
74
    "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37",
75
    "%38", "%39", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f",
76
    "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47",
77
    "%48", "%49", "%4a", "%4b", "%4c", "%4d", "%4e", "%4f",
78
    "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57",
79
    "%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e", "%5f",
80
    "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67",
81
    "%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f",
82
    "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77",
83
    "%78", "%79", "%7a", "%7b", "%7c", "%7d", "%7e", "%7f",
84
    "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87",
85
    "%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f",
86
    "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97",
87
    "%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f",
88
    "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7",
89
    "%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af",
90
    "%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7",
91
    "%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf",
92
    "%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7",
93
    "%c8", "%c9", "%ca", "%cb", "%cc", "%cd", "%ce", "%cf",
94
    "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",
95
    "%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df",
96
    "%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7",
97
    "%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee", "%ef",
98
    "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
99
    "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff"
100
    };
101

    
102
  private static String[][][] mCountry;
103
  private static String[][][] mName;
104
  private static float[][][] mTime;
105
  private static int[][] mPlaces;
106

    
107
  private static RubikNetwork mThis;
108
  private static String mScores = "";
109
  private static boolean mRunning = false;
110
  private static int mMode = IDLE;
111
  private static Receiver mReceiver;
112
  private static String mVersion;
113
  private static String mDebug;
114
  private static int mNumObjects;
115

    
116
///////////////////////////////////////////////////////////////////////////////////////////////////
117

    
118
  private static void initializeStatics()
119
    {
120
    int newNum = RubikObjectList.getNumObjects();
121

    
122
    if( mCountry==null || newNum!=mNumObjects ) mCountry = new String[newNum][MAX_LEVEL][MAX_PLACES];
123
    if( mName==null    || newNum!=mNumObjects ) mName    = new String[newNum][MAX_LEVEL][MAX_PLACES];
124
    if( mTime==null    || newNum!=mNumObjects ) mTime    = new  float[newNum][MAX_LEVEL][MAX_PLACES];
125
    if( mPlaces==null  || newNum!=mNumObjects ) mPlaces  = new int[newNum][MAX_LEVEL];
126

    
127
    mNumObjects = newNum;
128
    }
129

    
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131

    
132
  private static String computeHash(String stringToHash, byte[] salt)
133
    {
134
    String generatedPassword;
135

    
136
    try
137
      {
138
      MessageDigest md = MessageDigest.getInstance("MD5");
139
      md.update(salt);
140
      byte[] bytes = md.digest(stringToHash.getBytes());
141
      StringBuilder sb = new StringBuilder();
142

    
143
      for (byte aByte : bytes)
144
        {
145
        sb.append(Integer.toString((aByte & 0xff) + 0x100, 16).substring(1));
146
        }
147

    
148
      generatedPassword = sb.toString();
149
      }
150
    catch (NoSuchAlgorithmException e)
151
      {
152
      return "NoSuchAlgorithm";
153
      }
154

    
155
    return generatedPassword;
156
    }
157

    
158
///////////////////////////////////////////////////////////////////////////////////////////////////
159

    
160
  private boolean fillValues()
161
    {
162
    int begin=-1 ,end, len = mScores.length();
163
    String row;
164

    
165
    if( len==0 )
166
      {
167
      if( mReceiver!=null ) mReceiver.error("1");
168
      return false;
169
      }
170
    else if( len<=2 )
171
      {
172
      if( mReceiver!=null ) mReceiver.error(mScores);
173
      return false;
174
      }
175

    
176
    for(int i=0; i<mNumObjects; i++)
177
      for(int j=0; j<MAX_LEVEL; j++)
178
        {
179
        mPlaces[i][j] = 0;
180
        }
181

    
182
    while( begin<len )
183
      {
184
      end = mScores.indexOf('\n', begin+1);
185
      if( end<0 ) end = len;
186

    
187
      try
188
        {
189
        row = mScores.substring(begin+1,end);
190
        fillRow(row);
191
        }
192
      catch(Exception ex)
193
        {
194
        // faulty row - ignore
195
        }
196

    
197
      begin = end;
198
      }
199

    
200
    return true;
201
    }
202

    
203
///////////////////////////////////////////////////////////////////////////////////////////////////
204

    
205
  private void fillRow(String row)
206
    {
207
    int s1 = row.indexOf(' ');
208
    int s2 = row.indexOf(' ',s1+1);
209
    int s3 = row.indexOf(' ',s2+1);
210
    int s4 = row.indexOf(' ',s3+1);
211
    int s5 = row.length();
212

    
213
    if( s5>s4 && s4>s3 && s3>s2 && s2>s1 && s1>0 )
214
      {
215
      int object = RubikObjectList.getOrdinal( row.substring(0,s1) );
216

    
217
      if( object>=0 && object<mNumObjects )
218
        {
219
        int level      = Integer.parseInt( row.substring(s1+1,s2) );
220
        String name    = row.substring(s2+1, s3);
221
        int time       = Integer.parseInt( row.substring(s3+1,s4) );
222
        String country = row.substring(s4+1, s5);
223

    
224
        if( country.equals("do") ) country = "dm"; // see RubikScores.setCountry()
225

    
226
        if(level>=0 && level<MAX_LEVEL)
227
          {
228
          int p = mPlaces[object][level];
229
          mPlaces[object][level]++;
230

    
231
          mCountry[object][level][p] = country;
232
          mName   [object][level][p] = name;
233
          mTime   [object][level][p] = ((float)(time/10))/100.0f;
234
          }
235
        }
236
      }
237
    else
238
      {
239
      tryDoCommand(row);
240
      }
241
    }
242

    
243
///////////////////////////////////////////////////////////////////////////////////////////////////
244

    
245
  private void tryDoCommand(String row)
246
    {
247
    if( row.startsWith("comm") )
248
      {
249
      int colon = row.indexOf(':');
250

    
251
      if( colon>0 )
252
        {
253
        String commandNumber = row.substring(4,colon);
254
        int number;
255

    
256
        try
257
          {
258
          number = Integer.parseInt(commandNumber);
259
          }
260
        catch(NumberFormatException ex)
261
          {
262
          number=0;
263
          }
264

    
265
        if(number==1)
266
          {
267
          String country = row.substring(colon+1);
268
          RubikScores scores = RubikScores.getInstance();
269
          scores.setCountry(country);
270
          }
271
        }
272
      }
273
    }
274

    
275
///////////////////////////////////////////////////////////////////////////////////////////////////
276

    
277
  private int getRendererType(String renderer)
278
    {
279
    if( renderer.contains("Adreno")  ) return REND_ADRENO;
280
    if( renderer.contains("Mali")    ) return REND_MALI;
281
    if( renderer.contains("PowerVR") ) return REND_POWER;
282

    
283
    return REND_OTHER;
284
    }
285

    
286
///////////////////////////////////////////////////////////////////////////////////////////////////
287

    
288
  private String parseRenderer(final int type, String renderer)
289
    {
290
    if( type==REND_ADRENO || type==REND_POWER )
291
      {
292
      int lastSpace = renderer.lastIndexOf(' ');
293
      String ret = renderer.substring(lastSpace+1);
294
      return URLencode(ret);
295
      }
296

    
297
    if( type==REND_MALI )
298
      {
299
      int firstHyphen = renderer.indexOf('-');
300
      String ret = renderer.substring(firstHyphen+1);
301
      return URLencode(ret);
302
      }
303

    
304
    return "other";
305
    }
306

    
307
///////////////////////////////////////////////////////////////////////////////////////////////////
308

    
309
  private String parseVersion(final int type, String version)
310
    {
311
    switch(type)
312
      {
313
      case REND_ADRENO: int aMonkey = version.indexOf('@');
314
                        int aDot = version.indexOf('.', aMonkey);
315
                        String ret1 = aDot>=3 ? version.substring(aDot-3,aDot) : "";
316
                        return URLencode(ret1);
317
      case REND_MALI  : int mV1 = version.indexOf("v1");
318
                        int mHyphen = version.indexOf('-', mV1);
319
                        String ret2 = mHyphen>mV1+3 && mV1>=0 ? version.substring(mV1+3,mHyphen) : "";
320
                        return URLencode(ret2);
321
      case REND_POWER : int pMonkey = version.indexOf('@');
322
                        int pSpace  = version.lastIndexOf(' ');
323
                        String ret3 = pSpace>=0 && pMonkey>pSpace+1 ? version.substring(pSpace+1,pMonkey) : "";
324
                        return URLencode(ret3);
325
      default         : return "";
326
      }
327
    }
328

    
329
///////////////////////////////////////////////////////////////////////////////////////////////////
330

    
331
  private String URLencode(String s)
332
    {
333
    StringBuilder sbuf = new StringBuilder();
334
    int len = s.length();
335

    
336
    for (int i = 0; i < len; i++)
337
      {
338
      int ch = s.charAt(i);
339

    
340
           if ('A' <= ch && ch <= 'Z') sbuf.append((char)ch);
341
      else if ('a' <= ch && ch <= 'z') sbuf.append((char)ch);
342
      else if ('0' <= ch && ch <= '9') sbuf.append((char)ch);
343
      else if (ch == ' '             ) sbuf.append('+');
344
      else if (ch == '-' || ch == '_'
345
            || ch == '.' || ch == '!'
346
            || ch == '~' || ch == '*'
347
            || ch == '\'' || ch == '('
348
            || ch == ')'             ) sbuf.append((char)ch);
349
      else if (ch <= 0x007f)           sbuf.append(hex[ch]);
350
      else if (ch <= 0x07FF)
351
        {
352
        sbuf.append(hex[0xc0 | (ch >> 6)]);
353
        sbuf.append(hex[0x80 | (ch & 0x3F)]);
354
        }
355
      else
356
        {
357
        sbuf.append(hex[0xe0 | (ch >> 12)]);
358
        sbuf.append(hex[0x80 | ((ch >> 6) & 0x3F)]);
359
        sbuf.append(hex[0x80 | (ch & 0x3F)]);
360
        }
361
      }
362

    
363
    return sbuf.toString();
364
    }
365

    
366
///////////////////////////////////////////////////////////////////////////////////////////////////
367

    
368
  private void sendDebug()
369
    {
370
    String url = constructDebugURL();
371

    
372
    try
373
      {
374
      java.net.URL connectURL = new URL(url);
375
      HttpURLConnection conn = (HttpURLConnection)connectURL.openConnection();
376

    
377
      conn.setDoInput(true);
378
      conn.setDoOutput(true);
379
      conn.setUseCaches(false);
380
      conn.setRequestMethod("GET");
381
      conn.connect();
382
      conn.getOutputStream().flush();
383
      conn.getInputStream();
384
      }
385
    catch( final Exception e )
386
      {
387
      // ignore
388
      }
389
    }
390

    
391
///////////////////////////////////////////////////////////////////////////////////////////////////
392

    
393
  private void sendSuspicious()
394
    {
395
    String url = constructSuspiciousURL();
396

    
397
    try
398
      {
399
      java.net.URL connectURL = new URL(url);
400
      HttpURLConnection conn = (HttpURLConnection)connectURL.openConnection();
401

    
402
      conn.setDoInput(true);
403
      conn.setDoOutput(true);
404
      conn.setUseCaches(false);
405
      conn.setRequestMethod("GET");
406
      conn.connect();
407
      conn.getOutputStream().flush();
408
      conn.getInputStream();
409
      }
410
    catch( final Exception e )
411
      {
412
      // ignore
413
      }
414
    }
415

    
416
///////////////////////////////////////////////////////////////////////////////////////////////////
417

    
418
  private boolean network(String url)
419
    {
420
    try
421
      {
422
      java.net.URL connectURL = new URL(url);
423
      HttpURLConnection conn = (HttpURLConnection)connectURL.openConnection();
424

    
425
      conn.setDoInput(true);
426
      conn.setDoOutput(true);
427
      conn.setUseCaches(false);
428
      conn.setRequestMethod("GET");
429
      conn.connect();
430
      conn.getOutputStream().flush();
431

    
432
      InputStream is = conn.getInputStream();
433
      BufferedReader r = new BufferedReader(new InputStreamReader(is));
434
      StringBuilder total = new StringBuilder();
435

    
436
      for (String line; (line = r.readLine()) != null; )
437
        {
438
        total.append(line).append('\n');
439
        }
440

    
441
      mScores = total.toString();
442
      }
443
    catch( final UnknownHostException e )
444
      {
445
      if( mReceiver!=null ) mReceiver.message("No access to Internet");
446
      return false;
447
      }
448
    catch( final SecurityException e )
449
      {
450
      if( mReceiver!=null ) mReceiver.message("Application not authorized to connect to the Internet");
451
      return false;
452
      }
453
    catch( final Exception e )
454
      {
455
      if( mReceiver!=null ) mReceiver.message(e.getMessage());
456
      return false;
457
      }
458

    
459
    if( mScores.length()==0 )
460
      {
461
      if( mReceiver!=null ) mReceiver.message("Failed to download scores");
462
      return false;
463
      }
464

    
465
    return true;
466
    }
467

    
468
///////////////////////////////////////////////////////////////////////////////////////////////////
469

    
470
  private String constructSuspiciousURL()
471
    {
472
    RubikScores scores = RubikScores.getInstance();
473
    int deviceID= scores.getDeviceID();
474
    String debug = URLencode(mDebug);
475

    
476
    String url="https://distorted.org/magic/cgi-bin/suspicious.cgi";
477
    url += "?i="+deviceID+"&d="+debug;
478

    
479
    return url;
480
    }
481

    
482
///////////////////////////////////////////////////////////////////////////////////////////////////
483

    
484
  private String constructDebugURL()
485
    {
486
    RubikScores scores = RubikScores.getInstance();
487
    String name = URLencode(scores.getName());
488
    int numRuns = scores.getNumRuns();
489
    int numPlay = scores.getNumPlays();
490
    String country = scores.getCountry();
491
    String renderer = DistortedLibrary.getDriverRenderer();
492
    String version  = DistortedLibrary.getDriverVersion();
493

    
494
    renderer = URLencode(renderer);
495
    version  = URLencode(version);
496

    
497
    String url="https://distorted.org/magic/cgi-bin/debugs.cgi";
498
    url += "?n="+name+"&r="+numRuns+"&p="+numPlay+"&c="+country+"&e="+mVersion+"d"+"&d="+renderer+"&v="+version;
499

    
500
    return url;
501
    }
502

    
503
///////////////////////////////////////////////////////////////////////////////////////////////////
504

    
505
  private String constructDownloadURL()
506
    {
507
    RubikScores scores = RubikScores.getInstance();
508
    String name = URLencode(scores.getName());
509
    int numRuns = scores.getNumRuns();
510
    int numPlay = scores.getNumPlays();
511
    String country = scores.getCountry();
512

    
513
    String url="https://distorted.org/magic/cgi-bin/download.cgi";
514
    url += "?n="+name+"&r="+numRuns+"&p="+numPlay+"&c="+country+"&e="+mVersion;
515

    
516
    return url;
517
    }
518

    
519
///////////////////////////////////////////////////////////////////////////////////////////////////
520

    
521
  private String constructSubmitURL()
522
    {
523
    RubikScores scores = RubikScores.getInstance();
524
    String name = URLencode(scores.getName());
525
    String veri = scores.isVerified() ? "1" : "";
526
    int numRuns = scores.getNumRuns();
527
    int numPlay = scores.getNumPlays();
528
    int deviceID= scores.getDeviceID();
529
    String reclist = scores.getRecordList("&o=","&l=","&t=");
530
    String country = scores.getCountry();
531
    long epoch = System.currentTimeMillis();
532
    String salt = "cuboid";
533

    
534
    String renderer = DistortedLibrary.getDriverRenderer();
535
    String version  = DistortedLibrary.getDriverVersion();
536

    
537
    int type = getRendererType(renderer);
538
    renderer = parseRenderer(type,renderer);
539
    version  = parseVersion(type,version);
540

    
541
    String url1="https://distorted.org/magic/cgi-bin/submit.cgi";
542
    String url2 = "n="+name+"&v="+veri+"&r="+numRuns+"&p="+numPlay+"&i="+deviceID+"&e="+mVersion;
543
    url2 += "&d="+renderer+"&s="+version+reclist+"&c="+country+"&f="+epoch;
544
    String hash = computeHash( url2, salt.getBytes() );
545

    
546
    return url1 + "?" + url2 + "&h=" + hash;
547
    }
548

    
549
///////////////////////////////////////////////////////////////////////////////////////////////////
550

    
551
  private boolean gottaDownload()
552
    {
553
    return ((mScores.length()==0) && !mRunning);
554
    }
555

    
556
///////////////////////////////////////////////////////////////////////////////////////////////////
557

    
558
  @Override
559
  public void run()
560
    {
561
    boolean receiveValues=true;
562

    
563
    initializeStatics();
564

    
565
    try
566
      {
567
      if( mMode==DOWNLOAD && gottaDownload() )
568
        {
569
        mRunning = true;
570
        receiveValues = network(constructDownloadURL());
571
        }
572
      if( mMode==SUBMIT )
573
        {
574
        mRunning = true;
575
        RubikScores scores = RubikScores.getInstance();
576

    
577
        if( scores.thereAreUnsubmittedRecords() )
578
          {
579
          receiveValues = network(constructSubmitURL());
580
          }
581
        }
582
      if( mMode==DEBUG )
583
        {
584
        sendDebug();
585
        receiveValues = false;
586
        mRunning = false;
587
        }
588
      if( mMode==SUSPICIOUS )
589
        {
590
        sendSuspicious();
591
        receiveValues = false;
592
        mRunning = false;
593
        }
594
      }
595
    catch( Exception e )
596
      {
597
      if( mReceiver!=null ) mReceiver.message("Exception downloading records: "+e.getMessage() );
598
      }
599

    
600
    if( mRunning )
601
      {
602
      receiveValues = fillValues();
603
      mRunning = false;
604
      }
605

    
606
    if( receiveValues )
607
      {
608
      if( mReceiver!=null ) mReceiver.receive(mCountry, mName, mTime);
609

    
610
      if( mMode==SUBMIT )
611
        {
612
        RubikScores.getInstance().successfulSubmit();
613
        }
614
      }
615
    }
616

    
617
///////////////////////////////////////////////////////////////////////////////////////////////////
618

    
619
  private RubikNetwork()
620
    {
621

    
622
    }
623

    
624
///////////////////////////////////////////////////////////////////////////////////////////////////
625
// PUBLIC API
626
///////////////////////////////////////////////////////////////////////////////////////////////////
627

    
628
  public static void onPause()
629
    {
630
    mRunning = false;
631
    }
632

    
633
///////////////////////////////////////////////////////////////////////////////////////////////////
634

    
635
  public static RubikNetwork getInstance()
636
    {
637
    if( mThis==null )
638
      {
639
      mThis = new RubikNetwork();
640
      }
641

    
642
    return mThis;
643
    }
644

    
645
///////////////////////////////////////////////////////////////////////////////////////////////////
646

    
647
  private void start(Receiver receiver, Activity act, int mode)
648
    {
649
    mReceiver = receiver;
650
    mMode     = mode;
651

    
652
    try
653
      {
654
      PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
655
      mVersion = pInfo.versionName;
656
      }
657
    catch (PackageManager.NameNotFoundException e)
658
      {
659
      mVersion = "0.9.2";
660
      }
661

    
662
    Thread networkThrd = new Thread(this);
663
    networkThrd.start();
664
    }
665

    
666
///////////////////////////////////////////////////////////////////////////////////////////////////
667

    
668
  public void download(Receiver receiver, FragmentActivity act)
669
    {
670
    start(receiver, act, DOWNLOAD);
671
    }
672

    
673
///////////////////////////////////////////////////////////////////////////////////////////////////
674

    
675
  public void submit(Receiver receiver, FragmentActivity act)
676
    {
677
    start(receiver, act, SUBMIT);
678
    }
679

    
680
///////////////////////////////////////////////////////////////////////////////////////////////////
681

    
682
  public void debug(AppCompatActivity act)
683
    {
684
    start(null, act, DEBUG);
685
    }
686

    
687
///////////////////////////////////////////////////////////////////////////////////////////////////
688

    
689
  public void suspicious(AppCompatActivity act, String debug)
690
    {
691
    mDebug = debug;
692
    start(null, act, SUSPICIOUS);
693
    }
694
}
(1-1/2)