• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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  */
16 package com.android.wallpaper.module;
17 
18 import com.android.wallpaper.module.WallpaperPersister.WallpaperPosition;
19 
20 import androidx.annotation.IntDef;
21 
22 /**
23  * Interface for logging user events in the wallpaper picker.
24  */
25 public 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 
logResumed(boolean provisioned, boolean wallpaper)47     void logResumed(boolean provisioned, boolean wallpaper);
48 
logStopped()49     void logStopped();
50 
logAppLaunched()51     void logAppLaunched();
52 
logDailyRefreshTurnedOn()53     void logDailyRefreshTurnedOn();
54 
logCurrentWallpaperPreviewed()55     void logCurrentWallpaperPreviewed();
56 
logActionClicked(String collectionId, int actionLabelResId)57     void logActionClicked(String collectionId, int actionLabelResId);
58 
logIndividualWallpaperSelected(String collectionId)59     void logIndividualWallpaperSelected(String collectionId);
60 
logCategorySelected(String collectionId)61     void logCategorySelected(String collectionId);
62 
63     /**
64      * Logs the behavior of tapping live wallpaper info page.
65      *
66      * @param collectionId wallpaper category.
67      * @param wallpaperId wallpaper id.
68      */
logLiveWallpaperInfoSelected(String collectionId, String wallpaperId)69     void logLiveWallpaperInfoSelected(String collectionId, String wallpaperId);
70 
71     /**
72      * Logs the behavior of tapping live wallpaper customize page.
73      *
74      * @param collectionId wallpaper category.
75      * @param wallpaperId wallpaper id.
76      */
logLiveWallpaperCustomizeSelected(String collectionId, String wallpaperId)77     void logLiveWallpaperCustomizeSelected(String collectionId, String wallpaperId);
78 
79     /**
80      * Log current existing snapshot data.
81      */
logSnapshot()82     void logSnapshot();
83 
logWallpaperSet(String collectionId, String wallpaperId)84     void logWallpaperSet(String collectionId, String wallpaperId);
85 
logWallpaperSetResult(@allpaperSetResult int result)86     void logWallpaperSetResult(@WallpaperSetResult int result);
87 
88     /**
89      * Logs that a particular failure to set an individual wallpaper occurred for the given reason.
90      */
logWallpaperSetFailureReason(@allpaperSetFailureReason int reason)91     void logWallpaperSetFailureReason(@WallpaperSetFailureReason int reason);
92 
93     /**
94      * Logs the number of daily rotations that occurred in the last week if daily rotation has
95      * been enabled for at least a week.
96      */
logNumDailyWallpaperRotationsInLastWeek()97     void logNumDailyWallpaperRotationsInLastWeek();
98 
99     /**
100      * Logs the number of daily rotations that occurred during the previous day (24 hour period
101      * midnight to midnight) if daily rotation has been enabled at least since midnight yesterday.
102      */
logNumDailyWallpaperRotationsPreviousDay()103     void logNumDailyWallpaperRotationsPreviousDay();
104 
105     /**
106      * Logs given the hour of day that a successful "daily wallpaper" rotation occurred.
107      *
108      * @param hour An hour from 0 to 23.
109      */
logDailyWallpaperRotationHour(int hour)110     void logDailyWallpaperRotationHour(int hour);
111 
112     /**
113      * Logs whether the image file for the daily wallpaper "rotating image wallpaper" is successfully
114      * decoded as a bitmap.
115      *
116      * @param decodes Whether the decode succeeded.
117      */
logDailyWallpaperDecodes(boolean decodes)118     void logDailyWallpaperDecodes(boolean decodes);
119 
120     /**
121      * Logs the last-known status of daily wallpapers on the device.
122      */
logDailyWallpaperRotationStatus(int status)123     void logDailyWallpaperRotationStatus(int status);
124 
125     /**
126      * Logs the result of an operation to update the daily wallpaper.
127      */
logDailyWallpaperSetNextWallpaperResult(@ailyWallpaperUpdateResult int result)128     void logDailyWallpaperSetNextWallpaperResult(@DailyWallpaperUpdateResult int result);
129 
130     /**
131      * Logs that a particular crash occurred when trying to set the next wallpaper in a daily
132      * rotation.
133      */
logDailyWallpaperSetNextWallpaperCrash(@ailyWallpaperUpdateCrash int crash)134     void logDailyWallpaperSetNextWallpaperCrash(@DailyWallpaperUpdateCrash int crash);
135 
136     /**
137      * Logs that the request for metadata for the next wallpaper in a daily rotation failed for the
138      * given reason.
139      */
logDailyWallpaperMetadataRequestFailure(@ailyWallpaperMetadataFailureReason int reason)140     void logDailyWallpaperMetadataRequestFailure(@DailyWallpaperMetadataFailureReason int reason);
141 
142     /**
143      * Logs that the "refresh daily wallpaper" button was clicked.
144      */
logRefreshDailyWallpaperButtonClicked()145     void logRefreshDailyWallpaperButtonClicked();
146 
147     /**
148      * Logs the number of consecutive days that daily rotation was attempted but failed.
149      */
logNumDaysDailyRotationFailed(int days)150     void logNumDaysDailyRotationFailed(int days);
151 
152     /**
153      * Logs the number of consecutive days that daily rotation was not attempted but should have been
154      * attempted ("network conditions not met" doesn't count).
155      */
logNumDaysDailyRotationNotAttempted(int days)156     void logNumDaysDailyRotationNotAttempted(int days);
157 
158     /**
159      * Logs that the StandalonePreviewActivity was launched.
160      */
logStandalonePreviewLaunched()161     void logStandalonePreviewLaunched();
162 
163     /**
164      * Logs whether the image URI passed to StandalonePreviewActivity came properly preconfigured with
165      * read permissions.
166      */
logStandalonePreviewImageUriHasReadPermission(boolean isReadPermissionGranted)167     void logStandalonePreviewImageUriHasReadPermission(boolean isReadPermissionGranted);
168 
169     /**
170      * Logs whether the user approved the runtime dialog to grant this app READ_EXTERNAL_STORAGE
171      * permission in order to open an image URI.
172      */
logStandalonePreviewStorageDialogApproved(boolean isApproved)173     void logStandalonePreviewStorageDialogApproved(boolean isApproved);
174 
175     /**
176      * Logs the presentation mode of the current wallpaper.
177      */
logWallpaperPresentationMode()178     void logWallpaperPresentationMode();
179 
180     /**
181      * Logs that the app was restored from a backup set.
182      */
logRestored()183     void logRestored();
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 }
237