Change the condition for showing "no connection"

The "no connection" should be shown in no data cell connection.

Bug: 193273081
Test: atest passed
 - SubscriptionsPreferenceControllerTest.java
 - ProviderModelSliceHelperTest.java
 - ProviderModelSliceTest.java
 - NetworkProviderWorkerTest.java

Change-Id: Ied8a34d13d4bfc81e9136e05ba41cbb4233c9ad8
This commit is contained in:
SongFerngWang
2021-07-13 22:21:21 +08:00
committed by Tom Hsu
parent 29da5abcb1
commit 5f8f44c720
4 changed files with 82 additions and 26 deletions

View File

@@ -24,6 +24,8 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.telephony.AccessNetworkConstants;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
@@ -107,7 +109,12 @@ public class ProviderModelSliceHelper {
* @return whether the ServiceState's data state is in-service.
*/
public boolean isDataStateInService() {
return mTelephonyManager.getDataState() == mTelephonyManager.DATA_CONNECTED;
final ServiceState serviceState = mTelephonyManager.getServiceState();
NetworkRegistrationInfo regInfo =
(serviceState == null) ? null : serviceState.getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS,
AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
return (regInfo == null) ? false : regInfo.isRegistered();
}
/**