Begin merge XiaomiServiceFramework package

Working from line 240 back to line 15 in next commit.