[Provider Model] Show carrier network to internet preference
- If the connected network is the merged carrier Wi-Fi, then show carrier network to internet prefernce. Bug: 191091045 Test: manual test atest -c InternetUpdaterTest Change-Id: Iad3869f086ea0a4d0607691c6709ee12567831c7
This commit is contained in:
@@ -33,6 +33,7 @@ import android.net.ConnectivityManager;
|
||||
import android.net.ConnectivityManager.NetworkCallback;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -249,6 +250,9 @@ public class InternetUpdater implements AirplaneModeEnabler.OnAirplaneModeChange
|
||||
@InternetType int internetType = INTERNET_NETWORKS_AVAILABLE;
|
||||
if (mInternetAvailable) {
|
||||
internetType = sTransportMap.get(mTransport);
|
||||
if (internetType == INTERNET_WIFI && isCarrierWifiActive()) {
|
||||
internetType = INTERNET_CELLULAR;
|
||||
}
|
||||
} else if (mAirplaneModeEnabler.isAirplaneModeOn()
|
||||
&& mWifiManager.getWifiState() != WifiManager.WIFI_STATE_ENABLED) {
|
||||
internetType = INTERNET_OFF;
|
||||
@@ -260,6 +264,15 @@ public class InternetUpdater implements AirplaneModeEnabler.OnAirplaneModeChange
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isCarrierWifiActive() {
|
||||
final WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
|
||||
if (wifiInfo == null || !wifiInfo.isCarrierMerged()) {
|
||||
return false;
|
||||
}
|
||||
Log.i(TAG, "Detect a merged carrier Wi-Fi connected.");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the internet type.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user