1 /* 2 * Copyright (C) 2018 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.panel; 18 19 import android.content.Context; 20 import android.os.Bundle; 21 import android.provider.Settings; 22 23 public class PanelFeatureProviderImpl implements PanelFeatureProvider { 24 25 @Override getPanel(Context context, Bundle bundle)26 public PanelContent getPanel(Context context, Bundle bundle) { 27 if (context == null) { 28 return null; 29 } 30 31 final String panelType = 32 bundle.getString(SettingsPanelActivity.KEY_PANEL_TYPE_ARGUMENT); 33 final String mediaPackageName = 34 bundle.getString(SettingsPanelActivity.KEY_MEDIA_PACKAGE_NAME); 35 36 switch (panelType) { 37 case Settings.Panel.ACTION_INTERNET_CONNECTIVITY: 38 return InternetConnectivityPanel.create(context); 39 case Settings.Panel.ACTION_NFC: 40 return NfcPanel.create(context); 41 case Settings.Panel.ACTION_WIFI: 42 return WifiPanel.create(context); 43 case Settings.Panel.ACTION_VOLUME: 44 return VolumePanel.create(context); 45 } 46 47 throw new IllegalStateException("No matching panel for: " + panelType); 48 } 49 } 50