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

Commit 9ff4c574 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12748980 from c39974b3 to 25Q1-release

Change-Id: I87ca5c8d52ec185619786428fea37d3cfe59c644
parents f75f0784 c39974b3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -118,3 +118,11 @@ flag {
    description: "This flag controls to get a group id level2."
    bug:"381171540"
}

# OWNER=jinjeong TARGET=25Q2
flag {
    name: "action_sim_preference_settings"
    namespace: "telephony"
    description: "This flag controls to launch sim preference page in Setting"
    bug:"381319469"
}
+4 −2
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public class DisplayInfoController extends Handler {
        mTelephonyDisplayInfo = new TelephonyDisplayInfo(
                TelephonyManager.NETWORK_TYPE_UNKNOWN,
                TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
                false);
                false, false, false);
        mNetworkTypeController = new NetworkTypeController(phone, this, featureFlags);
        // EVENT_UPDATE will transition from DefaultState to the current state
        // and update the TelephonyDisplayInfo based on the current state.
@@ -132,7 +132,9 @@ public class DisplayInfoController extends Handler {
        TelephonyDisplayInfo newDisplayInfo = new TelephonyDisplayInfo(
                mNetworkTypeController.getDataNetworkType(),
                mNetworkTypeController.getOverrideNetworkType(),
                isRoaming());
                isRoaming(),
                mPhone.getServiceStateTracker().getServiceState().isUsingNonTerrestrialNetwork(),
                mNetworkTypeController.getSatelliteConstrainedData());
        if (!newDisplayInfo.equals(mTelephonyDisplayInfo)) {
            logl("TelephonyDisplayInfo changed from " + mTelephonyDisplayInfo + " to "
                    + newDisplayInfo);
+114 −0
Original line number Diff line number Diff line
@@ -22,7 +22,13 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.PowerManager;
@@ -233,6 +239,72 @@ public class NetworkTypeController extends StateMachine {
    private boolean mDoesPccListIndicateIdle = false;

    private boolean mInVoiceCall = false;
    private boolean mIsSatelliteConstrainedData = false;
    private boolean mIsSatelliteNetworkCallbackRegistered = false;
    private ConnectivityManager mConnectivityManager;

    private final ConnectivityManager.NetworkCallback mNetworkCallback =
            new ConnectivityManager.NetworkCallback() {
                @Override
                public void onAvailable(Network network) {
                    log("On Available: " + network);
                    if (network != null) {
                        if (mConnectivityManager != null) {
                            NetworkCapabilities capabilities =
                                    mConnectivityManager.getNetworkCapabilities(network);
                            updateBandwidthConstrainedStatus(capabilities);
                        } else {
                            log("network is null");
                        }
                    }
                }

                @Override
                public void onCapabilitiesChanged(Network network,
                        NetworkCapabilities networkCapabilities) {
                    log("onCapabilitiesChanged: " + network);
                    if (network != null) {
                        updateBandwidthConstrainedStatus(networkCapabilities);
                    } else {
                        log("network is null");
                    }
                }

                @Override
                public void onLost(Network network) {
                    log("Network Lost");
                    if (mIsSatelliteConstrainedData) {
                        mIsSatelliteConstrainedData = false;
                        mDisplayInfoController.updateTelephonyDisplayInfo();
                    }
                }
            };

    private boolean isBandwidthConstrainedCapabilitySupported(NetworkCapabilities
            capabilities) {
        // TODO (b/382002908: Remove try catch exception for
        //  NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED & replace datautils with
        //  NetworkCapabilities on api availability at mainline module)
        try {
            return capabilities.hasTransport(
                    NetworkCapabilities.TRANSPORT_SATELLITE) &&
                    !capabilities.hasCapability(DataUtils.NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED);
        } catch (Exception ignored) {
            log("NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED not supported ");
            return false;
        }
    }

    private void updateBandwidthConstrainedStatus(NetworkCapabilities capabilities) {
        if (capabilities != null) {
            mIsSatelliteConstrainedData
                    = isBandwidthConstrainedCapabilitySupported(capabilities);
            log("satellite constrained data status : " + mIsSatelliteConstrainedData);
            mDisplayInfoController.updateTelephonyDisplayInfo();
        } else {
            log("capabilities is null");
        }
    }

    /**
     * NetworkTypeController constructor.
@@ -266,9 +338,42 @@ public class NetworkTypeController extends StateMachine {
        mServiceState = mPhone.getServiceStateTracker().getServiceState();
        mPhysicalChannelConfigs = mPhone.getServiceStateTracker().getPhysicalChannelConfigList();

        if(mFeatureFlags.carrierEnabledSatelliteFlag()) {
            registerForSatelliteNetwork();
        }

        sendMessage(EVENT_INITIALIZE);
    }

    public synchronized void registerForSatelliteNetwork() {
        if (!mIsSatelliteNetworkCallbackRegistered) {
            mIsSatelliteNetworkCallbackRegistered = true;
            HandlerThread handlerThread = new HandlerThread("SatelliteDataUsageThread");
            handlerThread.start();
            Handler handler = new Handler(handlerThread.getLooper());

            NetworkRequest.Builder builder = new NetworkRequest.Builder();
            builder.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
            // TODO (b/382002908: Remove try catch exception for
            //  NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED & replace datautils with
            //  NetworkCapabilities on api availability at mainline module)
            try {
                builder.removeCapability(DataUtils.NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED);
            } catch (Exception ignored) {
                log("NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED not supported ");
            }
            mConnectivityManager =
                    (ConnectivityManager) mPhone.getContext()
                            .getSystemService(Context.CONNECTIVITY_SERVICE);
            if (mConnectivityManager != null) {
                mConnectivityManager.registerBestMatchingNetworkCallback(
                        builder.build(), mNetworkCallback, handler);
            } else {
                loge("network callback not registered");
            }
        }
    }

    /**
     * @return The current override network type, used to create TelephonyDisplayInfo in
     * DisplayInfoController.
@@ -288,6 +393,15 @@ public class NetworkTypeController extends StateMachine {
                : nri.getAccessNetworkTechnology();
    }

    /**
     * @return satellite bandwidth constrained connection status, used to create
     * TelephonyDisplayInfo in DisplayInfoController.
     *
     */
    public boolean getSatelliteConstrainedData() {
       return mIsSatelliteConstrainedData;
    }

    /**
     * @return {@code true} if either the primary or secondary 5G icon timers are active,
     * and {@code false} if neither are.
+5 −1
Original line number Diff line number Diff line
@@ -4274,7 +4274,11 @@ public class SatelliteController extends Handler {
        logd("onSatelliteEntitlementStatusUpdated subId=" + subId + ", entitlementEnabled="
                + entitlementEnabled + ", allowedPlmnList=["
                + String.join(",", allowedPlmnList) + "]" + ", barredPlmnList=["
                + String.join(",", barredPlmnList) + "]");
                + String.join(",", barredPlmnList) + "]"
                + ", plmnDataPlanMap =" + plmnDataPlanMap.toString()
                + ", plmnServiceTypeMap =" + plmnServiceTypeMap.toString()
                + ", plmnDataServicePolicyMap=" + plmnDataServicePolicyMap.toString()
                + ", plmnVoiceServicePolicyMap=" + plmnVoiceServicePolicyMap.toString());

        synchronized (mSupportedSatelliteServicesLock) {
            if (mSatelliteEntitlementStatusPerCarrier.get(subId, false) != entitlementEnabled) {
+2 −1
Original line number Diff line number Diff line
@@ -1044,7 +1044,8 @@ public class NetworkTypeControllerTest extends TelephonyTest {
            doReturn(new TelephonyDisplayInfo(
                    mNetworkTypeController.getDataNetworkType(),
                    mNetworkTypeController.getOverrideNetworkType(),
                    false)).when(mDisplayInfoController).getTelephonyDisplayInfo();
                    false, false, false))
                    .when(mDisplayInfoController).getTelephonyDisplayInfo();
            return null;
        }).when(mDisplayInfoController).updateTelephonyDisplayInfo();
        mNetworkRegistrationInfo = new NetworkRegistrationInfo.Builder()
Loading