Check SDK version before checking if context instanceof SandboxedSdkContext

Currently there are a few places where the code checks if the input context is an instance of SandboxedSdkContext, and casts it to that type if it is. On R/S, this type doesn't exist, therefore this check will result in a runtime exception. This change centralizes that check in a utilities class, and adds the SDK version check.

Bug: 263903808
Test: atest com.android.adservices.customaudience.CustomAudienceManagerTest com.android.adservices.tests.appsetid.AppSetIdManagerTest com.android.adservices.measurement.MeasurementManagerTest com.android.adservices.tests.cts.topics.TopicsManagerTest SandboxedSdkContextUtilsTest

Change-Id: I4712fc69c73338f86279f399882c73ffdd094fa5
8 files changed
tree: 4913b850264fb906d6479728f1d4ea0645f097b3
  1. adservices/
  2. apex/
  3. sdksandbox/
  4. groups
  5. OWNERS
  6. PREUPLOAD.cfg
  7. project.config