From 910a8e844bda2a6c3db358369e36ec3477b3160c Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 2 Jun 2024 13:05:11 +0200 Subject: [PATCH] Check for encrypted backup --- .../eu/faircode/email/FairEmailBackupAgent.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FairEmailBackupAgent.java b/app/src/main/java/eu/faircode/email/FairEmailBackupAgent.java index 83036045d2..4b2602c08f 100644 --- a/app/src/main/java/eu/faircode/email/FairEmailBackupAgent.java +++ b/app/src/main/java/eu/faircode/email/FairEmailBackupAgent.java @@ -56,9 +56,12 @@ public class FairEmailBackupAgent extends BackupAgent { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean enabled = prefs.getBoolean("google_backup", BuildConfig.PLAY_STORE_RELEASE); - EntityLog.log(this, "Backup start enabled=" + enabled); + boolean encrypted = ((data.getTransportFlags() & FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED) != 0); + boolean d2d = ((data.getTransportFlags() & FLAG_DEVICE_TO_DEVICE_TRANSFER) != 0); + EntityLog.log(this, "Backup start enabled=" + enabled + + " encrypted=" + encrypted + " d2d=" + d2d); - if (!enabled) + if (!enabled || !(encrypted || BuildConfig.DEBUG)) return; try { @@ -130,6 +133,11 @@ public class FairEmailBackupAgent extends BackupAgent { EntityLog.log(this, "Backup end"); } + @Override + public void onQuotaExceeded(long backupDataBytes, long quotaBytes) { + Log.e("Backup quota exceeded " + backupDataBytes + "/" + quotaBytes); + } + @Override public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException { @@ -215,6 +223,11 @@ public class FairEmailBackupAgent extends BackupAgent { EntityLog.log(this, "Restore end"); } + @Override + public void onRestoreFinished() { + EntityLog.log(this, "Restore finished"); + } + static void dataChanged(Context context) { try { new BackupManager(context).dataChanged();