Disable AOSP K/V Call log backups
K/V Backup of call logs creates one pair per call log entry, thus leading to thousands of files for people with lots of logs. This is really slow especially with Nextcloud, making the backup take hours. Fix that by not enabling the AOSP K/V code, and instead using our own full backup code. Full Backup implementation: https://review.calyxos.org/c/CalyxOS/platform_packages_providers_ContactsProvider/+/2970 Issue: calyxos#395 Issue: https://github.com/seedvault-app/seedvault/issues/127 Change-Id: I742408ab62e126129966f7c9d095d6e61fdc58f6
This commit is contained in:
parent
d53f0fcde2
commit
4c124765ce
3 changed files with 10 additions and 11 deletions
|
|
@ -27,7 +27,7 @@ private const val TAG = "AppListRetriever"
|
|||
|
||||
private const val PACKAGE_NAME_SMS = "com.android.providers.telephony"
|
||||
private const val PACKAGE_NAME_SETTINGS = "com.android.providers.settings"
|
||||
private const val PACKAGE_NAME_CALL_LOG = "com.android.calllogbackup"
|
||||
private const val PACKAGE_NAME_CALL_LOG = "com.android.providers.contacts"
|
||||
private const val PACKAGE_NAME_CONTACTS = "org.calyxos.backup.contacts"
|
||||
|
||||
sealed class AppListItem
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.stevesoltys.seedvault.settings
|
||||
|
||||
import android.app.backup.IBackupManager
|
||||
import android.content.Context.BACKUP_SERVICE // ktlint-disable no-unused-imports
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.RemoteException
|
||||
|
|
@ -55,7 +54,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
val enabled = newValue as Boolean
|
||||
try {
|
||||
backupManager.isBackupEnabled = enabled
|
||||
if (enabled) viewModel.enableCallLogBackup()
|
||||
if (enabled) viewModel.disableCallLogKVBackup()
|
||||
return@OnPreferenceChangeListener true
|
||||
} catch (e: RemoteException) {
|
||||
e.printStackTrace()
|
||||
|
|
@ -158,8 +157,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
try {
|
||||
backup.isChecked = backupManager.isBackupEnabled
|
||||
backup.isEnabled = true
|
||||
// enable call log backups for existing installs (added end of 2020)
|
||||
if (backup.isChecked) viewModel.enableCallLogBackup()
|
||||
// disable call log k/v backups for existing installs (added beginning of 2021)
|
||||
if (backup.isChecked) viewModel.disableCallLogKVBackup()
|
||||
} catch (e: RemoteException) {
|
||||
Log.e(TAG, "Error communicating with BackupManager", e)
|
||||
backup.isEnabled = false
|
||||
|
|
|
|||
|
|
@ -157,16 +157,16 @@ internal class SettingsViewModel(
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensures that the call log will be included in backups.
|
||||
* Disables AOSP's call log backup
|
||||
*
|
||||
* An AOSP code search found that call log backups get disabled if [USER_FULL_DATA_BACKUP_AWARE]
|
||||
* is not set. This method sets this flag, if it is not already set.
|
||||
* AOSP's call log backup is disabled if [USER_FULL_DATA_BACKUP_AWARE]
|
||||
* is not set. This method unsets this flag, if it is set.
|
||||
* No other apps were found to check for this, so this should affect only call log.
|
||||
*/
|
||||
fun enableCallLogBackup() {
|
||||
fun disableCallLogKVBackup() {
|
||||
// first check if the flag is already set
|
||||
if (Settings.Secure.getInt(app.contentResolver, USER_FULL_DATA_BACKUP_AWARE, 0) == 0) {
|
||||
Settings.Secure.putInt(app.contentResolver, USER_FULL_DATA_BACKUP_AWARE, 1)
|
||||
if (Settings.Secure.getInt(app.contentResolver, USER_FULL_DATA_BACKUP_AWARE, 0) == 1) {
|
||||
Settings.Secure.putInt(app.contentResolver, USER_FULL_DATA_BACKUP_AWARE, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue