140ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze/*
240ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * Copyright (C) 2017 The Android Open Source Project
340ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze *
440ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * Licensed under the Apache License, Version 2.0 (the "License");
540ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * you may not use this file except in compliance with the License.
640ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * You may obtain a copy of the License at
740ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze *
840ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze *      http://www.apache.org/licenses/LICENSE-2.0
940ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze *
1040ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * Unless required by applicable law or agreed to in writing, software
1140ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * distributed under the License is distributed on an "AS IS" BASIS,
1240ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1340ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * See the License for the specific language governing permissions and
1440ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * limitations under the License.
1540ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze *
1640ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze */
1740ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze
182078bc2358031ef3a191900d9036daf4251911c1Matthew Fritzepackage com.android.settings.search;
1940ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze
2040ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritzeimport android.content.Context;
212078bc2358031ef3a191900d9036daf4251911c1Matthew Fritzeimport com.android.settings.search.DatabaseResultLoader;
222078bc2358031ef3a191900d9036daf4251911c1Matthew Fritzeimport com.android.settings.search.SearchResult;
2340ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze
24683ccdf97bd8b3ed30b7014f2df17227cff92561Soroosh Mariooryadimport java.util.HashSet;
25683ccdf97bd8b3ed30b7014f2df17227cff92561Soroosh Mariooryadimport java.util.Set;
2640ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze
2740ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze/**
2840ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * Mock loader to subvert the requirements of returning data while also driving the Loader
2940ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze * lifecycle.
3040ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze */
3140ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritzeclass MockDBLoader extends DatabaseResultLoader {
3240ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze
3340ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze    public MockDBLoader(Context context) {
3440ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze        super(context, "test", null);
3540ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze    }
3640ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze
3740ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze    @Override
38683ccdf97bd8b3ed30b7014f2df17227cff92561Soroosh Mariooryad    public Set<? extends SearchResult> loadInBackground() {
39683ccdf97bd8b3ed30b7014f2df17227cff92561Soroosh Mariooryad        return new HashSet<>();
4040ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze    }
4140ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze
4240ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze    @Override
43683ccdf97bd8b3ed30b7014f2df17227cff92561Soroosh Mariooryad    protected void onDiscardResult(Set<? extends SearchResult> result) {
4440ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze
4540ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze    }
4640ce0fab758714c973945ec8f053c52076d5fc50Matthew Fritze}
47