blob: 93c73228265efc6ae63dd3c778ffb0627b9b423a [file] [log] [blame]
Joe Onoratofd52b182010-11-10 18:00:52 -08001/*
John Spurlockaf8d6c42014-05-07 17:49:08 -04002 * Copyright (C) 2014 The Android Open Source Project
Joe Onoratofd52b182010-11-10 18:00:52 -08003 *
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
17package com.android.systemui.statusbar.policy;
18
Jason Monk07b75fe2015-05-14 16:47:03 -040019import android.content.Context;
Jason Monk17f3c3f2015-01-14 10:13:22 -050020import android.content.Intent;
Jason Monk07b75fe2015-05-14 16:47:03 -040021import android.telephony.SubscriptionInfo;
Winsonc0d70582016-01-29 10:24:39 -080022
Jason Monkf668d7c2016-01-14 10:38:41 -050023import com.android.settingslib.net.DataUsageController;
Jason Monkd52356a2015-01-28 10:40:41 -050024import com.android.settingslib.wifi.AccessPoint;
25
26import java.util.List;
27
John Spurlockaf8d6c42014-05-07 17:49:08 -040028public interface NetworkController {
Joe Onoratofd52b182010-11-10 18:00:52 -080029
John Spurlockaf8d6c42014-05-07 17:49:08 -040030 boolean hasMobileDataFeature();
Jason Monk07b75fe2015-05-14 16:47:03 -040031 void addSignalCallback(SignalCallback cb);
32 void removeSignalCallback(SignalCallback cb);
John Spurlockaf8d6c42014-05-07 17:49:08 -040033 void setWifiEnabled(boolean enabled);
Lorenzo Colitti403aa262014-11-28 11:21:30 +090034 void onUserSwitched(int newUserId);
Jason Monkd2263cd2014-11-10 14:22:56 -050035 AccessPointController getAccessPointController();
Jason Monkf668d7c2016-01-14 10:38:41 -050036 DataUsageController getMobileDataController();
Jason Monk9a4ce132016-01-21 15:27:17 -050037 DataSaverController getDataSaverController();
Christian Robertson2e347422011-08-11 14:01:04 -070038
Jason Monk07b75fe2015-05-14 16:47:03 -040039 public interface SignalCallback {
40 void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon,
41 boolean activityIn, boolean activityOut, String description);
42
Andrew Flynn2fdbe122015-06-01 16:34:21 -040043 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 Monk07b75fe2015-05-14 16:47:03 -040046 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 Chungd63c59782012-09-05 17:34:41 -070071 }
John Spurlock7f8f22a2014-07-02 18:54:17 -040072
Jason Monkd2263cd2014-11-10 14:22:56 -050073 /**
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 Monkd52356a2015-01-28 10:40:41 -050081 int getIcon(AccessPoint ap);
Jason Monkd2263cd2014-11-10 14:22:56 -050082 boolean connect(AccessPoint ap);
83 boolean canConfigWifi();
John Spurlock7f8f22a2014-07-02 18:54:17 -040084
Jason Monkd2263cd2014-11-10 14:22:56 -050085 public interface AccessPointCallback {
Jason Monkd52356a2015-01-28 10:40:41 -050086 void onAccessPointsChanged(List<AccessPoint> accessPoints);
Jason Monk17f3c3f2015-01-14 10:13:22 -050087 void onSettingsActivityTriggered(Intent settingsIntent);
Jason Monkd2263cd2014-11-10 14:22:56 -050088 }
John Spurlock7f8f22a2014-07-02 18:54:17 -040089 }
Joe Onoratofd52b182010-11-10 18:00:52 -080090}