/**@class android.net.NetworkFactory @extends android.os.Handler A NetworkFactory is an entity that creates NetworkAgent objects. The bearers register with ConnectivityService using {@link #register} and their factory will start receiving scored NetworkRequests. NetworkRequests can be filtered 3 ways: by NetworkCapabilities, by score and more complexly by overridden function. All of these can be dynamic - changing NetworkCapabilities or score forces re-evaluation of all current requests. If any requests pass the filter some overrideable functions will be called. If the bearer only cares about very simple start/stopNetwork callbacks, those functions can be overridden. If the bearer needs more interaction, it can override addNetworkRequest and removeNetworkRequest which will give it each request that passes their current filters. @hide */ var NetworkFactory = { /** Pass a network request to the bearer. If the bearer believes it can satisfy the request it should connect to the network and create a NetworkAgent. Once the NetworkAgent is fully functional it will register itself with ConnectivityService using registerNetworkAgent. If the bearer cannot immediately satisfy the request (no network, user disabled the radio, lower-scored network) it should remember any NetworkRequests it may be able to satisfy in the future. It may disregard any that it will never be able to service, for example those requiring a different bearer. msg.obj = NetworkRequest msg.arg1 = score - the score of the any network currently satisfying this request. If this bearer knows in advance it cannot exceed this score it should not try to connect, holding the request for the future. Note that subsequent events may give a different (lower or higher) score for this request, transmitted to each NetworkFactory through additional CMD_REQUEST_NETWORK msgs with the same NetworkRequest but an updated score. Also, network conditions may change for this bearer allowing for a better score in the future. */ CMD_REQUEST_NETWORK : "536576", /** Cancel a network request msg.obj = NetworkRequest */ CMD_CANCEL_REQUEST : "536577", /** */ register : function( ) {}, /** */ unregister : function( ) {}, /** */ handleMessage : function( ) {}, /**Overridable function to provide complex filtering. Called for every request every time a new NetworkRequest is seen and whenever the filterScore or filterNetworkCapabilities change. acceptRequest can be overriden to provide complex filter behavior for the incoming requests For output, this class will call {@link #needNetworkFor} and {@link #releaseNetworkFor} for every request that passes the filters. If you don't need to see every request, you can leave the base implementations of those two functions and instead override {@link #startNetwork} and {@link #stopNetwork}. If you want to see every score fluctuation on every request, set your score filter to a very high number and watch {@link #needNetworkFor}. @return {Boolean} {@code true} to accept the request. */ acceptRequest : function( ) {}, /** */ addNetworkRequest : function( ) {}, /** */ removeNetworkRequest : function( ) {}, /** */ setScoreFilter : function( ) {}, /** */ setCapabilityFilter : function( ) {}, /** */ dump : function( ) {}, /** */ toString : function( ) {}, };