Added rule Sobriety > Hardware acceleration #103
Merged
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.
π‘οΈ PR Description: Add Rule ESOB016 β Detect Explicit and Implicit Use of Hardware Acceleration
This pull request introduces a new ecoCode rule for Android projects: ESOB016 β Detects explicit or implicit use of hardware acceleration in Android component declarations.
π Motivation
Hardware acceleration (android:hardwareAccelerated="true") can increase rendering performance, but at the cost of higher RAM usage and potential compatibility issues, especially on low-end or memory-constrained devices. This rule helps teams identify when it is unnecessarily enabledβeither explicitly or implicitlyβto encourage more conscious resource management.
π What the Rule Detects
Explicit activation of hardware acceleration via android:hardwareAccelerated="true" on supported XML elements.
Implicit activation when:
π― Scope
The rule targets the following AndroidManifest components:
β Recommendation
Enable hardware acceleration only when necessary for visual performance, such as complex animations or canvas rendering. In most other casesβespecially for background components or simple UIsβit should be disabled to save memory.
π Reference
Android Developer Guide: Hardware Acceleration