@Test @SmallTest public void testConvertNetworkType_any() { assertThat(SystemJobInfoConverter.convertNetworkType(CONNECTED), is(JobInfo.NETWORK_TYPE_ANY)); }
static int convertNetworkType(NetworkType networkType) { switch(networkType) { case NOT_REQUIRED: return JobInfo.NETWORK_TYPE_NONE; case CONNECTED: return JobInfo.NETWORK_TYPE_ANY; case UNMETERED: return JobInfo.NETWORK_TYPE_UNMETERED; case NOT_ROAMING: if (Build.VERSION.SDK_INT >= 24) { return JobInfo.NETWORK_TYPE_NOT_ROAMING; } break; case METERED: if (Build.VERSION.SDK_INT >= 26) { return JobInfo.NETWORK_TYPE_METERED; } break; } Log.d(TAG, String.format( "API version too low. Cannot convert network type value %s", networkType)); return JobInfo.NETWORK_TYPE_ANY; }
SystemJobInfoConverter { static int convertNetworkType(NetworkType networkType) { switch(networkType) { case NOT_REQUIRED: return JobInfo.NETWORK_TYPE_NONE; case CONNECTED: return JobInfo.NETWORK_TYPE_ANY; case UNMETERED: return JobInfo.NETWORK_TYPE_UNMETERED; case NOT_ROAMING: if (Build.VERSION.SDK_INT >= 24) { return JobInfo.NETWORK_TYPE_NOT_ROAMING; } break; case METERED: if (Build.VERSION.SDK_INT >= 26) { return JobInfo.NETWORK_TYPE_METERED; } break; } Log.d(TAG, String.format( "API version too low. Cannot convert network type value %s", networkType)); return JobInfo.NETWORK_TYPE_ANY; } }
SystemJobInfoConverter { static int convertNetworkType(NetworkType networkType) { switch(networkType) { case NOT_REQUIRED: return JobInfo.NETWORK_TYPE_NONE; case CONNECTED: return JobInfo.NETWORK_TYPE_ANY; case UNMETERED: return JobInfo.NETWORK_TYPE_UNMETERED; case NOT_ROAMING: if (Build.VERSION.SDK_INT >= 24) { return JobInfo.NETWORK_TYPE_NOT_ROAMING; } break; case METERED: if (Build.VERSION.SDK_INT >= 26) { return JobInfo.NETWORK_TYPE_METERED; } break; } Log.d(TAG, String.format( "API version too low. Cannot convert network type value %s", networkType)); return JobInfo.NETWORK_TYPE_ANY; } @VisibleForTesting(otherwise = PACKAGE_PRIVATE)  SystemJobInfoConverter(@NonNull Context context); }
SystemJobInfoConverter { static int convertNetworkType(NetworkType networkType) { switch(networkType) { case NOT_REQUIRED: return JobInfo.NETWORK_TYPE_NONE; case CONNECTED: return JobInfo.NETWORK_TYPE_ANY; case UNMETERED: return JobInfo.NETWORK_TYPE_UNMETERED; case NOT_ROAMING: if (Build.VERSION.SDK_INT >= 24) { return JobInfo.NETWORK_TYPE_NOT_ROAMING; } break; case METERED: if (Build.VERSION.SDK_INT >= 26) { return JobInfo.NETWORK_TYPE_METERED; } break; } Log.d(TAG, String.format( "API version too low. Cannot convert network type value %s", networkType)); return JobInfo.NETWORK_TYPE_ANY; } @VisibleForTesting(otherwise = PACKAGE_PRIVATE)  SystemJobInfoConverter(@NonNull Context context);  }
SystemJobInfoConverter { static int convertNetworkType(NetworkType networkType) { switch(networkType) { case NOT_REQUIRED: return JobInfo.NETWORK_TYPE_NONE; case CONNECTED: return JobInfo.NETWORK_TYPE_ANY; case UNMETERED: return JobInfo.NETWORK_TYPE_UNMETERED; case NOT_ROAMING: if (Build.VERSION.SDK_INT >= 24) { return JobInfo.NETWORK_TYPE_NOT_ROAMING; } break; case METERED: if (Build.VERSION.SDK_INT >= 26) { return JobInfo.NETWORK_TYPE_METERED; } break; } Log.d(TAG, String.format( "API version too low. Cannot convert network type value %s", networkType)); return JobInfo.NETWORK_TYPE_ANY; } @VisibleForTesting(otherwise = PACKAGE_PRIVATE)  SystemJobInfoConverter(@NonNull Context context);   }