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; |
Sundeep Ghuman | d57f324 | 2017-01-13 15:31:48 -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; |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 25 | import com.android.systemui.DemoMode; |
Jason Monk | 8852905 | 2016-11-04 13:29:58 -0400 | [diff] [blame] | 26 | import com.android.systemui.statusbar.policy.NetworkController.SignalCallback; |
Jason Monk | d52356a | 2015-01-28 10:40:41 -0500 | [diff] [blame] | 27 | |
| 28 | import java.util.List; |
| 29 | |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 30 | public interface NetworkController extends CallbackController<SignalCallback>, DemoMode { |
Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 31 | |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 32 | boolean hasMobileDataFeature(); |
Jason Monk | 8852905 | 2016-11-04 13:29:58 -0400 | [diff] [blame] | 33 | void addCallback(SignalCallback cb); |
| 34 | void removeCallback(SignalCallback cb); |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 35 | void setWifiEnabled(boolean enabled); |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 36 | AccessPointController getAccessPointController(); |
Jason Monk | f668d7c | 2016-01-14 10:38:41 -0500 | [diff] [blame] | 37 | DataUsageController getMobileDataController(); |
Jason Monk | 9a4ce13 | 2016-01-21 15:27:17 -0500 | [diff] [blame] | 38 | DataSaverController getDataSaverController(); |
Christian Robertson | 2e34742 | 2011-08-11 14:01:04 -0700 | [diff] [blame] | 39 | |
Jason Monk | 46dbfb4 | 2016-02-25 14:59:20 -0500 | [diff] [blame] | 40 | boolean hasVoiceCallingFeature(); |
| 41 | |
| 42 | void addEmergencyListener(EmergencyListener listener); |
| 43 | void removeEmergencyListener(EmergencyListener listener); |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 44 | boolean hasEmergencyCryptKeeperText(); |
| 45 | boolean isRadioOn(); |
Jason Monk | 46dbfb4 | 2016-02-25 14:59:20 -0500 | [diff] [blame] | 46 | |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 47 | public interface SignalCallback { |
Adrian Roos | 316bf54 | 2016-08-23 17:53:07 +0200 | [diff] [blame] | 48 | default void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon, |
Jason Monk | 110e5f6 | 2017-03-31 13:45:12 -0400 | [diff] [blame] | 49 | boolean activityIn, boolean activityOut, String description, boolean isTransient) {} |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 50 | |
Jason Monk | 7e6c83c | 2017-04-26 14:35:24 -0400 | [diff] [blame] | 51 | default void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, |
| 52 | int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, |
| 53 | String description, boolean isWide, int subId, boolean roaming) {} |
Adrian Roos | 316bf54 | 2016-08-23 17:53:07 +0200 | [diff] [blame] | 54 | default void setSubs(List<SubscriptionInfo> subs) {} |
| 55 | default void setNoSims(boolean show) {} |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 56 | |
Adrian Roos | 316bf54 | 2016-08-23 17:53:07 +0200 | [diff] [blame] | 57 | default void setEthernetIndicators(IconState icon) {} |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 58 | |
Adrian Roos | 316bf54 | 2016-08-23 17:53:07 +0200 | [diff] [blame] | 59 | default void setIsAirplaneMode(IconState icon) {} |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 60 | |
Adrian Roos | 316bf54 | 2016-08-23 17:53:07 +0200 | [diff] [blame] | 61 | default void setMobileDataEnabled(boolean enabled) {} |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 62 | } |
| 63 | |
Jason Monk | 46dbfb4 | 2016-02-25 14:59:20 -0500 | [diff] [blame] | 64 | public interface EmergencyListener { |
| 65 | void setEmergencyCallsOnly(boolean emergencyOnly); |
| 66 | } |
| 67 | |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 68 | public static class IconState { |
| 69 | public final boolean visible; |
| 70 | public final int icon; |
| 71 | public final String contentDescription; |
| 72 | |
Sundeep Ghuman | 9d10a3c | 2017-06-16 00:05:16 +0000 | [diff] [blame] | 73 | public IconState(boolean visible, int icon, String contentDescription) { |
Jason Monk | 07b75fe | 2015-05-14 16:47:03 -0400 | [diff] [blame] | 74 | this.visible = visible; |
| 75 | this.icon = icon; |
| 76 | this.contentDescription = contentDescription; |
| 77 | } |
| 78 | |
| 79 | public IconState(boolean visible, int icon, int contentDescription, |
| 80 | Context context) { |
| 81 | this(visible, icon, context.getString(contentDescription)); |
| 82 | } |
Winson Chung | d63c5978 | 2012-09-05 17:34:41 -0700 | [diff] [blame] | 83 | } |
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 | /** |
| 86 | * Tracks changes in access points. Allows listening for changes, scanning for new APs, |
| 87 | * and connecting to new ones. |
| 88 | */ |
| 89 | public interface AccessPointController { |
| 90 | void addAccessPointCallback(AccessPointCallback callback); |
| 91 | void removeAccessPointCallback(AccessPointCallback callback); |
| 92 | void scanForAccessPoints(); |
Jason Monk | d52356a | 2015-01-28 10:40:41 -0500 | [diff] [blame] | 93 | int getIcon(AccessPoint ap); |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 94 | boolean connect(AccessPoint ap); |
| 95 | boolean canConfigWifi(); |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 96 | |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 97 | public interface AccessPointCallback { |
Jason Monk | d52356a | 2015-01-28 10:40:41 -0500 | [diff] [blame] | 98 | void onAccessPointsChanged(List<AccessPoint> accessPoints); |
Jason Monk | 17f3c3f | 2015-01-14 10:13:22 -0500 | [diff] [blame] | 99 | void onSettingsActivityTriggered(Intent settingsIntent); |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 100 | } |
John Spurlock | 7f8f22a | 2014-07-02 18:54:17 -0400 | [diff] [blame] | 101 | } |
Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 102 | } |