blob: 16b185495a536c3c32d0a9dd509326955078afb8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
package com.android.launcher3.backuprestore
import android.content.Context
import com.android.launcher3.LauncherSettings.Favorites
import com.android.launcher3.R
import com.android.launcher3.util.ResourceBasedOverride
/**
* Wrapper for logging Restore event metrics for both success and failure to restore the Launcher
* workspace from a backup.
*/
open class LauncherRestoreEventLogger : ResourceBasedOverride {
companion object {
const val TAG = "LauncherRestoreEventLogger"
fun newInstance(context: Context?): LauncherRestoreEventLogger {
return ResourceBasedOverride.Overrides.getObject(
LauncherRestoreEventLogger::class.java,
context,
R.string.launcher_restore_event_logger_class
)
}
}
/**
* For logging when multiple items of a given data type failed to restore.
*
* @param dataType The data type that was not restored.
* @param count the number of data items that were not restored.
* @param error error type for why the data was not restored.
*/
open fun logLauncherItemsRestoreFailed(dataType: String, count: Int, error: String?) {
// no-op
}
/**
* For logging when multiple items of a given data type were successfully restored.
*
* @param dataType The data type that was restored.
* @param count the number of data items restored.
*/
open fun logLauncherItemsRestored(dataType: String, count: Int) {
// no-op
}
/**
* Helper to log successfully restoring a single item from the Favorites table.
*
* @param favoritesId The id of the item type from [Favorites] that was restored.
*/
open fun logSingleFavoritesItemRestored(favoritesId: Int) {
// no-op
}
/**
* Helper to log a failure to restore a single item from the Favorites table.
*
* @param favoritesId The id of the item type from [Favorites] that was not restored.
* @param error error type for why the data was not restored.
*/
open fun logSingleFavoritesItemRestoreFailed(favoritesId: Int, error: String?) {
// no-op
}
/**
* Helper to log a failure to restore items from the Favorites table.
*
* @param favoritesId The id of the item type from [Favorites] that was not restored.
* @param count number of items that failed to restore.
* @param error error type for why the data was not restored.
*/
open fun logFavoritesItemsRestoreFailed(favoritesId: Int, count: Int, error: String?) {
// no-op
}
/**
* Uses the current [restoreEventLogger] to report its results to the [backupManager]. Use when
* done restoring items for Launcher.
*/
open fun reportLauncherRestoreResults() {
// no-op
}
}
|