Merge SM changes into kitkat-legacy