Write app warning configs on IO thread

- readConfigFromFileAmsThread is called from the constructor
  of ActivityManagerService, which runs on main thread with
  allowing IO during booting. And because it is done in
  constructor, there is no synchronization concern.
- Previously writeConfigToFileAmsThread runs by ConfigHandler
  which executes on display thread, which is not allowed to perform
  IO operations. So move it to IO thread.
- Also optimize a bit that it doesn't need to write config every
  time when a package is removed or cleared data. It only needs
  to write if there was a corresponding config of the package.

Bug: 286620755
Test: atest DeprecatedTargetSdkTest
Test: Launch an app with targetSdk < 28
      Click "Ok" of the warning dialog, wait 10s, reboot.
      Launch the app again. The dialog won't popup again.
Change-Id: I128963718054e8ba4254153ca543e4964e423f04
1 file changed