make keyguard related code being independent of framework/base part 2