Loading telephony/java/android/telephony/TelephonyManager.java +3 −31 Original line number Original line Diff line number Diff line Loading @@ -2449,21 +2449,7 @@ public class TelephonyManager { * @return the NETWORK_TYPE_xxxx for current data connection. * @return the NETWORK_TYPE_xxxx for current data connection. */ */ public @NetworkType int getNetworkType() { public @NetworkType int getNetworkType() { try { return getDataNetworkType(); ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.getNetworkType(); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; } } catch(RemoteException ex) { // This shouldn't happen in the normal case return NETWORK_TYPE_UNKNOWN; } catch (NullPointerException ex) { // This could happen before phone restarts due to crashing return NETWORK_TYPE_UNKNOWN; } } } /** /** Loading Loading @@ -2494,23 +2480,9 @@ public class TelephonyManager { * @hide * @hide */ */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getNetworkType(int subId) { public int getNetworkType(int subId) { try { return getDataNetworkType(subId); ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.getNetworkTypeForSubscriber(subId, getOpPackageName()); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; } } catch (RemoteException ex) { // This shouldn't happen in the normal case return NETWORK_TYPE_UNKNOWN; } catch (NullPointerException ex) { // This could happen before phone restarts due to crashing return NETWORK_TYPE_UNKNOWN; } } } /** /** Loading Loading
telephony/java/android/telephony/TelephonyManager.java +3 −31 Original line number Original line Diff line number Diff line Loading @@ -2449,21 +2449,7 @@ public class TelephonyManager { * @return the NETWORK_TYPE_xxxx for current data connection. * @return the NETWORK_TYPE_xxxx for current data connection. */ */ public @NetworkType int getNetworkType() { public @NetworkType int getNetworkType() { try { return getDataNetworkType(); ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.getNetworkType(); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; } } catch(RemoteException ex) { // This shouldn't happen in the normal case return NETWORK_TYPE_UNKNOWN; } catch (NullPointerException ex) { // This could happen before phone restarts due to crashing return NETWORK_TYPE_UNKNOWN; } } } /** /** Loading Loading @@ -2494,23 +2480,9 @@ public class TelephonyManager { * @hide * @hide */ */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getNetworkType(int subId) { public int getNetworkType(int subId) { try { return getDataNetworkType(subId); ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.getNetworkTypeForSubscriber(subId, getOpPackageName()); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; } } catch (RemoteException ex) { // This shouldn't happen in the normal case return NETWORK_TYPE_UNKNOWN; } catch (NullPointerException ex) { // This could happen before phone restarts due to crashing return NETWORK_TYPE_UNKNOWN; } } } /** /** Loading