Conversation
leakcanary/leakcanary-android-process/src/main/java/leakcanary/LeakCanaryProcess.kt
Show resolved
Hide resolved
4456f96 to
8759ab6
Compare
|
the CI currently has the same problem I have locally
the report is not capturing the test runs |
Updates Android instrumentation test dependencies and configuration to work with compileSdk 35 and API level 36: - Update Gradle from 8.2 to 8.10.2 - Move from KAPT to KSP - Update AGP to 8.2.2 and Gradle to 8.2 - Update Hilt to consistently be 2.53 - Update AndroidX Test dependencies to modern versions compatible with API 36 - Fix test namespace configuration to match actual package structure - Move TuPeuxPasTest to correct package structure for proper test discovery - Fixes build warnings about packagingOptions - Add missing Java sourceCompatibility declarations - Appease lint by suppressing the failures, we could remove the checks but they where written for a reason so keeping them This ensures UI tests are properly discovered and executed by Gradle with correct reporting, while maintaining compatibility with newer Android APIs. Co-Authored-By: Claude <noreply@anthropic.com>
What These Changes Mean:
Removed Methods: getDefaultImpl() and setDefaultImpl()
These were part of an older AIDL pattern for handling default implementations when the service isn't available. This was a fallback mechanism that's been deprecated in favor of better error handling.
Added: DESCRIPTOR Field
This is the standard AIDL interface descriptor string - it's always been there internally, but now it's explicitly exposed in the public API.
Added: LeakUiApp$_Parcel Class
This is a newer AIDL tooling artifact - modern AIDL compilers generate additional helper classes for parcelization.
Impact Analysis: ✅ Likely SAFE - No Breaking Changes for Clients
Why this is probably fine:
1. Internal APIs: These are in org.leakcanary.internal.* package - the internal namespace signals these aren't meant for public consumption
2. AIDL Evolution: The Android AIDL compiler has been evolving to generate more modern, efficient code. The removed methods were legacy patterns.
3. Backwards Compatible:
- The core sendHeapAnalysis() method remains unchanged
- The DESCRIPTOR field addition doesn't break existing clients
- The new _Parcel class is just tooling infrastructure
4. LeakCanary Context: This appears to be inter-process communication between LeakCanary components, not a public API for app developers
⚠️ Potential Concerns:
1. If any external code was using the removed methods (unlikely since they're internal APIs)
2. Binary compatibility for any code that was directly instantiating or reflection-accessing these classes
What Could Have Caused This:
1. Java 17 + newer Android Gradle Plugin - may use a newer AIDL compiler
2. Updated compileOptions - could affect how AIDL generates code
3. Build environment changes - newer toolchain versions
Recommendation:
This is likely safe because:
- It's internal LeakCanary APIs
- The core functionality (sendHeapAnalysis) is preserved
- This follows AIDL tooling evolution patterns
However, you should consider:
- Testing: Ensure LeakCanary still works properly between processes
- Release notes: Document that internal AIDL APIs changed (if you publish these changes)
- Monitoring: Watch for any reports of inter-process communication issues
The changes appear to be tooling evolution rather than functional changes, but it's worth testing the actual LeakCanary functionality to be sure.
d830d05 to
dc01b26
Compare
Fixed by : #2801 |
- This allows a new emu to be created if dependencies are updated - Dependencies being updated can cause signature mismatches in installed test apks
f860ebe to
82d8c80
Compare
- allow the instrumentation tests running an API 16 to pass
| arch: ${{ matrix.arch }} | ||
| force-avd-creation: false | ||
| # FORCE true here ensures if 'actions/cache' restored old avd, we wipe and start with a fresh image for the new dependency hash. | ||
| force-avd-creation: true |
There was a problem hiding this comment.
Does this mean we create a new AVD on every run? Doesn't that slow down CI?
There was a problem hiding this comment.
No — only when libs.versions.toml changes. The step has if: steps.avd-cache.outputs.cache-hit != 'true', so it's skipped entirely on an exact cache hit. The key includes hashFiles('**/libs.versions.toml'), so on runs where deps haven't changed the key matches → cache-hit = 'true' → step is skipped entirely.
force-avd-creation: true only matters when the step does run (cache miss or partial match via restore-keys): it ensures any restored but stale AVD snapshot is wiped and a fresh one is created, rather than reusing a snapshot from a different dep version. The Instrumentation Tests step keeps force-avd-creation: false so it always reuses whatever snapshot was just created (or retrieved from an exact cache hit).
| key: avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }} | ||
| key: avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}-${{ hashFiles('**/libs.versions.toml') }} | ||
| restore-keys: | | ||
| avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}- |
There was a problem hiding this comment.
Cache fallback. The exact key includes hashFiles('**/libs.versions.toml'), so when deps change there's no exact match. Without restore-keys, that's a total cache miss — the emulator runner has to set up everything from scratch. With restore-keys: avd-cached-{api-level}-{os}-{target}-, GitHub will restore the most recent cached AVD for that API level/target combination (from a previous dep version) as a partial restore. Then force-avd-creation: true wipes that old snapshot and creates a fresh one, which gets saved under the new key.
|
|
||
| @TargetApi(M) fun hasStoragePermission(): Boolean { | ||
| // Defensive check: @TargetApi doesn't prevent this method from being called on older APIs | ||
| @Suppress("ObsoleteSdkInt") // Intentional safety check despite @TargetApi annotation |
There was a problem hiding this comment.
- never put a comment at the end of a line of code
| fun createPendingIntent(context: Context, permission: String): PendingIntent { | ||
| val intent = createIntent(context, permission) | ||
| // Defensive check: @TargetApi on class doesn't prevent this method from being called on older APIs | ||
| @Suppress("ObsoleteSdkInt") // Intentional safety check despite @TargetApi annotation |
There was a problem hiding this comment.
- never put a comment at the end of a line of code
* origin/main: Pin gradle/actions/wrapper-validation to commit SHA to satisfy code scanning Drop API 28 and 29 from instrumentation test matrix Fix LeakActivityTest on API 33+ by disabling notifications during test Fix INSTALL_FAILED_DEPRECATED_SDK_VERSION on API 28+ for leakcanary-android tests Upgrade wrapper-validation-action to gradle/actions/wrapper-validation@v4 Add recent Android API levels to instrumentation test matrix Fix pkill self-match: use qemu-syste[m] pattern Update changelog entry wording for ToastEventListener fix Fix emulator process hanging 20+ min after CI tests finish Add changelog entry for ToastEventListener race condition fix Fix ToastEventListener race condition retaining finished Toast
Move the explanation to the preceding comment line instead of appending it to the annotation itself, per project style conventions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>



Updates Android instrumentation test dependencies and configuration to work with compileSdk 35 and API level 36: