mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge pull request #1411 from deltachat/streamline-some-logging
streamline rough logging on app-foreground etc.
This commit is contained in:
@@ -13,6 +13,8 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
@@ -58,6 +60,8 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
||||
// }
|
||||
// LeakCanary.install(this);
|
||||
|
||||
Log.i("DeltaChat", "++++++++++++++++++ ApplicationContext.onCreate() ++++++++++++++++++");
|
||||
|
||||
System.loadLibrary("native-utils");
|
||||
dcContext = new ApplicationDcContext(this);
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ public class ApplicationDcContext extends DcContext {
|
||||
}
|
||||
|
||||
public void maybeStartIo() {
|
||||
Log.i("DeltaChat", "++++++++++++++++++ ApplicationDcContext.maybeStartIo() ++++++++++++++++++");
|
||||
if (isConfigured()!=0) {
|
||||
startIo();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class FetchWorker extends Worker {
|
||||
// therefore we do not stopIo() here.
|
||||
@Override
|
||||
public @NonNull Result doWork() {
|
||||
Log.i("DeltaChat", "-------------------- FetchWorker.doWork() started --------------------");
|
||||
Log.i("DeltaChat", "++++++++++++++++++ FetchWorker.doWork() started ++++++++++++++++++");
|
||||
ApplicationDcContext dcContext = DcHelper.getContext(context);
|
||||
dcContext.maybeStartIo();
|
||||
|
||||
@@ -36,7 +36,7 @@ public class FetchWorker extends Worker {
|
||||
// however, we should not wait too long here to avoid getting bad battery ratings.
|
||||
Util.sleep(60 * 1000);
|
||||
|
||||
Log.i("DeltaChat", "-------------------- FetchWorker.doWork() done --------------------");
|
||||
Log.i("DeltaChat", "++++++++++++++++++ FetchWorker.doWork() will return ++++++++++++++++++");
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
|
||||
@@ -36,9 +37,14 @@ public class ForegroundDetector implements Application.ActivityLifecycleCallback
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
if (refs == 0) {
|
||||
Log.i("DeltaChat", "++++++++++++++++++ first ForegroundDetector.onActivityStarted() ++++++++++++++++++");
|
||||
application.dcContext.maybeStartIo();
|
||||
if (application.dcContext.isNetworkConnected()) {
|
||||
new Thread(() -> application.dcContext.maybeNetwork()).start();
|
||||
new Thread(() -> {
|
||||
Log.i("DeltaChat", "calling maybeNetwork()");
|
||||
application.dcContext.maybeNetwork();
|
||||
Log.i("DeltaChat", "maybeNetwork() returned");
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,10 +55,15 @@ public class ForegroundDetector implements Application.ActivityLifecycleCallback
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
if( refs <= 0 ) {
|
||||
Log.w("DeltaChat", "invalid call to ForegroundDetector.onActivityStopped()");
|
||||
return;
|
||||
}
|
||||
|
||||
refs--;
|
||||
|
||||
if (refs == 0) {
|
||||
Log.i("DeltaChat", "++++++++++++++++++ last ForegroundDetector.onActivityStopped() ++++++++++++++++++");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user