• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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.testing;
17 
18 import com.android.wallpaper.module.UserEventLogger;
19 import com.android.wallpaper.module.WallpaperPersister.WallpaperPosition;
20 
21 /**
22  * Test implementation of {@link UserEventLogger}.
23  */
24 public class TestUserEventLogger implements UserEventLogger {
25 
26     private int mNumDailyRefreshTurnedOnEvents;
27     private int mNumCurrentWallpaperPreviewedEvents;
28     private int mNumActionClickedEvents;
29     private int mNumIndividualWallpaperSelectedEvents;
30     private int mNumCategorySelectedEvents;
31     private int mNumWallpaperSetEvents;
32     private int mNumWallpaperSetResultEvents;
33     private String mLastCollectionId;
34     private String mLastWallpaperId;
35     @WallpaperSetResult
36     private int mLastWallpaperSetResult;
37     private int mLastDailyRotationHour;
38     private int mNum1DayActiveLogs;
39     private int mNum7DayActiveLogs;
40     private int mNum14DayActiveLogs;
41     private int mNum28DayActiveLogs;
42     private int mLastDailyWallpaperRotationStatus;
43     private int mNumDaysDailyRotationFailed;
44     private int mNumDaysDailyRotationNotAttempted;
45     private int mLastDailyWallpaperUpdateResult;
46     private int mStandalonePreviewLaunches;
47     private int mNumRestores;
48     @WallpaperPosition
49     private int mWallpaperPosition;
50 
TestUserEventLogger()51     public TestUserEventLogger() {
52         mLastDailyRotationHour = -1;
53         mLastDailyWallpaperRotationStatus = -1;
54         mNumDaysDailyRotationFailed = -1;
55         mNumDaysDailyRotationNotAttempted = -1;
56     }
57 
58     @Override
logResumed(boolean provisioned, boolean wallpaper)59     public void logResumed(boolean provisioned, boolean wallpaper) {
60 
61     }
62 
63     @Override
logStopped()64     public void logStopped() {
65 
66     }
67 
68     @Override
logAppLaunched()69     public void logAppLaunched() {
70         // Do nothing.
71     }
72 
73     @Override
logDailyRefreshTurnedOn()74     public void logDailyRefreshTurnedOn() {
75         mNumDailyRefreshTurnedOnEvents++;
76     }
77 
getNumDailyRefreshTurnedOnEvents()78     public int getNumDailyRefreshTurnedOnEvents() {
79         return mNumDailyRefreshTurnedOnEvents;
80     }
81 
82     @Override
logCurrentWallpaperPreviewed()83     public void logCurrentWallpaperPreviewed() {
84         mNumCurrentWallpaperPreviewedEvents++;
85     }
86 
87     @Override
logActionClicked(String collectionId, int actionLabelResId)88     public void logActionClicked(String collectionId, int actionLabelResId) {
89         mNumActionClickedEvents++;
90         mLastCollectionId = collectionId;
91     }
92 
getNumCurrentWallpaperPreviewedEvents()93     public int getNumCurrentWallpaperPreviewedEvents() {
94         return mNumCurrentWallpaperPreviewedEvents;
95     }
96 
getNumActionClickedEvents()97     public int getNumActionClickedEvents() {
98         return mNumActionClickedEvents;
99     }
100 
101     @Override
logIndividualWallpaperSelected(String collectionId)102     public void logIndividualWallpaperSelected(String collectionId) {
103         mNumIndividualWallpaperSelectedEvents++;
104         mLastCollectionId = collectionId;
105     }
106 
getNumIndividualWallpaperSelectedEvents()107     public int getNumIndividualWallpaperSelectedEvents() {
108         return mNumIndividualWallpaperSelectedEvents;
109     }
110 
111     @Override
logCategorySelected(String collectionId)112     public void logCategorySelected(String collectionId) {
113         mNumCategorySelectedEvents++;
114         mLastCollectionId = collectionId;
115     }
116 
117     @Override
logLiveWallpaperInfoSelected(String collectionId, String wallpaperId)118     public void logLiveWallpaperInfoSelected(String collectionId, String wallpaperId) {
119         // No-op
120     }
121 
122     @Override
logLiveWallpaperCustomizeSelected(String collectionId, String wallpaperId)123     public void logLiveWallpaperCustomizeSelected(String collectionId, String wallpaperId) {
124         // No-op
125     }
126 
127     @Override
logSnapshot()128     public void logSnapshot() {
129         // No-op
130     }
131 
getNumCategorySelectedEvents()132     public int getNumCategorySelectedEvents() {
133         return mNumCategorySelectedEvents;
134     }
135 
136     @Override
logWallpaperSet(String collectionId, String wallpaperId)137     public void logWallpaperSet(String collectionId, String wallpaperId) {
138         mNumWallpaperSetEvents++;
139         mLastCollectionId = collectionId;
140         mLastWallpaperId = wallpaperId;
141     }
142 
143     @Override
logWallpaperSetResult(@allpaperSetResult int result)144     public void logWallpaperSetResult(@WallpaperSetResult int result) {
145         mNumWallpaperSetResultEvents++;
146         mLastWallpaperSetResult = result;
147     }
148 
149     @Override
logWallpaperSetFailureReason(@allpaperSetFailureReason int reason)150     public void logWallpaperSetFailureReason(@WallpaperSetFailureReason int reason) {
151         // No-op
152     }
153 
154 
155     @Override
logNumDailyWallpaperRotationsInLastWeek()156     public void logNumDailyWallpaperRotationsInLastWeek() {
157         // No-op
158     }
159 
160     @Override
logNumDailyWallpaperRotationsPreviousDay()161     public void logNumDailyWallpaperRotationsPreviousDay() {
162         // No-op
163     }
164 
165     @Override
logDailyWallpaperRotationHour(int hour)166     public void logDailyWallpaperRotationHour(int hour) {
167         mLastDailyRotationHour = hour;
168     }
169 
170     @Override
logDailyWallpaperDecodes(boolean decodes)171     public void logDailyWallpaperDecodes(boolean decodes) {
172         // No-op
173     }
174 
175     @Override
logRefreshDailyWallpaperButtonClicked()176     public void logRefreshDailyWallpaperButtonClicked() {
177         // No-op
178     }
179 
180     @Override
logDailyWallpaperRotationStatus(int status)181     public void logDailyWallpaperRotationStatus(int status) {
182         mLastDailyWallpaperRotationStatus = status;
183     }
184 
185     @Override
logDailyWallpaperSetNextWallpaperResult(@ailyWallpaperUpdateResult int result)186     public void logDailyWallpaperSetNextWallpaperResult(@DailyWallpaperUpdateResult int result) {
187         mLastDailyWallpaperUpdateResult = result;
188     }
189 
190     @Override
logDailyWallpaperSetNextWallpaperCrash(@ailyWallpaperUpdateCrash int crash)191     public void logDailyWallpaperSetNextWallpaperCrash(@DailyWallpaperUpdateCrash int crash) {
192         // No-op
193     }
194 
195     @Override
logNumDaysDailyRotationFailed(int days)196     public void logNumDaysDailyRotationFailed(int days) {
197         mNumDaysDailyRotationFailed = days;
198     }
199 
200     @Override
logDailyWallpaperMetadataRequestFailure( @ailyWallpaperMetadataFailureReason int reason)201     public void logDailyWallpaperMetadataRequestFailure(
202             @DailyWallpaperMetadataFailureReason int reason) {
203         // No-op
204     }
205 
206     @Override
logNumDaysDailyRotationNotAttempted(int days)207     public void logNumDaysDailyRotationNotAttempted(int days) {
208         mNumDaysDailyRotationNotAttempted = days;
209     }
210 
211     @Override
logStandalonePreviewLaunched()212     public void logStandalonePreviewLaunched() {
213         mStandalonePreviewLaunches++;
214     }
215 
216     @Override
logStandalonePreviewImageUriHasReadPermission(boolean isReadPermissionGranted)217     public void logStandalonePreviewImageUriHasReadPermission(boolean isReadPermissionGranted) {
218         // No-op
219     }
220 
221     @Override
logStandalonePreviewStorageDialogApproved(boolean isApproved)222     public void logStandalonePreviewStorageDialogApproved(boolean isApproved) {
223         // No-op
224     }
225 
226     @Override
logWallpaperPresentationMode()227     public void logWallpaperPresentationMode() {
228         // No-op
229     }
230 
231     @Override
logRestored()232     public void logRestored() {
233         mNumRestores++;
234     }
235 
getNumWallpaperSetEvents()236     public int getNumWallpaperSetEvents() {
237         return mNumWallpaperSetEvents;
238     }
239 
getLastCollectionId()240     public String getLastCollectionId() {
241         return mLastCollectionId;
242     }
243 
getLastWallpaperId()244     public String getLastWallpaperId() {
245         return mLastWallpaperId;
246     }
247 
getNumWallpaperSetResultEvents()248     public int getNumWallpaperSetResultEvents() {
249         return mNumWallpaperSetResultEvents;
250     }
251 
252     @WallpaperSetResult
getLastWallpaperSetResult()253     public int getLastWallpaperSetResult() {
254         return mLastWallpaperSetResult;
255     }
256 
getLastDailyRotationHour()257     public int getLastDailyRotationHour() {
258         return mLastDailyRotationHour;
259     }
260 
getNum1DayActiveLogs()261     public int getNum1DayActiveLogs() {
262         return mNum1DayActiveLogs;
263     }
264 
getNum7DayActiveLogs()265     public int getNum7DayActiveLogs() {
266         return mNum7DayActiveLogs;
267     }
268 
getNum14DayActiveLogs()269     public int getNum14DayActiveLogs() {
270         return mNum14DayActiveLogs;
271     }
272 
getNum28DayActiveLogs()273     public int getNum28DayActiveLogs() {
274         return mNum28DayActiveLogs;
275     }
276 
getLastDailyWallpaperRotationStatus()277     public int getLastDailyWallpaperRotationStatus() {
278         return mLastDailyWallpaperRotationStatus;
279     }
280 
getNumDaysDailyRotationFailed()281     public int getNumDaysDailyRotationFailed() {
282         return mNumDaysDailyRotationFailed;
283     }
284 
getNumDaysDailyRotationNotAttempted()285     public int getNumDaysDailyRotationNotAttempted() {
286         return mNumDaysDailyRotationNotAttempted;
287     }
288 
getLastDailyWallpaperUpdateResult()289     public int getLastDailyWallpaperUpdateResult() {
290         return mLastDailyWallpaperUpdateResult;
291     }
292 
getStandalonePreviewLaunches()293     public int getStandalonePreviewLaunches() {
294         return mStandalonePreviewLaunches;
295     }
296 
getNumRestores()297     public int getNumRestores() {
298         return mNumRestores;
299     }
300 
getWallpaperPosition()301     public int getWallpaperPosition() {
302         return mWallpaperPosition;
303     }
304 }
305