Improve handling of settings storage and android secure

Change-Id: I8af92543c2f0c201e7220267c417d74e4561038d