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.app.settings.SettingsEnums; 20 import android.content.Context; 21 import android.content.Intent; 22 import android.net.Uri; 23 import android.provider.Settings; 24 25 import com.android.settings.R; 26 import com.android.settings.network.AirplaneModePreferenceController; 27 import com.android.settings.slices.CustomSliceRegistry; 28 29 import java.util.ArrayList; 30 import java.util.List; 31 32 /** 33 * Represents the Internet Connectivity Panel. 34 * 35 * <p> 36 * Displays Wifi (full Slice) and Airplane mode. 37 * </p> 38 */ 39 public class InternetConnectivityPanel implements PanelContent { 40 41 private final Context mContext; 42 create(Context context)43 public static InternetConnectivityPanel create(Context context) { 44 return new InternetConnectivityPanel(context); 45 } 46 InternetConnectivityPanel(Context context)47 private InternetConnectivityPanel(Context context) { 48 mContext = context.getApplicationContext(); 49 } 50 51 @Override getTitle()52 public CharSequence getTitle() { 53 return mContext.getText(R.string.internet_connectivity_panel_title); 54 } 55 56 @Override getSlices()57 public List<Uri> getSlices() { 58 final List<Uri> uris = new ArrayList<>(); 59 uris.add(CustomSliceRegistry.WIFI_SLICE_URI); 60 uris.add(CustomSliceRegistry.MOBILE_DATA_SLICE_URI); 61 uris.add(AirplaneModePreferenceController.SLICE_URI); 62 return uris; 63 } 64 65 @Override getSeeMoreIntent()66 public Intent getSeeMoreIntent() { 67 return new Intent(Settings.ACTION_WIRELESS_SETTINGS) 68 .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 69 } 70 71 @Override getMetricsCategory()72 public int getMetricsCategory() { 73 return SettingsEnums.PANEL_INTERNET_CONNECTIVITY; 74 } 75 } 76