Do not query CS in NetworkProvider constructor
ConnectivityService may not be available in a NetworkProvider constructor, if it is created (but still unused) before ConnectivityService starts. As ConnectivityManager is only necessary in declareNetworkRequestUnfulfillable, which should not be called often, just query ConnectivityManager at that point. This is necessary for VcnManagementService, which is started before ConnectivityService and creates its NetworkProvider in its constructor. Fortunately VcnManagementService does not call declareNetworkRequestUnfulfillable at this point. ConnectivityManager may be migrated to classic service getters that cache "null" when the service was not available the first time it is queried, so no system service must query it before it starts. Bug: 171540887 Test: atest FrameworksNetTests:NetworkProviderTest Change-Id: I8dadcd0e1360a9464192f330493e13aa69dd9fe2
Loading
Please register or sign in to comment