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.res.Resources;
19 
20 import androidx.annotation.Nullable;
21 
22 import java.io.File;
23 
24 /**
25  * Provides content from the partner customization on the device.
26  */
27 public interface PartnerProvider {
28 
29     /**
30      * Marker action used to discover partner.
31      */
32     String ACTION_PARTNER_CUSTOMIZATION =
33             "com.android.launcher3.action.PARTNER_CUSTOMIZATION";
34 
35     /**
36      * The resource ID in the partner APK for an xml describing collections and wallpapers.
37      */
38     String WALLPAPER_RES_ID = "wallpapers";
39 
40     /**
41      * The resource ID in the partner APK for its list of wallpapers in legacy string-array format.
42      */
43     String LEGACY_WALLPAPER_RES_ID = "partner_wallpapers";
44 
45     /**
46      * Directory for system wallpapers in legacy versions of the partner APK.
47      */
48     String RES_LEGACY_SYSTEM_WALLPAPER_DIR = "system_wallpaper_directory";
49 
50     /**
51      * Boolean indicating the OEM does not want the picker to show the built-in Android system
52      * wallpaper because they've provided their own wallpapers instead.
53      * NOTE: The typo here "wallpapper" is intentional. The typo was made in legacy versions of the
54      * customization scheme so we can't fix it without breaking existing devices.
55      */
56     String RES_DEFAULT_WALLPAPER_HIDDEN = "default_wallpapper_hidden";
57 
58     /**
59      * Returns the Resources object for the partner APK, or null if there is no partner APK on the
60      * device.
61      */
62     @Nullable
getResources()63     Resources getResources();
64 
65     /**
66      * Returns the directory containing wallpapers, or null if the directory is not found on the
67      * device. The directory is only present and populated in legacy versions of the partner
68      * customization scheme.
69      */
getLegacyWallpaperDirectory()70     File getLegacyWallpaperDirectory();
71 
72     /**
73      * Returns the package name of the partner APK, or null if there is no partner APK on the
74      * device.
75      */
getPackageName()76     @Nullable String getPackageName();
77 
78     /**
79      * Returns whether the OEM has specified that the built-in system default wallpaper should be
80      * hidden (because OEM has provided their own wallpaper). If no partner customization exists on
81      * the device, returns false.
82      */
shouldHideDefaultWallpaper()83     boolean shouldHideDefaultWallpaper();
84 }
85