chore: suppress the three lint checks that are wrong here, with reasons - #256
Merged
Conversation
Part of #245. Clears 8 warnings that are not defects: 2 InlinedApi, 1 UnusedAttribute, 5 IconLauncherShape. Each is scoped as narrowly as the mechanism allows and states why, per the issue's rule that suppressions are never blanket and never a baseline. InlinedApi on BatteryManager.EXTRA_CYCLE_COUNT (API 34) is safe because the field is a compile-time String constant: javac inlines its value, so nothing is resolved at runtime and an older device simply finds no such extra and takes the default. Both call sites already normalize a missing value to -1. Suppressed on the local variable declaration rather than the enclosing method, so the rest of each method stays checked. UnusedAttribute on android:localeConfig is the intended state — it is read on API 33+, minSdk is 26, and older devices fall back to the in-app language choice (#48). IconLauncherShape needs lint.xml, because a PNG has nowhere to carry an annotation. The five files are the legacy raster launcher icon; the real one is the adaptive icon (#236), which has the safe zone and the mask. A legacy raster has neither, so filling its square is correct and the guidance lint quotes does not apply. Listed per file rather than disabled, so the check stays live for any icon added later. lintDebug: 35 -> 27 warnings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #245. Clears 8 warnings that are not defects: 2
InlinedApi, 1UnusedAttribute, 5IconLauncherShape.lintDebug: 35 → 27 warnings. Independent of #254 and #255 — all three can merge in any order.Per the issue's ground rules, every suppression is scoped as narrowly as the mechanism allows and carries a reason. No
lint-baseline.xml.InlinedApi×2 — safe, and worth explaining whyBatteryManager.EXTRA_CYCLE_COUNTis API 34, minSdk 26. The reason this is harmless is that it's a compile-timeStringconstant — javac inlines the literal, so nothing is resolved at runtime and there's noNoSuchFieldErroron an older device. It just reads an extra that isn't in the Intent and gets the default. Both sites already normalise a missing value to-1.Suppressed on the local variable declaration, not the enclosing method, so the rest of each method stays checked.
UnusedAttribute— the intended stateandroid:localeConfigis read on API 33+; minSdk is 26. That's exactly the intent of #48 — older devices fall back to the in-app language choiceAppCompatDelegatestores.tools:ignoreon<application>is the only scope the manifest offers, so there's a comment naminglocaleConfigspecifically.IconLauncherShape×5 — needslint.xmlA PNG has nowhere to put an annotation, so this is the one that needs a config file. It lists the five files individually rather than disabling the check, so a genuinely bad icon added later still gets flagged.
The reasoning: these are the legacy raster launcher icons. The real icon is the adaptive one (#236) — it has the safe zone and the launcher mask. A legacy raster has neither, so filling its square is what it's supposed to do. The guidance lint quotes is about adaptive icons.
Two things I noticed but did not touch
Both are outside this issue's scope, and I'd rather flag them than quietly fold them in:
Those five PNGs may be dead weight entirely. minSdk is 26 and the adaptive icon lives in
mipmap-anydpi-v26, andanydpitakes precedence over every density bucket — so on every supported device@mipmap/ic_launcherresolves to the XML, never to a PNG. I did not delete them: some OEM launchers and backup UIs read density mipmaps directly, and chore: get lintDebug to zero warnings and keep it there #245 explicitly chose suppression over redrawing here.The notification's large icon is probably null.
NotificationService:654doesBitmapFactory.decodeResource(res, R.mipmap.ic_launcher)and feeds it tosetLargeIcon. Given the resolution order above, that call almost certainly hits the adaptive-icon XML, anddecodeResourcereturnsnullfor an XML drawable — so the notification would silently show no large icon rather than crash. I'm reasoning from resource-resolution rules, not from a device, so treat it as "worth checking": pull down your notification shade and see whether the app icon appears on the right of the alert. If it doesn't, that's a real bug and wants its own issue — the fix isAppCompatResources.getDrawable(...)plustoBitmap(), orIconCompat.createWithResource.Verification
lintDebug: 35 → 27, zeroInlinedApi, zeroUnusedAttribute, zeroIconLauncherShape.assembleDebugpass.🤖 Generated with Claude Code