mirror of
https://github.com/square/leakcanary.git
synced 2026-03-13 08:24:22 +08:00
This commit migrates the entire LeakCanary project from minimum SDK API 21 to API 26, enabling modern Android features and further simplifying the codebase. API 26 corresponds to Android 8.0 (Oreo), released in 2017, providing over 7 years of Android compatibility while enabling notification channels and modern development practices. Changes included: ## Build Configuration - Update androidMinSdk from "21" to "26" in version catalog - Update hardcoded minSdk value in leakcanary-app from 21 to 26 - Update comment to reflect modern Android features requirement ## GitHub Actions / CI - Remove API 21 and API 23 from test matrix - Streamline CI to test only API 26+ (26, 31, 33, 34) - Improve CI efficiency with fewer test combinations ## Code Modernization - Simplify notification builder to always use notification channels (API 26+ requirement) - Remove obsolete PendingIntent FLAG_IMMUTABLE version checks (API 23+ always available) - Simplify instant app detection (API 26+ always supports this) - Remove obsolete SDK version checks for dynamic shortcuts (N_MR1 no longer relevant) - Modernize Context.getColor() usage (API 23+ always available) - Simplify process utilities in UiAutomator (API 23+ features always available) - Remove obsolete @TargetApi annotations for API levels below 26 ## Resources & UI - Move adaptive icons from mipmap-anydpi-v26 to mipmap-anydpi (no qualifier needed) - Move app launcher icons from drawable-v24 to drawable (API 26+ always supports adaptive icons) - Remove obsolete resource version qualifiers ## Code Cleanup - Remove unused import statements after version check removals - Simplify conditional logic where version checks became always true/false - Remove dead code branches for pre-API 26 compatibility ## Benefits - Access to notification channels (API 26 requirement) without compatibility code - Simplified codebase with removed legacy compatibility workarounds - Modern UI patterns with adaptive icons as standard - Faster CI builds with fewer test matrix combinations ## Compatibility All modules now consistently require Android 8.0 (API 26, 2017) or higher. This affects minSdk but does not change the public API surface. Library consumers benefit from simplified, more reliable notification handling. Co-Authored-By: Claude <noreply@anthropic.com>