1# Motivation
2Rubidium Back Compat design introduces additional constraints on how JobServices can be used in AdServices codebase. Add a linter to warn engineer about the additional constraints in code review
3
4## Lint Description
5Avoid using new classes in AdServices JobService field Initializers. Due to the fact that ExtServices can OTA to any AdServices build, JobServices code needs to be properly gated to avoid NoClassDefFoundError. NoClassDefFoundError can happen when new class is used in ExtServices build, and the error happens when the device OTA to old AdServices build on T which does not contain the new class definition
6
7# How-to
8## Avoid static initialization in JobServices
9It is hard (or impossible in some cases) to properly gate field Initializers with function calls. Put any new class usage after ServiceCompatUtils.shouldDisableExtServicesJobOnTPlus(this) in onStartJob, and so the new class usage can be properly gated
10
11## Classes which are safe to use in static initialization
12The following class are safe to use in JobServices static initialization
13
14* com.android.adservices.spe.AdservicesJobInfo
15* com.android.adservices.concurrency.AdServicesExecutors
16