2 * Copyright (c) 2014, The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 import android.net.INetworkScoreCache;
20 import android.net.ScoredNetwork;
23 * A service for updating network scores from a network scorer application.
26 interface INetworkScoreService
30 * @return whether the update was successful.
31 * @throws SecurityException if the caller is not the current active scorer.
33 boolean updateScores(in ScoredNetwork[] networks);
37 * @return whether the clear was successful.
38 * @throws SecurityException if the caller is neither the current active scorer nor the system.
40 boolean clearScores();
43 * Set the active scorer and clear existing scores.
44 * @param packageName the package name of the new scorer to use.
45 * @return true if the operation succeeded, or false if the new package is not a valid scorer.
46 * @throws SecurityException if the caller is not the system.
48 boolean setActiveScorer(in String packageName);
51 * Disable the current active scorer and clear existing scores.
52 * @throws SecurityException if the caller is not the current scorer or the system.
54 void disableScoring();
57 * Register a network subsystem for scoring.
59 * @param networkType the type of network this cache can handle. See {@link NetworkKey#type}.
60 * @param scoreCache implementation of {@link INetworkScoreCache} to store the scores.
61 * @throws SecurityException if the caller is not the system.
62 * @throws IllegalArgumentException if a score cache is already registed for this type.
65 void registerNetworkScoreCache(int networkType, INetworkScoreCache scoreCache);