Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 792de8d6 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Move the job scheduler service code to its own jar file.

- Also remove the dependency from SystemServiceRegistry to JobScheduler

See apex/jobscheduler/README_js-mainline.md for the details.

Bug: 137763703
Test: build and boot
Test: atest CtsJobSchedulerTestCases
Change-Id: I2386c78b7a6085d6e543a63f22cb620c4cabd06a
parent 6188f35d
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
# Making Job Scheduler into a Mainline Module

## TODOs

See also:
- http://go/moving-js-code-for-mainline
- http://go/jobscheduler-code-dependencies-2019-07

- [ ] Move client code
  - [ ] Move code
  - [ ] Make build file
  - [ ] "m jobscheduler-framework" pass
  - [ ] "m framework" pass
  - [ ] "m service" pass
- [ ] Move proto
  - No, couldn't do it, because it's referred to by incidentd_proto
- [ ] Move service
  - [X] Move code (done, but it won't compile yet)
  - [X] Make build file
  - [X] "m service" pass
  - [X] "m jobscheduler-service" pass
    - To make it pass, jobscheduler-service has to link services.jar too. Many dependencies.
- [ ] Move this into `frameworks/apex/jobscheduler/...`. Currently it's in `frameworks/base/apex/...`
because `frameworks/apex/` is not a part of any git projects. (and also working on multiple
projects is a pain.)


## Problems
- Couldn't move dumpsys proto files. They are used by incidentd_proto, which is in the platform
  (not updatable).
  - One idea is *not* to move the proto files into apex but keep them in the platform.
    Then we make sure to extend the proto files in a backward-compat way (which we do anyway)
    and always use the latest file from the JS apex.

- There are a lot of build tasks that use "framework.jar". (Examples: hiddenapi-greylist.txt check,
  update-api / public API check and SDK stub (android.jar) creation)
  To make the downstream build modules buildable, we need to include js-framework.jar in
  framework.jar. However it turned out to be tricky because soong has special logic for "framework"
  and "framework.jar".
  i.e. Conceptually, we can do it by renaming `framework` to `framework-minus-jobscheduler`, build
  `jobscheduler-framework` with `framework-minus-jobscheduler`, and create `framework` by merging
  `framework-minus-jobscheduler` and `jobscheduler-framework`.
  However it didn't quite work because of the special casing.

- JS-service uses a lot of other code in `services`, so it needs to link services.core.jar e.g.
 - Common system service code, e.g. `com.android.server.SystemService`
 - Common utility code, e.g. `FgThread` and `IoThread`
 - Other system services such as `DeviceIdleController` and `ActivityManagerService`
 - Server side singleton. `AppStateTracker`
 - `DeviceIdleController.LocalService`, which is a local service but there's no interface class.
 - `XxxInternal` interfaces that are not in the framework side. -> We should be able to move them.
+15 −0
Original line number Diff line number Diff line
// Job Scheduler Service jar, which will eventually be put in the jobscheduler mainline apex.
// jobscheduler-service needs to be added to PRODUCT_SYSTEM_SERVER_JARS.
java_library {
    name: "jobscheduler-service",
    installable: true,

    srcs: [
        "java/**/*.java",
    ],

    libs: [
        "framework",
        "services.core",
    ],
}
Loading