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