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 android.content.res.Resources; 19 20 import com.android.wallpaper.module.PartnerProvider; 21 22 import java.io.File; 23 24 import javax.inject.Inject; 25 import javax.inject.Singleton; 26 27 /** 28 * Test implementation for PartnerProvider. 29 */ 30 @Singleton 31 public class TestPartnerProvider implements PartnerProvider { 32 private File mLegacyWallpaperDirectory; 33 private String mPackageName; 34 private Resources mResources; 35 36 @Inject TestPartnerProvider()37 public TestPartnerProvider() { 38 } 39 40 @Override getResources()41 public Resources getResources() { 42 return mResources; 43 } 44 setPackageName(String packageName)45 public void setPackageName(String packageName) { 46 this.mPackageName = packageName; 47 } setResources(Resources mResources)48 public void setResources(Resources mResources) { 49 this.mResources = mResources; 50 } 51 @Override getLegacyWallpaperDirectory()52 public File getLegacyWallpaperDirectory() { 53 return mLegacyWallpaperDirectory; 54 } 55 56 /** 57 * Sets the File to be returned by subsequent calls to getLegacyWallpaperDirectory(). 58 * 59 * @param dir The legacy wallpaper directory. 60 */ setLegacyWallpaperDirectory(File dir)61 public void setLegacyWallpaperDirectory(File dir) { 62 mLegacyWallpaperDirectory = dir; 63 } 64 65 @Override getPackageName()66 public String getPackageName() { 67 return mPackageName; 68 } 69 70 @Override shouldHideDefaultWallpaper()71 public boolean shouldHideDefaultWallpaper() { 72 return true; 73 } 74 } 75