From e80d89f0a22f1ee3dfa89f1a0e0b57d4661a3e6d Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 7 Oct 2021 16:56:32 -0300 Subject: [PATCH] Use our transport flags when creating RestoreSets This hopefully prevents apps skipping restore that require end-to-end encrypted backup transports. https://gitlab.com/CalyxOS/platform_frameworks_base/-/commit/3762670bb7cd13e7ef46ff05d58fff2283ed0221 --- .../seedvault/transport/ConfigurableBackupTransport.kt | 4 +++- .../seedvault/transport/restore/RestoreCoordinator.kt | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransport.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransport.kt index c4b65399..c3b51187 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransport.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransport.kt @@ -20,6 +20,8 @@ import org.koin.core.component.inject // If we ever change this, we should use a ComponentName like the other backup transports. val TRANSPORT_ID: String = ConfigurableBackupTransport::class.java.name +const val TRANSPORT_FLAGS = FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED + private const val TRANSPORT_DIRECTORY_NAME = "com.stevesoltys.seedvault.transport.ConfigurableBackupTransport" private val TAG = ConfigurableBackupTransport::class.java.simpleName @@ -52,7 +54,7 @@ class ConfigurableBackupTransport internal constructor(private val context: Cont * This allows the agent to decide what to do based on properties of the transport. */ override fun getTransportFlags(): Int { - return FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED + return TRANSPORT_FLAGS } /** diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinator.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinator.kt index ea5df7db..8a7d2e02 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinator.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinator.kt @@ -22,6 +22,7 @@ import com.stevesoltys.seedvault.metadata.MetadataManager import com.stevesoltys.seedvault.metadata.MetadataReader import com.stevesoltys.seedvault.plugins.StoragePlugin import com.stevesoltys.seedvault.settings.SettingsManager +import com.stevesoltys.seedvault.transport.TRANSPORT_FLAGS import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager import java.io.IOException @@ -91,7 +92,7 @@ internal class RestoreCoordinator( **/ suspend fun getAvailableRestoreSets(): Array? { return getAvailableMetadata()?.map { (_, metadata) -> - RestoreSet(metadata.deviceName, metadata.deviceName, metadata.token) + RestoreSet(metadata.deviceName, metadata.deviceName, metadata.token, TRANSPORT_FLAGS) }?.toTypedArray() }