Nowadays, portrait mode is not something special, this feature is already available on almost all the latest smartphones. You can take photos with a bokeh effect. Usually this bokeh effect is used to select the main subject from the background so that the main subject looks more prominent. But to produce photos like this requires a large sensor, which for a smartphone the size of it is somewhat impossible.
The average smartphone sensor size is 1/2.3" which is very small compared to the size of a 1" Nikon DSLR camera, even though it is also small for a camera. This makes it impossible to achieve the bokeh effect naturally on a smartphone because the bigger the sensor, the thicker the smartphone. So a way was found with the help of software and the sophistication of the smartphone processor. How does it work?
Usually this portrait mode uses at least 2 cameras to manipulate the bokeh effect. The main camera is useful for photographing subjects, and the second camera does not take pictures directly but takes information that is used to be processed by the camera software to create a bokeh effect. That's more or less how it works.