Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 1 | /* |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 2 | * Copyright (C) 2014 The Android Open Source Project |
Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 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.systemui.statusbar.policy; |
| 18 | |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 19 | import android.content.Context; |
Jason Monk | 17f3c3f | 2015-01-14 10:13:22 -0500 | [diff] [blame] | 20 | import android.content.Intent; |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 21 | import android.telephony.SubscriptionInfo; |
Winson | c0d7058 | 2016-01-29 10:24:39 -0800 | [diff] [blame] | 22 | |
Jason Monk | f668d7c | 2016-01-14 10:38:41 -0500 | [diff] [blame] | 23 | import com.android.settingslib.net.DataUsageController; |
Jason Monk | d52356a | 2015-01-28 10:40:41 -0500 | [diff] [blame] | 24 | import com.android.settingslib.wifi.AccessPoint; |
| 25 | |
| 26 | import java.util.List; |
| 27 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 28 | public interface NetworkController { |
Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 29 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 30 | boolean hasMobileDataFeature(); |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 31 | void addSignalCallback(SignalCallback cb); |
| 32 | void removeSignalCallback(SignalCallback cb); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 33 | void setWifiEnabled(boolean enabled); |
Lorenzo Colitti | 403aa26 | 2014-11-28 11:21:30 +0900 | [diff] [blame] | 34 | void onUserSwitched(int newUserId); |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 35 | AccessPointController getAccessPointController(); |
Jason Monk | f668d7c | 2016-01-14 10:38:41 -0500 | [diff] [blame] | 36 | DataUsageController getMobileDataController(); |
Jason Monk | 9a4ce13 | 2016-01-21 15:27:17 -0500 | [diff] [blame] | 37 | DataSaverController getDataSaverController(); |
Christian Robertson | 2e34742 | 2011-08-11 14:01:04 -0700 | [diff] [blame] | 38 | |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 39 | public interface SignalCallback { |
| 40 | void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon, |
| 41 | boolean activityIn, boolean activityOut, String description); |
| 42 | |
Andrew Flynn | 2fdbe12 | 2015-06-01 16:34:21 -0400 | [diff] [blame] | 43 | void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, |
| 44 | int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, |
| 45 | String description, boolean isWide, int subId); |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 46 | void setSubs(List<SubscriptionInfo> subs); |
| 47 | void setNoSims(boolean show); |
| 48 | |
| 49 | void setEthernetIndicators(IconState icon); |
| 50 | |
| 51 | void setIsAirplaneMode(IconState icon); |
| 52 | |
| 53 | void setMobileDataEnabled(boolean enabled); |
| 54 | } |
| 55 | |
| 56 | public static class IconState { |
| 57 | public final boolean visible; |
| 58 | public final int icon; |
| 59 | public final String contentDescription; |
| 60 | |
| 61 | public IconState(boolean visible, int icon, String contentDescription) { |
| 62 | this.visible = visible; |
| 63 | this.icon = icon; |
| 64 | this.contentDescription = contentDescription; |
| 65 | } |
| 66 | |
| 67 | public IconState(boolean visible, int icon, int contentDescription, |
| 68 | Context context) { |
| 69 | this(visible, icon, context.getString(contentDescription)); |
| 70 | } |
Winson Chung | d63c5978 | 2012-09-05 17:34:41 -0700 | [diff] [blame] | 71 | } |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 72 | |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 73 | /** |
| 74 | * Tracks changes in access points. Allows listening for changes, scanning for new APs, |
| 75 | * and connecting to new ones. |
| 76 | */ |
| 77 | public interface AccessPointController { |
| 78 | void addAccessPointCallback(AccessPointCallback callback); |
| 79 | void removeAccessPointCallback(AccessPointCallback callback); |
| 80 | void scanForAccessPoints(); |
Jason Monk | d52356a | 2015-01-28 10:40:41 -0500 | [diff] [blame] | 81 | int getIcon(AccessPoint ap); |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 82 | boolean connect(AccessPoint ap); |
| 83 | boolean canConfigWifi(); |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 84 | |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 85 | public interface AccessPointCallback { |
Jason Monk | d52356a | 2015-01-28 10:40:41 -0500 | [diff] [blame] | 86 | void onAccessPointsChanged(List<AccessPoint> accessPoints); |
Jason Monk | 17f3c3f | 2015-01-14 10:13:22 -0500 | [diff] [blame] | 87 | void onSettingsActivityTriggered(Intent settingsIntent); |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 88 | } |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 89 | } |
Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 90 | } |