Recently we convinced one of our customers that Smart Lock for Passwords would be a neat feature for his app.
At the moment users have to enter their credentials on every login and every new device. We could and should increase customer satisfaction by offering a seamless transition from one installation to another.
Smart Lock for Passwords is a password management system that Google introduced in 2015. It stores third-party credentials in its safe and offers them to users who authenticate via Google, Facebook, Twitter or other accounts. Smart Lock is an alternative to Dashlane, Kaspersky Password Manager, LastPass and other password managers.
We are not talking about the entirely different Smart Lock, an intelligent screen lock, which was integrated into the Android operating system from version 5.0 onwards.
During the implementation of Smart Lock for Passwords we met several problems surrounding its container, the Google Play Services.
This blog post serves as a documentation as well as a guide for other developers that may stumble upon the same problems.
- Google Play Service 11.8.0 and ProGuard
Upgrading from version 11.6.2 to 11.8.0 comes with one grain of salt: Changes in the default shrinker lead to build breaks with a ProGuard configuration parser error. The solution is to downgrade to version 11.6.2 (more on that later) or to enable ProGuard for debug builds - set minifyEnabled and useProGuard to true - increased build times included (Instant Run to the rescue). Read More
- Android O and AutoFill
AutoFill shares the same keystore as Smart Lock for Passwords. It is therefor the default method for password convenience on devices with Android O and higher. This clashes with Smart Lock for Passwords. The Google Play Services 11.8.0 brought forceEnableSaveDialog() to disable this default behavior. Sadly there is no public method to set this flag on lower versions, other than using reflection or other dirty hacks. Read More
At the end we decided to stick with Smart Lock until Android O reaches a wider audience (as of January 2018 its distribution rate is less than one percent). Since we have to deal with AutoFill, we upgraded to the Google Play Services 11.8.0 and enabled ProGuard for the debug build. AutoFill is still on our todo list but at the moment we decided to deactivate it for the app by setting setImportantForAutofill.