Add a flag to block the job scheduler from starting bg dexopt jobs.

Add options to `pm bg-dexopt-job` to control the flag.

This also restructures the `bg-dexopt-job` subcommand to take flags to
control this and running/cancelling of the bg dexopt jobs. That to
avoid a proliferation of different background dexopt commands.
`cancel-bg-dexopt-job` is kept as a compatibility alias for
`bg-dexopt-job --cancel`.

Test: atest com.android.server.pm.BackgroundDexOptServiceUnitTest
Test: adb shell cmd package bg-dexopt-job
Test: adb shell cmd package bg-dexopt-job com.android.egg
Test: adb shell cmd package bg-dexopt-job --cancel
Test: adb shell cmd package cancel-bg-dexopt-job
Test: adb shell cmd package bg-dexopt-job --disable
Test: adb shell cmd package bg-dexopt-job --enable
Test: adb shell cmd package bg-dexopt-job --enable com.android.egg
      -> Invalid argument: com.android.egg
Test: adb shell cmd package bg-dexopt-job --disable --cancel
      -> Invalid argument: --cancel
Test: adb shell cmd package bg-dexopt-job --invalid
      -> Unknown option: --invalid
Test: adb shell cmd package bg-dexopt-job --enable --disable
      -> Invalid argument: --disable
Test: adb shell cmd package bg-dexopt-job --cancel com.android.egg
      -> Invalid argument: com.android.egg
Bug: 173034829
Change-Id: I5ce97ec4b28aa8043cde86644bdb528035b1ca71
3 files changed