Use our transport flags when creating RestoreSets

This hopefully prevents apps skipping restore that require end-to-end encrypted backup transports.

3762670bb7
This commit is contained in:
Torsten Grote 2021-10-07 16:56:32 -03:00 committed by Chirayu Desai
parent 7f4b565d2a
commit e80d89f0a2
2 changed files with 5 additions and 2 deletions

View file

@ -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. // If we ever change this, we should use a ComponentName like the other backup transports.
val TRANSPORT_ID: String = ConfigurableBackupTransport::class.java.name val TRANSPORT_ID: String = ConfigurableBackupTransport::class.java.name
const val TRANSPORT_FLAGS = FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED
private const val TRANSPORT_DIRECTORY_NAME = private const val TRANSPORT_DIRECTORY_NAME =
"com.stevesoltys.seedvault.transport.ConfigurableBackupTransport" "com.stevesoltys.seedvault.transport.ConfigurableBackupTransport"
private val TAG = ConfigurableBackupTransport::class.java.simpleName 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. * This allows the agent to decide what to do based on properties of the transport.
*/ */
override fun getTransportFlags(): Int { override fun getTransportFlags(): Int {
return FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED return TRANSPORT_FLAGS
} }
/** /**

View file

@ -22,6 +22,7 @@ import com.stevesoltys.seedvault.metadata.MetadataManager
import com.stevesoltys.seedvault.metadata.MetadataReader import com.stevesoltys.seedvault.metadata.MetadataReader
import com.stevesoltys.seedvault.plugins.StoragePlugin import com.stevesoltys.seedvault.plugins.StoragePlugin
import com.stevesoltys.seedvault.settings.SettingsManager import com.stevesoltys.seedvault.settings.SettingsManager
import com.stevesoltys.seedvault.transport.TRANSPORT_FLAGS
import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
import java.io.IOException import java.io.IOException
@ -91,7 +92,7 @@ internal class RestoreCoordinator(
**/ **/
suspend fun getAvailableRestoreSets(): Array<RestoreSet>? { suspend fun getAvailableRestoreSets(): Array<RestoreSet>? {
return getAvailableMetadata()?.map { (_, metadata) -> return getAvailableMetadata()?.map { (_, metadata) ->
RestoreSet(metadata.deviceName, metadata.deviceName, metadata.token) RestoreSet(metadata.deviceName, metadata.deviceName, metadata.token, TRANSPORT_FLAGS)
}?.toTypedArray() }?.toTypedArray()
} }