* changes: Expose permission flag APIs for tests Move permission restore code into permission controller.