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

Commit 2e6228c6 authored by tom hsu's avatar tom hsu Committed by Tom Hsu
Browse files

[Satellite] Show satellite state on internetdialog

Flag: EXEMPT bug fix
Fix: b/386424636
Fix: b/375038015
Test: Visual
Test: atest pass
Change-Id: Id189356cb02bc21c3ecef7da0c9541622aad0c0f
parent d44d0d12
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -2059,6 +2059,8 @@
    <string name="satellite_connected_carrier_text">Satellite SOS</string>
    <string name="satellite_connected_carrier_text">Satellite SOS</string>
    <!-- Text displayed indicating that the user might be able to use satellite SOS. -->
    <!-- Text displayed indicating that the user might be able to use satellite SOS. -->
    <string name="satellite_emergency_only_carrier_text">Emergency calls or SOS only</string>
    <string name="satellite_emergency_only_carrier_text">Emergency calls or SOS only</string>
    <!-- Text displayed indicating current network is satellite network. -->
    <string name="satellite_network_title_text">Satellite network</string>


    <!-- Content description skeleton. Input strings should be carrier name and signal bar description [CHAR LIMIT=NONE]-->
    <!-- Content description skeleton. Input strings should be carrier name and signal bar description [CHAR LIMIT=NONE]-->
    <string name="accessibility_phone_string_format"><xliff:g id="carrier_name" example="Carrier Name">%1$s</xliff:g>, <xliff:g id="signal_strength_description" example="two bars">%2$s</xliff:g>.</string>
    <string name="accessibility_phone_string_format"><xliff:g id="carrier_name" example="Carrier Name">%1$s</xliff:g>, <xliff:g id="signal_strength_description" example="two bars">%2$s</xliff:g>.</string>
+110 −74
Original line number Original line Diff line number Diff line
@@ -53,6 +53,8 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback;
import android.telephony.TelephonyCallback;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.telephony.satellite.SatelliteManager;
import android.telephony.satellite.SatelliteModemStateCallback;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.Log;
import android.util.Log;
import android.view.Gravity;
import android.view.Gravity;
@@ -105,6 +107,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.Objects;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReference;
@@ -153,19 +156,28 @@ public class InternetDetailsContentController implements AccessPointController.A


    static final int MAX_WIFI_ENTRY_COUNT = 3;
    static final int MAX_WIFI_ENTRY_COUNT = 3;


    static final int SATELLITE_CONNECTED = 2;
    static final int SATELLITE_STARTED = 1;
    static final int SATELLITE_NOT_STARTED = 0;

    private final FeatureFlags mFeatureFlags;
    private final FeatureFlags mFeatureFlags;


    //Should be accessible only to the main thread.
    @VisibleForTesting
    @VisibleForTesting
    /** Should be accessible only to the main thread. */
    final Map<Integer, TelephonyDisplayInfo>
    final Map<Integer, TelephonyDisplayInfo> mSubIdTelephonyDisplayInfoMap = new HashMap<>();
            mSubIdTelephonyDisplayInfoMap = new HashMap<>();
    //Should be accessible only to the main thread.
    @VisibleForTesting
    @VisibleForTesting
    /** Should be accessible only to the main thread. */
    final Map<Integer, TelephonyManager>
    final Map<Integer, TelephonyManager> mSubIdTelephonyManagerMap = new HashMap<>();
            mSubIdTelephonyManagerMap = new HashMap<>();
    // Should be accessible only to the main thread.
    @VisibleForTesting
    @VisibleForTesting
    /** Should be accessible only to the main thread. */
    final Map<Integer, TelephonyCallback>
    final Map<Integer, TelephonyCallback> mSubIdTelephonyCallbackMap = new HashMap<>();
            mSubIdTelephonyCallbackMap = new HashMap<>();


    private WifiManager mWifiManager;
    private WifiManager mWifiManager;
    @Nullable
    private SatelliteManager mSatelliteManager;
    private Context mContext;
    private Context mContext;
    private SubscriptionManager mSubscriptionManager;
    private SubscriptionManager mSubscriptionManager;
    private TelephonyManager mTelephonyManager;
    private TelephonyManager mTelephonyManager;
@@ -222,6 +234,24 @@ public class InternetDetailsContentController implements AccessPointController.A
    @VisibleForTesting
    @VisibleForTesting
    protected boolean mCarrierNetworkChangeMode;
    protected boolean mCarrierNetworkChangeMode;


    int mCurrentSatelliteState = SATELLITE_NOT_STARTED;

    final SatelliteModemStateCallback mSatelliteModemStateCallback =
            new SatelliteModemStateCallback() {
                @Override
                public void onSatelliteModemStateChanged(int state) {
                    mCurrentSatelliteState = switch (state) {
                        case SatelliteManager.SATELLITE_MODEM_STATE_OFF,
                             SatelliteManager.SATELLITE_MODEM_STATE_UNAVAILABLE,
                             SatelliteManager.SATELLITE_MODEM_STATE_UNKNOWN ->
                                SATELLITE_NOT_STARTED;
                        case SatelliteManager.SATELLITE_MODEM_STATE_CONNECTED ->
                                SATELLITE_CONNECTED;
                        default -> SATELLITE_STARTED;
                    };
                }
            };

    private final KeyguardUpdateMonitorCallback mKeyguardUpdateCallback =
    private final KeyguardUpdateMonitorCallback mKeyguardUpdateCallback =
            new KeyguardUpdateMonitorCallback() {
            new KeyguardUpdateMonitorCallback() {
                @Override
                @Override
@@ -245,21 +275,18 @@ public class InternetDetailsContentController implements AccessPointController.A


    @Inject
    @Inject
    public InternetDetailsContentController(@ShadeDisplayAware Context context,
    public InternetDetailsContentController(@ShadeDisplayAware Context context,
            UiEventLogger uiEventLogger,
            UiEventLogger uiEventLogger, ActivityStarter starter,
            ActivityStarter starter, AccessPointController accessPointController,
            AccessPointController accessPointController, SubscriptionManager subscriptionManager,
            SubscriptionManager subscriptionManager, TelephonyManager telephonyManager,
            TelephonyManager telephonyManager, @Nullable WifiManager wifiManager,
            @Nullable WifiManager wifiManager, ConnectivityManager connectivityManager,
            ConnectivityManager connectivityManager, Optional<SatelliteManager> optSatelliteManager,
            @Main Handler handler, @Main Executor mainExecutor,
            @Main Handler handler, @Main Executor mainExecutor,
            BroadcastDispatcher broadcastDispatcher, KeyguardUpdateMonitor keyguardUpdateMonitor,
            BroadcastDispatcher broadcastDispatcher, KeyguardUpdateMonitor keyguardUpdateMonitor,
            GlobalSettings globalSettings, KeyguardStateController keyguardStateController,
            GlobalSettings globalSettings, KeyguardStateController keyguardStateController,
            @ShadeDisplayAware WindowManager windowManager, ToastFactory toastFactory,
            @ShadeDisplayAware WindowManager windowManager, ToastFactory toastFactory,
            @Background Handler workerHandler,
            @Background Handler workerHandler, CarrierConfigTracker carrierConfigTracker,
            CarrierConfigTracker carrierConfigTracker,
            LocationController locationController,
            LocationController locationController,
            DialogTransitionAnimator dialogTransitionAnimator,
            DialogTransitionAnimator dialogTransitionAnimator, WifiStateWorker wifiStateWorker,
            WifiStateWorker wifiStateWorker,
            FeatureFlags featureFlags) {
            FeatureFlags featureFlags
    ) {
        if (DEBUG) {
        if (DEBUG) {
            Log.d(TAG, "Init InternetDetailsContentController");
            Log.d(TAG, "Init InternetDetailsContentController");
        }
        }
@@ -270,6 +297,7 @@ public class InternetDetailsContentController implements AccessPointController.A
        mGlobalSettings = globalSettings;
        mGlobalSettings = globalSettings;
        mWifiManager = wifiManager;
        mWifiManager = wifiManager;
        mTelephonyManager = telephonyManager;
        mTelephonyManager = telephonyManager;
        mSatelliteManager = optSatelliteManager.orElse(null);
        mConnectivityManager = connectivityManager;
        mConnectivityManager = connectivityManager;
        mSubscriptionManager = subscriptionManager;
        mSubscriptionManager = subscriptionManager;
        mCarrierConfigTracker = carrierConfigTracker;
        mCarrierConfigTracker = carrierConfigTracker;
@@ -321,6 +349,15 @@ public class InternetDetailsContentController implements AccessPointController.A
        mConnectivityManager.registerDefaultNetworkCallback(mConnectivityManagerNetworkCallback);
        mConnectivityManager.registerDefaultNetworkCallback(mConnectivityManagerNetworkCallback);
        mCanConfigWifi = canConfigWifi;
        mCanConfigWifi = canConfigWifi;
        scanWifiAccessPoints();
        scanWifiAccessPoints();

        if (mSatelliteManager != null) {
            try {
                mSatelliteManager.registerForModemStateChanged(mExecutor,
                        mSatelliteModemStateCallback);
            } catch (IllegalStateException e) {
                Log.w(TAG, "Unable to register callback for modem state changes : " + e);
            }
        }
    }
    }


    void onStop() {
    void onStop() {
@@ -339,13 +376,20 @@ public class InternetDetailsContentController implements AccessPointController.A
        mSubIdTelephonyManagerMap.clear();
        mSubIdTelephonyManagerMap.clear();
        mSubIdTelephonyCallbackMap.clear();
        mSubIdTelephonyCallbackMap.clear();
        mSubIdTelephonyDisplayInfoMap.clear();
        mSubIdTelephonyDisplayInfoMap.clear();
        mSubscriptionManager.removeOnSubscriptionsChangedListener(
        mSubscriptionManager.removeOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
                mOnSubscriptionsChangedListener);
        mAccessPointController.removeAccessPointCallback(this);
        mAccessPointController.removeAccessPointCallback(this);
        mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateCallback);
        mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateCallback);
        mConnectivityManager.unregisterNetworkCallback(mConnectivityManagerNetworkCallback);
        mConnectivityManager.unregisterNetworkCallback(mConnectivityManagerNetworkCallback);
        mConnectedWifiInternetMonitor.unregisterCallback();
        mConnectedWifiInternetMonitor.unregisterCallback();
        mCallback = null;
        mCallback = null;

        if (mSatelliteManager != null) {
            try {
                mSatelliteManager.unregisterForModemStateChanged(mSatelliteModemStateCallback);
            } catch (IllegalStateException e) {
                Log.w(TAG, "Unable to unregister callback for modem state changes : " + e);
            }
        }
    }
    }


    /**
    /**
@@ -354,8 +398,7 @@ public class InternetDetailsContentController implements AccessPointController.A
     * {@link com.android.server.TelephonyRegistry}, so if subscription id and callback were cached
     * {@link com.android.server.TelephonyRegistry}, so if subscription id and callback were cached
     * already, it shall do nothing to avoid registering redundant callback to Telephony.
     * already, it shall do nothing to avoid registering redundant callback to Telephony.
     */
     */
    private void registerInternetTelephonyCallback(
    private void registerInternetTelephonyCallback(TelephonyManager telephonyManager, int subId) {
            TelephonyManager telephonyManager, int subId) {
        if (mSubIdTelephonyCallbackMap.containsKey(subId)) {
        if (mSubIdTelephonyCallbackMap.containsKey(subId)) {
            // Avoid to generate and register unnecessary callback to Telephony.
            // Avoid to generate and register unnecessary callback to Telephony.
            return;
            return;
@@ -446,8 +489,8 @@ public class InternetDetailsContentController implements AccessPointController.A
        if (DEBUG) {
        if (DEBUG) {
            Log.d(TAG, "No Wi-Fi item.");
            Log.d(TAG, "No Wi-Fi item.");
        }
        }
        boolean isActiveOnNonDds = getActiveAutoSwitchNonDdsSubId() != SubscriptionManager
        boolean isActiveOnNonDds =
                .INVALID_SUBSCRIPTION_ID;
                getActiveAutoSwitchNonDdsSubId() != SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        if (!hasActiveSubIdOnDds() || (!isVoiceStateInService(mDefaultDataSubId)
        if (!hasActiveSubIdOnDds() || (!isVoiceStateInService(mDefaultDataSubId)
                && !isDataStateInService(mDefaultDataSubId) && !isActiveOnNonDds)) {
                && !isDataStateInService(mDefaultDataSubId) && !isActiveOnNonDds)) {
            if (DEBUG) {
            if (DEBUG) {
@@ -560,9 +603,8 @@ public class InternetDetailsContentController implements AccessPointController.A
    Drawable getSignalStrengthIcon(int subId, Context context, int level, int numLevels,
    Drawable getSignalStrengthIcon(int subId, Context context, int level, int numLevels,
            int iconType, boolean cutOut) {
            int iconType, boolean cutOut) {
        boolean isForDds = subId == mDefaultDataSubId;
        boolean isForDds = subId == mDefaultDataSubId;
        int levelDrawable =
        int levelDrawable = mCarrierNetworkChangeMode ? SignalDrawable.getCarrierChangeState(
                mCarrierNetworkChangeMode ? SignalDrawable.getCarrierChangeState(numLevels)
                numLevels) : SignalDrawable.getState(level, numLevels, cutOut);
                        : SignalDrawable.getState(level, numLevels, cutOut);
        if (isForDds) {
        if (isForDds) {
            mSignalDrawable.setLevel(levelDrawable);
            mSignalDrawable.setLevel(levelDrawable);
        } else {
        } else {
@@ -570,16 +612,14 @@ public class InternetDetailsContentController implements AccessPointController.A
        }
        }


        // Make the network type drawable
        // Make the network type drawable
        final Drawable networkDrawable =
        final Drawable networkDrawable = iconType == NO_CELL_DATA_TYPE_ICON ? EMPTY_DRAWABLE
                iconType == NO_CELL_DATA_TYPE_ICON
                        ? EMPTY_DRAWABLE
                : context.getResources().getDrawable(iconType, context.getTheme());
                : context.getResources().getDrawable(iconType, context.getTheme());


        // Overlay the two drawables
        // Overlay the two drawables
        final Drawable[] layers = {networkDrawable, isForDds
        final Drawable[] layers =
                ? mSignalDrawable : mSecondarySignalDrawable};
                {networkDrawable, isForDds ? mSignalDrawable : mSecondarySignalDrawable};
        final int iconSize =
        final int iconSize = context.getResources().getDimensionPixelSize(
                context.getResources().getDimensionPixelSize(R.dimen.signal_strength_icon_size);
                R.dimen.signal_strength_icon_size);


        final LayerDrawable icons = new LayerDrawable(layers);
        final LayerDrawable icons = new LayerDrawable(layers);
        // Set the network type icon at the top left
        // Set the network type icon at the top left
@@ -614,21 +654,17 @@ public class InternetDetailsContentController implements AccessPointController.A


        // Map of SubscriptionId to DisplayName
        // Map of SubscriptionId to DisplayName
        final Supplier<Stream<DisplayInfo>> originalInfos =
        final Supplier<Stream<DisplayInfo>> originalInfos =
                () -> getSubscriptionInfo()
                () -> getSubscriptionInfo().stream().filter(i -> {
                        .stream()
                        .filter(i -> {
                    // Filter out null values.
                    // Filter out null values.
                    return (i != null && i.getDisplayName() != null);
                    return (i != null && i.getDisplayName() != null);
                        })
                }).map(i -> new DisplayInfo(i, i.getDisplayName().toString().trim()));
                        .map(i -> new DisplayInfo(i, i.getDisplayName().toString().trim()));


        // A Unique set of display names
        // A Unique set of display names
        Set<CharSequence> uniqueNames = new HashSet<>();
        Set<CharSequence> uniqueNames = new HashSet<>();
        // Return the set of duplicate names
        // Return the set of duplicate names
        final Set<CharSequence> duplicateOriginalNames = originalInfos.get()
        final Set<CharSequence> duplicateOriginalNames = originalInfos.get().filter(
                .filter(info -> !uniqueNames.add(info.originalName))
                info -> !uniqueNames.add(info.originalName)).map(info -> info.originalName).collect(
                .map(info -> info.originalName)
                Collectors.toSet());
                .collect(Collectors.toSet());


        // If a display name is duplicate, append the final 4 digits of the phone number.
        // If a display name is duplicate, append the final 4 digits of the phone number.
        // Creates a mapping of Subscription id to original display name + phone number display name
        // Creates a mapping of Subscription id to original display name + phone number display name
@@ -639,8 +675,8 @@ public class InternetDetailsContentController implements AccessPointController.A
                        info.subscriptionInfo);
                        info.subscriptionInfo);
                String lastFourDigits = "";
                String lastFourDigits = "";
                if (phoneNumber != null) {
                if (phoneNumber != null) {
                    lastFourDigits = (phoneNumber.length() > 4)
                    lastFourDigits = (phoneNumber.length() > 4) ? phoneNumber.substring(
                            ? phoneNumber.substring(phoneNumber.length() - 4) : phoneNumber;
                            phoneNumber.length() - 4) : phoneNumber;
                }
                }


                if (TextUtils.isEmpty(lastFourDigits)) {
                if (TextUtils.isEmpty(lastFourDigits)) {
@@ -659,19 +695,17 @@ public class InternetDetailsContentController implements AccessPointController.A
        // We might not have had permission to view the phone numbers.
        // We might not have had permission to view the phone numbers.
        // There might also be multiple phone numbers whose last 4 digits the same.
        // There might also be multiple phone numbers whose last 4 digits the same.
        uniqueNames.clear();
        uniqueNames.clear();
        final Set<CharSequence> duplicatePhoneNames = uniqueInfos.get()
        final Set<CharSequence> duplicatePhoneNames = uniqueInfos.get().filter(
                .filter(info -> !uniqueNames.add(info.uniqueName))
                info -> !uniqueNames.add(info.uniqueName)).map(info -> info.uniqueName).collect(
                .map(info -> info.uniqueName)
                Collectors.toSet());
                .collect(Collectors.toSet());


        return uniqueInfos.get().map(info -> {
        return uniqueInfos.get().map(info -> {
            if (duplicatePhoneNames.contains(info.uniqueName)) {
            if (duplicatePhoneNames.contains(info.uniqueName)) {
                info.uniqueName = info.originalName + " "
                info.uniqueName =
                        + info.subscriptionInfo.getSubscriptionId();
                        info.originalName + " " + info.subscriptionInfo.getSubscriptionId();
            }
            }
            return info;
            return info;
        }).collect(Collectors.toMap(
        }).collect(Collectors.toMap(info -> info.subscriptionInfo.getSubscriptionId(),
                info -> info.subscriptionInfo.getSubscriptionId(),
                info -> info.uniqueName));
                info -> info.uniqueName));
    }
    }


@@ -720,8 +754,8 @@ public class InternetDetailsContentController implements AccessPointController.A
     */
     */
    private String getNetworkTypeDescription(Context context, MobileMappings.Config config,
    private String getNetworkTypeDescription(Context context, MobileMappings.Config config,
            int subId) {
            int subId) {
        TelephonyDisplayInfo telephonyDisplayInfo =
        TelephonyDisplayInfo telephonyDisplayInfo = mSubIdTelephonyDisplayInfoMap.getOrDefault(
                mSubIdTelephonyDisplayInfoMap.getOrDefault(subId, DEFAULT_TELEPHONY_DISPLAY_INFO);
                subId, DEFAULT_TELEPHONY_DISPLAY_INFO);
        String iconKey = getIconKey(telephonyDisplayInfo);
        String iconKey = getIconKey(telephonyDisplayInfo);


        if (mapIconSets(config) == null || mapIconSets(config).get(iconKey) == null) {
        if (mapIconSets(config) == null || mapIconSets(config).get(iconKey) == null) {
@@ -741,8 +775,8 @@ public class InternetDetailsContentController implements AccessPointController.A
            resId = iconGroup.dataContentDescription;
            resId = iconGroup.dataContentDescription;
        }
        }


        return resId != 0
        return resId != 0 ? SubscriptionManager.getResourcesForSubId(context, subId).getString(
                ? SubscriptionManager.getResourcesForSubId(context, subId).getString(resId) : "";
                resId) : "";
    }
    }


    private String getMobileSummary(Context context, String networkTypeDescription, int subId) {
    private String getMobileSummary(Context context, String networkTypeDescription, int subId) {
@@ -873,8 +907,7 @@ public class InternetDetailsContentController implements AccessPointController.A
            return;
            return;
        }
        }


        MergedCarrierEntry mergedCarrierEntry =
        MergedCarrierEntry mergedCarrierEntry = mAccessPointController.getMergedCarrierEntry();
                mAccessPointController.getMergedCarrierEntry();
        if (mergedCarrierEntry == null) {
        if (mergedCarrierEntry == null) {
            Log.e(TAG, errorLogPrefix + "no merged entry");
            Log.e(TAG, errorLogPrefix + "no merged entry");
            return;
            return;
@@ -1009,8 +1042,8 @@ public class InternetDetailsContentController implements AccessPointController.A
            return;
            return;
        }
        }


        mTelephonyManager.setDataEnabledForReason(
        mTelephonyManager.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_USER,
                TelephonyManager.DATA_ENABLED_REASON_USER, enabled);
                enabled);
        if (disableOtherSubscriptions) {
        if (disableOtherSubscriptions) {
            final List<SubscriptionInfo> subInfoList =
            final List<SubscriptionInfo> subInfoList =
                    mSubscriptionManager.getActiveSubscriptionInfoList();
                    mSubscriptionManager.getActiveSubscriptionInfoList();
@@ -1058,14 +1091,17 @@ public class InternetDetailsContentController implements AccessPointController.A


        final ServiceState serviceState = mSubIdServiceState.getOrDefault(subId,
        final ServiceState serviceState = mSubIdServiceState.getOrDefault(subId,
                new ServiceState());
                new ServiceState());
        return serviceState != null
        return serviceState != null && serviceState.getState() == serviceState.STATE_IN_SERVICE;
                && serviceState.getState() == serviceState.STATE_IN_SERVICE;
    }
    }


    public boolean isDeviceLocked() {
    public boolean isDeviceLocked() {
        return !mKeyguardStateController.isUnlocked();
        return !mKeyguardStateController.isUnlocked();
    }
    }


    int getCurrentSatelliteState() {
        return mCurrentSatelliteState;
    }

    boolean activeNetworkIsCellular() {
    boolean activeNetworkIsCellular() {
        if (mConnectivityManager == null) {
        if (mConnectivityManager == null) {
            if (DEBUG) {
            if (DEBUG) {
@@ -1079,8 +1115,8 @@ public class InternetDetailsContentController implements AccessPointController.A
            Log.d(TAG, "getActiveNetwork is null.");
            Log.d(TAG, "getActiveNetwork is null.");
            return false;
            return false;
        }
        }
        final NetworkCapabilities networkCapabilities =
        final NetworkCapabilities networkCapabilities = mConnectivityManager.getNetworkCapabilities(
                mConnectivityManager.getNetworkCapabilities(activeNetwork);
                activeNetwork);
        if (networkCapabilities == null) {
        if (networkCapabilities == null) {
            return false;
            return false;
        }
        }
@@ -1206,10 +1242,8 @@ public class InternetDetailsContentController implements AccessPointController.A
    }
    }


    private class InternetTelephonyCallback extends TelephonyCallback implements
    private class InternetTelephonyCallback extends TelephonyCallback implements
            TelephonyCallback.DataEnabledListener,
            TelephonyCallback.DataEnabledListener, TelephonyCallback.DataConnectionStateListener,
            TelephonyCallback.DataConnectionStateListener,
            TelephonyCallback.DisplayInfoListener, TelephonyCallback.ServiceStateListener,
            TelephonyCallback.DisplayInfoListener,
            TelephonyCallback.ServiceStateListener,
            TelephonyCallback.SignalStrengthsListener,
            TelephonyCallback.SignalStrengthsListener,
            TelephonyCallback.UserMobileDataStateListener,
            TelephonyCallback.UserMobileDataStateListener,
            TelephonyCallback.CarrierNetworkListener {
            TelephonyCallback.CarrierNetworkListener {
@@ -1273,8 +1307,8 @@ public class InternetDetailsContentController implements AccessPointController.A
        }
        }
    }
    }


    private class InternetOnSubscriptionChangedListener
    private class InternetOnSubscriptionChangedListener extends
            extends SubscriptionManager.OnSubscriptionsChangedListener {
            SubscriptionManager.OnSubscriptionsChangedListener {
        InternetOnSubscriptionChangedListener() {
        InternetOnSubscriptionChangedListener() {
            super();
            super();
        }
        }
@@ -1326,8 +1360,8 @@ public class InternetDetailsContentController implements AccessPointController.A
            }
            }
            // If the Wi-Fi is not connected yet, or it's the connected Wi-Fi with Internet
            // If the Wi-Fi is not connected yet, or it's the connected Wi-Fi with Internet
            // access. Then we don't need to listen to the callback to update the Wi-Fi entries.
            // access. Then we don't need to listen to the callback to update the Wi-Fi entries.
            if (entry.getConnectedState() != CONNECTED_STATE_CONNECTED
            if (entry.getConnectedState() != CONNECTED_STATE_CONNECTED || (entry.isDefaultNetwork()
                    || (entry.isDefaultNetwork() && entry.hasInternetAccess())) {
                    && entry.hasInternetAccess())) {
                return;
                return;
            }
            }
            mWifiEntry = entry;
            mWifiEntry = entry;
@@ -1458,6 +1492,8 @@ public class InternetDetailsContentController implements AccessPointController.A
                @Nullable WifiEntry connectedEntry, boolean hasMoreWifiEntries);
                @Nullable WifiEntry connectedEntry, boolean hasMoreWifiEntries);


        void onWifiScan(boolean isScan);
        void onWifiScan(boolean isScan);

        void onSatelliteModemStateChanged(int state);
    }
    }


    void makeOverlayToast(int stringId) {
    void makeOverlayToast(int stringId) {
+4 −0
Original line number Original line Diff line number Diff line
@@ -1020,6 +1020,10 @@ constructor(
            override fun onWifiScan(isScan: Boolean) {
            override fun onWifiScan(isScan: Boolean) {
                setProgressBarVisible(isScan)
                setProgressBarVisible(isScan)
            }
            }

            override fun onSatelliteModemStateChanged(state: Int) {
                updateContent(shouldUpdateMobileNetwork = true)
            }
        }
        }


    enum class InternetDetailsEvent(private val id: Int) : UiEventLogger.UiEventEnum {
    enum class InternetDetailsEvent(private val id: Int) : UiEventLogger.UiEventEnum {
+137 −102

File changed.

Preview size limit exceeded, changes collapsed.

+5 −1
Original line number Original line Diff line number Diff line
@@ -52,6 +52,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback;
import android.telephony.TelephonyCallback;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.telephony.satellite.SatelliteManager;
import android.testing.TestableLooper;
import android.testing.TestableLooper;
import android.testing.TestableResources;
import android.testing.TestableResources;
import android.text.TextUtils;
import android.text.TextUtils;
@@ -100,6 +101,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.Locale;
import java.util.Locale;
import java.util.Map;
import java.util.Map;
import java.util.Optional;


@SmallTest
@SmallTest
@RunWith(AndroidJUnit4.class)
@RunWith(AndroidJUnit4.class)
@@ -121,6 +123,8 @@ public class InternetDetailsContentControllerTest extends SysuiTestCase {
    @Mock
    @Mock
    private ConnectivityManager mConnectivityManager;
    private ConnectivityManager mConnectivityManager;
    @Mock
    @Mock
    private Optional<SatelliteManager> mSatelliteManager;
    @Mock
    private Network mNetwork;
    private Network mNetwork;
    @Mock
    @Mock
    private NetworkCapabilities mNetworkCapabilities;
    private NetworkCapabilities mNetworkCapabilities;
@@ -231,7 +235,7 @@ public class InternetDetailsContentControllerTest extends SysuiTestCase {
        mInternetDetailsContentController = new InternetDetailsContentController(mContext,
        mInternetDetailsContentController = new InternetDetailsContentController(mContext,
                mock(UiEventLogger.class), mock(ActivityStarter.class), mAccessPointController,
                mock(UiEventLogger.class), mock(ActivityStarter.class), mAccessPointController,
                mSubscriptionManager, mTelephonyManager, mWifiManager,
                mSubscriptionManager, mTelephonyManager, mWifiManager,
                mConnectivityManager, mHandler, mExecutor, mBroadcastDispatcher,
                mConnectivityManager, mSatelliteManager, mHandler, mExecutor, mBroadcastDispatcher,
                mock(KeyguardUpdateMonitor.class), mGlobalSettings, mKeyguardStateController,
                mock(KeyguardUpdateMonitor.class), mGlobalSettings, mKeyguardStateController,
                mWindowManager, mToastFactory, mWorkerHandler, mCarrierConfigTracker,
                mWindowManager, mToastFactory, mWorkerHandler, mCarrierConfigTracker,
                mLocationController, mDialogTransitionAnimator, mWifiStateWorker, mFlags);
                mLocationController, mDialogTransitionAnimator, mWifiStateWorker, mFlags);
Loading