Skip to content

Harden 5G and carrier capability caching mechanisms - #19

Merged
Dhangofa merged 4 commits into
mainfrom
Test-patch
Aug 18, 2026
Merged

Harden 5G and carrier capability caching mechanisms#19
Dhangofa merged 4 commits into
mainfrom
Test-patch

Conversation

@Dhangofa

Copy link
Copy Markdown
Owner

Summary

This pull request introduces critical robustness improvements and security hardening to the device capability and carrier matching logic. It ensures that only verified, valid 5G capability results and carrier matches are cached, preventing false negatives, incorrect substring matches, and edge-case misconfigurations across different Android versions.

Changes & Improvements

1. 5G Capability Caching & Version Safeguards

  • Version Floor Enforcement: Maintained Android 11 as the minimum OS version required for 5G capability detection, while preserving backward compatibility for Android 7–10 legacy behaviors.
  • Profile ID Validation: Preserved forward-compatible profile ID checks for values 23 and higher.
  • Negative Result Prevention:
    • Stopped empty default-network properties and unparseable property values from being incorrectly cached as "5G unsupported."
    • Restricted capability caching to instances where at least one valid numeric profile is successfully identified.

2. Carrier Alias Match Accuracy

  • Strict Matching Rules:
    • Restricted short carrier aliases to exact matching to eliminate unrelated substring matches.
    • Implemented whole-phrase matching for longer carrier labels.
  • Normalization & Registry:
    • Normalized common separators prior to phrase matching.
    • Preserved the maintained LTE-and-above carrier registry as valid real-world evidence.

3. Carrier Capability Validation & Caching

  • Source Validation: Replaced the shell echo cache check with strict capability-source validation.
  • Config Requirements:
    • Required at least one relevant, selected-slot CarrierConfig value before allowing cache persistence.
    • Ensured slot headers alone cannot validate default capability values.
  • Optimistic Fallback: Preserved optimistic default behavior when CarrierConfig detection is unavailable.

- Kept Android 11 as the minimum version for 5G capability detection.
- Preserved the forward-compatible profile ID check for values 23 and higher.
- Prevented empty default-network properties from being cached as 5G unsupported.
- Prevented unparseable property values from producing a cached negative result.
- Cached device capabilities only when at least one valid numeric profile was found.
- Preserved Android 7–10 compatibility and existing legacy capability behavior.
- Preserved the maintained LTE-and-above carrier registry.
- Restricted short carrier aliases to exact matching.
- Added whole-phrase matching for longer carrier labels.
- Normalized common separators before phrase matching.
- Prevented unrelated carriers from matching short aliases by substring.
- Replaced the shell echo cache check with capability-source validation.
- Required at least one relevant selected-slot CarrierConfig value before caching.
- Kept maintained carrier registry matches as cacheable real-world evidence.
- Prevented slot headers alone from validating default capability values.
- Preserved optimistic behavior when CarrierConfig detection is unavailable.
@Dhangofa
Dhangofa merged commit 93c0a79 into main Aug 18, 2026
2 checks passed
@Dhangofa
Dhangofa deleted the Test-patch branch August 18, 2026 11:23
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