Allow using isFeatureEnabled on APEX module init

isFeatureEnabled is not usable in APEX module service initialization,
as it relies on PackageManager.getModuleInfo, which is only available
once the module controller is initialized. Also, there is no module
metadata in base AOSP.

Avoid this by guessing the tethering module name based on its
APK-in-APEX packages, which can be queried at that time.
ConnectivityServiceResources will indicate the package prefix used on
the device.

If querying with prefix + "tethering" fails, retry querying with prefix
+ "go.tethering" for Go devices.

This should allow using isFeatureEnabled in services (like
ConnectivityService) constructors, and allows removing the
FIXED_PACKAGE_VERSION hack when Tethering is not considered a module.

getConnectivityResourcesPackageName is implemented based on existing
code in ConnectivityResources.java. aosp/2446026 updates
ConnectivityResources to use getConnectivityResourcesPackageName.

Bug: 279108992
Test: atest
(cherry picked from https://android-review.googlesource.com/q/commit:16880108d397b591f1ff85484e3a899c7c5a6091)
Merged-In: I277f4583e92ba41d53bd19666f1e8e29f68dfcd1
Change-Id: I277f4583e92ba41d53bd19666f1e8e29f68dfcd1
2 files changed
tree: 8a2fe177f9a2a6ad9445da46942d4ab63f0e340b
  1. client-libs/
  2. common/
  3. .gitignore
  4. OWNERS
  5. PREUPLOAD.cfg
  6. TEST_MAPPING