remove debug logging
This commit is contained in:
@@ -60,7 +60,6 @@ public class OperationRunner
|
||||
|
||||
public void Run(IKp2aApp app, OperationWithFinishHandler operation, bool runBlocking = false)
|
||||
{
|
||||
Kp2aLog.Log("OPR: Run: " + operation.GetType().Name + ", runBlocking: " + runBlocking);
|
||||
lock (Instance._taskQueueLock)
|
||||
{
|
||||
_taskQueue.Enqueue(new OperationWithMetadata(){ Operation = operation, RunBlocking = runBlocking});
|
||||
@@ -81,7 +80,6 @@ public class OperationRunner
|
||||
{
|
||||
_thread = null;
|
||||
_statusLogger.EndLogging();
|
||||
Kp2aLog.Log("OPR: task queue empty. Stopping operation runner thread.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -92,13 +90,10 @@ public class OperationRunner
|
||||
|
||||
if (_currentlyRunningTask.Value.RunBlocking)
|
||||
{
|
||||
Kp2aLog.Log("OPR: Run. Posting to set up progress dialog for blocking task: " + _currentlyRunningTask?.Operation?.GetType()?.Name ?? "null");
|
||||
app.UiThreadHandler.Post(
|
||||
() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Run. Starting Setting up progress dialog for blocking task: " + _currentlyRunningTask?.Operation?.GetType()?.Name ?? "null");
|
||||
TrySetupProgressDialog();
|
||||
Kp2aLog.Log("OPR: Run. Finished Setting up progress dialog for blocking task: " + _currentlyRunningTask?.Operation?.GetType()?.Name ?? "null");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -108,20 +103,15 @@ public class OperationRunner
|
||||
{
|
||||
if (_currentlyRunningTask?.RunBlocking == true)
|
||||
{
|
||||
Kp2aLog.Log("OPR: Run. Blocking task finished: " + _currentlyRunningTask?.Operation?.GetType()?.Name ?? "null");
|
||||
_app.UiThreadHandler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting Dismissing progress dialog");
|
||||
_progressDialog?.Dismiss();
|
||||
Kp2aLog.Log("OPR: Finished Dismissing progress dialog");
|
||||
}
|
||||
);
|
||||
}
|
||||
Kp2aLog.Log("OPR: Run. Finished handler called for task: " + _currentlyRunningTask?.Operation?.GetType()?.Name ?? "null");
|
||||
_currentlyRunningTask = null;
|
||||
|
||||
}), originalFinishedHandler);
|
||||
Kp2aLog.Log("OPR: starting to run " + _currentlyRunningTask?.Operation?.GetType()?.Name ?? "null");
|
||||
_currentlyRunningTask.Value.Operation.Run();
|
||||
|
||||
while (_currentlyRunningTask != null)
|
||||
@@ -135,13 +125,12 @@ public class OperationRunner
|
||||
Kp2aLog.Log("Thread interrupted.");
|
||||
}
|
||||
}
|
||||
Kp2aLog.Log("OPR: waiting for next task in queue...");
|
||||
}
|
||||
|
||||
});
|
||||
_thread.Start();
|
||||
}
|
||||
else Kp2aLog.Log("OPR: thread already running, only enqueued " + operation.GetType().Name );
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -151,7 +140,6 @@ public class OperationRunner
|
||||
|
||||
private bool TrySetupProgressDialog()
|
||||
{
|
||||
Kp2aLog.Log("OPR: TrySetupProgressDialog");
|
||||
string currentMessage = "Initializing...";
|
||||
string currentSubmessage = "";
|
||||
|
||||
@@ -166,9 +154,7 @@ public class OperationRunner
|
||||
var pd = _progressDialog;
|
||||
_app.UiThreadHandler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting TrySetupProgressDialog: Dismissing existing progress dialog");
|
||||
pd.Dismiss();
|
||||
Kp2aLog.Log("OPR: Finished TrySetupProgressDialog: Dismissing existing progress dialog");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -176,7 +162,6 @@ public class OperationRunner
|
||||
_progressDialog = _app.CreateProgressDialog(_app.ActiveContext);
|
||||
if (_progressDialog == null)
|
||||
{
|
||||
Kp2aLog.Log("OPR: OperationRunner.TrySetupProgressDialog: _progressDialog is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -192,7 +177,6 @@ public class OperationRunner
|
||||
|
||||
public void SetNewActiveContext(IKp2aApp app)
|
||||
{
|
||||
Kp2aLog.Log("OPR: SetNewActiveContext: " + app.ActiveContext?.GetType().Name);
|
||||
_app = app;
|
||||
Context? context = app.ActiveContext;
|
||||
bool isAppContext = context == null || (context.ApplicationContext == context);
|
||||
@@ -207,12 +191,9 @@ public class OperationRunner
|
||||
|
||||
if (_currentlyRunningTask?.RunBlocking == true && (context is Activity { IsFinishing: false, IsDestroyed:false}))
|
||||
{
|
||||
Kp2aLog.Log("OPR: SetNewActiveContext: running blocking task, setting up progress dialog");
|
||||
app.UiThreadHandler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted TrySetupProgressDialog");
|
||||
TrySetupProgressDialog();
|
||||
Kp2aLog.Log("OPR: Finished posted TrySetupProgressDialog");
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -121,7 +121,6 @@ namespace keepass2android
|
||||
{
|
||||
_handler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted SetMessage");
|
||||
if (!String.IsNullOrEmpty(submessage))
|
||||
{
|
||||
_progressDialog.SetMessage(_message + " (" + submessage + ")");
|
||||
@@ -130,7 +129,6 @@ namespace keepass2android
|
||||
{
|
||||
_progressDialog.SetMessage(_message);
|
||||
}
|
||||
Kp2aLog.Log("OPR: Finished posted SetMessage");
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -140,9 +138,7 @@ namespace keepass2android
|
||||
{
|
||||
_handler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted Show");
|
||||
_progressDialog?.Show();
|
||||
Kp2aLog.Log("OPR: Finished posted Show");
|
||||
|
||||
});
|
||||
}
|
||||
@@ -151,9 +147,7 @@ namespace keepass2android
|
||||
{
|
||||
_handler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted Dismiss");
|
||||
_progressDialog?.Dismiss();
|
||||
Kp2aLog.Log("OPR: Finished posted Dismiss");
|
||||
|
||||
});
|
||||
}
|
||||
@@ -166,9 +160,7 @@ namespace keepass2android
|
||||
{
|
||||
_handler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted SetMessage");
|
||||
_progressDialog.SetMessage(message);
|
||||
Kp2aLog.Log("OPR: Finishing posted SetMessage");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,7 @@ namespace keepass2android
|
||||
{
|
||||
Handler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted actionToPerform ");
|
||||
_actionToPerform(Success, Message, ActiveContext);
|
||||
Kp2aLog.Log("OPR: Finished posted actionToPerform ");
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -103,9 +103,7 @@ namespace keepass2android
|
||||
if (handler != null ) {
|
||||
handler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted NextOnOperationFinishedHandler");
|
||||
NextOnOperationFinishedHandler.Run();
|
||||
Kp2aLog.Log("OPR: Finished posted NextOnOperationFinishedHandler");
|
||||
});
|
||||
} else {
|
||||
NextOnOperationFinishedHandler.Run();
|
||||
|
||||
@@ -272,9 +272,7 @@ namespace keepass2android
|
||||
PerformSaveWithoutCheck(fileStorage, ioc);
|
||||
new Handler(Looper.MainLooper).Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted UpdateGlobals");
|
||||
_db.UpdateGlobals();
|
||||
Kp2aLog.Log("OPR: Finished posted UpdateGlobals");
|
||||
});
|
||||
|
||||
FinishWithSuccess();
|
||||
|
||||
@@ -651,8 +651,6 @@ namespace keepass2android
|
||||
{
|
||||
if (app.ActiveContext is Activity activity)
|
||||
{
|
||||
Kp2aLog.Log("OPR: Will show YesNoCancel dialog because active context is an Activity.");
|
||||
|
||||
if (_dialog is { IsShowing: true })
|
||||
{
|
||||
try
|
||||
@@ -752,7 +750,6 @@ namespace keepass2android
|
||||
}
|
||||
else
|
||||
{
|
||||
Kp2aLog.Log("OPR: Cannot show YesNoCancel dialog because active context is not an Activity.");
|
||||
OperationRunner.Instance.StatusLogger?.UpdateSubMessage(App.Context.GetString(Resource.String.user_interaction_required));
|
||||
return false;
|
||||
}
|
||||
@@ -770,8 +767,6 @@ namespace keepass2android
|
||||
{
|
||||
throw new Java.Lang.InterruptedException();
|
||||
}
|
||||
Kp2aLog.Log("OPR: AskYesNoCancel called with titleKey " + titleKey + ", messageKey " + messageKey);
|
||||
|
||||
_currentlyPendingYesNoCancelQuestion = new YesNoCancelQuestion()
|
||||
{
|
||||
TitleKey = titleKey,
|
||||
@@ -787,9 +782,7 @@ namespace keepass2android
|
||||
|
||||
UiThreadHandler.Post( () =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted AskYesNoCancel/TryShow ");
|
||||
_currentlyPendingYesNoCancelQuestion.TryShow(this, OnUserInputDialogClose, OnUserInputDialogShow);
|
||||
Kp2aLog.Log("OPR: Finished posted AskYesNoCancel/TryShow ");
|
||||
_currentlyPendingYesNoCancelQuestion.TryShow(this, OnUserInputDialogClose, OnUserInputDialogShow);
|
||||
});
|
||||
|
||||
}
|
||||
@@ -803,20 +796,16 @@ namespace keepass2android
|
||||
/// </summary>
|
||||
private void ShowAllActiveProgressDialogs()
|
||||
{
|
||||
Kp2aLog.Log("OPR: ShowAllActiveProgressDialogs");
|
||||
foreach (RealProgressDialog progressDialog in _activeProgressDialogs)
|
||||
{
|
||||
Kp2aLog.Log("OPR: ShowAllActiveProgressDialogs: Showing " + progressDialog.GetType().Name);
|
||||
progressDialog.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void HideAllActiveProgressDialogs()
|
||||
{
|
||||
Kp2aLog.Log("OPR: HideAllActiveProgressDialogs");
|
||||
foreach (RealProgressDialog progressDialog in _activeProgressDialogs)
|
||||
{
|
||||
Kp2aLog.Log("OPR: HideAllActiveProgressDialogs: Hiding " + progressDialog.GetType().Name);
|
||||
progressDialog.Hide();
|
||||
}
|
||||
}
|
||||
@@ -837,7 +826,6 @@ namespace keepass2android
|
||||
private void OnUserInputDialogClose()
|
||||
{
|
||||
_isShowingUserInputDialog = false;
|
||||
Kp2aLog.Log("OPR: OnUserInputDialogClose called, _currentlyPendingYesNoCancelQuestion is " + (_currentlyPendingYesNoCancelQuestion != null ? "not null" : "null") + " Will set to null now.");
|
||||
_currentlyPendingYesNoCancelQuestion = null;
|
||||
|
||||
ShowAllActiveProgressDialogs();
|
||||
@@ -892,8 +880,6 @@ namespace keepass2android
|
||||
// Only show if asking dialog not also showing
|
||||
if (!_app._isShowingUserInputDialog)
|
||||
{
|
||||
Kp2aLog.Log("OPR: Showing progress dialog " + _pd.GetType().Name);
|
||||
|
||||
try
|
||||
{
|
||||
_pd.Show();
|
||||
@@ -913,12 +899,6 @@ namespace keepass2android
|
||||
|
||||
public IProgressDialog CreateProgressDialog(Context ctx)
|
||||
{
|
||||
Kp2aLog.Log("OPR: CreateProgressDialog called with ctx " + ctx?.GetType().Name);
|
||||
/*Kp2aLog.Log("ctx is null ? " + (ctx == null));
|
||||
Kp2aLog.Log("ctx is activity ? " + (ctx is Activity));
|
||||
Kp2aLog.Log("ctx is destroyed ? " + (ctx is Activity { IsDestroyed: true }));
|
||||
Kp2aLog.Log("ctx is finishing ? " + (ctx is Activity { IsFinishing: true }));
|
||||
*/
|
||||
try
|
||||
{
|
||||
|
||||
@@ -930,7 +910,7 @@ namespace keepass2android
|
||||
catch (Exception e)
|
||||
{
|
||||
//may happen if the activity is (being) destroyed
|
||||
Kp2aLog.Log("OPR: CreateProgressDialog failed with " + e.ToString());
|
||||
Kp2aLog.Log("CreateProgressDialog failed with " + e.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1339,9 +1319,7 @@ namespace keepass2android
|
||||
|
||||
public void StartBackgroundSyncService()
|
||||
{
|
||||
Kp2aLog.Log("OPR: StartBackgroundSyncService");
|
||||
|
||||
Intent intent = new Intent(App.Context, typeof(BackgroundSyncService));
|
||||
Intent intent = new Intent(App.Context, typeof(BackgroundSyncService));
|
||||
intent.SetAction(BackgroundSyncService.ActionStart);
|
||||
App.Context.StartService(intent);
|
||||
}
|
||||
@@ -1541,7 +1519,6 @@ namespace keepass2android
|
||||
{
|
||||
_activeContext = value;
|
||||
OperationRunner.Instance.SetNewActiveContext(App.Kp2a);
|
||||
Kp2aLog.Log("OPR: ActiveContext set to " + _activeContext?.GetType().Name + ". Pending question? " +(_currentlyPendingYesNoCancelQuestion != null));
|
||||
_currentlyPendingYesNoCancelQuestion?.TryShow(this, OnUserInputDialogClose, OnUserInputDialogShow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,11 +44,9 @@ public class BackgroundOperationContainer : LinearLayout, IProgressUi
|
||||
{
|
||||
App.Kp2a.UiThreadHandler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted Show ");
|
||||
Visibility = ViewStates.Visible;
|
||||
FindViewById<TextView>(Resource.Id.background_ops_message)!.Visibility = ViewStates.Gone;
|
||||
FindViewById<TextView>(Resource.Id.background_ops_submessage)!.Visibility = ViewStates.Gone;
|
||||
Kp2aLog.Log("OPR: Finished posted Show ");
|
||||
});
|
||||
|
||||
}
|
||||
@@ -57,11 +55,8 @@ public class BackgroundOperationContainer : LinearLayout, IProgressUi
|
||||
{
|
||||
App.Kp2a.UiThreadHandler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted Hide ");
|
||||
String activityType = Context.GetType().FullName;
|
||||
Kp2aLog.Log("Hiding background ops container in" + activityType);
|
||||
Visibility = ViewStates.Gone;
|
||||
Kp2aLog.Log("OPR: Finished posted Hide ");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -69,7 +64,6 @@ public class BackgroundOperationContainer : LinearLayout, IProgressUi
|
||||
{
|
||||
App.Kp2a.UiThreadHandler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted UpdateMessage ");
|
||||
TextView messageTextView = FindViewById<TextView>(Resource.Id.background_ops_message)!;
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
@@ -80,7 +74,6 @@ public class BackgroundOperationContainer : LinearLayout, IProgressUi
|
||||
messageTextView.Visibility = ViewStates.Visible;
|
||||
messageTextView.Text = message;
|
||||
}
|
||||
Kp2aLog.Log("OPR: Finished posted UpdateMessage ");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -88,7 +81,6 @@ public class BackgroundOperationContainer : LinearLayout, IProgressUi
|
||||
{
|
||||
App.Kp2a.UiThreadHandler.Post(() =>
|
||||
{
|
||||
Kp2aLog.Log("OPR: Starting posted UpdateSubMessage ");
|
||||
TextView subMessageTextView = FindViewById<TextView>(Resource.Id.background_ops_submessage)!;
|
||||
if (string.IsNullOrEmpty(submessage))
|
||||
{
|
||||
@@ -99,7 +91,6 @@ public class BackgroundOperationContainer : LinearLayout, IProgressUi
|
||||
subMessageTextView.Visibility = ViewStates.Visible;
|
||||
subMessageTextView.Text = submessage;
|
||||
}
|
||||
Kp2aLog.Log("OPR: Finished posted UpdateSubMessage ");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user