The current control is implemented by the power management logic implemented in the phone. In particular, according to the Mi 4i FAQ, your phone uses Qualcomm's original QuickCharge 1.0, which consists primarily of two components: AICL = Adaptive / Automatic Current Control, and APSD = Automatic Power Source Detection.
APSD incorporates BC1.2 = Battery Charging Revision 1.2, an extension of the USB standard that allows chargers to communicate that they can deliver higher current, e.g. by shorting the D+ and D- lines.
AICL includes heuristics for automatically detecting the current limit of the power supply by slowly stepping up the input current (e.g. in 25mA steps). Usually this is limited to about 2A.
You ask in the comments if you can safely charge your phone using a DIY charger using a 5V regulator. Generally this should work fine as long as you include the appropriate BC1.2 signalling to the phone. To do that you can either construct your own fast-charge cable with the D+ and D- wired as needed (see below), or you can buy various fast-charge USB adapters, e.g. search on "CW3002" on eBay to locate adapters using a common CellWise CW3002 controller.
Below is a bit more info on the technical details, first on on AICL, from the NXP (freescale) BC3770 datasheet, and second on BC1.2 from Maxim's Overview of USB Battery Charging Revision 1.2 and the Important Role of Adapter Emulators. Now that you know the appropriate buzzwords you should be able to dig deeper if need be.