Skip to content

Fix WorkSource.isEmpty() hidden-API reflection denial and handle IMeasurementService methods 24-26 - #3952

Open
chmjdev wants to merge 1 commit into
microg:masterfrom
chmjdev:fix/worksource-measurement-huawei
Open

chmjdev wants to merge 1 commit into
microg:masterfrom
chmjdev:fix/worksource-measurement-huawei

Conversation

@chmjdev

@chmjdev chmjdev commented Nov 1, 2026

Copy link
Copy Markdown

Summary

While diagnosing location and measurement IPC issues with Uber / Uber Eats on Huawei EMUI 12 (Android 10 / API 29, -hw build), two recurring runtime issues appeared in logcat:

  1. WorkSourceUtil.isEmpty(WorkSource) triggers greylist-max-o hidden-API reflection denial on API 29+:

    W gle.android.gm: Accessing hidden method Landroid/os/WorkSource;->isEmpty()Z (greylist-max-o, reflection, denied)
    

    WorkSource.isEmpty() is annotated with @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) (greylist-max-o). When targetSdkVersion >= 29, reflecting WorkSource#isEmpty() is rejected by ART's hidden-API enforcement on every LocationRequest.toString() call, throwing NoSuchMethodException and falling through to size(workSource) == 0 (which uses unrestricted @UnsupportedAppUsage WorkSource#size()). Using size(workSource) == 0 directly (with a null guard) avoids the hidden-API violation and unnecessary exception allocation on every location request update.

  2. IMeasurementService transaction code 27 (sendAppBackgrounded, AIDL = 26) and consent methods (= 24, = 25):

    W MeasurementService: Unknown method 27 in com.google.android.gms.measurement.internal.IMeasurementService, skipping
    

    Uncomments sendStorageConsentSettings (= 24), sendDmaConsentSettings (= 25), and sendAppBackgrounded (= 26, FIRST_CALL_TRANSACTION + 26 = 27) in IMeasurementService.aidl and implements their debug stubs in MeasurementServiceImpl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant