mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
66c9a86f2c
commit
351ae13234
|
@ -26,7 +26,6 @@ import android.content.pm.PackageManager;
|
|||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -48,7 +47,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.i(Helper.TAG, "Create " + this.getClass().getName() + " version=" + BuildConfig.VERSION_NAME);
|
||||
Log.i("Create " + this.getClass().getName() + " version=" + BuildConfig.VERSION_NAME);
|
||||
|
||||
this.contacts = (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS)
|
||||
== PackageManager.PERMISSION_GRANTED);
|
||||
|
@ -69,13 +68,13 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
Log.i(Helper.TAG, "Resume " + this.getClass().getName());
|
||||
Log.i("Resume " + this.getClass().getName());
|
||||
|
||||
boolean contacts = (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS)
|
||||
== PackageManager.PERMISSION_GRANTED);
|
||||
|
||||
if (!this.getClass().equals(ActivitySetup.class) && this.contacts != contacts) {
|
||||
Log.i(Helper.TAG, "Contacts permission=" + contacts);
|
||||
Log.i("Contacts permission=" + contacts);
|
||||
finish();
|
||||
startActivity(getIntent());
|
||||
}
|
||||
|
@ -85,33 +84,33 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Log.i(Helper.TAG, "Pause " + this.getClass().getName());
|
||||
Log.i("Pause " + this.getClass().getName());
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
Log.i(Helper.TAG, "Config " + this.getClass().getName());
|
||||
Log.i("Config " + this.getClass().getName());
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Log.i(Helper.TAG, "Destroy " + this.getClass().getName());
|
||||
Log.i("Destroy " + this.getClass().getName());
|
||||
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
Log.i(Helper.TAG, "Result class=" + this.getClass().getSimpleName() +
|
||||
Log.i("Result class=" + this.getClass().getSimpleName() +
|
||||
" request=" + requestCode + " result=" + resultCode + " data=" + data);
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||
Log.i(Helper.TAG, "Preference " + key + "=" + prefs.getAll().get(key));
|
||||
Log.i("Preference " + key + "=" + prefs.getAll().get(key));
|
||||
if ("theme".equals(key)) {
|
||||
finish();
|
||||
if (this.getClass().equals(ActivitySetup.class))
|
||||
|
@ -123,11 +122,11 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
protected View getVisibleView() {
|
||||
for (Fragment fragment : getSupportFragmentManager().getFragments())
|
||||
if (fragment.getUserVisibleHint()) {
|
||||
Log.i(Helper.TAG, "Visible fragment=" + fragment.getClass().getName());
|
||||
Log.i("Visible fragment=" + fragment.getClass().getName());
|
||||
return fragment.getView();
|
||||
}
|
||||
|
||||
Log.i(Helper.TAG, "Visible activity=" + this.getClass().getName());
|
||||
Log.i("Visible activity=" + this.getClass().getName());
|
||||
return findViewById(android.R.id.content);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import android.os.Handler;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.billingclient.api.BillingClient;
|
||||
import com.android.billingclient.api.BillingClientStateListener;
|
||||
|
@ -103,7 +102,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
intent.setData(Uri.parse("https://email.faircode.eu/pro/?challenge=" + getChallenge()));
|
||||
return intent;
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +134,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
.build();
|
||||
int responseCode = billingClient.launchBillingFlow(this, flowParams);
|
||||
String text = Helper.getBillingResponseText(responseCode);
|
||||
Log.i(Helper.TAG, "IAB launch billing flow response=" + text);
|
||||
Log.i("IAB launch billing flow response=" + text);
|
||||
if (responseCode != BillingClient.BillingResponse.OK)
|
||||
Snackbar.make(getVisibleView(), text, Snackbar.LENGTH_LONG).show();
|
||||
} else
|
||||
|
@ -147,20 +146,20 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
Uri data = intent.getParcelableExtra("uri");
|
||||
String challenge = getChallenge();
|
||||
String response = data.getQueryParameter("response");
|
||||
Log.i(Helper.TAG, "Challenge=" + challenge);
|
||||
Log.i(Helper.TAG, "Response=" + response);
|
||||
Log.i("Challenge=" + challenge);
|
||||
Log.i("Response=" + response);
|
||||
String expected = getResponse();
|
||||
if (expected.equals(response)) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
prefs.edit().putBoolean("pro", true).apply();
|
||||
Log.i(Helper.TAG, "Response valid");
|
||||
Log.i("Response valid");
|
||||
Snackbar.make(getVisibleView(), R.string.title_pro_valid, Snackbar.LENGTH_LONG).show();
|
||||
} else {
|
||||
Log.i(Helper.TAG, "Response invalid");
|
||||
Log.i("Response invalid");
|
||||
Snackbar.make(getVisibleView(), R.string.title_pro_invalid, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
Log.e(Helper.TAG, Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
Helper.unexpectedError(this, this, ex);
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +170,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
@Override
|
||||
public void onBillingSetupFinished(@BillingClient.BillingResponse int responseCode) {
|
||||
String text = Helper.getBillingResponseText(responseCode);
|
||||
Log.i(Helper.TAG, "IAB connected response=" + text);
|
||||
Log.i("IAB connected response=" + text);
|
||||
|
||||
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
|
||||
return;
|
||||
|
@ -186,7 +185,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
@Override
|
||||
public void onBillingServiceDisconnected() {
|
||||
backoff *= 2;
|
||||
Log.i(Helper.TAG, "IAB disconnected retry in " + backoff + " s");
|
||||
Log.i("IAB disconnected retry in " + backoff + " s");
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -200,7 +199,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
@Override
|
||||
public void onPurchasesUpdated(int responseCode, @Nullable List<Purchase> purchases) {
|
||||
String text = Helper.getBillingResponseText(responseCode);
|
||||
Log.i(Helper.TAG, "IAB purchases updated response=" + text);
|
||||
Log.i("IAB purchases updated response=" + text);
|
||||
if (responseCode == BillingClient.BillingResponse.OK)
|
||||
checkPurchases(purchases);
|
||||
else
|
||||
|
@ -210,7 +209,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
private void queryPurchases() {
|
||||
Purchase.PurchasesResult result = billingClient.queryPurchases(BillingClient.SkuType.INAPP);
|
||||
String text = Helper.getBillingResponseText(result.getResponseCode());
|
||||
Log.i(Helper.TAG, "IAB query purchases response=" + text);
|
||||
Log.i("IAB query purchases response=" + text);
|
||||
if (result.getResponseCode() == BillingClient.BillingResponse.OK)
|
||||
checkPurchases(result.getPurchasesList());
|
||||
else
|
||||
|
@ -227,7 +226,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
|
||||
for (Purchase purchase : purchases)
|
||||
try {
|
||||
Log.i(Helper.TAG, "IAB SKU=" + purchase.getSku());
|
||||
Log.i("IAB SKU=" + purchase.getSku());
|
||||
|
||||
byte[] decodedKey = Base64.decode(getString(R.string.public_key), Base64.DEFAULT);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
|
@ -238,14 +237,14 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
|
|||
if (sig.verify(Base64.decode(purchase.getSignature(), Base64.DEFAULT))) {
|
||||
if ((BuildConfig.APPLICATION_ID + ".pro").equals(purchase.getSku())) {
|
||||
editor.putBoolean("pro", true);
|
||||
Log.i(Helper.TAG, "IAB pro features activated");
|
||||
Log.i("IAB pro features activated");
|
||||
}
|
||||
} else {
|
||||
Log.w(Helper.TAG, "Invalid signature");
|
||||
Log.w("Invalid signature");
|
||||
Snackbar.make(getVisibleView(), R.string.title_pro_invalid, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
Snackbar.make(getVisibleView(), ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.content.Intent;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
|
@ -74,7 +73,7 @@ public class ActivityCompose extends ActivityBilling implements FragmentManager.
|
|||
InternetAddress.parse(to);
|
||||
args.putString("to", to);
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +84,7 @@ public class ActivityCompose extends ActivityBilling implements FragmentManager.
|
|||
InternetAddress.parse(TextUtils.join(", ", to));
|
||||
args.putString("to", TextUtils.join(", ", to));
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +95,7 @@ public class ActivityCompose extends ActivityBilling implements FragmentManager.
|
|||
InternetAddress.parse(TextUtils.join(", ", cc));
|
||||
args.putString("cc", TextUtils.join(", ", cc));
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +106,7 @@ public class ActivityCompose extends ActivityBilling implements FragmentManager.
|
|||
InternetAddress.parse(TextUtils.join(", ", bcc));
|
||||
args.putString("bcc", TextUtils.join(", ", bcc));
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -42,7 +41,7 @@ public class ActivityMain extends AppCompatActivity implements FragmentManager.O
|
|||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
if (!Helper.isPlayStoreInstall(this)) {
|
||||
Log.i(Helper.TAG, "Third party install");
|
||||
Log.i("Third party install");
|
||||
prefs.edit().putBoolean("play_store", false).apply();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ import android.os.ParcelFileDescriptor;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -351,7 +350,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
Intent intent = getIntent();
|
||||
|
||||
String action = intent.getAction();
|
||||
Log.i(Helper.TAG, "View intent=" + intent + " action=" + action);
|
||||
Log.i("View intent=" + intent + " action=" + action);
|
||||
if (action != null) {
|
||||
intent.setAction(null);
|
||||
setIntent(intent);
|
||||
|
@ -635,7 +634,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
if (TextUtils.isEmpty(info.tag_name))
|
||||
info.tag_name = name;
|
||||
|
||||
Log.i(Helper.TAG, "Latest version=" + info.tag_name);
|
||||
Log.i("Latest version=" + info.tag_name);
|
||||
if (BuildConfig.VERSION_NAME.equals(info.tag_name))
|
||||
break;
|
||||
else
|
||||
|
@ -717,7 +716,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
long last = cursor.getLong(cursor.getColumnIndex(ContactsContract.Contacts.LAST_TIME_CONTACTED));
|
||||
|
||||
InternetAddress address = new InternetAddress(email, name);
|
||||
Log.i(Helper.TAG, "Shortcut id=" + id + " address=" + address +
|
||||
Log.i("Shortcut id=" + id + " address=" + address +
|
||||
" starred=" + starred + " times=" + times + " last=" + last);
|
||||
|
||||
if (starred == 0 && times == 0 && last == 0)
|
||||
|
@ -748,7 +747,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
if (sm.getManifestShortcuts().size() + shortcuts.size() >= sm.getMaxShortcutCountPerActivity())
|
||||
break;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
|
@ -1220,7 +1219,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
OpenPgpApi api = new OpenPgpApi(context, pgpService.getService());
|
||||
Intent result = api.executeApi(data, encrypted, decrypted);
|
||||
|
||||
Log.i(Helper.TAG, "PGP result=" + result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR));
|
||||
Log.i("PGP result=" + result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR));
|
||||
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
|
||||
case OpenPgpApi.RESULT_CODE_SUCCESS:
|
||||
if (inline) {
|
||||
|
@ -1292,7 +1291,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
protected void onLoaded(Bundle args, PendingIntent pi) {
|
||||
if (pi != null)
|
||||
try {
|
||||
Log.i(Helper.TAG, "PGP executing pi=" + pi);
|
||||
Log.i("PGP executing pi=" + pi);
|
||||
startIntentSenderForResult(
|
||||
pi.getIntentSender(),
|
||||
ActivityView.REQUEST_DECRYPT,
|
||||
|
@ -1349,19 +1348,19 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
if (pfd != null)
|
||||
pfd.close();
|
||||
} catch (Throwable ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
try {
|
||||
if (fos != null)
|
||||
fos.close();
|
||||
} catch (Throwable ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
try {
|
||||
if (fis != null)
|
||||
fis.close();
|
||||
} catch (Throwable ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -137,7 +136,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|||
}
|
||||
|
||||
public void set(@NonNull List<EntityAccount> accounts) {
|
||||
Log.i(Helper.TAG, "Set accounts=" + accounts.size());
|
||||
Log.i("Set accounts=" + accounts.size());
|
||||
|
||||
final Collator collator = Collator.getInstance(Locale.getDefault());
|
||||
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc
|
||||
|
@ -159,22 +158,22 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|||
diff.dispatchUpdatesTo(new ListUpdateCallback() {
|
||||
@Override
|
||||
public void onInserted(int position, int count) {
|
||||
Log.i(Helper.TAG, "Inserted @" + position + " #" + count);
|
||||
Log.i("Inserted @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(int position, int count) {
|
||||
Log.i(Helper.TAG, "Removed @" + position + " #" + count);
|
||||
Log.i("Removed @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoved(int fromPosition, int toPosition) {
|
||||
Log.i(Helper.TAG, "Moved " + fromPosition + ">" + toPosition);
|
||||
Log.i("Moved " + fromPosition + ">" + toPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(int position, int count, Object payload) {
|
||||
Log.i(Helper.TAG, "Changed @" + position + " #" + count);
|
||||
Log.i("Changed @" + position + " #" + count);
|
||||
}
|
||||
});
|
||||
diff.dispatchUpdatesTo(this);
|
||||
|
|
|
@ -21,7 +21,6 @@ package eu.faircode.email;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -90,7 +89,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
|
|||
}
|
||||
|
||||
public void set(@NonNull List<EntityAnswer> answers) {
|
||||
Log.i(Helper.TAG, "Set answers=" + answers.size());
|
||||
Log.i("Set answers=" + answers.size());
|
||||
|
||||
final Collator collator = Collator.getInstance(Locale.getDefault());
|
||||
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc
|
||||
|
@ -112,22 +111,22 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
|
|||
diff.dispatchUpdatesTo(new ListUpdateCallback() {
|
||||
@Override
|
||||
public void onInserted(int position, int count) {
|
||||
Log.i(Helper.TAG, "Inserted @" + position + " #" + count);
|
||||
Log.i("Inserted @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(int position, int count) {
|
||||
Log.i(Helper.TAG, "Removed @" + position + " #" + count);
|
||||
Log.i("Removed @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoved(int fromPosition, int toPosition) {
|
||||
Log.i(Helper.TAG, "Moved " + fromPosition + ">" + toPosition);
|
||||
Log.i("Moved " + fromPosition + ">" + toPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(int position, int count, Object payload) {
|
||||
Log.i(Helper.TAG, "Changed @" + position + " #" + count);
|
||||
Log.i("Changed @" + position + " #" + count);
|
||||
}
|
||||
});
|
||||
diff.dispatchUpdatesTo(this);
|
||||
|
|
|
@ -29,7 +29,6 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -171,7 +170,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
|||
|
||||
// https://developer.android.com/reference/android/support/v4/content/FileProvider
|
||||
final Uri uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, file);
|
||||
Log.i(Helper.TAG, "uri=" + uri);
|
||||
Log.i("uri=" + uri);
|
||||
|
||||
// Build intent
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
|
@ -179,15 +178,15 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
|||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
if (!TextUtils.isEmpty(attachment.name))
|
||||
intent.putExtra(Intent.EXTRA_TITLE, attachment.name);
|
||||
Log.i(Helper.TAG, "Sharing " + file + " type=" + attachment.type);
|
||||
Log.i(Helper.TAG, "Intent=" + intent);
|
||||
Log.i("Sharing " + file + " type=" + attachment.type);
|
||||
Log.i("Intent=" + intent);
|
||||
|
||||
// Get targets
|
||||
PackageManager pm = context.getPackageManager();
|
||||
List<NameResolveInfo> targets = new ArrayList<>();
|
||||
List<ResolveInfo> ris = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
for (ResolveInfo ri : ris) {
|
||||
Log.i(Helper.TAG, "Target=" + ri);
|
||||
Log.i("Target=" + ri);
|
||||
context.grantUriPermission(ri.activityInfo.packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
targets.add(new NameResolveInfo(
|
||||
pm.getApplicationIcon(ri.activityInfo.applicationInfo),
|
||||
|
@ -316,7 +315,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
|||
}
|
||||
|
||||
public void set(@NonNull List<EntityAttachment> attachments) {
|
||||
Log.i(Helper.TAG, "Set attachments=" + attachments.size());
|
||||
Log.i("Set attachments=" + attachments.size());
|
||||
|
||||
Collections.sort(attachments, new Comparator<EntityAttachment>() {
|
||||
@Override
|
||||
|
@ -335,22 +334,22 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
|||
diff.dispatchUpdatesTo(new ListUpdateCallback() {
|
||||
@Override
|
||||
public void onInserted(int position, int count) {
|
||||
Log.i(Helper.TAG, "Inserted @" + position + " #" + count);
|
||||
Log.i("Inserted @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(int position, int count) {
|
||||
Log.i(Helper.TAG, "Removed @" + position + " #" + count);
|
||||
Log.i("Removed @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoved(int fromPosition, int toPosition) {
|
||||
Log.i(Helper.TAG, "Moved " + fromPosition + ">" + toPosition);
|
||||
Log.i("Moved " + fromPosition + ">" + toPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(int position, int count, Object payload) {
|
||||
Log.i(Helper.TAG, "Changed @" + position + " #" + count);
|
||||
Log.i("Changed @" + position + " #" + count);
|
||||
}
|
||||
});
|
||||
diff.dispatchUpdatesTo(this);
|
||||
|
|
|
@ -29,7 +29,6 @@ import android.graphics.Typeface;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -297,7 +296,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
protected Void onLoad(Context context, Bundle args) {
|
||||
long id = args.getLong("id");
|
||||
boolean outbox = args.getBoolean("outbox");
|
||||
Log.i(Helper.TAG, "Delete local messages outbox=" + outbox);
|
||||
Log.i("Delete local messages outbox=" + outbox);
|
||||
if (outbox)
|
||||
DB.getInstance(context).message().deleteSeenMessages(id);
|
||||
else
|
||||
|
@ -389,7 +388,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
}
|
||||
|
||||
public void set(long account, @NonNull List<TupleFolderEx> _folders) {
|
||||
Log.i(Helper.TAG, "Set account=" + account + " folders=" + _folders.size());
|
||||
Log.i("Set account=" + account + " folders=" + _folders.size());
|
||||
|
||||
this.account = account;
|
||||
|
||||
|
@ -414,22 +413,22 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
diff.dispatchUpdatesTo(new ListUpdateCallback() {
|
||||
@Override
|
||||
public void onInserted(int position, int count) {
|
||||
Log.i(Helper.TAG, "Inserted @" + position + " #" + count);
|
||||
Log.i("Inserted @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(int position, int count) {
|
||||
Log.i(Helper.TAG, "Removed @" + position + " #" + count);
|
||||
Log.i("Removed @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoved(int fromPosition, int toPosition) {
|
||||
Log.i(Helper.TAG, "Moved " + fromPosition + ">" + toPosition);
|
||||
Log.i("Moved " + fromPosition + ">" + toPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(int position, int count, Object payload) {
|
||||
Log.i(Helper.TAG, "Changed @" + position + " #" + count);
|
||||
Log.i("Changed @" + position + " #" + count);
|
||||
}
|
||||
});
|
||||
diff.dispatchUpdatesTo(this);
|
||||
|
|
|
@ -22,7 +22,6 @@ package eu.faircode.email;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -125,7 +124,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
|
|||
}
|
||||
|
||||
public void set(@NonNull List<TupleIdentityEx> identities) {
|
||||
Log.i(Helper.TAG, "Set identities=" + identities.size());
|
||||
Log.i("Set identities=" + identities.size());
|
||||
|
||||
final Collator collator = Collator.getInstance(Locale.getDefault());
|
||||
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc
|
||||
|
@ -147,22 +146,22 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
|
|||
diff.dispatchUpdatesTo(new ListUpdateCallback() {
|
||||
@Override
|
||||
public void onInserted(int position, int count) {
|
||||
Log.i(Helper.TAG, "Inserted @" + position + " #" + count);
|
||||
Log.i("Inserted @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(int position, int count) {
|
||||
Log.i(Helper.TAG, "Removed @" + position + " #" + count);
|
||||
Log.i("Removed @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoved(int fromPosition, int toPosition) {
|
||||
Log.i(Helper.TAG, "Moved " + fromPosition + ">" + toPosition);
|
||||
Log.i("Moved " + fromPosition + ">" + toPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(int position, int count, Object payload) {
|
||||
Log.i(Helper.TAG, "Changed @" + position + " #" + count);
|
||||
Log.i("Changed @" + position + " #" + count);
|
||||
}
|
||||
});
|
||||
diff.dispatchUpdatesTo(this);
|
||||
|
|
|
@ -20,7 +20,6 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -70,7 +69,7 @@ public class AdapterLog extends RecyclerView.Adapter<AdapterLog.ViewHolder> {
|
|||
}
|
||||
|
||||
public void set(@NonNull List<EntityLog> logs) {
|
||||
Log.i(Helper.TAG, "Set logs=" + logs.size());
|
||||
Log.i("Set logs=" + logs.size());
|
||||
|
||||
all = logs;
|
||||
|
||||
|
@ -82,22 +81,22 @@ public class AdapterLog extends RecyclerView.Adapter<AdapterLog.ViewHolder> {
|
|||
diff.dispatchUpdatesTo(new ListUpdateCallback() {
|
||||
@Override
|
||||
public void onInserted(int position, int count) {
|
||||
Log.i(Helper.TAG, "Inserted @" + position + " #" + count);
|
||||
Log.i("Inserted @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(int position, int count) {
|
||||
Log.i(Helper.TAG, "Removed @" + position + " #" + count);
|
||||
Log.i("Removed @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoved(int fromPosition, int toPosition) {
|
||||
Log.i(Helper.TAG, "Moved " + fromPosition + ">" + toPosition);
|
||||
Log.i("Moved " + fromPosition + ">" + toPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(int position, int count, Object payload) {
|
||||
Log.i(Helper.TAG, "Changed @" + position + " #" + count);
|
||||
Log.i("Changed @" + position + " #" + count);
|
||||
}
|
||||
});
|
||||
diff.dispatchUpdatesTo(this);
|
||||
|
|
|
@ -51,7 +51,6 @@ import android.text.method.LinkMovementMethod;
|
|||
import android.text.style.ImageSpan;
|
||||
import android.text.style.QuoteSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -342,7 +341,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
ivAvatar.setImageDrawable(Drawable.createFromStream(is, "avatar"));
|
||||
}
|
||||
} catch (SecurityException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
if (!photo && identicons && !outgoing) {
|
||||
|
@ -793,7 +792,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
try {
|
||||
body = message.read(context);
|
||||
} catch (IOException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
body = ex.toString();
|
||||
DB.getInstance(context).message().setMessageContent(message.id, false, null);
|
||||
}
|
||||
|
@ -877,7 +876,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
@Override
|
||||
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.i(Helper.TAG, "HTML tag=" + tag + " opening=" + opening);
|
||||
Log.i("HTML tag=" + tag + " opening=" + opening);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1167,7 +1166,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
args.putLong("id", message.id);
|
||||
args.putBoolean("flagged", !message.ui_flagged);
|
||||
args.putBoolean("thread", viewType != ViewType.THREAD);
|
||||
Log.i(Helper.TAG, "Set message id=" + message.id + " flagged=" + !message.ui_flagged);
|
||||
Log.i("Set message id=" + message.id + " flagged=" + !message.ui_flagged);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
|
@ -1710,11 +1709,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
for (int i = 0; i < messages.size(); i++) {
|
||||
TupleMessageEx message = messages.get(i);
|
||||
if (message != null && message.id.equals(key)) {
|
||||
Log.i(Helper.TAG, "Position=" + i + " @Key=" + key);
|
||||
Log.i("Position=" + i + " @Key=" + key);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
Log.i(Helper.TAG, "Position=" + RecyclerView.NO_POSITION + " @Key=" + key);
|
||||
Log.i("Position=" + RecyclerView.NO_POSITION + " @Key=" + key);
|
||||
return RecyclerView.NO_POSITION;
|
||||
}
|
||||
|
||||
|
@ -1723,10 +1722,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (list != null && pos < list.size()) {
|
||||
TupleMessageEx message = list.get(pos);
|
||||
Long key = (message == null ? null : message.id);
|
||||
Log.i(Helper.TAG, "Item=" + key + " @Position=" + pos);
|
||||
Log.i("Item=" + key + " @Position=" + pos);
|
||||
return message;
|
||||
} else {
|
||||
Log.i(Helper.TAG, "Item=" + null + " @Position=" + pos);
|
||||
Log.i("Item=" + null + " @Position=" + pos);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1737,18 +1736,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
for (int i = 0; i < messages.size(); i++) {
|
||||
TupleMessageEx message = messages.get(i);
|
||||
if (message != null && message.id.equals(key)) {
|
||||
Log.i(Helper.TAG, "Item=" + message.id + " @Key=" + key);
|
||||
Log.i("Item=" + message.id + " @Key=" + key);
|
||||
return message;
|
||||
}
|
||||
}
|
||||
Log.i(Helper.TAG, "Item=" + null + " @Key" + key);
|
||||
Log.i("Item=" + null + " @Key" + key);
|
||||
return null;
|
||||
}
|
||||
|
||||
Long getKeyAtPosition(int pos) {
|
||||
TupleMessageEx message = getItemAtPosition(pos);
|
||||
Long key = (message == null ? null : message.id);
|
||||
Log.i(Helper.TAG, "Key=" + key + " @Position=" + pos);
|
||||
Log.i("Key=" + key + " @Position=" + pos);
|
||||
return key;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -166,7 +165,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
|
|||
}
|
||||
|
||||
public void set(@NonNull List<TupleOperationEx> operations) {
|
||||
Log.i(Helper.TAG, "Set operations=" + operations.size());
|
||||
Log.i("Set operations=" + operations.size());
|
||||
|
||||
all = operations;
|
||||
|
||||
|
@ -178,22 +177,22 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
|
|||
diff.dispatchUpdatesTo(new ListUpdateCallback() {
|
||||
@Override
|
||||
public void onInserted(int position, int count) {
|
||||
Log.i(Helper.TAG, "Inserted @" + position + " #" + count);
|
||||
Log.i("Inserted @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved(int position, int count) {
|
||||
Log.i(Helper.TAG, "Removed @" + position + " #" + count);
|
||||
Log.i("Removed @" + position + " #" + count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoved(int fromPosition, int toPosition) {
|
||||
Log.i(Helper.TAG, "Moved " + fromPosition + ">" + toPosition);
|
||||
Log.i("Moved " + fromPosition + ">" + toPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(int position, int count, Object payload) {
|
||||
Log.i(Helper.TAG, "Changed @" + position + " #" + count);
|
||||
Log.i("Changed @" + position + " #" + count);
|
||||
}
|
||||
});
|
||||
diff.dispatchUpdatesTo(this);
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.content.Context;
|
|||
import android.os.Build;
|
||||
import android.os.DeadSystemException;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
@ -47,7 +46,7 @@ public class ApplicationEx extends Application {
|
|||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable ex) {
|
||||
if (ownFault(ex)) {
|
||||
Log.e(Helper.TAG, ex + "\r\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
|
||||
if (!Helper.isPlayStoreInstall(ApplicationEx.this))
|
||||
writeCrashLog(ApplicationEx.this, ex);
|
||||
|
@ -55,7 +54,7 @@ public class ApplicationEx extends Application {
|
|||
if (prev != null)
|
||||
prev.uncaughtException(thread, ex);
|
||||
} else {
|
||||
Log.w(Helper.TAG, ex + "\r\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -116,21 +115,21 @@ public class ApplicationEx extends Application {
|
|||
|
||||
static void writeCrashLog(Context context, Throwable ex) {
|
||||
File file = new File(context.getCacheDir(), "crash.log");
|
||||
Log.w(Helper.TAG, "Writing exception to " + file);
|
||||
Log.w("Writing exception to " + file);
|
||||
|
||||
FileWriter out = null;
|
||||
try {
|
||||
out = new FileWriter(file, true);
|
||||
out.write(BuildConfig.VERSION_NAME + " " + new Date() + "\r\n");
|
||||
out.write(ex + "\r\n" + Log.getStackTraceString(ex) + "\r\n");
|
||||
out.write(ex + "\r\n" + android.util.Log.getStackTraceString(ex) + "\r\n");
|
||||
} catch (IOException e) {
|
||||
Log.e(Helper.TAG, e + "\n" + Log.getStackTraceString(e));
|
||||
Log.e(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(Helper.TAG, e + "\n" + Log.getStackTraceString(e));
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -72,13 +71,13 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
|
||||
@Override
|
||||
public void onZeroItemsLoaded() {
|
||||
Log.i(Helper.TAG, "onZeroItemsLoaded");
|
||||
Log.i("onZeroItemsLoaded");
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemAtEndLoaded(final TupleMessageEx itemAtEnd) {
|
||||
Log.i(Helper.TAG, "onItemAtEndLoaded");
|
||||
Log.i("onItemAtEndLoaded");
|
||||
load();
|
||||
}
|
||||
|
||||
|
@ -97,7 +96,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
});
|
||||
model.load();
|
||||
} catch (final Throwable ex) {
|
||||
Log.e(Helper.TAG, "Boundary " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e("Boundary", ex);
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.SharedPreferences;
|
|||
import android.database.Cursor;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
@ -90,9 +89,9 @@ public abstract class DB extends RoomDatabase {
|
|||
.openHelperFactory(new RequerySQLiteOpenHelperFactory())
|
||||
.setJournalMode(JournalMode.WRITE_AHEAD_LOGGING));
|
||||
|
||||
Log.i(Helper.TAG, "sqlite version=" + exec(sInstance, "SELECT sqlite_version() AS sqlite_version"));
|
||||
Log.i(Helper.TAG, "sqlite sync=" + exec(sInstance, "PRAGMA synchronous"));
|
||||
Log.i(Helper.TAG, "sqlite journal=" + exec(sInstance, "PRAGMA journal_mode"));
|
||||
Log.i("sqlite version=" + exec(sInstance, "SELECT sqlite_version() AS sqlite_version"));
|
||||
Log.i("sqlite sync=" + exec(sInstance, "PRAGMA synchronous"));
|
||||
Log.i("sqlite journal=" + exec(sInstance, "PRAGMA journal_mode"));
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
|
@ -118,14 +117,14 @@ public abstract class DB extends RoomDatabase {
|
|||
.addCallback(new Callback() {
|
||||
@Override
|
||||
public void onOpen(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "Database version=" + db.getVersion());
|
||||
Log.i("Database version=" + db.getVersion());
|
||||
super.onOpen(db);
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(1, 2) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` RENAME COLUMN `after` TO `sync_days`");
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `keep_days` INTEGER NOT NULL DEFAULT 30");
|
||||
db.execSQL("UPDATE `folder` SET keep_days = sync_days");
|
||||
|
@ -134,7 +133,7 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(2, 3) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `identity` ADD COLUMN `signature` TEXT");
|
||||
db.execSQL("UPDATE `identity` SET signature =" +
|
||||
" (SELECT account.signature FROM account WHERE account.id = identity.account)");
|
||||
|
@ -143,7 +142,7 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(3, 4) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `message` ADD COLUMN `forwarding` INTEGER" +
|
||||
" REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL");
|
||||
db.execSQL("CREATE INDEX `index_message_forwarding` ON `message` (`forwarding`)");
|
||||
|
@ -152,7 +151,7 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(4, 5) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `account` ADD COLUMN `last_connected` INTEGER");
|
||||
db.execSQL("ALTER TABLE `message` ADD COLUMN `last_attempt` INTEGER");
|
||||
}
|
||||
|
@ -160,14 +159,14 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(5, 6) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `account` ADD COLUMN `notify` INTEGER NOT NULL DEFAULT 0");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(6, 7) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `message` ADD COLUMN `answered` INTEGER NOT NULL DEFAULT 0");
|
||||
db.execSQL("ALTER TABLE `message` ADD COLUMN `ui_answered` INTEGER NOT NULL DEFAULT 0");
|
||||
}
|
||||
|
@ -175,21 +174,21 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(7, 8) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `message` ADD COLUMN `keywords` TEXT");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(8, 9) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `keywords` TEXT");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(9, 10) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `message` ADD COLUMN `ui_browsed` INTEGER NOT NULL DEFAULT 0");
|
||||
db.execSQL("CREATE INDEX `index_message_ui_browsed` ON `message` (`ui_browsed`)");
|
||||
}
|
||||
|
@ -197,14 +196,14 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(10, 11) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `operation` ADD COLUMN `error` TEXT");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(11, 12) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("DROP INDEX `index_operation_folder`");
|
||||
db.execSQL("DROP INDEX `index_operation_message`");
|
||||
db.execSQL("DROP TABLE `operation`");
|
||||
|
@ -225,35 +224,35 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(12, 13) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("CREATE INDEX `index_message_ui_flagged` ON `message` (`ui_flagged`)");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(13, 14) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `level` INTEGER NOT NULL DEFAULT 0");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(14, 15) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `sync_state` TEXT");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(15, 16) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `poll` INTEGER NOT NULL DEFAULT 0");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(16, 17) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("DELETE FROM `message` WHERE ui_found");
|
||||
db.execSQL("DROP INDEX `index_message_folder_uid_ui_found`");
|
||||
db.execSQL("DROP INDEX `index_message_msgid_folder_ui_found`");
|
||||
|
@ -264,7 +263,7 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(17, 18) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `account` ADD COLUMN `tbd` INTEGER");
|
||||
db.execSQL("ALTER TABLE `identity` ADD COLUMN `tbd` INTEGER");
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `tbd` INTEGER");
|
||||
|
@ -273,7 +272,7 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(18, 19) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `identity` ADD COLUMN `delivery_receipt` INTEGER NOT NULL DEFAULT 0");
|
||||
db.execSQL("ALTER TABLE `identity` ADD COLUMN `read_receipt` INTEGER NOT NULL DEFAULT 0");
|
||||
}
|
||||
|
@ -281,7 +280,7 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(19, 20) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `notify` INTEGER NOT NULL DEFAULT 0");
|
||||
db.execSQL("UPDATE `folder` SET notify = unified");
|
||||
}
|
||||
|
@ -289,7 +288,7 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(20, 21) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `identity` ADD COLUMN `display` TEXT");
|
||||
db.execSQL("ALTER TABLE `identity` ADD COLUMN `bcc` TEXT");
|
||||
}
|
||||
|
@ -297,7 +296,7 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(21, 22) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `initialize` INTEGER NOT NULL DEFAULT 1");
|
||||
db.execSQL("UPDATE `folder` SET sync_days = 1");
|
||||
}
|
||||
|
@ -305,28 +304,28 @@ public abstract class DB extends RoomDatabase {
|
|||
.addMigrations(new Migration(22, 23) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `download` INTEGER NOT NULL DEFAULT 1");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(23, 24) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `folder` ADD COLUMN `tbc` INTEGER");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(24, 25) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `account` ADD COLUMN `prefix` TEXT");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(25, 26) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int browse = (prefs.getBoolean("browse", true) ? 1 : 0);
|
||||
db.execSQL("ALTER TABLE `account` ADD COLUMN `browse` INTEGER NOT NULL DEFAULT " + browse);
|
||||
|
@ -374,7 +373,7 @@ public abstract class DB extends RoomDatabase {
|
|||
jaddresses.put(jaddress);
|
||||
}
|
||||
} catch (JSONException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
return jaddresses.toString();
|
||||
}
|
||||
|
@ -398,7 +397,7 @@ public abstract class DB extends RoomDatabase {
|
|||
}
|
||||
} catch (Throwable ex) {
|
||||
// Compose can store invalid addresses
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
return result.toArray(new Address[0]);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedWriter;
|
||||
|
@ -127,7 +126,7 @@ public class EntityAttachment {
|
|||
this.available = true;
|
||||
db.attachment().updateAttachment(this);
|
||||
|
||||
Log.i(Helper.TAG, "Downloaded attachment size=" + this.size);
|
||||
Log.i("Downloaded attachment size=" + this.size);
|
||||
} catch (IOException ex) {
|
||||
// Reset progress on failure
|
||||
this.progress = null;
|
||||
|
|
|
@ -20,7 +20,6 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
@ -52,7 +51,7 @@ public class EntityLog {
|
|||
private static ExecutorService executor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||
|
||||
static void log(Context context, String data) {
|
||||
Log.i(Helper.TAG, data);
|
||||
Log.i(data);
|
||||
|
||||
final EntityLog entry = new EntityLog();
|
||||
entry.time = new Date().getTime();
|
||||
|
|
|
@ -26,7 +26,6 @@ import android.content.pm.PackageManager;
|
|||
import android.database.Cursor;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
|
@ -233,7 +232,7 @@ public class EntityMessage implements Serializable {
|
|||
}
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package eu.faircode.email;
|
|||
Copyright 2018 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
|
@ -109,7 +107,7 @@ public class EntityOperation {
|
|||
|
||||
db.folder().setFolderSyncState(fid, "requested");
|
||||
|
||||
Log.i(Helper.TAG, "Queued sync folder=" + folder);
|
||||
Log.i("Queued sync folder=" + folder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +135,7 @@ public class EntityOperation {
|
|||
} else if (DELETE.equals(name))
|
||||
db.message().setMessageUiHide(message.id, true);
|
||||
} catch (JSONException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
EntityOperation operation = new EntityOperation();
|
||||
|
@ -148,7 +146,7 @@ public class EntityOperation {
|
|||
operation.created = new Date().getTime();
|
||||
operation.id = db.operation().insertOperation(operation);
|
||||
|
||||
Log.i(Helper.TAG, "Queued op=" + operation.id + "/" + operation.name +
|
||||
Log.i("Queued op=" + operation.id + "/" + operation.name +
|
||||
" msg=" + operation.folder + "/" + operation.message +
|
||||
" args=" + operation.args);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ import android.preference.PreferenceManager;
|
|||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -277,7 +276,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
if (records != null)
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
SRVRecord srv = (SRVRecord) records[i];
|
||||
Log.i(Helper.TAG, "SRV=" + srv);
|
||||
Log.i("SRV=" + srv);
|
||||
return srv;
|
||||
}
|
||||
|
||||
|
@ -335,13 +334,13 @@ public class FragmentAccount extends FragmentEx {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
Provider provider = (Provider) spProvider.getSelectedItem();
|
||||
Log.i(Helper.TAG, "Authorize " + provider);
|
||||
Log.i("Authorize " + provider);
|
||||
|
||||
if ("com.google".equals(provider.type)) {
|
||||
String permission = Manifest.permission.GET_ACCOUNTS;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O &&
|
||||
ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
Log.i(Helper.TAG, "Requesting " + permission);
|
||||
Log.i("Requesting " + permission);
|
||||
requestPermissions(new String[]{permission}, ActivitySetup.REQUEST_PERMISSION);
|
||||
} else
|
||||
selectAccount();
|
||||
|
@ -487,7 +486,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
String type = null;
|
||||
boolean selectable = true;
|
||||
String[] attrs = ((IMAPFolder) ifolder).getAttributes();
|
||||
Log.i(Helper.TAG, ifolder.getFullName() + " attrs=" + TextUtils.join(" ", attrs));
|
||||
Log.i(ifolder.getFullName() + " attrs=" + TextUtils.join(" ", attrs));
|
||||
for (String attr : attrs) {
|
||||
if ("\\Noselect".equals(attr) || "\\NonExistent".equals(attr))
|
||||
selectable = false;
|
||||
|
@ -514,7 +513,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
}
|
||||
result.folders.add(folder);
|
||||
|
||||
Log.i(Helper.TAG, folder.name + " id=" + folder.id +
|
||||
Log.i(folder.name + " id=" + folder.id +
|
||||
" type=" + folder.type + " attr=" + TextUtils.join(",", attrs));
|
||||
}
|
||||
}
|
||||
|
@ -803,7 +802,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
EntityFolder existing = db.folder().getFolderByName(account.id, folder.name);
|
||||
if (existing == null) {
|
||||
folder.account = account.id;
|
||||
Log.i(Helper.TAG, "Creating folder=" + folder.name + " (" + folder.type + ")");
|
||||
Log.i("Creating folder=" + folder.name + " (" + folder.type + ")");
|
||||
folder.id = db.folder().insertFolder(folder);
|
||||
} else {
|
||||
db.folder().setFolderType(existing.id, folder.type);
|
||||
|
@ -1108,7 +1107,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
|
||||
AccountManager am = AccountManager.get(getContext());
|
||||
Account[] accounts = am.getAccountsByType(type);
|
||||
Log.i(Helper.TAG, "Accounts=" + accounts.length);
|
||||
Log.i("Accounts=" + accounts.length);
|
||||
for (final Account account : accounts)
|
||||
if (name.equals(account.name)) {
|
||||
final Snackbar snackbar = Snackbar.make(view, R.string.title_authorizing, Snackbar.LENGTH_SHORT);
|
||||
|
@ -1125,7 +1124,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
try {
|
||||
Bundle bundle = future.getResult();
|
||||
String token = bundle.getString(AccountManager.KEY_AUTHTOKEN);
|
||||
Log.i(Helper.TAG, "Got token");
|
||||
Log.i("Got token");
|
||||
|
||||
authorized = token;
|
||||
etUser.setText(account.name);
|
||||
|
@ -1137,7 +1136,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
}
|
||||
}, 1000);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
snackbar.setText(Helper.formatThrowable(ex));
|
||||
}
|
||||
}
|
||||
|
@ -1149,7 +1148,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
}
|
||||
|
||||
private void selectAccount() {
|
||||
Log.i(Helper.TAG, "Select account");
|
||||
Log.i("Select account");
|
||||
Provider provider = (Provider) spProvider.getSelectedItem();
|
||||
if (provider.type != null)
|
||||
startActivityForResult(
|
||||
|
|
|
@ -47,7 +47,6 @@ import android.text.style.StyleSpan;
|
|||
import android.text.style.TypefaceSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -838,7 +837,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
etBcc.setText(sb.toString());
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
|
@ -946,7 +945,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
|
||||
args.putString("body", Html.toHtml(spannable));
|
||||
|
||||
Log.i(Helper.TAG, "Run load id=" + working);
|
||||
Log.i("Run load id=" + working);
|
||||
actionLoader.load(this, args);
|
||||
}
|
||||
|
||||
|
@ -996,7 +995,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
db.beginTransaction();
|
||||
|
||||
EntityMessage draft = db.message().getMessage(id);
|
||||
Log.i(Helper.TAG, "Attaching to id=" + id);
|
||||
Log.i("Attaching to id=" + id);
|
||||
|
||||
attachment.message = draft.id;
|
||||
attachment.sequence = db.attachment().getAttachmentSequence(draft.id) + 1;
|
||||
|
@ -1012,7 +1011,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
attachment.progress = 0;
|
||||
|
||||
attachment.id = db.attachment().insertAttachment(attachment);
|
||||
Log.i(Helper.TAG, "Created attachment=" + attachment.name + ":" + attachment.sequence + " type=" + attachment.type);
|
||||
Log.i("Created attachment=" + attachment.name + ":" + attachment.sequence + " type=" + attachment.type);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
@ -1074,7 +1073,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
boolean raw = args.getBoolean("raw", false);
|
||||
long answer = args.getLong("answer", -1);
|
||||
|
||||
Log.i(Helper.TAG, "Load draft action=" + action + " id=" + id + " reference=" + reference);
|
||||
Log.i("Load draft action=" + action + " id=" + id + " reference=" + reference);
|
||||
|
||||
DraftAccount result = new DraftAccount();
|
||||
|
||||
|
@ -1116,20 +1115,20 @@ public class FragmentCompose extends FragmentEx {
|
|||
|
||||
if (ref.deliveredto != null && (ref.to == null || ref.to.length == 0)) {
|
||||
try {
|
||||
Log.i(Helper.TAG, "Setting delivered to=" + ref.deliveredto);
|
||||
Log.i("Setting delivered to=" + ref.deliveredto);
|
||||
ref.to = InternetAddress.parse(ref.deliveredto);
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (ref.from != null && ref.from.length > 0) {
|
||||
String from = Helper.canonicalAddress(((InternetAddress) ref.from[0]).getAddress());
|
||||
Log.i(Helper.TAG, "From=" + from + " to=" + MessageHelper.getFormattedAddresses(ref.to, false));
|
||||
Log.i("From=" + from + " to=" + MessageHelper.getFormattedAddresses(ref.to, false));
|
||||
for (EntityIdentity identity : identities) {
|
||||
String email = Helper.canonicalAddress(identity.email);
|
||||
if (from.equals(email)) {
|
||||
Log.i(Helper.TAG, "Swapping from/to");
|
||||
Log.i("Swapping from/to");
|
||||
Address[] tmp = ref.to;
|
||||
ref.to = ref.from;
|
||||
ref.from = tmp;
|
||||
|
@ -1160,21 +1159,21 @@ public class FragmentCompose extends FragmentEx {
|
|||
String to = args.getString("to");
|
||||
result.draft.to = (TextUtils.isEmpty(to) ? null : InternetAddress.parse(to));
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
try {
|
||||
String cc = args.getString("cc");
|
||||
result.draft.cc = (TextUtils.isEmpty(cc) ? null : InternetAddress.parse(cc));
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
try {
|
||||
String bcc = args.getString("bcc");
|
||||
result.draft.bcc = (TextUtils.isEmpty(bcc) ? null : InternetAddress.parse(bcc));
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
result.draft.subject = args.getString("subject");
|
||||
|
@ -1321,7 +1320,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
working = result.draft.id;
|
||||
|
||||
final String action = getArguments().getString("action");
|
||||
Log.i(Helper.TAG, "Loaded draft id=" + result.draft.id + " action=" + action);
|
||||
Log.i("Loaded draft id=" + result.draft.id + " action=" + action);
|
||||
|
||||
etExtra.setText(result.draft.extra);
|
||||
etTo.setText(MessageHelper.getFormattedAddresses(result.draft.to, true));
|
||||
|
@ -1347,7 +1346,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
if (accounts == null)
|
||||
accounts = new ArrayList<>();
|
||||
|
||||
Log.i(Helper.TAG, "Set accounts=" + accounts.size());
|
||||
Log.i("Set accounts=" + accounts.size());
|
||||
|
||||
// Sort accounts
|
||||
Collections.sort(accounts, new Comparator<EntityAccount>() {
|
||||
|
@ -1377,7 +1376,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
if (identities == null)
|
||||
identities = new ArrayList<>();
|
||||
|
||||
Log.i(Helper.TAG, "Set identities=" + identities.size());
|
||||
Log.i("Set identities=" + identities.size());
|
||||
|
||||
// Sort identities
|
||||
Collections.sort(identities, new Comparator<EntityIdentity>() {
|
||||
|
@ -1571,7 +1570,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
if (draft == null)
|
||||
throw new MessageRemovedException("Draft for action was deleted");
|
||||
|
||||
Log.i(Helper.TAG, "Load action id=" + draft.id + " action=" + action);
|
||||
Log.i("Load action id=" + draft.id + " action=" + action);
|
||||
|
||||
// Move draft to new account
|
||||
if (draft.account != aid && aid >= 0) {
|
||||
|
@ -1731,7 +1730,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
@Override
|
||||
protected void onLoaded(Bundle args, EntityMessage draft) {
|
||||
int action = args.getInt("action");
|
||||
Log.i(Helper.TAG, "Loaded action id=" + (draft == null ? null : draft.id) + " action=" + action);
|
||||
Log.i("Loaded action id=" + (draft == null ? null : draft.id) + " action=" + action);
|
||||
|
||||
busy = false;
|
||||
Helper.setViewsEnabled(view, true);
|
||||
|
@ -1804,7 +1803,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
}
|
||||
|
||||
private void processTt(boolean opening, Editable output) {
|
||||
Log.i(Helper.TAG, "Handling tt");
|
||||
Log.i("Handling tt");
|
||||
int len = output.length();
|
||||
if (opening)
|
||||
output.setSpan(new TypefaceSpan("monospace"), len, len, Spannable.SPAN_MARK_MARK);
|
||||
|
|
|
@ -22,7 +22,6 @@ package eu.faircode.email;
|
|||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -55,14 +54,14 @@ public class FragmentEx extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
Log.i(Helper.TAG, "Save instance " + this);
|
||||
Log.i("Save instance " + this);
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString("subtitle", subtitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
Log.i(Helper.TAG, "Create " + this + " saved=" + (savedInstanceState != null));
|
||||
Log.i("Create " + this + " saved=" + (savedInstanceState != null));
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState != null)
|
||||
subtitle = savedInstanceState.getString("subtitle");
|
||||
|
@ -70,19 +69,19 @@ public class FragmentEx extends Fragment {
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
Log.i(Helper.TAG, "Create view " + this);
|
||||
Log.i("Create view " + this);
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
Log.i(Helper.TAG, "Activity " + this + " saved=" + (savedInstanceState != null));
|
||||
Log.i("Activity " + this + " saved=" + (savedInstanceState != null));
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
Log.i(Helper.TAG, "Resume " + this);
|
||||
Log.i("Resume " + this);
|
||||
super.onResume();
|
||||
updateSubtitle();
|
||||
if (finish) {
|
||||
|
@ -93,7 +92,7 @@ public class FragmentEx extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Log.i(Helper.TAG, "Pause " + this);
|
||||
Log.i("Pause " + this);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
@ -109,13 +108,13 @@ public class FragmentEx extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
Log.i(Helper.TAG, "Config " + this);
|
||||
Log.i("Config " + this);
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.i(Helper.TAG, "Destroy " + this);
|
||||
Log.i("Destroy " + this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.content.DialogInterface;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -180,7 +179,7 @@ public class FragmentFolder extends FragmentEx {
|
|||
|
||||
if (folder == null) {
|
||||
reload = true;
|
||||
Log.i(Helper.TAG, "Creating folder=" + name);
|
||||
Log.i("Creating folder=" + name);
|
||||
|
||||
if (TextUtils.isEmpty(name))
|
||||
throw new IllegalArgumentException(getString(R.string.title_folder_name_missing));
|
||||
|
@ -217,7 +216,7 @@ public class FragmentFolder extends FragmentEx {
|
|||
if (keep_time < 0)
|
||||
keep_time = 0;
|
||||
|
||||
Log.i(Helper.TAG, "Updating folder=" + name);
|
||||
Log.i("Updating folder=" + name);
|
||||
db.folder().setFolderProperties(id,
|
||||
display, unified, notify, hide,
|
||||
synchronize, poll, download,
|
||||
|
|
|
@ -29,7 +29,6 @@ import android.os.Handler;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -270,7 +269,7 @@ public class FragmentIdentity extends FragmentEx {
|
|||
if (records != null)
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
SRVRecord srv = (SRVRecord) records[i];
|
||||
Log.i(Helper.TAG, "SRV=" + srv);
|
||||
Log.i("SRV=" + srv);
|
||||
return srv;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.os.Handler;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -435,7 +434,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
if (getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
|
||||
loadMessages();
|
||||
} catch (IllegalStateException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
swipeRefresh.setEnabled(true);
|
||||
}
|
||||
|
@ -528,7 +527,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
TupleMessageEx message = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList().get(pos);
|
||||
if (message == null)
|
||||
return;
|
||||
Log.i(Helper.TAG, "Swiped dir=" + direction + " message=" + message.id);
|
||||
Log.i("Swiped dir=" + direction + " message=" + message.id);
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", message.id);
|
||||
|
@ -1596,7 +1595,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
message.folder = sent.id;
|
||||
message.uid = null;
|
||||
db.message().updateMessage(message);
|
||||
Log.i(Helper.TAG, "Appending sent msgid=" + message.msgid);
|
||||
Log.i("Appending sent msgid=" + message.msgid);
|
||||
EntityOperation.queue(db, message, EntityOperation.ADD); // Could already exist
|
||||
}
|
||||
}
|
||||
|
@ -1792,7 +1791,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
!EntityFolder.JUNK.equals(message.folderType))
|
||||
count++;
|
||||
}
|
||||
Log.i(Helper.TAG, "Auto close=" + count);
|
||||
Log.i("Auto close=" + count);
|
||||
|
||||
// Auto close when:
|
||||
// - no more non archived/trashed/sent messages
|
||||
|
@ -1808,7 +1807,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
model.setMessages(messages);
|
||||
}
|
||||
|
||||
Log.i(Helper.TAG, "Submit messages=" + messages.size());
|
||||
Log.i("Submit messages=" + messages.size());
|
||||
adapter.submitList(messages);
|
||||
|
||||
boolean searching = (searchCallback != null && searchCallback.isSearching());
|
||||
|
@ -1906,7 +1905,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
for (long id : result.ids) {
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message != null) {
|
||||
Log.i(Helper.TAG, "Move id=" + id + " target=" + result.target.name);
|
||||
Log.i("Move id=" + id + " target=" + result.target.name);
|
||||
EntityFolder folder = db.folder().getFolderByName(message.account, result.target.name);
|
||||
EntityOperation.queue(db, message, EntityOperation.MOVE, folder.id);
|
||||
}
|
||||
|
@ -1950,7 +1949,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
DB db = DB.getInstance(context);
|
||||
MessageTarget result = (MessageTarget) args.getSerializable("result");
|
||||
for (long id : result.ids) {
|
||||
Log.i(Helper.TAG, "Move undo id=" + id);
|
||||
Log.i("Move undo id=" + id);
|
||||
db.message().setMessageUiHide(id, false);
|
||||
}
|
||||
return null;
|
||||
|
@ -1969,7 +1968,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i(Helper.TAG, "Move timeout");
|
||||
Log.i("Move timeout");
|
||||
|
||||
// Remove snackbar
|
||||
if (snackbar.isShown())
|
||||
|
@ -1986,7 +1985,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
for (long id : result.ids) {
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message != null && message.ui_hide) {
|
||||
Log.i(Helper.TAG, "Move id=" + id + " target=" + result.target.name);
|
||||
Log.i("Move id=" + id + " target=" + result.target.name);
|
||||
EntityFolder folder = db.folder().getFolderByName(message.account, result.target.name);
|
||||
EntityOperation.queue(db, message, EntityOperation.MOVE, folder.id);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import android.content.Intent;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -142,9 +141,9 @@ public class FragmentOperations extends FragmentEx {
|
|||
protected Void onLoad(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
List<EntityOperation> ops = db.operation().getOperationsError();
|
||||
Log.i(Helper.TAG, "Operations with error count=" + ops.size());
|
||||
Log.i("Operations with error count=" + ops.size());
|
||||
for (EntityOperation op : ops) {
|
||||
Log.w(Helper.TAG, "Deleting operation=" + op.id + " error=" + op.error);
|
||||
Log.w("Deleting operation=" + op.id + " error=" + op.error);
|
||||
if (op.message != null)
|
||||
db.message().setMessageUiHide(op.message, false);
|
||||
db.operation().deleteOperation(op.id);
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -229,13 +228,13 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
|||
for (Long id : db.message().getMessageWithoutPreview()) {
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
try {
|
||||
Log.i(Helper.TAG, "Building preview id=" + id);
|
||||
Log.i("Building preview id=" + id);
|
||||
String html = message.read(context);
|
||||
String text = (html == null ? null : Jsoup.parse(html).text());
|
||||
String preview = (text == null ? null : text.substring(0, Math.min(text.length(), 250)));
|
||||
db.message().setMessageContent(message.id, true, preview);
|
||||
} catch (IOException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
db.message().setMessageContent(message.id, false, null);
|
||||
if (!metered)
|
||||
EntityOperation.queue(db, message, EntityOperation.BODY);
|
||||
|
@ -419,13 +418,13 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
|||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.i(Helper.TAG, "Result class=" + this.getClass().getSimpleName() +
|
||||
Log.i("Result class=" + this.getClass().getSimpleName() +
|
||||
" request=" + requestCode + " result=" + resultCode + " data=" + data);
|
||||
|
||||
if (requestCode == ActivitySetup.REQUEST_SOUND)
|
||||
if (resultCode == RESULT_OK) {
|
||||
Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
|
||||
Log.i(Helper.TAG, "Selected ringtone=" + uri);
|
||||
Log.i("Selected ringtone=" + uri);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
if (uri == null)
|
||||
|
|
|
@ -37,7 +37,6 @@ import android.os.PowerManager;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -204,7 +203,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
try {
|
||||
startActivity(new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -221,7 +220,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
startActivity(new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS,
|
||||
Uri.parse("package:" + BuildConfig.APPLICATION_ID)));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -614,7 +613,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
|
||||
OutputStream out = null;
|
||||
try {
|
||||
Log.i(Helper.TAG, "Writing URI=" + uri);
|
||||
Log.i("Writing URI=" + uri);
|
||||
|
||||
byte[] salt = new byte[16];
|
||||
SecureRandom random = new SecureRandom();
|
||||
|
@ -678,7 +677,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
|
||||
out.write(jexport.toString(2).getBytes());
|
||||
|
||||
Log.i(Helper.TAG, "Exported data");
|
||||
Log.i("Exported data");
|
||||
} finally {
|
||||
if (out != null)
|
||||
out.close();
|
||||
|
@ -718,7 +717,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
|
||||
InputStream in = null;
|
||||
try {
|
||||
Log.i(Helper.TAG, "Reading URI=" + uri);
|
||||
Log.i("Reading URI=" + uri);
|
||||
ContentResolver resolver = getContext().getContentResolver();
|
||||
AssetFileDescriptor descriptor = resolver.openTypedAssetFileDescriptor(uri, "*/*", null);
|
||||
InputStream raw = descriptor.createInputStream();
|
||||
|
@ -744,7 +743,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
String line;
|
||||
while ((line = reader.readLine()) != null)
|
||||
response.append(line);
|
||||
Log.i(Helper.TAG, "Importing " + resolver.toString());
|
||||
Log.i("Importing " + resolver.toString());
|
||||
|
||||
JSONObject jimport = new JSONObject(response.toString());
|
||||
|
||||
|
@ -758,7 +757,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
EntityAccount account = EntityAccount.fromJSON(jaccount);
|
||||
account.created = new Date().getTime();
|
||||
account.id = db.account().insertAccount(account);
|
||||
Log.i(Helper.TAG, "Imported account=" + account.name);
|
||||
Log.i("Imported account=" + account.name);
|
||||
|
||||
JSONArray jidentities = (JSONArray) jaccount.get("identities");
|
||||
for (int i = 0; i < jidentities.length(); i++) {
|
||||
|
@ -766,7 +765,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
EntityIdentity identity = EntityIdentity.fromJSON(jidentity);
|
||||
identity.account = account.id;
|
||||
identity.id = db.identity().insertIdentity(identity);
|
||||
Log.i(Helper.TAG, "Imported identity=" + identity.email);
|
||||
Log.i("Imported identity=" + identity.email);
|
||||
}
|
||||
|
||||
JSONArray jfolders = (JSONArray) jaccount.get("folders");
|
||||
|
@ -775,7 +774,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
EntityFolder folder = EntityFolder.fromJSON(jfolder);
|
||||
folder.account = account.id;
|
||||
folder.id = db.folder().insertFolder(folder);
|
||||
Log.i(Helper.TAG, "Imported folder=" + folder.name);
|
||||
Log.i("Imported folder=" + folder.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -784,7 +783,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
JSONObject janswer = (JSONObject) janswers.get(a);
|
||||
EntityAnswer answer = EntityAnswer.fromJSON(janswer);
|
||||
answer.id = db.answer().insertAnswer(answer);
|
||||
Log.i(Helper.TAG, "Imported answer=" + answer.name);
|
||||
Log.i("Imported answer=" + answer.name);
|
||||
}
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
@ -805,7 +804,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
editor.putString(key, (String) value);
|
||||
else
|
||||
throw new IllegalArgumentException("Unknown settings type key=" + key);
|
||||
Log.i(Helper.TAG, "Imported setting=" + key);
|
||||
Log.i("Imported setting=" + key);
|
||||
}
|
||||
}
|
||||
editor.apply();
|
||||
|
@ -815,7 +814,7 @@ public class FragmentSetup extends FragmentEx {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
Log.i(Helper.TAG, "Imported data");
|
||||
Log.i("Imported data");
|
||||
ServiceSynchronize.reload(context, "import");
|
||||
} finally {
|
||||
if (in != null)
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -104,7 +103,7 @@ public class FragmentWebView extends FragmentEx {
|
|||
webview.setDownloadListener(new DownloadListener() {
|
||||
public void onDownloadStart(
|
||||
String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
||||
Log.i(Helper.TAG, "Download url=" + url + " mime type=" + mimetype);
|
||||
Log.i("Download url=" + url + " mime type=" + mimetype);
|
||||
|
||||
Uri uri = Uri.parse(url);
|
||||
|
||||
|
@ -168,7 +167,7 @@ public class FragmentWebView extends FragmentEx {
|
|||
}
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
return doc.html();
|
||||
|
@ -207,7 +206,7 @@ public class FragmentWebView extends FragmentEx {
|
|||
final WebView.HitTestResult result = ((WebView) view).getHitTestResult();
|
||||
if (result.getType() == WebView.HitTestResult.IMAGE_TYPE ||
|
||||
result.getType() == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
|
||||
Log.i(Helper.TAG, "Context menu url=" + result.getExtra());
|
||||
Log.i("Context menu url=" + result.getExtra());
|
||||
|
||||
menu.add(Menu.NONE, 1, 0, R.string.title_view)
|
||||
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
|
|
@ -41,7 +41,6 @@ import android.os.Bundle;
|
|||
import android.os.PowerManager;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -90,8 +89,6 @@ import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
|
|||
import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION;
|
||||
|
||||
public class Helper {
|
||||
static final String TAG = "fairemail";
|
||||
|
||||
static final int JOB_DAILY = 1001;
|
||||
|
||||
static final int AUTH_TYPE_PASSWORD = 1;
|
||||
|
@ -115,7 +112,7 @@ public class Helper {
|
|||
}
|
||||
|
||||
static void view(Context context, LifecycleOwner owner, Uri uri, boolean browse) {
|
||||
Log.i(Helper.TAG, "View=" + uri);
|
||||
Log.i("View=" + uri);
|
||||
|
||||
if (!hasCustomTabs(context, uri))
|
||||
browse = true;
|
||||
|
@ -267,7 +264,7 @@ public class Helper {
|
|||
sb.append(context.getString(title)).append("\n\n\n\n");
|
||||
sb.append(Helper.getAppInfo(context));
|
||||
if (ex != null)
|
||||
sb.append(ex.toString()).append("\n").append(Log.getStackTraceString(ex));
|
||||
sb.append(ex.toString()).append("\n").append(android.util.Log.getStackTraceString(ex));
|
||||
if (log != null)
|
||||
sb.append(log);
|
||||
String body = "<pre>" + sb.toString().replaceAll("\\r?\\n", "<br />") + "</pre>";
|
||||
|
@ -526,7 +523,7 @@ public class Helper {
|
|||
"-d",
|
||||
"-v", "threadtime",
|
||||
//"-t", "1000",
|
||||
Helper.TAG + ":I"};
|
||||
Log.TAG + ":I"};
|
||||
proc = Runtime.getRuntime().exec(cmd);
|
||||
br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
|
||||
|
||||
|
@ -615,7 +612,7 @@ public class Helper {
|
|||
}
|
||||
|
||||
if (log)
|
||||
Log.i(Helper.TAG, "isMetered: active info=" + cm.getNetworkInfo(active));
|
||||
Log.i("isMetered: active info=" + cm.getNetworkInfo(active));
|
||||
|
||||
NetworkCapabilities caps = cm.getNetworkCapabilities(active);
|
||||
if (caps == null) {
|
||||
|
@ -625,7 +622,7 @@ public class Helper {
|
|||
}
|
||||
|
||||
if (log)
|
||||
Log.i(Helper.TAG, "isMetered: active caps=" + caps);
|
||||
Log.i("isMetered: active caps=" + caps);
|
||||
|
||||
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)) {
|
||||
boolean unmetered = caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
|
||||
|
@ -642,7 +639,7 @@ public class Helper {
|
|||
for (Network network : networks) {
|
||||
NetworkInfo ni = cm.getNetworkInfo(network);
|
||||
if (log)
|
||||
Log.i(Helper.TAG, "isMetered: underlying info=" + ni);
|
||||
Log.i("isMetered: underlying info=" + ni);
|
||||
|
||||
caps = cm.getNetworkCapabilities(network);
|
||||
if (caps == null) {
|
||||
|
@ -652,17 +649,17 @@ public class Helper {
|
|||
}
|
||||
|
||||
if (log)
|
||||
Log.i(Helper.TAG, "isMetered: underlying caps=" + caps);
|
||||
Log.i("isMetered: underlying caps=" + caps);
|
||||
|
||||
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)) {
|
||||
underlying = true;
|
||||
|
||||
if (log)
|
||||
Log.i(Helper.TAG, "isMetered: underlying caps=" + caps);
|
||||
Log.i("isMetered: underlying caps=" + caps);
|
||||
|
||||
if (ni != null && ni.isConnected()) {
|
||||
if (log)
|
||||
Log.i(Helper.TAG, "isMetered: underlying is connected");
|
||||
Log.i("isMetered: underlying is connected");
|
||||
|
||||
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED)) {
|
||||
if (log)
|
||||
|
@ -671,7 +668,7 @@ public class Helper {
|
|||
}
|
||||
} else {
|
||||
if (log)
|
||||
Log.i(Helper.TAG, "isMetered: underlying is disconnected");
|
||||
Log.i("isMetered: underlying is disconnected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -707,14 +704,14 @@ public class Helper {
|
|||
Account[] accounts = am.getAccountsByType(type);
|
||||
for (Account account : accounts)
|
||||
if (name.equals(account.name)) {
|
||||
Log.i(Helper.TAG, "Refreshing token");
|
||||
Log.i("Refreshing token");
|
||||
am.invalidateAuthToken(type, current);
|
||||
String refreshed = am.blockingGetAuthToken(account, getAuthTokenType(type), true);
|
||||
Log.i(Helper.TAG, "Refreshed token");
|
||||
Log.i("Refreshed token");
|
||||
return refreshed;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.w(TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
@ -733,7 +730,7 @@ public class Helper {
|
|||
try {
|
||||
return "com.android.vending".equals(context.getPackageManager().getInstallerPackageName(context.getPackageName()));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -814,7 +811,7 @@ public class Helper {
|
|||
sb.append(Integer.toString(b & 0xff, 16).toUpperCase());
|
||||
return sb.toString();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.graphics.drawable.Drawable;
|
|||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
@ -121,7 +120,7 @@ public class HtmlHelper {
|
|||
|
||||
boolean embedded = source.startsWith("cid:");
|
||||
boolean data = source.startsWith("data:");
|
||||
Log.i(Helper.TAG, "Image embedded=" + embedded + " data=" + data + " source=" + source);
|
||||
Log.i("Image embedded=" + embedded + " data=" + data + " source=" + source);
|
||||
|
||||
if (show) {
|
||||
// Embedded images
|
||||
|
@ -167,7 +166,7 @@ public class HtmlHelper {
|
|||
d.setBounds(0, 0, bm.getWidth(), bm.getHeight());
|
||||
return d;
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
Drawable d = context.getResources().getDrawable(R.drawable.baseline_broken_image_24, context.getTheme());
|
||||
d.setBounds(0, 0, px / 2, px / 2);
|
||||
return d;
|
||||
|
@ -186,10 +185,10 @@ public class HtmlHelper {
|
|||
|
||||
// Get input stream
|
||||
if (file.exists()) {
|
||||
Log.i(Helper.TAG, "Using cached " + file);
|
||||
Log.i("Using cached " + file);
|
||||
is = new FileInputStream(file);
|
||||
} else {
|
||||
Log.i(Helper.TAG, "Downloading " + source);
|
||||
Log.i("Downloading " + source);
|
||||
is = new URL(source).openStream();
|
||||
}
|
||||
|
||||
|
@ -210,7 +209,7 @@ public class HtmlHelper {
|
|||
return d;
|
||||
} catch (Throwable ex) {
|
||||
// Show warning icon
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
Drawable d = context.getResources().getDrawable(R.drawable.baseline_broken_image_24, context.getTheme());
|
||||
d.setBounds(0, 0, px / 2, px / 2);
|
||||
return d;
|
||||
|
@ -220,14 +219,14 @@ public class HtmlHelper {
|
|||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
Log.w(Helper.TAG, e + "\n" + Log.getStackTraceString(e));
|
||||
Log.w(e);
|
||||
}
|
||||
}
|
||||
if (os != null) {
|
||||
try {
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
Log.w(Helper.TAG, e + "\n" + Log.getStackTraceString(e));
|
||||
Log.w(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ package eu.faircode.email;
|
|||
Copyright 2018 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.selection.ItemDetailsLookup;
|
||||
|
||||
|
@ -34,7 +32,7 @@ public class ItemDetailsMessage extends ItemDetailsLookup.ItemDetails<Long> {
|
|||
@Override
|
||||
public int getPosition() {
|
||||
int pos = viewHolder.getAdapterPosition();
|
||||
Log.i(Helper.TAG, "ItemDetails pos=" + pos);
|
||||
Log.i("ItemDetails pos=" + pos);
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
@ -43,7 +41,7 @@ public class ItemDetailsMessage extends ItemDetailsLookup.ItemDetails<Long> {
|
|||
public Long getSelectionKey() {
|
||||
int pos = viewHolder.getAdapterPosition();
|
||||
Long key = viewHolder.getKey();
|
||||
Log.i(Helper.TAG, "ItemDetails pos=" + pos + " key=" + key);
|
||||
Log.i("ItemDetails pos=" + pos + " key=" + key);
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import android.app.job.JobScheduler;
|
|||
import android.app.job.JobService;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
|
@ -42,7 +41,7 @@ public class JobDaily extends JobService {
|
|||
private static final long KEEP_LOG_DURATION = 24 * 3600 * 1000L; // milliseconds
|
||||
|
||||
public static void schedule(Context context) {
|
||||
Log.i(Helper.TAG, "Scheduling daily job");
|
||||
Log.i("Scheduling daily job");
|
||||
|
||||
JobInfo.Builder job = new JobInfo.Builder(Helper.JOB_DAILY, new ComponentName(context, JobDaily.class))
|
||||
.setPeriodic(CLEANUP_INTERVAL)
|
||||
|
@ -51,9 +50,9 @@ public class JobDaily extends JobService {
|
|||
JobScheduler scheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
|
||||
scheduler.cancel(Helper.JOB_DAILY);
|
||||
if (scheduler.schedule(job.build()) == JobScheduler.RESULT_SUCCESS)
|
||||
Log.i(Helper.TAG, "Scheduled daily job");
|
||||
Log.i("Scheduled daily job");
|
||||
else
|
||||
Log.e(Helper.TAG, "Scheduling daily job failed");
|
||||
Log.e("Scheduling daily job failed");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,10 +74,10 @@ public class JobDaily extends JobService {
|
|||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
Log.i(Helper.TAG, "Start daily job");
|
||||
Log.i("Start daily job");
|
||||
|
||||
// Cleanup folders
|
||||
Log.i(Helper.TAG, "Cleanup folders");
|
||||
Log.i("Cleanup folders");
|
||||
for (EntityFolder folder : db.folder().getFolders()) {
|
||||
Calendar cal_keep = Calendar.getInstance();
|
||||
cal_keep.add(Calendar.DAY_OF_MONTH, -folder.keep_days);
|
||||
|
@ -93,62 +92,62 @@ public class JobDaily extends JobService {
|
|||
|
||||
int messages = db.message().deleteMessagesBefore(folder.id, keep_time, false);
|
||||
if (messages > 0)
|
||||
Log.i(Helper.TAG, "Cleanup folder=" + folder.account + "/" + folder.name +
|
||||
Log.i("Cleanup folder=" + folder.account + "/" + folder.name +
|
||||
" before=" + new Date(keep_time) + " deleted=" + messages);
|
||||
}
|
||||
|
||||
long now = new Date().getTime();
|
||||
|
||||
// Cleanup message files
|
||||
Log.i(Helper.TAG, "Cleanup message files");
|
||||
Log.i("Cleanup message files");
|
||||
File[] messages = new File(context.getFilesDir(), "messages").listFiles();
|
||||
if (messages != null)
|
||||
for (File file : messages)
|
||||
if (file.isFile() && (now - file.lastModified()) > FILE_DELETE_THRESHOLD) {
|
||||
long id = Long.parseLong(file.getName());
|
||||
if (db.message().countMessage(id) == 0) {
|
||||
Log.i(Helper.TAG, "Cleanup message id=" + id);
|
||||
Log.i("Cleanup message id=" + id);
|
||||
if (!file.delete())
|
||||
Log.w(Helper.TAG, "Error deleting " + file);
|
||||
Log.w("Error deleting " + file);
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup attachment files
|
||||
Log.i(Helper.TAG, "Cleanup attachment files");
|
||||
Log.i("Cleanup attachment files");
|
||||
File[] attachments = new File(context.getFilesDir(), "attachments").listFiles();
|
||||
if (attachments != null)
|
||||
for (File file : attachments)
|
||||
if (file.isFile() && (now - file.lastModified()) > FILE_DELETE_THRESHOLD) {
|
||||
long id = Long.parseLong(file.getName());
|
||||
if (db.attachment().countAttachment(id) == 0) {
|
||||
Log.i(Helper.TAG, "Cleanup attachment id=" + id);
|
||||
Log.i("Cleanup attachment id=" + id);
|
||||
if (!file.delete())
|
||||
Log.w(Helper.TAG, "Error deleting " + file);
|
||||
Log.w("Error deleting " + file);
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup cached images
|
||||
Log.i(Helper.TAG, "Cleanup cached image files");
|
||||
Log.i("Cleanup cached image files");
|
||||
File[] images = new File(context.getCacheDir(), "images").listFiles();
|
||||
if (images != null)
|
||||
for (File file : images)
|
||||
if (file.isFile() && (now - file.lastModified()) > CACHE_IMAGE_DURATION) {
|
||||
Log.i(Helper.TAG, "Deleting cached image=" + file.getName());
|
||||
Log.i("Deleting cached image=" + file.getName());
|
||||
if (!file.delete())
|
||||
Log.w(Helper.TAG, "Error deleting " + file);
|
||||
Log.w("Error deleting " + file);
|
||||
}
|
||||
|
||||
Log.i(Helper.TAG, "Cleanup log");
|
||||
Log.i("Cleanup log");
|
||||
long before = now - KEEP_LOG_DURATION;
|
||||
int logs = db.log().deleteLogs(before);
|
||||
Log.i(Helper.TAG, "Deleted logs=" + logs);
|
||||
Log.i("Deleted logs=" + logs);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
Log.i(Helper.TAG, "End daily job");
|
||||
Log.i("End daily job");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package eu.faircode.email;
|
||||
|
||||
public class Log {
|
||||
static final String TAG = "fairemail";
|
||||
|
||||
public static int i(String msg) {
|
||||
return android.util.Log.i(TAG, msg);
|
||||
}
|
||||
|
||||
public static int w(String msg) {
|
||||
return android.util.Log.w(TAG, msg);
|
||||
}
|
||||
|
||||
public static int e(String msg) {
|
||||
return android.util.Log.e(TAG, msg);
|
||||
}
|
||||
|
||||
public static int w(Throwable ex) {
|
||||
return android.util.Log.w(TAG, ex + "\n" + android.util.Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
public static int e(Throwable ex) {
|
||||
return android.util.Log.e(TAG, ex + "\n" + android.util.Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
public static int w(String prefix, Throwable ex) {
|
||||
return android.util.Log.w(TAG, prefix + " " + ex + "\n" + android.util.Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
public static int e(String prefix, Throwable ex) {
|
||||
return android.util.Log.e(TAG, prefix + " " + ex + "\n" + android.util.Log.getStackTraceString(ex));
|
||||
}
|
||||
}
|
|
@ -22,7 +22,6 @@ package eu.faircode.email;
|
|||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
|
@ -159,12 +158,12 @@ public class MessageHelper {
|
|||
System.setProperty("mail.mime.multipart.ignoreexistingboundaryparameter", "true");
|
||||
|
||||
if (false) {
|
||||
Log.i(Helper.TAG, "Prefering IPv4");
|
||||
Log.i("Prefering IPv4");
|
||||
System.setProperty("java.net.preferIPv4Stack", "true");
|
||||
}
|
||||
|
||||
// https://javaee.github.io/javamail/OAuth2
|
||||
Log.i(Helper.TAG, "Auth type=" + auth_type);
|
||||
Log.i("Auth type=" + auth_type);
|
||||
if (auth_type == Helper.AUTH_TYPE_GMAIL) {
|
||||
props.put("mail.imaps.auth.mechanisms", "XOAUTH2");
|
||||
props.put("mail.imap.auth.mechanisms", "XOAUTH2");
|
||||
|
@ -201,7 +200,7 @@ public class MessageHelper {
|
|||
if (email != null && !TextUtils.isEmpty(message.extra)) {
|
||||
int at = email.indexOf('@');
|
||||
email = email.substring(0, at) + message.extra + email.substring(at);
|
||||
Log.i(Helper.TAG, "extra=" + email);
|
||||
Log.i("extra=" + email);
|
||||
}
|
||||
imessage.setFrom(new InternetAddress(email, name));
|
||||
}
|
||||
|
@ -502,13 +501,13 @@ public class MessageHelper {
|
|||
} catch (UnsupportedEncodingException ex) {
|
||||
// x-binaryenc
|
||||
// https://javaee.github.io/javamail/FAQ#unsupen
|
||||
Log.w(Helper.TAG, "Unsupported encoding: " + part.getContentType());
|
||||
Log.w("Unsupported encoding: " + part.getContentType());
|
||||
return readStream(part.getInputStream(), "US-ASCII");
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// IOException; Unknown encoding: none
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
return "<pre>" + ex + "<br />" + Log.getStackTraceString(ex) + "</pre>";
|
||||
Log.w(ex);
|
||||
return "<pre>" + ex + "<br />" + android.util.Log.getStackTraceString(ex) + "</pre>";
|
||||
}
|
||||
|
||||
if (part.isMimeType("text/plain"))
|
||||
|
@ -535,8 +534,8 @@ public class MessageHelper {
|
|||
}
|
||||
} catch (ParseException ex) {
|
||||
// ParseException: In parameter list boundary="...">, expected parameter name, got ";"
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
text = "<pre>" + ex + "<br />" + Log.getStackTraceString(ex) + "</pre>";
|
||||
Log.w(ex);
|
||||
text = "<pre>" + ex + "<br />" + android.util.Log.getStackTraceString(ex) + "</pre>";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
@ -550,8 +549,8 @@ public class MessageHelper {
|
|||
return s;
|
||||
}
|
||||
} catch (ParseException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
return "<pre>" + ex + "<br />" + Log.getStackTraceString(ex) + "</pre>";
|
||||
Log.w(ex);
|
||||
return "<pre>" + ex + "<br />" + android.util.Log.getStackTraceString(ex) + "</pre>";
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -572,11 +571,11 @@ public class MessageHelper {
|
|||
}
|
||||
} catch (IOException ex) {
|
||||
if (ex.getCause() instanceof MessagingException)
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
else
|
||||
throw ex;
|
||||
} catch (ParseException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -590,10 +589,10 @@ public class MessageHelper {
|
|||
try {
|
||||
content = part.getContent();
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Log.w(Helper.TAG, "attachment content type=" + part.getContentType());
|
||||
Log.w("attachment content type=" + part.getContentType());
|
||||
content = part.getInputStream();
|
||||
} catch (ParseException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
content = null;
|
||||
}
|
||||
|
||||
|
@ -602,7 +601,7 @@ public class MessageHelper {
|
|||
try {
|
||||
disposition = part.getDisposition();
|
||||
} catch (MessagingException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
disposition = null;
|
||||
}
|
||||
|
||||
|
@ -610,7 +609,7 @@ public class MessageHelper {
|
|||
try {
|
||||
filename = part.getFileName();
|
||||
} catch (MessagingException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
filename = null;
|
||||
}
|
||||
|
||||
|
@ -635,7 +634,7 @@ public class MessageHelper {
|
|||
if (extension != null) {
|
||||
String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
|
||||
if (type != null) {
|
||||
Log.w(Helper.TAG, "Guessing file=" + attachment.name + " type=" + type);
|
||||
Log.w("Guessing file=" + attachment.name + " type=" + type);
|
||||
attachment.type = type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ package eu.faircode.email;
|
|||
Copyright 2018 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
@ -39,7 +37,7 @@ public class MimeMessageEx extends MimeMessage {
|
|||
super.updateMessageID();
|
||||
else {
|
||||
setHeader("Message-ID", msgid);
|
||||
Log.v(Helper.TAG, "Override Message-ID=" + msgid);
|
||||
Log.i("Override Message-ID=" + msgid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package eu.faircode.email;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.util.Log;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
|
@ -89,7 +88,7 @@ public class Provider {
|
|||
eventType = xml.next();
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
final Collator collator = Collator.getInstance(Locale.getDefault());
|
||||
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc
|
||||
|
|
|
@ -50,7 +50,6 @@ import android.preference.PreferenceManager;
|
|||
import android.provider.ContactsContract;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.LongSparseArray;
|
||||
|
||||
import com.sun.mail.iap.ConnectionException;
|
||||
|
@ -158,7 +157,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Log.i(Helper.TAG, "Service create version=" + BuildConfig.VERSION_NAME);
|
||||
Log.i("Service create version=" + BuildConfig.VERSION_NAME);
|
||||
super.onCreate();
|
||||
|
||||
// Listen for network changes
|
||||
|
@ -188,7 +187,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Log.i(Helper.TAG, "Notification messages=" + messages.size());
|
||||
Log.i("Notification messages=" + messages.size());
|
||||
|
||||
Widget.update(ServiceSynchronize.this, messages.size());
|
||||
|
||||
|
@ -222,11 +221,11 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
all.add(id);
|
||||
if (removed.contains(id)) {
|
||||
removed.remove(id);
|
||||
Log.i(Helper.TAG, "Notification removing=" + id);
|
||||
Log.i("Notification removing=" + id);
|
||||
} else {
|
||||
removed.remove(Integer.valueOf(-id));
|
||||
added.add(id);
|
||||
Log.i(Helper.TAG, "Notification adding=" + id);
|
||||
Log.i("Notification adding=" + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +235,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (id < 0)
|
||||
headers++;
|
||||
|
||||
Log.i(Helper.TAG, "Notification account=" + account +
|
||||
Log.i("Notification account=" + account +
|
||||
" notifications=" + notifications.size() + " all=" + all.size() +
|
||||
" added=" + added.size() + " removed=" + removed.size() + " headers=" + headers);
|
||||
|
||||
|
@ -258,7 +257,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
notifying.put(account, all);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -268,7 +267,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.i(Helper.TAG, "Service destroy");
|
||||
Log.i("Service destroy");
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
cm.unregisterNetworkCallback(serviceManager);
|
||||
|
@ -288,7 +287,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
String action = (intent == null ? null : intent.getAction());
|
||||
Log.i(Helper.TAG, "Service command intent=" + intent + " action=" + action);
|
||||
Log.i("Service command intent=" + intent + " action=" + action);
|
||||
|
||||
startForeground(NOTIFICATION_SYNCHRONIZE, getNotificationService(null).build());
|
||||
|
||||
|
@ -370,7 +369,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
break;
|
||||
|
||||
default:
|
||||
Log.w(Helper.TAG, "Unknown action: " + parts[0]);
|
||||
Log.w("Unknown action: " + parts[0]);
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
@ -382,7 +381,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
break;
|
||||
|
||||
default:
|
||||
Log.w(Helper.TAG, "Unknown action: " + action);
|
||||
Log.w("Unknown action: " + action);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -627,7 +626,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
sb.append(Jsoup.parse(html).text());
|
||||
mbuilder.setStyle(new Notification.BigTextStyle().bigText(Html.fromHtml(sb.toString())));
|
||||
} catch (IOException ex) {
|
||||
Log.e(Helper.TAG, ex + "/n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
mbuilder.setStyle(new Notification.BigTextStyle().bigText(ex.toString()));
|
||||
}
|
||||
|
||||
|
@ -659,7 +658,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
}
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
@ -794,7 +793,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
int backoff = CONNECT_BACKOFF_START;
|
||||
while (state.running()) {
|
||||
Log.i(Helper.TAG, account.name + " run");
|
||||
Log.i(account.name + " run");
|
||||
|
||||
// Debug
|
||||
boolean debug = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("debug", false);
|
||||
|
@ -825,7 +824,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
reportError(account, null, new AlertException(e.getMessage()));
|
||||
state.error();
|
||||
} else
|
||||
Log.i(Helper.TAG, account.name + " " + type + ": " + e.getMessage());
|
||||
Log.i(account.name + " " + type + ": " + e.getMessage());
|
||||
} finally {
|
||||
wlAccount.release();
|
||||
}
|
||||
|
@ -838,7 +837,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
public void folderCreated(FolderEvent e) {
|
||||
try {
|
||||
wlAccount.acquire();
|
||||
Log.i(Helper.TAG, "Folder created=" + e.getFolder().getFullName());
|
||||
Log.i("Folder created=" + e.getFolder().getFullName());
|
||||
reload(ServiceSynchronize.this, "folder created");
|
||||
} finally {
|
||||
wlAccount.release();
|
||||
|
@ -849,12 +848,12 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
public void folderRenamed(FolderEvent e) {
|
||||
try {
|
||||
wlAccount.acquire();
|
||||
Log.i(Helper.TAG, "Folder renamed=" + e.getFolder().getFullName());
|
||||
Log.i("Folder renamed=" + e.getFolder().getFullName());
|
||||
|
||||
String old = e.getFolder().getFullName();
|
||||
String name = e.getNewFolder().getFullName();
|
||||
int count = db.folder().renameFolder(account.id, old, name);
|
||||
Log.i(Helper.TAG, "Renamed to " + name + " count=" + count);
|
||||
Log.i("Renamed to " + name + " count=" + count);
|
||||
|
||||
reload(ServiceSynchronize.this, "folder renamed");
|
||||
} finally {
|
||||
|
@ -866,7 +865,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
public void folderDeleted(FolderEvent e) {
|
||||
try {
|
||||
wlAccount.acquire();
|
||||
Log.i(Helper.TAG, "Folder deleted=" + e.getFolder().getFullName());
|
||||
Log.i("Folder deleted=" + e.getFolder().getFullName());
|
||||
reload(ServiceSynchronize.this, "folder deleted");
|
||||
} finally {
|
||||
wlAccount.release();
|
||||
|
@ -878,17 +877,17 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
istore.addConnectionListener(new ConnectionAdapter() {
|
||||
@Override
|
||||
public void opened(ConnectionEvent e) {
|
||||
Log.i(Helper.TAG, account.name + " opened event");
|
||||
Log.i(account.name + " opened event");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(ConnectionEvent e) {
|
||||
Log.e(Helper.TAG, account.name + " disconnected event");
|
||||
Log.e(account.name + " disconnected event");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closed(ConnectionEvent e) {
|
||||
Log.e(Helper.TAG, account.name + " closed event");
|
||||
Log.e(account.name + " closed event");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -907,7 +906,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
long now = new Date().getTime();
|
||||
long delayed = now - account.last_connected;
|
||||
if (delayed > ACCOUNT_ERROR_AFTER * 60 * 1000L) {
|
||||
Log.i(Helper.TAG, "Reporting sync error after=" + delayed);
|
||||
Log.i("Reporting sync error after=" + delayed);
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.notify("receive", account.id.intValue(),
|
||||
getNotificationError(account.name, account.last_connected, ex, false).build());
|
||||
|
@ -918,7 +917,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
}
|
||||
|
||||
final boolean capIdle = istore.hasCapability("IDLE");
|
||||
Log.i(Helper.TAG, account.name + " idle=" + capIdle);
|
||||
Log.i(account.name + " idle=" + capIdle);
|
||||
|
||||
db.account().setAccountState(account.id, "connected");
|
||||
|
||||
|
@ -934,7 +933,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
final ExecutorService pollExecutor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||
for (final EntityFolder folder : db.folder().getFolders(account.id)) {
|
||||
if (folder.synchronize && !folder.poll && capIdle) {
|
||||
Log.i(Helper.TAG, account.name + " sync folder " + folder.name);
|
||||
Log.i(account.name + " sync folder " + folder.name);
|
||||
|
||||
db.folder().setFolderState(folder.id, "connecting");
|
||||
|
||||
|
@ -950,7 +949,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
db.folder().setFolderState(folder.id, "connected");
|
||||
db.folder().setFolderError(folder.id, null);
|
||||
|
||||
Log.i(Helper.TAG, account.name + " folder " + folder.name + " flags=" + ifolder.getPermanentFlags());
|
||||
Log.i(account.name + " folder " + folder.name + " flags=" + ifolder.getPermanentFlags());
|
||||
|
||||
// Listen for new and deleted messages
|
||||
ifolder.addMessageCountListener(new MessageCountAdapter() {
|
||||
|
@ -958,7 +957,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
public void messagesAdded(MessageCountEvent e) {
|
||||
try {
|
||||
wlAccount.acquire();
|
||||
Log.i(Helper.TAG, folder.name + " messages added");
|
||||
Log.i(folder.name + " messages added");
|
||||
|
||||
FetchProfile fp = new FetchProfile();
|
||||
fp.add(FetchProfile.Item.ENVELOPE);
|
||||
|
@ -993,22 +992,22 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
db.endTransaction();
|
||||
}
|
||||
} catch (MessageRemovedException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
} catch (FolderClosedException ex) {
|
||||
throw ex;
|
||||
} catch (IOException ex) {
|
||||
if (ex.getCause() instanceof MessagingException) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
if (!(ex.getCause() instanceof MessageRemovedException))
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
} else
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
reportError(account, folder, ex);
|
||||
state.error();
|
||||
} finally {
|
||||
|
@ -1020,7 +1019,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
public void messagesRemoved(MessageCountEvent e) {
|
||||
try {
|
||||
wlAccount.acquire();
|
||||
Log.i(Helper.TAG, folder.name + " messages removed");
|
||||
Log.i(folder.name + " messages removed");
|
||||
for (Message imessage : e.getMessages())
|
||||
try {
|
||||
long uid = ifolder.getUID(imessage);
|
||||
|
@ -1028,12 +1027,12 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
DB db = DB.getInstance(ServiceSynchronize.this);
|
||||
int count = db.message().deleteMessage(folder.id, uid);
|
||||
|
||||
Log.i(Helper.TAG, "Deleted uid=" + uid + " count=" + count);
|
||||
Log.i("Deleted uid=" + uid + " count=" + count);
|
||||
} catch (MessageRemovedException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
reportError(account, folder, ex);
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
state.error();
|
||||
|
@ -1052,7 +1051,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
try {
|
||||
wlAccount.acquire();
|
||||
try {
|
||||
Log.i(Helper.TAG, folder.name + " message changed");
|
||||
Log.i(folder.name + " message changed");
|
||||
|
||||
FetchProfile fp = new FetchProfile();
|
||||
fp.add(UIDFolder.FetchProfileItem.UID);
|
||||
|
@ -1079,22 +1078,22 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
db.endTransaction();
|
||||
}
|
||||
} catch (MessageRemovedException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
} catch (FolderClosedException ex) {
|
||||
throw ex;
|
||||
} catch (IOException ex) {
|
||||
if (ex.getCause() instanceof MessagingException) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
if (!(ex.getCause() instanceof MessageRemovedException))
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
} else
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
reportError(account, folder, ex);
|
||||
state.error();
|
||||
} finally {
|
||||
|
@ -1108,18 +1107,18 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Log.i(Helper.TAG, folder.name + " start idle");
|
||||
Log.i(folder.name + " start idle");
|
||||
while (state.running()) {
|
||||
Log.v(Helper.TAG, folder.name + " do idle");
|
||||
Log.i(folder.name + " do idle");
|
||||
ifolder.idle(false);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
reportError(account, folder, ex);
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
state.error();
|
||||
} finally {
|
||||
Log.i(Helper.TAG, folder.name + " end idle");
|
||||
Log.i(folder.name + " end idle");
|
||||
}
|
||||
}
|
||||
}, "idler." + folder.id);
|
||||
|
@ -1136,7 +1135,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
@Override
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
Log.i(Helper.TAG, account.name + "/" + folder.name + " observe=" + msg.what);
|
||||
Log.i(account.name + "/" + folder.name + " observe=" + msg.what);
|
||||
try {
|
||||
if (msg.what == 0)
|
||||
liveOperations.removeObserver(observer);
|
||||
|
@ -1145,7 +1144,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
liveOperations.observe(ServiceSynchronize.this, observer);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1167,20 +1166,20 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
handling = current;
|
||||
|
||||
if (handling.size() > 0 && process) {
|
||||
Log.i(Helper.TAG, folder.name + " operations=" + operations.size());
|
||||
Log.i(folder.name + " operations=" + operations.size());
|
||||
(folder.poll ? pollExecutor : folderExecutor).submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
wlFolder.acquire();
|
||||
Log.i(Helper.TAG, folder.name + " process");
|
||||
Log.i(folder.name + " process");
|
||||
|
||||
// Get folder
|
||||
IMAPFolder ifolder = folders.get(folder); // null when polling
|
||||
final boolean shouldClose = (ifolder == null);
|
||||
|
||||
try {
|
||||
Log.i(Helper.TAG, folder.name + " run " + (shouldClose ? "offline" : "online"));
|
||||
Log.i(folder.name + " run " + (shouldClose ? "offline" : "online"));
|
||||
|
||||
if (ifolder == null) {
|
||||
// Prevent unnecessary folder connections
|
||||
|
@ -1199,7 +1198,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
processOperations(account, folder, isession, istore, ifolder, state);
|
||||
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
reportError(account, folder, ex);
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
state.error();
|
||||
|
@ -1210,7 +1209,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
try {
|
||||
ifolder.close(false);
|
||||
} catch (MessagingException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
}
|
||||
}
|
||||
db.folder().setFolderState(folder.id, null);
|
||||
|
@ -1227,7 +1226,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
boolean eq = super.equals(obj);
|
||||
Log.i(Helper.TAG, account.name + "/" + folder.name + " equal=" + eq + " observer=" + observer + " other=" + obj);
|
||||
Log.i(account.name + "/" + folder.name + " equal=" + eq + " observer=" + observer + " other=" + obj);
|
||||
return eq;
|
||||
}
|
||||
};
|
||||
|
@ -1303,9 +1302,9 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
unregisterReceiver(alarm);
|
||||
}
|
||||
|
||||
Log.i(Helper.TAG, account.name + " done state=" + state);
|
||||
Log.i(account.name + " done state=" + state);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, account.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(account.name, ex);
|
||||
reportError(account, null, ex);
|
||||
|
||||
EntityLog.log(ServiceSynchronize.this, account.name + " " + Helper.formatThrowable(ex));
|
||||
|
@ -1328,7 +1327,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
istore.close();
|
||||
EntityLog.log(ServiceSynchronize.this, account.name + " store closed");
|
||||
} catch (Throwable ex) {
|
||||
Log.w(Helper.TAG, account.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(account.name, ex);
|
||||
} finally {
|
||||
EntityLog.log(this, account.name + " closed");
|
||||
db.account().setAccountState(account.id, null);
|
||||
|
@ -1394,7 +1393,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (backoff <= CONNECT_BACKOFF_MAX)
|
||||
backoff *= 2;
|
||||
} catch (InterruptedException ex) {
|
||||
Log.w(Helper.TAG, account.name + " backoff " + ex.toString());
|
||||
Log.w(account.name + " backoff " + ex.toString());
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
@ -1405,16 +1404,16 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
private void processOperations(EntityAccount account, EntityFolder folder, Session isession, IMAPStore istore, IMAPFolder ifolder, ServiceState state) throws MessagingException, JSONException, IOException {
|
||||
try {
|
||||
Log.i(Helper.TAG, folder.name + " start process");
|
||||
Log.i(folder.name + " start process");
|
||||
|
||||
DB db = DB.getInstance(this);
|
||||
List<EntityOperation> ops = db.operation().getOperationsByFolder(
|
||||
folder.id, EntityFolder.OUTBOX.equals(folder.type));
|
||||
Log.i(Helper.TAG, folder.name + " pending operations=" + ops.size());
|
||||
Log.i(folder.name + " pending operations=" + ops.size());
|
||||
for (int i = 0; i < ops.size() && state.running(); i++) {
|
||||
EntityOperation op = ops.get(i);
|
||||
try {
|
||||
Log.i(Helper.TAG, folder.name +
|
||||
Log.i(folder.name +
|
||||
" start op=" + op.id + "/" + op.name +
|
||||
" msg=" + op.message +
|
||||
" args=" + op.args);
|
||||
|
@ -1502,7 +1501,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (ex instanceof MessageRemovedException ||
|
||||
ex instanceof FolderNotFoundException ||
|
||||
ex instanceof SendFailedException) {
|
||||
Log.w(Helper.TAG, "Unrecoverable " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w("Unrecoverable", ex);
|
||||
|
||||
// There is no use in repeating
|
||||
db.operation().deleteOperation(op.id);
|
||||
|
@ -1510,7 +1509,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
} else if (ex instanceof MessagingException) {
|
||||
// Socket timeout is a recoverable condition (send message)
|
||||
if (ex.getCause() instanceof SocketTimeoutException) {
|
||||
Log.w(Helper.TAG, "Recoverable " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w("Recoverable", ex);
|
||||
// No need to inform user
|
||||
return;
|
||||
}
|
||||
|
@ -1519,11 +1518,11 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
throw ex;
|
||||
}
|
||||
} finally {
|
||||
Log.i(Helper.TAG, folder.name + " end op=" + op.id + "/" + op.name);
|
||||
Log.i(folder.name + " end op=" + op.id + "/" + op.name);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Log.i(Helper.TAG, folder.name + " end process state=" + state);
|
||||
Log.i(folder.name + " end process state=" + state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1659,7 +1658,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
Folder itarget = istore.getFolder(target.name);
|
||||
ifolder.moveMessages(new Message[]{imessage}, itarget);
|
||||
} else {
|
||||
Log.w(Helper.TAG, "MOVE by DELETE/APPEND");
|
||||
Log.w("MOVE by DELETE/APPEND");
|
||||
|
||||
// Delete source
|
||||
imessage.setFlag(Flags.Flag.DELETED, true);
|
||||
|
@ -1680,7 +1679,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (message.msgid != null) {
|
||||
Message[] imessages = ifolder.search(new MessageIDTerm(message.msgid));
|
||||
for (Message imessage : imessages) {
|
||||
Log.i(Helper.TAG, "Deleting uid=" + message.uid + " msgid=" + message.msgid);
|
||||
Log.i("Deleting uid=" + message.uid + " msgid=" + message.msgid);
|
||||
imessage.setFlag(Flags.Flag.DELETED, true);
|
||||
}
|
||||
ifolder.expunge();
|
||||
|
@ -1759,7 +1758,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
// Send message
|
||||
Address[] to = imessage.getAllRecipients();
|
||||
itransport.sendMessage(imessage, to);
|
||||
Log.i(Helper.TAG, "Sent via " + ident.host + "/" + ident.user +
|
||||
Log.i("Sent via " + ident.host + "/" + ident.user +
|
||||
" to " + TextUtils.join(", ", to));
|
||||
|
||||
try {
|
||||
|
@ -1786,7 +1785,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
message.folder = sent.id;
|
||||
message.uid = null;
|
||||
db.message().updateMessage(message);
|
||||
Log.i(Helper.TAG, "Appending sent msgid=" + message.msgid);
|
||||
Log.i("Appending sent msgid=" + message.msgid);
|
||||
EntityOperation.queue(db, message, EntityOperation.ADD); // Could already exist
|
||||
}
|
||||
}
|
||||
|
@ -1827,7 +1826,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
long now = new Date().getTime();
|
||||
long delayed = now - message.last_attempt;
|
||||
if (delayed > IDENTITY_ERROR_AFTER * 60 * 1000L) {
|
||||
Log.i(Helper.TAG, "Reporting send error after=" + delayed);
|
||||
Log.i("Reporting send error after=" + delayed);
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.notify("send", message.identity.intValue(), getNotificationError(ident.name, ex).build());
|
||||
}
|
||||
|
@ -1904,7 +1903,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
Log.v(Helper.TAG, "Start sync folders account=" + account.name);
|
||||
Log.i("Start sync folders account=" + account.name);
|
||||
|
||||
List<String> names = new ArrayList<>();
|
||||
for (EntityFolder folder : db.folder().getFolders(account.id)) {
|
||||
|
@ -1923,12 +1922,12 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
db.folder().deleteFolder(folder.id);
|
||||
}
|
||||
}
|
||||
Log.i(Helper.TAG, "Local folder count=" + names.size());
|
||||
Log.i("Local folder count=" + names.size());
|
||||
|
||||
Folder defaultFolder = istore.getDefaultFolder();
|
||||
char separator = defaultFolder.getSeparator();
|
||||
Folder[] ifolders = defaultFolder.list("*");
|
||||
Log.i(Helper.TAG, "Remote folder count=" + ifolders.length + " separator=" + separator);
|
||||
Log.i("Remote folder count=" + ifolders.length + " separator=" + separator);
|
||||
|
||||
for (Folder ifolder : ifolders) {
|
||||
String fullName = ifolder.getFullName();
|
||||
|
@ -1936,7 +1935,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
String type = null;
|
||||
boolean selectable = true;
|
||||
String[] attrs = ((IMAPFolder) ifolder).getAttributes();
|
||||
Log.i(Helper.TAG, account.name + ":" + fullName +
|
||||
Log.i(account.name + ":" + fullName +
|
||||
" attrs=" + TextUtils.join(" ", attrs));
|
||||
for (String attr : attrs) {
|
||||
if ("\\Noselect".equals(attr) || "\\NonExistent".equals(attr))
|
||||
|
@ -1976,9 +1975,9 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
folder.sync_days = EntityFolder.DEFAULT_SYNC;
|
||||
folder.keep_days = EntityFolder.DEFAULT_KEEP;
|
||||
db.folder().insertFolder(folder);
|
||||
Log.i(Helper.TAG, folder.name + " added");
|
||||
Log.i(folder.name + " added");
|
||||
} else {
|
||||
Log.i(Helper.TAG, folder.name + " exists");
|
||||
Log.i(folder.name + " exists");
|
||||
|
||||
if (folder.display == null) {
|
||||
if (display != null)
|
||||
|
@ -1999,16 +1998,16 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
}
|
||||
}
|
||||
|
||||
Log.i(Helper.TAG, "Delete local count=" + names.size());
|
||||
Log.i("Delete local count=" + names.size());
|
||||
for (String name : names) {
|
||||
Log.i(Helper.TAG, name + " delete");
|
||||
Log.i(name + " delete");
|
||||
db.folder().deleteFolder(account.id, name);
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
Log.v(Helper.TAG, "End sync folder");
|
||||
Log.i("End sync folder");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2018,7 +2017,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
int sync_days = jargs.getInt(0);
|
||||
int keep_days = jargs.getInt(1);
|
||||
|
||||
Log.v(Helper.TAG, folder.name + " start sync after=" + sync_days + "/" + keep_days);
|
||||
Log.i(folder.name + " start sync after=" + sync_days + "/" + keep_days);
|
||||
|
||||
db.folder().setFolderSyncState(folder.id, "syncing");
|
||||
|
||||
|
@ -2045,15 +2044,15 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (keep_time < 0)
|
||||
keep_time = 0;
|
||||
|
||||
Log.i(Helper.TAG, folder.name + " sync=" + new Date(sync_time) + " keep=" + new Date(keep_time));
|
||||
Log.i(folder.name + " sync=" + new Date(sync_time) + " keep=" + new Date(keep_time));
|
||||
|
||||
// Delete old local messages
|
||||
int old = db.message().deleteMessagesBefore(folder.id, keep_time, false);
|
||||
Log.i(Helper.TAG, folder.name + " local old=" + old);
|
||||
Log.i(folder.name + " local old=" + old);
|
||||
|
||||
// Get list of local uids
|
||||
List<Long> uids = db.message().getUids(folder.id, sync_time);
|
||||
Log.i(Helper.TAG, folder.name + " local count=" + uids.size());
|
||||
Log.i(folder.name + " local count=" + uids.size());
|
||||
|
||||
// Reduce list of local uids
|
||||
long search = SystemClock.elapsedRealtime();
|
||||
|
@ -2063,7 +2062,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
new FlagTerm(new Flags(Flags.Flag.FLAGGED), true)
|
||||
)
|
||||
);
|
||||
Log.i(Helper.TAG, folder.name + " remote count=" + imessages.length +
|
||||
Log.i(folder.name + " remote count=" + imessages.length +
|
||||
" search=" + (SystemClock.elapsedRealtime() - search) + " ms");
|
||||
|
||||
FetchProfile fp = new FetchProfile();
|
||||
|
@ -2072,24 +2071,24 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
ifolder.fetch(imessages, fp);
|
||||
|
||||
long fetch = SystemClock.elapsedRealtime();
|
||||
Log.i(Helper.TAG, folder.name + " remote fetched=" + (SystemClock.elapsedRealtime() - fetch) + " ms");
|
||||
Log.i(folder.name + " remote fetched=" + (SystemClock.elapsedRealtime() - fetch) + " ms");
|
||||
|
||||
for (int i = 0; i < imessages.length && state.running(); i++)
|
||||
try {
|
||||
uids.remove(ifolder.getUID(imessages[i]));
|
||||
} catch (MessageRemovedException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
reportError(account, folder, ex);
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
}
|
||||
|
||||
// Delete local messages not at remote
|
||||
Log.i(Helper.TAG, folder.name + " delete=" + uids.size());
|
||||
Log.i(folder.name + " delete=" + uids.size());
|
||||
for (Long uid : uids) {
|
||||
int count = db.message().deleteMessage(folder.id, uid);
|
||||
Log.i(Helper.TAG, folder.name + " delete local uid=" + uid + " count=" + count);
|
||||
Log.i(folder.name + " delete local uid=" + uid + " count=" + count);
|
||||
}
|
||||
|
||||
fp.add(FetchProfile.Item.ENVELOPE);
|
||||
|
@ -2103,7 +2102,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
// Add/update local messages
|
||||
Long[] ids = new Long[imessages.length];
|
||||
Log.i(Helper.TAG, folder.name + " add=" + imessages.length);
|
||||
Log.i(folder.name + " add=" + imessages.length);
|
||||
for (int i = imessages.length - 1; i >= 0 && state.running(); i -= SYNC_BATCH_SIZE) {
|
||||
int from = Math.max(0, i - SYNC_BATCH_SIZE + 1);
|
||||
Message[] isub = Arrays.copyOfRange(imessages, from, i + 1);
|
||||
|
@ -2119,7 +2118,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (full.size() > 0) {
|
||||
long headers = SystemClock.elapsedRealtime();
|
||||
ifolder.fetch(full.toArray(new Message[0]), fp);
|
||||
Log.i(Helper.TAG, folder.name + " fetched headers=" + full.size() +
|
||||
Log.i(folder.name + " fetched headers=" + full.size() +
|
||||
" " + (SystemClock.elapsedRealtime() - headers) + " ms");
|
||||
}
|
||||
|
||||
|
@ -2132,18 +2131,18 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
ids[from + j] = message.id;
|
||||
db.setTransactionSuccessful();
|
||||
} catch (MessageRemovedException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
} catch (FolderClosedException ex) {
|
||||
throw ex;
|
||||
} catch (IOException ex) {
|
||||
if (ex.getCause() instanceof MessagingException) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name, ex);
|
||||
if (!(ex.getCause() instanceof MessageRemovedException))
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
} else
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
|
@ -2163,7 +2162,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
//fp.add(IMAPFolder.FetchProfileItem.MESSAGE);
|
||||
|
||||
// Download messages/attachments
|
||||
Log.i(Helper.TAG, folder.name + " download=" + imessages.length);
|
||||
Log.i(folder.name + " download=" + imessages.length);
|
||||
for (int i = imessages.length - 1; i >= 0 && state.running(); i -= DOWNLOAD_BATCH_SIZE) {
|
||||
int from = Math.max(0, i - DOWNLOAD_BATCH_SIZE + 1);
|
||||
|
||||
|
@ -2181,7 +2180,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
} catch (FolderClosedIOException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name, ex);
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
// Free memory
|
||||
|
@ -2200,7 +2199,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
db.folder().setFolderError(folder.id, null);
|
||||
} finally {
|
||||
Log.v(Helper.TAG, folder.name + " end sync state=" + state);
|
||||
Log.i(folder.name + " end sync state=" + state);
|
||||
db.folder().setFolderSyncState(folder.id, null);
|
||||
}
|
||||
}
|
||||
|
@ -2212,11 +2211,11 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
long uid = ifolder.getUID(imessage);
|
||||
|
||||
if (imessage.isExpunged()) {
|
||||
Log.i(Helper.TAG, folder.name + " expunged uid=" + uid);
|
||||
Log.i(folder.name + " expunged uid=" + uid);
|
||||
throw new MessageRemovedException();
|
||||
}
|
||||
if (imessage.isSet(Flags.Flag.DELETED)) {
|
||||
Log.i(Helper.TAG, folder.name + " deleted uid=" + uid);
|
||||
Log.i(folder.name + " deleted uid=" + uid);
|
||||
throw new MessageRemovedException();
|
||||
}
|
||||
|
||||
|
@ -2237,17 +2236,17 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (message == null) {
|
||||
// Will fetch headers within database transaction
|
||||
String msgid = helper.getMessageID();
|
||||
Log.i(Helper.TAG, "Searching for " + msgid);
|
||||
Log.i("Searching for " + msgid);
|
||||
for (EntityMessage dup : db.message().getMessageByMsgId(folder.account, msgid)) {
|
||||
EntityFolder dfolder = db.folder().getFolder(dup.folder);
|
||||
Log.i(Helper.TAG, folder.name + " found as id=" + dup.id + "/" + dup.uid +
|
||||
Log.i(folder.name + " found as id=" + dup.id + "/" + dup.uid +
|
||||
" folder=" + dfolder.type + ":" + dup.folder + "/" + folder.type + ":" + folder.id +
|
||||
" msgid=" + dup.msgid + " thread=" + dup.thread);
|
||||
|
||||
if (dup.folder.equals(folder.id) ||
|
||||
(EntityFolder.OUTBOX.equals(dfolder.type) && EntityFolder.SENT.equals(folder.type))) {
|
||||
String thread = helper.getThreadId(uid);
|
||||
Log.i(Helper.TAG, folder.name + " found as id=" + dup.id + "/" +
|
||||
Log.i(folder.name + " found as id=" + dup.id + "/" +
|
||||
" uid=" + dup.uid + "/" + uid +
|
||||
" msgid=" + msgid + " thread=" + thread);
|
||||
dup.folder = folder.id; // outbox to sent
|
||||
|
@ -2256,16 +2255,16 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
dup.uid = uid;
|
||||
else if (dup.uid != uid) {
|
||||
if (EntityFolder.DRAFTS.equals(folder.type)) {
|
||||
Log.i(Helper.TAG, "Deleting previous uid=" + dup.uid);
|
||||
Log.i("Deleting previous uid=" + dup.uid);
|
||||
Message iprev = ifolder.getMessageByUID(dup.uid);
|
||||
if (iprev == null)
|
||||
Log.w(Helper.TAG, "Previous not found uid=" + dup.uid);
|
||||
Log.w("Previous not found uid=" + dup.uid);
|
||||
else {
|
||||
iprev.setFlag(Flags.Flag.DELETED, true);
|
||||
ifolder.expunge();
|
||||
}
|
||||
} else // Draft in Gmail archive
|
||||
Log.e(Helper.TAG, "Changed uid=" + dup.uid + "/" + uid);
|
||||
Log.e("Changed uid=" + dup.uid + "/" + uid);
|
||||
dup.uid = uid;
|
||||
}
|
||||
|
||||
|
@ -2325,7 +2324,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
message.msgid = helper.getMessageID();
|
||||
if (TextUtils.isEmpty(message.msgid))
|
||||
Log.w(Helper.TAG, "No Message-ID id=" + message.id + " uid=" + message.uid);
|
||||
Log.w("No Message-ID id=" + message.id + " uid=" + message.uid);
|
||||
|
||||
message.references = TextUtils.join(" ", helper.getReferences());
|
||||
message.inreplyto = helper.getInReplyTo();
|
||||
|
@ -2355,15 +2354,15 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
message.id = db.message().insertMessage(message);
|
||||
|
||||
Log.i(Helper.TAG, folder.name + " added id=" + message.id + " uid=" + message.uid);
|
||||
Log.i(folder.name + " added id=" + message.id + " uid=" + message.uid);
|
||||
|
||||
int sequence = 1;
|
||||
for (EntityAttachment attachment : helper.getAttachments()) {
|
||||
Log.i(Helper.TAG, folder.name + " attachment seq=" + sequence +
|
||||
Log.i(folder.name + " attachment seq=" + sequence +
|
||||
" name=" + attachment.name + " type=" + attachment.type + " cid=" + attachment.cid);
|
||||
if (!TextUtils.isEmpty(attachment.cid) &&
|
||||
db.attachment().getAttachment(message.id, attachment.cid) != null) {
|
||||
Log.i(Helper.TAG, "Skipping duplicated CID");
|
||||
Log.i("Skipping duplicated CID");
|
||||
continue;
|
||||
}
|
||||
attachment.message = message.id;
|
||||
|
@ -2377,34 +2376,34 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
update = true;
|
||||
message.seen = seen;
|
||||
message.ui_seen = seen;
|
||||
Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid + " seen=" + seen);
|
||||
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " seen=" + seen);
|
||||
}
|
||||
|
||||
if (!message.answered.equals(answered) || !message.answered.equals(message.ui_answered)) {
|
||||
update = true;
|
||||
message.answered = answered;
|
||||
message.ui_answered = answered;
|
||||
Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid + " answered=" + answered);
|
||||
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " answered=" + answered);
|
||||
}
|
||||
|
||||
if (!message.flagged.equals(flagged) || !message.flagged.equals(message.ui_flagged)) {
|
||||
update = true;
|
||||
message.flagged = flagged;
|
||||
message.ui_flagged = flagged;
|
||||
Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid + " flagged=" + flagged);
|
||||
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " flagged=" + flagged);
|
||||
}
|
||||
|
||||
if (!Helper.equal(message.keywords, keywords)) {
|
||||
update = true;
|
||||
message.keywords = keywords;
|
||||
Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid +
|
||||
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid +
|
||||
" keywords=" + TextUtils.join(" ", keywords));
|
||||
}
|
||||
|
||||
if (message.ui_hide && full) {
|
||||
update = true;
|
||||
message.ui_hide = false;
|
||||
Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid + " unhide");
|
||||
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " unhide");
|
||||
}
|
||||
|
||||
if (update)
|
||||
|
@ -2415,7 +2414,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
for (String keyword : keywords)
|
||||
if (!fkeywords.contains(keyword)) {
|
||||
Log.i(Helper.TAG, folder.name + " adding keyword=" + keyword);
|
||||
Log.i(folder.name + " adding keyword=" + keyword);
|
||||
fkeywords.add(keyword);
|
||||
}
|
||||
|
||||
|
@ -2461,7 +2460,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
}
|
||||
|
||||
if (fetch) {
|
||||
Log.i(Helper.TAG, folder.name + " fetching message id=" + message.id);
|
||||
Log.i(folder.name + " fetching message id=" + message.id);
|
||||
FetchProfile fp = new FetchProfile();
|
||||
fp.add(FetchProfile.Item.ENVELOPE);
|
||||
fp.add(FetchProfile.Item.FLAGS);
|
||||
|
@ -2481,7 +2480,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
String preview = (text == null ? null : text.substring(0, Math.min(text.length(), PREVIEW_SIZE)));
|
||||
message.write(context, html);
|
||||
db.message().setMessageContent(message.id, true, preview);
|
||||
Log.i(Helper.TAG, folder.name + " downloaded message id=" + message.id + " size=" + message.size);
|
||||
Log.i(folder.name + " downloaded message id=" + message.id + " size=" + message.size);
|
||||
}
|
||||
|
||||
List<EntityAttachment> iattachments = null;
|
||||
|
@ -2495,7 +2494,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (i < iattachments.size()) {
|
||||
attachment.part = iattachments.get(i).part;
|
||||
attachment.download(context, db);
|
||||
Log.i(Helper.TAG, folder.name + " downloaded message id=" + message.id + " attachment=" + attachment.name + " size=" + message.size);
|
||||
Log.i(folder.name + " downloaded message id=" + message.id + " attachment=" + attachment.name + " size=" + message.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2518,7 +2517,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
queue_reload(true, "connect " + network);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2531,7 +2530,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (!started && suitableNetwork())
|
||||
queue_reload(true, "connect " + network);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2545,7 +2544,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
queue_reload(false, "disconnect " + network);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2603,7 +2602,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
if (state.acquire(backoff))
|
||||
return;
|
||||
} catch (InterruptedException ex) {
|
||||
Log.w(Helper.TAG, "main backoff " + ex.toString());
|
||||
Log.w("main backoff " + ex.toString());
|
||||
}
|
||||
|
||||
// Start monitoring outbox
|
||||
|
@ -2617,7 +2616,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
@Override
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
Log.i(Helper.TAG, outbox.name + " observe=" + msg.what);
|
||||
Log.i(outbox.name + " observe=" + msg.what);
|
||||
if (msg.what == 0)
|
||||
liveOperations.removeObserver(observer);
|
||||
else {
|
||||
|
@ -2645,19 +2644,19 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
handling = current;
|
||||
|
||||
if (handling.size() > 0 && process) {
|
||||
Log.i(Helper.TAG, outbox.name + " operations=" + operations.size());
|
||||
Log.i(outbox.name + " operations=" + operations.size());
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
wl.acquire();
|
||||
Log.i(Helper.TAG, outbox.name + " process");
|
||||
Log.i(outbox.name + " process");
|
||||
|
||||
db.folder().setFolderSyncState(outbox.id, "syncing");
|
||||
processOperations(null, outbox, null, null, null, state);
|
||||
db.folder().setFolderError(outbox.id, null);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, outbox.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(outbox.name, ex);
|
||||
reportError(null, outbox, ex);
|
||||
db.folder().setFolderError(outbox.id, Helper.formatThrowable(ex));
|
||||
} finally {
|
||||
|
@ -2684,7 +2683,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
else
|
||||
account.deleteNotificationChannel(ServiceSynchronize.this);
|
||||
|
||||
Log.i(Helper.TAG, account.host + "/" + account.user + " run");
|
||||
Log.i(account.host + "/" + account.user + " run");
|
||||
final ServiceState astate = new ServiceState();
|
||||
astate.runnable(new Runnable() {
|
||||
@Override
|
||||
|
@ -2692,7 +2691,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
try {
|
||||
monitorAccount(account, astate);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
EntityLog.log(ServiceSynchronize.this, account.name + " " + Helper.formatThrowable(ex));
|
||||
db.account().setAccountError(account.id, Helper.formatThrowable(ex));
|
||||
}
|
||||
|
@ -2708,7 +2707,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
wl.release();
|
||||
state.acquire();
|
||||
} catch (InterruptedException ex) {
|
||||
Log.w(Helper.TAG, "main wait " + ex.toString());
|
||||
Log.w("main wait " + ex.toString());
|
||||
} finally {
|
||||
wl.acquire();
|
||||
}
|
||||
|
@ -2722,7 +2721,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
// Stop monitoring outbox
|
||||
if (outbox != null) {
|
||||
Log.i(Helper.TAG, outbox.name + " unlisten operations");
|
||||
Log.i(outbox.name + " unlisten operations");
|
||||
handler.sendEmptyMessage(0);
|
||||
db.folder().setFolderState(outbox.id, null);
|
||||
}
|
||||
|
@ -2730,7 +2729,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
EntityLog.log(ServiceSynchronize.this, "Main exited");
|
||||
} catch (Throwable ex) {
|
||||
// Fail-safe
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
wl.release();
|
||||
EntityLog.log(ServiceSynchronize.this, "Start wake lock=" + wl.isHeld());
|
||||
|
@ -2786,13 +2785,13 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
int accounts = db.account().deleteAccountsTbd();
|
||||
int identities = db.identity().deleteIdentitiesTbd();
|
||||
if (accounts > 0 || identities > 0)
|
||||
Log.i(Helper.TAG, "Deleted accounts=" + accounts + " identities=" + identities);
|
||||
Log.i("Deleted accounts=" + accounts + " identities=" + identities);
|
||||
|
||||
if (doStart)
|
||||
start();
|
||||
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
queued--;
|
||||
EntityLog.log(ServiceSynchronize.this, "Reload done queued=" + queued);
|
||||
|
@ -2892,12 +2891,12 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
boolean joined = false;
|
||||
while (!joined)
|
||||
try {
|
||||
Log.i(Helper.TAG, "Joining " + thread.getName());
|
||||
Log.i("Joining " + thread.getName());
|
||||
thread.join();
|
||||
joined = true;
|
||||
Log.i(Helper.TAG, "Joined " + thread.getName());
|
||||
Log.i("Joined " + thread.getName());
|
||||
} catch (InterruptedException ex) {
|
||||
Log.w(Helper.TAG, thread.getName() + " join " + ex.toString());
|
||||
Log.w(thread.getName() + " join " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,11 @@ import android.os.Build;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.service.quicksettings.Tile;
|
||||
import android.service.quicksettings.TileService;
|
||||
import android.util.Log;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.N)
|
||||
public class ServiceTileSynchronize extends TileService implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
public void onStartListening() {
|
||||
Log.i(Helper.TAG, "Start tile synchronize");
|
||||
Log.i("Start tile synchronize");
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
update();
|
||||
|
@ -46,7 +45,7 @@ public class ServiceTileSynchronize extends TileService implements SharedPrefere
|
|||
private void update() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean enabled = prefs.getBoolean("enabled", false);
|
||||
Log.i(Helper.TAG, "Update tile synchronize=" + enabled);
|
||||
Log.i("Update tile synchronize=" + enabled);
|
||||
|
||||
Tile tile = getQsTile();
|
||||
if (tile != null) {
|
||||
|
@ -58,13 +57,13 @@ public class ServiceTileSynchronize extends TileService implements SharedPrefere
|
|||
}
|
||||
|
||||
public void onStopListening() {
|
||||
Log.i(Helper.TAG, "Stop tile synchronize");
|
||||
Log.i("Stop tile synchronize");
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
prefs.unregisterOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
public void onClick() {
|
||||
Log.i(Helper.TAG, "Click tile synchronize");
|
||||
Log.i("Click tile synchronize");
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean enabled = !prefs.getBoolean("enabled", false);
|
||||
|
|
|
@ -26,7 +26,6 @@ import android.os.Build;
|
|||
import android.os.IBinder;
|
||||
import android.service.quicksettings.Tile;
|
||||
import android.service.quicksettings.TileService;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -64,12 +63,12 @@ public class ServiceTileUnseen extends TileService {
|
|||
}
|
||||
|
||||
public void onStartListening() {
|
||||
Log.i(Helper.TAG, "Start tile unseen");
|
||||
Log.i("Start tile unseen");
|
||||
liveMessages = DB.getInstance(this).message().liveUnseenNotify();
|
||||
liveMessages.observe(owner, new Observer<List<TupleMessageEx>>() {
|
||||
@Override
|
||||
public void onChanged(List<TupleMessageEx> messages) {
|
||||
Log.i(Helper.TAG, "Update tile unseen=" + messages.size());
|
||||
Log.i("Update tile unseen=" + messages.size());
|
||||
|
||||
Tile tile = getQsTile();
|
||||
if (tile != null) {
|
||||
|
@ -85,7 +84,7 @@ public class ServiceTileUnseen extends TileService {
|
|||
}
|
||||
|
||||
public void onStopListening() {
|
||||
Log.i(Helper.TAG, "Stop tile unseen");
|
||||
Log.i("Stop tile unseen");
|
||||
if (liveMessages != null) {
|
||||
liveMessages.removeObservers(owner);
|
||||
liveMessages = null;
|
||||
|
@ -93,7 +92,7 @@ public class ServiceTileUnseen extends TileService {
|
|||
}
|
||||
|
||||
public void onClick() {
|
||||
Log.i(Helper.TAG, "Click tile unseen");
|
||||
Log.i("Click tile unseen");
|
||||
|
||||
Intent clear = new Intent(this, ServiceSynchronize.class);
|
||||
clear.setAction("clear");
|
||||
|
|
|
@ -22,7 +22,6 @@ package eu.faircode.email;
|
|||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -65,26 +64,26 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
try {
|
||||
run(fragment.getContext(), fragment.getViewLifecycleOwner(), args);
|
||||
} catch (IllegalStateException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_START)
|
||||
public void onStart() {
|
||||
Log.i(Helper.TAG, "Start task " + this);
|
||||
Log.i("Start task " + this);
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
|
||||
public void onStop() {
|
||||
Log.i(Helper.TAG, "Stop task " + this);
|
||||
Log.i("Stop task " + this);
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
||||
public void onResume() {
|
||||
Log.i(Helper.TAG, "Resume task " + this);
|
||||
Log.i("Resume task " + this);
|
||||
paused = false;
|
||||
if (stored != null) {
|
||||
Log.i(Helper.TAG, "Deferred delivery task " + this);
|
||||
Log.i("Deferred delivery task " + this);
|
||||
deliver(args, stored);
|
||||
stored = null;
|
||||
}
|
||||
|
@ -92,18 +91,18 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
|
||||
public void onPause() {
|
||||
Log.i(Helper.TAG, "Pause task " + this);
|
||||
Log.i("Pause task " + this);
|
||||
paused = true;
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
|
||||
public void onCreated() {
|
||||
Log.i(Helper.TAG, "Created task " + this);
|
||||
Log.i("Created task " + this);
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||
public void onDestroyed() {
|
||||
Log.i(Helper.TAG, "Destroy task " + this);
|
||||
Log.i("Destroy task " + this);
|
||||
owner.getLifecycle().removeObserver(this);
|
||||
owner = null;
|
||||
paused = true;
|
||||
|
@ -120,7 +119,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
try {
|
||||
onInit(args);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
owner.getLifecycle().addObserver(this);
|
||||
|
@ -136,7 +135,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
try {
|
||||
result.data = onLoad(context, args);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
result.ex = ex;
|
||||
}
|
||||
|
||||
|
@ -153,23 +152,23 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
|
||||
private void deliver(Bundle args, Result result) {
|
||||
if (paused) {
|
||||
Log.i(Helper.TAG, "Deferring delivery task " + this);
|
||||
Log.i("Deferring delivery task " + this);
|
||||
this.args = args;
|
||||
this.stored = result;
|
||||
} else {
|
||||
Log.i(Helper.TAG, "Delivery task " + this);
|
||||
Log.i("Delivery task " + this);
|
||||
try {
|
||||
if (result.ex == null)
|
||||
onLoaded(args, (T) result.data);
|
||||
else
|
||||
onException(args, result.ex);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
try {
|
||||
onCleanup(args);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
onDestroyed();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.sun.mail.imap.IMAPFolder;
|
||||
import com.sun.mail.imap.IMAPMessage;
|
||||
|
@ -111,7 +110,7 @@ public class ViewModelBrowse extends ViewModel {
|
|||
try {
|
||||
body = message.read(state.context);
|
||||
} catch (IOException ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
if (message.from != null)
|
||||
|
@ -151,15 +150,15 @@ public class ViewModelBrowse extends ViewModel {
|
|||
props.setProperty("mail.imap.throwsearchexception", "true");
|
||||
Session isession = Session.getInstance(props, null);
|
||||
|
||||
Log.i(Helper.TAG, "Boundary connecting account=" + account.name);
|
||||
Log.i("Boundary connecting account=" + account.name);
|
||||
state.istore = (IMAPStore) isession.getStore(account.starttls ? "imap" : "imaps");
|
||||
Helper.connect(state.context, state.istore, account);
|
||||
|
||||
Log.i(Helper.TAG, "Boundary opening folder=" + folder.name);
|
||||
Log.i("Boundary opening folder=" + folder.name);
|
||||
state.ifolder = (IMAPFolder) state.istore.getFolder(folder.name);
|
||||
state.ifolder.open(Folder.READ_WRITE);
|
||||
|
||||
Log.i(Helper.TAG, "Boundary searching=" + state.search);
|
||||
Log.i("Boundary searching=" + state.search);
|
||||
if (state.search == null)
|
||||
state.imessages = state.ifolder.getMessages();
|
||||
else
|
||||
|
@ -178,14 +177,14 @@ public class ViewModelBrowse extends ViewModel {
|
|||
new FlagTerm(new Flags(Helper.sanitizeKeyword(state.search)), true)
|
||||
)
|
||||
);
|
||||
Log.i(Helper.TAG, "Boundary found messages=" + state.imessages.length);
|
||||
Log.i("Boundary found messages=" + state.imessages.length);
|
||||
|
||||
state.index = state.imessages.length - 1;
|
||||
} catch (Throwable ex) {
|
||||
if (ex instanceof FolderClosedException)
|
||||
Log.w(Helper.TAG, "Search " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w("Search", ex);
|
||||
else {
|
||||
Log.e(Helper.TAG, "Search " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e("Search", ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +192,7 @@ public class ViewModelBrowse extends ViewModel {
|
|||
|
||||
int count = 0;
|
||||
while (state.index >= 0 && count < state.pageSize && currentState != null) {
|
||||
Log.i(Helper.TAG, "Boundary index=" + state.index);
|
||||
Log.i("Boundary index=" + state.index);
|
||||
int from = Math.max(0, state.index - (state.pageSize - count) + 1);
|
||||
Message[] isub = Arrays.copyOfRange(state.imessages, from, state.index + 1);
|
||||
state.index -= (state.pageSize - count);
|
||||
|
@ -214,7 +213,7 @@ public class ViewModelBrowse extends ViewModel {
|
|||
for (int j = isub.length - 1; j >= 0; j--)
|
||||
try {
|
||||
long uid = state.ifolder.getUID(isub[j]);
|
||||
Log.i(Helper.TAG, "Boundary sync uid=" + uid);
|
||||
Log.i("Boundary sync uid=" + uid);
|
||||
EntityMessage message = db.message().getMessageByUid(state.fid, uid);
|
||||
if (message == null) {
|
||||
message = ServiceSynchronize.synchronizeMessage(
|
||||
|
@ -224,18 +223,18 @@ public class ViewModelBrowse extends ViewModel {
|
|||
}
|
||||
db.message().setMessageFound(message.account, message.thread);
|
||||
} catch (MessageRemovedException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " boundary " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name + " boundary", ex);
|
||||
} catch (FolderClosedException ex) {
|
||||
throw ex;
|
||||
} catch (IOException ex) {
|
||||
if (ex.getCause() instanceof MessagingException) {
|
||||
Log.w(Helper.TAG, folder.name + " boundary " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.w(folder.name + " boundary", ex);
|
||||
if (!(ex.getCause() instanceof MessageRemovedException))
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
} else
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " boundary " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e(folder.name + " boundary", ex);
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
} finally {
|
||||
((IMAPMessage) isub[j]).invalidateHeaders();
|
||||
|
@ -247,7 +246,7 @@ public class ViewModelBrowse extends ViewModel {
|
|||
}
|
||||
}
|
||||
|
||||
Log.i(Helper.TAG, "Boundary done");
|
||||
Log.i("Boundary done");
|
||||
}
|
||||
|
||||
void clear() {
|
||||
|
@ -256,12 +255,12 @@ public class ViewModelBrowse extends ViewModel {
|
|||
return;
|
||||
currentState = null;
|
||||
|
||||
Log.i(Helper.TAG, "Boundary clear");
|
||||
Log.i("Boundary clear");
|
||||
try {
|
||||
if (state.istore != null)
|
||||
state.istore.close();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, "Boundary " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
Log.e("Boundary", ex);
|
||||
} finally {
|
||||
state.context = null;
|
||||
state.messages = null;
|
||||
|
|
Loading…
Reference in New Issue