Loading packages/SystemUI/src/com/android/systemui/backup/BackupHelper.kt +7 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import com.android.systemui.communal.data.backup.CommunalBackupUtils import com.android.systemui.communal.domain.backup.CommunalPrefsBackupHelper import com.android.systemui.controls.controller.AuxiliaryPersistenceWrapper import com.android.systemui.controls.controller.ControlsFavoritePersistenceWrapper import com.android.systemui.inputdevice.tutorial.domain.backup.TutorialSchedulerBackupHelper import com.android.systemui.keyguard.domain.backup.KeyguardQuickAffordanceBackupHelper import com.android.systemui.people.widget.PeopleBackupHelper import com.android.systemui.qs.panels.domain.backup.QSPreferencesBackupHelper Loading Loading @@ -63,6 +64,8 @@ open class BackupHelper : BackupAgentHelper() { private const val COMMUNAL_PREFS_BACKUP_KEY = "systemui.communal.shared_preferences" private const val COMMUNAL_STATE_BACKUP_KEY = "systemui.communal_state" private const val QS_PREFERENCES_BACKUP_KEY = "systemui.qs.shared_preferences" private const val INPUT_DEVICE_TUTORIAL_SCHEDULER_BACKUP_KEY = "systemui.inputdevice.tutorial_data_store" val controlsDataLock = Any() const val ACTION_RESTORE_FINISHED = "com.android.systemui.backup.RESTORE_FINISHED" const val PERMISSION_SELF = "com.android.systemui.permission.SELF" Loading @@ -86,6 +89,10 @@ open class BackupHelper : BackupAgentHelper() { QS_PREFERENCES_BACKUP_KEY, QSPreferencesBackupHelper(context = this, userId = userHandle.identifier), ) addHelper( INPUT_DEVICE_TUTORIAL_SCHEDULER_BACKUP_KEY, TutorialSchedulerBackupHelper(context = applicationContext), ) if (communalEnabled()) { addHelper( COMMUNAL_PREFS_BACKUP_KEY, Loading packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/domain/backup/TutorialSchedulerBackupHelper.kt 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.inputdevice.tutorial.domain.backup import android.app.QueuedWork import android.app.backup.AbsoluteFileBackupHelper import android.app.backup.BackupDataOutput import android.content.Context import android.os.ParcelFileDescriptor import androidx.datastore.preferences.preferencesDataStoreFile import com.android.systemui.inputdevice.tutorial.data.repository.TutorialSchedulerRepository.Companion.DATASTORE_NAME class TutorialSchedulerBackupHelper(context: Context) : AbsoluteFileBackupHelper( context, context.preferencesDataStoreFile(DATASTORE_NAME).absolutePath, ) { override fun performBackup( oldState: ParcelFileDescriptor?, data: BackupDataOutput?, newState: ParcelFileDescriptor?, ) { // Finish outstanding DataStore write QueuedWork.waitToFinish() super.performBackup(oldState, data, newState) } } Loading
packages/SystemUI/src/com/android/systemui/backup/BackupHelper.kt +7 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import com.android.systemui.communal.data.backup.CommunalBackupUtils import com.android.systemui.communal.domain.backup.CommunalPrefsBackupHelper import com.android.systemui.controls.controller.AuxiliaryPersistenceWrapper import com.android.systemui.controls.controller.ControlsFavoritePersistenceWrapper import com.android.systemui.inputdevice.tutorial.domain.backup.TutorialSchedulerBackupHelper import com.android.systemui.keyguard.domain.backup.KeyguardQuickAffordanceBackupHelper import com.android.systemui.people.widget.PeopleBackupHelper import com.android.systemui.qs.panels.domain.backup.QSPreferencesBackupHelper Loading Loading @@ -63,6 +64,8 @@ open class BackupHelper : BackupAgentHelper() { private const val COMMUNAL_PREFS_BACKUP_KEY = "systemui.communal.shared_preferences" private const val COMMUNAL_STATE_BACKUP_KEY = "systemui.communal_state" private const val QS_PREFERENCES_BACKUP_KEY = "systemui.qs.shared_preferences" private const val INPUT_DEVICE_TUTORIAL_SCHEDULER_BACKUP_KEY = "systemui.inputdevice.tutorial_data_store" val controlsDataLock = Any() const val ACTION_RESTORE_FINISHED = "com.android.systemui.backup.RESTORE_FINISHED" const val PERMISSION_SELF = "com.android.systemui.permission.SELF" Loading @@ -86,6 +89,10 @@ open class BackupHelper : BackupAgentHelper() { QS_PREFERENCES_BACKUP_KEY, QSPreferencesBackupHelper(context = this, userId = userHandle.identifier), ) addHelper( INPUT_DEVICE_TUTORIAL_SCHEDULER_BACKUP_KEY, TutorialSchedulerBackupHelper(context = applicationContext), ) if (communalEnabled()) { addHelper( COMMUNAL_PREFS_BACKUP_KEY, Loading
packages/SystemUI/src/com/android/systemui/inputdevice/tutorial/domain/backup/TutorialSchedulerBackupHelper.kt 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.inputdevice.tutorial.domain.backup import android.app.QueuedWork import android.app.backup.AbsoluteFileBackupHelper import android.app.backup.BackupDataOutput import android.content.Context import android.os.ParcelFileDescriptor import androidx.datastore.preferences.preferencesDataStoreFile import com.android.systemui.inputdevice.tutorial.data.repository.TutorialSchedulerRepository.Companion.DATASTORE_NAME class TutorialSchedulerBackupHelper(context: Context) : AbsoluteFileBackupHelper( context, context.preferencesDataStoreFile(DATASTORE_NAME).absolutePath, ) { override fun performBackup( oldState: ParcelFileDescriptor?, data: BackupDataOutput?, newState: ParcelFileDescriptor?, ) { // Finish outstanding DataStore write QueuedWork.waitToFinish() super.performBackup(oldState, data, newState) } }