Code cleanup.

Avoid repetetive boilerplate code by using helper methods.

Change-Id: Id3ce8d07d35d59c08cbc67fa35bbf6daa67c9608
Merge "Code cleanup." into cm-11.0
Merge branch 'cm-11.0' of https://github.com/CyanogenMod/android_packages_apps_Dialer into cm-11.0