Check the code path when enabling disabling packages. Add unit test Change-Id: I0f0f482a3735234eab3f63ba1f6462574b70144e