summaryrefslogtreecommitdiffstats
path: root/src/com/android/wallpaper/module/UserEventLogger.java
blob: b574d5d4a46f45aed882ca10080965603b2e457e (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/*
 * Copyright (C) 2017 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.wallpaper.module;

import android.content.Intent;

import androidx.annotation.IntDef;

import com.android.wallpaper.module.WallpaperPersister.WallpaperPosition;

/**
 * Interface for logging user events in the wallpaper picker.
 */
public interface UserEventLogger {

    int ROTATION_STATUS_NOT_ATTEMPTED = 0;
    int ROTATION_STATUS_FAILED = 5;

    int WALLPAPER_SET_RESULT_SUCCESS = 0;
    int WALLPAPER_SET_RESULT_FAILURE = 1;
    int DAILY_WALLPAPER_UPDATE_RESULT_SUCCESS = 0;
    int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_METADATA = 1;
    int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_BITMAP = 2;
    int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_SET_WALLPAPER = 3;
    int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_CRASH = 4;
    int WALLPAPER_SET_FAILURE_REASON_OTHER = 0;
    int WALLPAPER_SET_FAILURE_REASON_OOM = 1;
    int DAILY_WALLPAPER_UPDATE_CRASH_GENERIC = 0;
    int DAILY_WALLPAPER_UPDATE_CRASH_OOM = 1;
    int DAILY_WALLPAPER_METADATA_FAILURE_UNKNOWN = 0;
    int DAILY_WALLPAPER_METADATA_FAILURE_NO_CONNECTION = 1;
    int DAILY_WALLPAPER_METADATA_FAILURE_PARSE_ERROR = 2;
    int DAILY_WALLPAPER_METADATA_FAILURE_SERVER_ERROR = 3;
    int DAILY_WALLPAPER_METADATA_FAILURE_TIMEOUT = 4;

    void logResumed(boolean provisioned, boolean wallpaper);

    void logStopped();

    void logAppLaunched(Intent launchSource);

    void logDailyRefreshTurnedOn();

    void logCurrentWallpaperPreviewed();

    void logActionClicked(String collectionId, int actionLabelResId);

    void logIndividualWallpaperSelected(String collectionId);

    void logCategorySelected(String collectionId);

    /**
     * Logs the behavior of tapping live wallpaper info page.
     *
     * @param collectionId wallpaper category.
     * @param wallpaperId wallpaper id.
     */
    void logLiveWallpaperInfoSelected(String collectionId, String wallpaperId);

    /**
     * Logs the behavior of tapping live wallpaper customize page.
     *
     * @param collectionId wallpaper category.
     * @param wallpaperId wallpaper id.
     */
    void logLiveWallpaperCustomizeSelected(String collectionId, String wallpaperId);

    /**
     * Log current existing snapshot data.
     */
    void logSnapshot();

    void logWallpaperSet(String collectionId, String wallpaperId);

    void logWallpaperSetResult(@WallpaperSetResult int result);

    /**
     * Logs that a particular failure to set an individual wallpaper occurred for the given reason.
     */
    void logWallpaperSetFailureReason(@WallpaperSetFailureReason int reason);

    /**
     * Logs the number of daily rotations that occurred in the last week if daily rotation has
     * been enabled for at least a week.
     */
    void logNumDailyWallpaperRotationsInLastWeek();

    /**
     * Logs the number of daily rotations that occurred during the previous day (24 hour period
     * midnight to midnight) if daily rotation has been enabled at least since midnight yesterday.
     */
    void logNumDailyWallpaperRotationsPreviousDay();

    /**
     * Logs given the hour of day that a successful "daily wallpaper" rotation occurred.
     *
     * @param hour An hour from 0 to 23.
     */
    void logDailyWallpaperRotationHour(int hour);

    /**
     * Logs whether the image file for the daily wallpaper "rotating image wallpaper" is successfully
     * decoded as a bitmap.
     *
     * @param decodes Whether the decode succeeded.
     */
    void logDailyWallpaperDecodes(boolean decodes);

    /**
     * Logs the last-known status of daily wallpapers on the device.
     */
    void logDailyWallpaperRotationStatus(int status);

    /**
     * Logs the result of an operation to update the daily wallpaper.
     */
    void logDailyWallpaperSetNextWallpaperResult(@DailyWallpaperUpdateResult int result);

    /**
     * Logs that a particular crash occurred when trying to set the next wallpaper in a daily
     * rotation.
     */
    void logDailyWallpaperSetNextWallpaperCrash(@DailyWallpaperUpdateCrash int crash);

    /**
     * Logs that the request for metadata for the next wallpaper in a daily rotation failed for the
     * given reason.
     */
    void logDailyWallpaperMetadataRequestFailure(@DailyWallpaperMetadataFailureReason int reason);

    /**
     * Logs that the "refresh daily wallpaper" button was clicked.
     */
    void logRefreshDailyWallpaperButtonClicked();

    /**
     * Logs the number of consecutive days that daily rotation was attempted but failed.
     */
    void logNumDaysDailyRotationFailed(int days);

    /**
     * Logs the number of consecutive days that daily rotation was not attempted but should have been
     * attempted ("network conditions not met" doesn't count).
     */
    void logNumDaysDailyRotationNotAttempted(int days);

    /**
     * Logs that the StandalonePreviewActivity was launched.
     */
    void logStandalonePreviewLaunched();

    /**
     * Logs whether the image URI passed to StandalonePreviewActivity came properly preconfigured with
     * read permissions.
     */
    void logStandalonePreviewImageUriHasReadPermission(boolean isReadPermissionGranted);

    /**
     * Logs whether the user approved the runtime dialog to grant this app READ_EXTERNAL_STORAGE
     * permission in order to open an image URI.
     */
    void logStandalonePreviewStorageDialogApproved(boolean isApproved);

    /**
     * Logs the presentation mode of the current wallpaper.
     */
    void logWallpaperPresentationMode();

    /**
     * Logs that the app was restored from a backup set.
     */
    void logRestored();

    /**
     * Possible results of a "set wallpaper" operation.
     */
    @IntDef({
            WALLPAPER_SET_RESULT_SUCCESS,
            WALLPAPER_SET_RESULT_FAILURE})
    @interface WallpaperSetResult {
    }

    /**
     * Possible results of an operation to set the next wallpaper in a daily rotation.
     */
    @IntDef({
            DAILY_WALLPAPER_UPDATE_RESULT_SUCCESS,
            DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_METADATA,
            DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_BITMAP,
            DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_SET_WALLPAPER,
            DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_CRASH})
    @interface DailyWallpaperUpdateResult {
    }

    /**
     * Possible reasons setting an individual wallpaper failed.
     */
    @IntDef({
            WALLPAPER_SET_FAILURE_REASON_OTHER,
            WALLPAPER_SET_FAILURE_REASON_OOM})
    @interface WallpaperSetFailureReason {
    }

    /**
     * Possible crash types of a crashing failed "set next wallpaper" operation when daily rotation
     * is enabled and trying to set the next wallpaper.
     */
    @IntDef({
            DAILY_WALLPAPER_UPDATE_CRASH_GENERIC,
            DAILY_WALLPAPER_UPDATE_CRASH_OOM})
    @interface DailyWallpaperUpdateCrash {
    }

    /**
     * Possible reasons for a request for "next wallpaper" metadata in a daily rotation to fail.
     */
    @IntDef({
            DAILY_WALLPAPER_METADATA_FAILURE_UNKNOWN,
            DAILY_WALLPAPER_METADATA_FAILURE_NO_CONNECTION,
            DAILY_WALLPAPER_METADATA_FAILURE_PARSE_ERROR,
            DAILY_WALLPAPER_METADATA_FAILURE_SERVER_ERROR,
            DAILY_WALLPAPER_METADATA_FAILURE_TIMEOUT})
    @interface DailyWallpaperMetadataFailureReason {
    }
}