• 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.model.WallpaperInfo;
19 import com.android.wallpaper.module.WallpaperPreferences.PresentationMode;
20 
21 import androidx.annotation.Nullable;
22 
23 /**
24  * Interface for factories which construct {@link WallpaperInfo} objects representing the device's
25  * currently set wallpapers.
26  */
27 public interface CurrentWallpaperInfoFactory {
28 
29     /**
30      * Constructs WallpaperInfo object(s) to represent the current home wallpaper and optionally the
31      * current lock wallpaper if device is running Android N or later and lock wallpaper is explicitly
32      * set.
33      *
34      * @param forceRefresh Whether the factory should ignore cached copies of the WallpaperInfo(s) and
35      *                     presentation mode that represent the currently-set wallpaper.
36      */
createCurrentWallpaperInfos(WallpaperInfoCallback callback, boolean forceRefresh)37     void createCurrentWallpaperInfos(WallpaperInfoCallback callback, boolean forceRefresh);
38 
39     /**
40      * Interface which clients may implement to receive current wallpaper {@link WallpaperInfo}
41      * objects constructed by the factory as well as the mode which describes their current
42      * presentation (i.e., daily rotation or static).
43      */
44     interface WallpaperInfoCallback {
onWallpaperInfoCreated(WallpaperInfo homeWallpaper, @Nullable WallpaperInfo lockWallpaper, @PresentationMode int presentationMode)45         void onWallpaperInfoCreated(WallpaperInfo homeWallpaper, @Nullable WallpaperInfo lockWallpaper,
46                                     @PresentationMode int presentationMode);
47     }
48 }
49