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 17 package com.android.settings.intelligence.overlay; 18 19 import android.content.Context; 20 import androidx.annotation.Keep; 21 22 import com.android.settings.intelligence.experiment.ExperimentFeatureProvider; 23 import com.android.settings.intelligence.instrumentation.MetricsFeatureProvider; 24 import com.android.settings.intelligence.search.SearchFeatureProvider; 25 import com.android.settings.intelligence.search.SearchFeatureProviderImpl; 26 import com.android.settings.intelligence.suggestions.SuggestionFeatureProvider; 27 28 @Keep 29 public class FeatureFactoryImpl extends FeatureFactory { 30 31 protected MetricsFeatureProvider mMetricsFeatureProvider; 32 protected SuggestionFeatureProvider mSuggestionFeatureProvider; 33 protected ExperimentFeatureProvider mExperimentFeatureProvider; 34 protected SearchFeatureProvider mSearchFeatureProvider; 35 36 @Override metricsFeatureProvider(Context context)37 public MetricsFeatureProvider metricsFeatureProvider(Context context) { 38 if (mMetricsFeatureProvider == null) { 39 mMetricsFeatureProvider = new MetricsFeatureProvider(context.getApplicationContext()); 40 } 41 return mMetricsFeatureProvider; 42 } 43 44 @Override suggestionFeatureProvider()45 public SuggestionFeatureProvider suggestionFeatureProvider() { 46 if (mSuggestionFeatureProvider == null) { 47 mSuggestionFeatureProvider = new SuggestionFeatureProvider(); 48 } 49 return mSuggestionFeatureProvider; 50 } 51 52 @Override experimentFeatureProvider()53 public ExperimentFeatureProvider experimentFeatureProvider() { 54 if (mExperimentFeatureProvider == null) { 55 mExperimentFeatureProvider = new ExperimentFeatureProvider(); 56 } 57 return mExperimentFeatureProvider; 58 } 59 60 @Override searchFeatureProvider()61 public SearchFeatureProvider searchFeatureProvider() { 62 if (mSearchFeatureProvider == null) { 63 mSearchFeatureProvider = new SearchFeatureProviderImpl(); 64 } 65 return mSearchFeatureProvider; 66 } 67 } 68