Skip to content
Commit 0ea563f4 authored by Lorenzo Colitti's avatar Lorenzo Colitti
Browse files

Mark several NetworkAgentInfo members @NonNull and address TODO.

1. network cannot be null because it's final and the only caller
   of the constructor passes in a fresh copy.
2. linkProperties cannot be null because:
   - The only caller of the constructor passes in a fresh copy.
   - The only assignment to nai.linkProperties is in
     updateLinkProperties, and that dereferences newLp a few
     lines before assigning it.
3. networkCapabilities cannot be null because:
   - The only caller of the constructor passes in a fresh copy.
   - There are no direct assignments to nai.networkCapabilities.
   - All 4 assignments happen via getAndSetNetworkCapabilities:
     - registerNetworkAgentInternal, updateCapabilities and
       applyBackgroundChangeForRematch all pass in the return
       value of mixInCapabilities, which is always non-null.
     - updateNetworkInfo re-assigns the capabilities that were
       already set in the object.
4. networkAgentConfig cannot be null because it's final and
   the only caller of the NetworkAgentInfo constructor passes
   in a fresh copy.

Address a TODO in ConnectivityService to remove a check for the
nai's capabilities being null.

Also fix a style nit pointed out by the linter.

Test: atest FrameworksNetTests
Change-Id: I2e265f1c60a73d6da0222dd6711bc53c32db06ec
parent c5f2057d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment