Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e59b66fb authored by yinxu's avatar yinxu
Browse files

Support the Carrier WiFi for Provider Model

When the device is connected to the Carrier WiFi, the Cellular icons
will be shown in the SysUI instead of the WiFi icons.

Bug: 175317582
Test: Unit tests, Manual tests
Change-Id: I4e090f3058724937ba9bbe131d91379ad2383083
parent 677c97dd
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2020 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="38dp"
        android:height="24dp"
        android:viewportWidth="38.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="#FF000000"
        android:pathData="M9.45,14.48h1.8c-0.05,0.98 -0.24,1.82 -0.6,2.53c-0.35,0.7 -0.85,1.24 -1.51,1.62c-0.66,0.38 -1.48,0.57 -2.47,0.57c-0.71,0 -1.35,-0.14 -1.92,-0.42c-0.57,-0.28 -1.06,-0.68 -1.47,-1.2c-0.4,-0.53 -0.71,-1.16 -0.93,-1.89c-0.21,-0.74 -0.32,-1.56 -0.32,-2.48v-2.63c0,-0.91 0.11,-1.74 0.32,-2.47c0.22,-0.74 0.54,-1.36 0.95,-1.88C3.71,5.69 4.21,5.29 4.8,5.01c0.6,-0.28 1.28,-0.42 2.03,-0.42c0.92,0 1.71,0.19 2.34,0.56c0.64,0.36 1.14,0.9 1.48,1.61c0.35,0.7 0.55,1.57 0.59,2.59h-1.8C9.41,8.59 9.29,7.98 9.1,7.52C8.91,7.04 8.63,6.69 8.26,6.47C7.9,6.24 7.42,6.13 6.84,6.13c-0.52,0 -0.97,0.1 -1.36,0.31C5.1,6.65 4.79,6.95 4.54,7.34C4.3,7.72 4.12,8.19 3.99,8.74c-0.12,0.54 -0.18,1.15 -0.18,1.82v2.65c0,0.62 0.05,1.21 0.15,1.75c0.1,0.54 0.27,1.02 0.49,1.43c0.23,0.4 0.52,0.72 0.89,0.95c0.36,0.23 0.81,0.34 1.33,0.34c0.66,0 1.18,-0.11 1.56,-0.32c0.38,-0.21 0.67,-0.56 0.85,-1.03C9.27,15.85 9.39,15.23 9.45,14.48z"/>
    <path
        android:fillColor="#FF000000"
        android:pathData="M24.87,4.78l-1.74,9.72l-0.2,1.64l-0.29,-1.44l-2.21,-9.92l-0.2,0l-1.06,0l-0.22,0l-2.28,9.92l-0.28,1.4l-0.18,-1.59l-1.78,-9.73l-1.79,0l2.83,14.22l0.34,0l0.92,0l0.35,0l2.48,-10.36l0.14,-0.84l0.15,0.84l2.36,10.36l0.36,0l0.92,0l0.34,0l2.82,-14.22z"/>
    <path
        android:fillColor="#FF000000"
        android:pathData="M35.72,6.32l0,-1.54l-5.61,0l-0.34,0l-1.45,0l0,14.22l1.79,0l0,-6.28l4.8,0l0,-1.54l-4.8,0l0,-4.86z"/>
</vector>
+3 −0
Original line number Diff line number Diff line
@@ -1447,6 +1447,9 @@
    <!-- Content description of the data connection type 5G+. [CHAR LIMIT=NONE] -->
    <string name="data_connection_5g_plus" translatable="false">5G+</string>

    <!-- Content description of the data connection type Carrier WiFi. [CHAR LIMIT=NONE] -->
    <string name="data_connection_carrier_wifi">CWF</string>

    <!-- Content description of the cell data being disabled. [CHAR LIMIT=NONE] -->
    <string name="cell_data_off_content_description">Mobile data off</string>

+15 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public class TelephonyIcons {
    public static final int ICON_1X = R.drawable.ic_1x_mobiledata;
    public static final int ICON_5G = R.drawable.ic_5g_mobiledata;
    public static final int ICON_5G_PLUS = R.drawable.ic_5g_plus_mobiledata;
    public static final int ICON_CWF = R.drawable.ic_carrier_wifi;

    public static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
            "CARRIER_NETWORK_CHANGE",
@@ -276,6 +277,20 @@ public class TelephonyIcons {
            0,
            false);

    public static final MobileIconGroup CARRIER_MERGED_WIFI = new MobileIconGroup(
            "CWF",
            /* sbIcons= */ null,
            /* qsIcons= */ null,
            AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
            /* sbNullState= */ 0,
            /* qsNullState= */ 0,
            /* sbDiscState= */ 0,
            /* qsDiscState= */ 0,
            AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
            R.string.data_connection_carrier_wifi,
            TelephonyIcons.ICON_CWF,
            /* isWide= */ true);

    // When adding a new MobileIconGround, check if the dataContentDescription has to be filtered
    // in QSCarrier#hasValidTypeContentDescription

+10 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.net.wifi.WifiNetworkScoreCache;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.util.FeatureFlagUtils;

import com.android.settingslib.R;

@@ -103,11 +104,14 @@ public class WifiStatusTracker {
    private Network mDefaultNetwork = null;
    private NetworkCapabilities mDefaultNetworkCapabilities = null;
    private final Runnable mCallback;
    private final boolean mProviderModel;

    private WifiInfo mWifiInfo;
    public boolean enabled;
    public boolean isCaptivePortal;
    public boolean isDefaultNetwork;
    public boolean isCarrierMerged;
    public int subId;
    public int state;
    public boolean connected;
    public String ssid;
@@ -124,6 +128,8 @@ public class WifiStatusTracker {
        mNetworkScoreManager = networkScoreManager;
        mConnectivityManager = connectivityManager;
        mCallback = callback;
        mProviderModel = FeatureFlagUtils.isEnabled(
                mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
    }

    public void setListening(boolean listening) {
@@ -193,6 +199,10 @@ public class WifiStatusTracker {
            } else {
                ssid = getValidSsid(mWifiInfo);
            }
            if (mProviderModel) {
                isCarrierMerged = mWifiInfo.isCarrierMerged();
                subId = mWifiInfo.getSubscriptionId();
            }
            updateRssi(mWifiInfo.getRssi());
            maybeRequestNetworkScore();
        }
+1 −1
Original line number Diff line number Diff line
@@ -359,7 +359,7 @@ public class NetworkControllerImpl extends BroadcastReceiver

        // broadcasts
        IntentFilter filter = new IntentFilter();
        filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
        filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
        filter.addAction(Intent.ACTION_SIM_STATE_CHANGED);
        filter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
        filter.addAction(TelephonyManager.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED);
Loading