blob: 4fb2b0d0c396b615f8f7fed1a988735811e6e6da [file] [log] [blame]
Jon Miranda16ea1b12017-12-12 14:52:48 -08001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.wallpaper.module;
17
18import android.support.annotation.IntDef;
19
20import com.android.wallpaper.module.WallpaperPersister.WallpaperPosition;
21
22/**
23 * Interface for logging user events in the wallpaper picker.
24 */
25public interface UserEventLogger {
26
27 int ROTATION_STATUS_NOT_ATTEMPTED = 0;
28 int ROTATION_STATUS_FAILED = 5;
29
30 int WALLPAPER_SET_RESULT_SUCCESS = 0;
31 int WALLPAPER_SET_RESULT_FAILURE = 1;
32 int DAILY_WALLPAPER_UPDATE_RESULT_SUCCESS = 0;
33 int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_METADATA = 1;
34 int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_BITMAP = 2;
35 int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_SET_WALLPAPER = 3;
36 int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_CRASH = 4;
37 int WALLPAPER_SET_FAILURE_REASON_OTHER = 0;
38 int WALLPAPER_SET_FAILURE_REASON_OOM = 1;
39 int DAILY_WALLPAPER_UPDATE_CRASH_GENERIC = 0;
40 int DAILY_WALLPAPER_UPDATE_CRASH_OOM = 1;
41 int DAILY_WALLPAPER_METADATA_FAILURE_UNKNOWN = 0;
42 int DAILY_WALLPAPER_METADATA_FAILURE_NO_CONNECTION = 1;
43 int DAILY_WALLPAPER_METADATA_FAILURE_PARSE_ERROR = 2;
44 int DAILY_WALLPAPER_METADATA_FAILURE_SERVER_ERROR = 3;
45 int DAILY_WALLPAPER_METADATA_FAILURE_TIMEOUT = 4;
46
47 void logAppLaunched();
48
49 void logDailyRefreshTurnedOn();
50
51 void logCurrentWallpaperPreviewed();
52
Santiago Etchebeherece5613f2018-06-01 13:22:47 -070053 void logActionClicked(String collectionId, int actionLabelResId);
Jon Miranda16ea1b12017-12-12 14:52:48 -080054
55 void logIndividualWallpaperSelected(String collectionId);
56
57 void logCategorySelected(String collectionId);
58
59 void logWallpaperSet(String collectionId, String wallpaperId);
60
61 void logWallpaperSetResult(@WallpaperSetResult int result);
62
63 /**
64 * Logs that a particular failure to set an individual wallpaper occurred for the given reason.
65 */
66 void logWallpaperSetFailureReason(@WallpaperSetFailureReason int reason);
67
68 /**
69 * Logs the number of daily rotations that occurred in the last week if daily rotation has
70 * been enabled for at least a week.
71 */
72 void logNumDailyWallpaperRotationsInLastWeek();
73
74 /**
75 * Logs the number of daily rotations that occurred during the previous day (24 hour period
76 * midnight to midnight) if daily rotation has been enabled at least since midnight yesterday.
77 */
78 void logNumDailyWallpaperRotationsPreviousDay();
79
80 /**
81 * Logs given the hour of day that a successful "daily wallpaper" rotation occurred.
82 *
83 * @param hour An hour from 0 to 23.
84 */
85 void logDailyWallpaperRotationHour(int hour);
86
87 /**
88 * Logs that the user is a 1 day active.
89 */
90 void log1DayActive();
91
92 /**
93 * Logs that the user is a 7 day active.
94 */
95 void log7DayActive();
96
97 /**
98 * Logs that the user is a 14 day active.
99 */
100 void log14DayActive();
101
102 /**
103 * Logs that the user is a 28 day active.
104 */
105 void log28DayActive();
106
107 /**
108 * Logs whether the image file for the daily wallpaper "rotating image wallpaper" is successfully
109 * decoded as a bitmap.
110 *
111 * @param decodes Whether the decode succeeded.
112 */
113 void logDailyWallpaperDecodes(boolean decodes);
114
115 /**
116 * Logs the last-known status of daily wallpapers on the device.
117 */
118 void logDailyWallpaperRotationStatus(int status);
119
120 /**
121 * Logs the result of an operation to update the daily wallpaper.
122 */
123 void logDailyWallpaperSetNextWallpaperResult(@DailyWallpaperUpdateResult int result);
124
125 /**
126 * Logs that a particular crash occurred when trying to set the next wallpaper in a daily
127 * rotation.
128 */
129 void logDailyWallpaperSetNextWallpaperCrash(@DailyWallpaperUpdateCrash int crash);
130
131 /**
132 * Logs that the request for metadata for the next wallpaper in a daily rotation failed for the
133 * given reason.
134 */
135 void logDailyWallpaperMetadataRequestFailure(@DailyWallpaperMetadataFailureReason int reason);
136
137 /**
138 * Logs that the "refresh daily wallpaper" button was clicked.
139 */
140 void logRefreshDailyWallpaperButtonClicked();
141
142 /**
143 * Logs the number of consecutive days that daily rotation was attempted but failed.
144 */
145 void logNumDaysDailyRotationFailed(int days);
146
147 /**
148 * Logs the number of consecutive days that daily rotation was not attempted but should have been
149 * attempted ("network conditions not met" doesn't count).
150 */
151 void logNumDaysDailyRotationNotAttempted(int days);
152
153 /**
154 * Logs that the StandalonePreviewActivity was launched.
155 */
156 void logStandalonePreviewLaunched();
157
158 /**
159 * Logs whether the image URI passed to StandalonePreviewActivity came properly preconfigured with
160 * read permissions.
161 */
162 void logStandalonePreviewImageUriHasReadPermission(boolean isReadPermissionGranted);
163
164 /**
165 * Logs whether the user approved the runtime dialog to grant this app READ_EXTERNAL_STORAGE
166 * permission in order to open an image URI.
167 */
168 void logStandalonePreviewStorageDialogApproved(boolean isApproved);
169
170 /**
171 * Logs the presentation mode of the current wallpaper.
172 */
173 void logWallpaperPresentationMode();
174
175 /**
176 * Logs that the app was restored from a backup set.
177 */
178 void logRestored();
179
180 /**
181 * Logs the wallpaper position of a custom photo wallpaper set by the user on desktop.
182 */
183 void logWallpaperPosition(@WallpaperPosition int wallpaperPosition);
184
185 /**
186 * Possible results of a "set wallpaper" operation.
187 */
188 @IntDef({
189 WALLPAPER_SET_RESULT_SUCCESS,
190 WALLPAPER_SET_RESULT_FAILURE})
191 @interface WallpaperSetResult {
192 }
193
194 /**
195 * Possible results of an operation to set the next wallpaper in a daily rotation.
196 */
197 @IntDef({
198 DAILY_WALLPAPER_UPDATE_RESULT_SUCCESS,
199 DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_METADATA,
200 DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_BITMAP,
201 DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_SET_WALLPAPER,
202 DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_CRASH})
203 @interface DailyWallpaperUpdateResult {
204 }
205
206 /**
207 * Possible reasons setting an individual wallpaper failed.
208 */
209 @IntDef({
210 WALLPAPER_SET_FAILURE_REASON_OTHER,
211 WALLPAPER_SET_FAILURE_REASON_OOM})
212 @interface WallpaperSetFailureReason {
213 }
214
215 /**
216 * Possible crash types of a crashing failed "set next wallpaper" operation when daily rotation
217 * is enabled and trying to set the next wallpaper.
218 */
219 @IntDef({
220 DAILY_WALLPAPER_UPDATE_CRASH_GENERIC,
221 DAILY_WALLPAPER_UPDATE_CRASH_OOM})
222 @interface DailyWallpaperUpdateCrash {
223 }
224
225 /**
226 * Possible reasons for a request for "next wallpaper" metadata in a daily rotation to fail.
227 */
228 @IntDef({
229 DAILY_WALLPAPER_METADATA_FAILURE_UNKNOWN,
230 DAILY_WALLPAPER_METADATA_FAILURE_NO_CONNECTION,
231 DAILY_WALLPAPER_METADATA_FAILURE_PARSE_ERROR,
232 DAILY_WALLPAPER_METADATA_FAILURE_SERVER_ERROR,
233 DAILY_WALLPAPER_METADATA_FAILURE_TIMEOUT})
234 @interface DailyWallpaperMetadataFailureReason {
235 }
236}