• 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 android.content.Intent;
19 
20 import androidx.annotation.IntDef;
21 
22 import com.android.wallpaper.module.WallpaperPersister.WallpaperPosition;
23 
24 /**
25  * Interface for logging user events in the wallpaper picker.
26  */
27 public interface UserEventLogger {
28 
29     int ROTATION_STATUS_NOT_ATTEMPTED = 0;
30     int ROTATION_STATUS_FAILED = 5;
31 
32     int WALLPAPER_SET_RESULT_SUCCESS = 0;
33     int WALLPAPER_SET_RESULT_FAILURE = 1;
34     int DAILY_WALLPAPER_UPDATE_RESULT_SUCCESS = 0;
35     int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_METADATA = 1;
36     int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_BITMAP = 2;
37     int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_SET_WALLPAPER = 3;
38     int DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_CRASH = 4;
39     int WALLPAPER_SET_FAILURE_REASON_OTHER = 0;
40     int WALLPAPER_SET_FAILURE_REASON_OOM = 1;
41     int DAILY_WALLPAPER_UPDATE_CRASH_GENERIC = 0;
42     int DAILY_WALLPAPER_UPDATE_CRASH_OOM = 1;
43     int DAILY_WALLPAPER_METADATA_FAILURE_UNKNOWN = 0;
44     int DAILY_WALLPAPER_METADATA_FAILURE_NO_CONNECTION = 1;
45     int DAILY_WALLPAPER_METADATA_FAILURE_PARSE_ERROR = 2;
46     int DAILY_WALLPAPER_METADATA_FAILURE_SERVER_ERROR = 3;
47     int DAILY_WALLPAPER_METADATA_FAILURE_TIMEOUT = 4;
48 
logResumed(boolean provisioned, boolean wallpaper)49     void logResumed(boolean provisioned, boolean wallpaper);
50 
logStopped()51     void logStopped();
52 
logAppLaunched(Intent launchSource)53     void logAppLaunched(Intent launchSource);
54 
logDailyRefreshTurnedOn()55     void logDailyRefreshTurnedOn();
56 
logCurrentWallpaperPreviewed()57     void logCurrentWallpaperPreviewed();
58 
logActionClicked(String collectionId, int actionLabelResId)59     void logActionClicked(String collectionId, int actionLabelResId);
60 
logIndividualWallpaperSelected(String collectionId)61     void logIndividualWallpaperSelected(String collectionId);
62 
logCategorySelected(String collectionId)63     void logCategorySelected(String collectionId);
64 
65     /**
66      * Logs the behavior of tapping live wallpaper info page.
67      *
68      * @param collectionId wallpaper category.
69      * @param wallpaperId wallpaper id.
70      */
logLiveWallpaperInfoSelected(String collectionId, String wallpaperId)71     void logLiveWallpaperInfoSelected(String collectionId, String wallpaperId);
72 
73     /**
74      * Logs the behavior of tapping live wallpaper customize page.
75      *
76      * @param collectionId wallpaper category.
77      * @param wallpaperId wallpaper id.
78      */
logLiveWallpaperCustomizeSelected(String collectionId, String wallpaperId)79     void logLiveWallpaperCustomizeSelected(String collectionId, String wallpaperId);
80 
81     /**
82      * Log current existing snapshot data.
83      */
logSnapshot()84     void logSnapshot();
85 
logWallpaperSet(String collectionId, String wallpaperId)86     void logWallpaperSet(String collectionId, String wallpaperId);
87 
logWallpaperSetResult(@allpaperSetResult int result)88     void logWallpaperSetResult(@WallpaperSetResult int result);
89 
90     /**
91      * Logs that a particular failure to set an individual wallpaper occurred for the given reason.
92      */
logWallpaperSetFailureReason(@allpaperSetFailureReason int reason)93     void logWallpaperSetFailureReason(@WallpaperSetFailureReason int reason);
94 
95     /**
96      * Logs the number of daily rotations that occurred in the last week if daily rotation has
97      * been enabled for at least a week.
98      */
logNumDailyWallpaperRotationsInLastWeek()99     void logNumDailyWallpaperRotationsInLastWeek();
100 
101     /**
102      * Logs the number of daily rotations that occurred during the previous day (24 hour period
103      * midnight to midnight) if daily rotation has been enabled at least since midnight yesterday.
104      */
logNumDailyWallpaperRotationsPreviousDay()105     void logNumDailyWallpaperRotationsPreviousDay();
106 
107     /**
108      * Logs given the hour of day that a successful "daily wallpaper" rotation occurred.
109      *
110      * @param hour An hour from 0 to 23.
111      */
logDailyWallpaperRotationHour(int hour)112     void logDailyWallpaperRotationHour(int hour);
113 
114     /**
115      * Logs whether the image file for the daily wallpaper "rotating image wallpaper" is successfully
116      * decoded as a bitmap.
117      *
118      * @param decodes Whether the decode succeeded.
119      */
logDailyWallpaperDecodes(boolean decodes)120     void logDailyWallpaperDecodes(boolean decodes);
121 
122     /**
123      * Logs the last-known status of daily wallpapers on the device.
124      */
logDailyWallpaperRotationStatus(int status)125     void logDailyWallpaperRotationStatus(int status);
126 
127     /**
128      * Logs the result of an operation to update the daily wallpaper.
129      */
logDailyWallpaperSetNextWallpaperResult(@ailyWallpaperUpdateResult int result)130     void logDailyWallpaperSetNextWallpaperResult(@DailyWallpaperUpdateResult int result);
131 
132     /**
133      * Logs that a particular crash occurred when trying to set the next wallpaper in a daily
134      * rotation.
135      */
logDailyWallpaperSetNextWallpaperCrash(@ailyWallpaperUpdateCrash int crash)136     void logDailyWallpaperSetNextWallpaperCrash(@DailyWallpaperUpdateCrash int crash);
137 
138     /**
139      * Logs that the request for metadata for the next wallpaper in a daily rotation failed for the
140      * given reason.
141      */
logDailyWallpaperMetadataRequestFailure(@ailyWallpaperMetadataFailureReason int reason)142     void logDailyWallpaperMetadataRequestFailure(@DailyWallpaperMetadataFailureReason int reason);
143 
144     /**
145      * Logs that the "refresh daily wallpaper" button was clicked.
146      */
logRefreshDailyWallpaperButtonClicked()147     void logRefreshDailyWallpaperButtonClicked();
148 
149     /**
150      * Logs the number of consecutive days that daily rotation was attempted but failed.
151      */
logNumDaysDailyRotationFailed(int days)152     void logNumDaysDailyRotationFailed(int days);
153 
154     /**
155      * Logs the number of consecutive days that daily rotation was not attempted but should have been
156      * attempted ("network conditions not met" doesn't count).
157      */
logNumDaysDailyRotationNotAttempted(int days)158     void logNumDaysDailyRotationNotAttempted(int days);
159 
160     /**
161      * Logs that the StandalonePreviewActivity was launched.
162      */
logStandalonePreviewLaunched()163     void logStandalonePreviewLaunched();
164 
165     /**
166      * Logs whether the image URI passed to StandalonePreviewActivity came properly preconfigured with
167      * read permissions.
168      */
logStandalonePreviewImageUriHasReadPermission(boolean isReadPermissionGranted)169     void logStandalonePreviewImageUriHasReadPermission(boolean isReadPermissionGranted);
170 
171     /**
172      * Logs whether the user approved the runtime dialog to grant this app READ_EXTERNAL_STORAGE
173      * permission in order to open an image URI.
174      */
logStandalonePreviewStorageDialogApproved(boolean isApproved)175     void logStandalonePreviewStorageDialogApproved(boolean isApproved);
176 
177     /**
178      * Logs the presentation mode of the current wallpaper.
179      */
logWallpaperPresentationMode()180     void logWallpaperPresentationMode();
181 
182     /**
183      * Logs that the app was restored from a backup set.
184      */
logRestored()185     void logRestored();
186 
187     /**
188      * Possible results of a "set wallpaper" operation.
189      */
190     @IntDef({
191             WALLPAPER_SET_RESULT_SUCCESS,
192             WALLPAPER_SET_RESULT_FAILURE})
193     @interface WallpaperSetResult {
194     }
195 
196     /**
197      * Possible results of an operation to set the next wallpaper in a daily rotation.
198      */
199     @IntDef({
200             DAILY_WALLPAPER_UPDATE_RESULT_SUCCESS,
201             DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_METADATA,
202             DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_LOAD_BITMAP,
203             DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_SET_WALLPAPER,
204             DAILY_WALLPAPER_UPDATE_RESULT_FAILURE_CRASH})
205     @interface DailyWallpaperUpdateResult {
206     }
207 
208     /**
209      * Possible reasons setting an individual wallpaper failed.
210      */
211     @IntDef({
212             WALLPAPER_SET_FAILURE_REASON_OTHER,
213             WALLPAPER_SET_FAILURE_REASON_OOM})
214     @interface WallpaperSetFailureReason {
215     }
216 
217     /**
218      * Possible crash types of a crashing failed "set next wallpaper" operation when daily rotation
219      * is enabled and trying to set the next wallpaper.
220      */
221     @IntDef({
222             DAILY_WALLPAPER_UPDATE_CRASH_GENERIC,
223             DAILY_WALLPAPER_UPDATE_CRASH_OOM})
224     @interface DailyWallpaperUpdateCrash {
225     }
226 
227     /**
228      * Possible reasons for a request for "next wallpaper" metadata in a daily rotation to fail.
229      */
230     @IntDef({
231             DAILY_WALLPAPER_METADATA_FAILURE_UNKNOWN,
232             DAILY_WALLPAPER_METADATA_FAILURE_NO_CONNECTION,
233             DAILY_WALLPAPER_METADATA_FAILURE_PARSE_ERROR,
234             DAILY_WALLPAPER_METADATA_FAILURE_SERVER_ERROR,
235             DAILY_WALLPAPER_METADATA_FAILURE_TIMEOUT})
236     @interface DailyWallpaperMetadataFailureReason {
237     }
238 }
239