blob: 438692643c6ce8d832881df41214dab5e5684339 [file] [log] [blame]
Jeff Davidson6a4b2202014-04-16 17:29:40 -07001/**
2 * Copyright (c) 2014, The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17package android.net;
18
Jeff Davidson14f1ec02014-04-29 11:58:26 -070019import android.net.INetworkScoreCache;
Jeff Davidson6a4b2202014-04-16 17:29:40 -070020import android.net.ScoredNetwork;
21
22/**
23 * A service for updating network scores from a network scorer application.
24 * @hide
25 */
26interface INetworkScoreService
27{
28 /**
29 * Update scores.
30 * @return whether the update was successful.
31 * @throws SecurityException if the caller is not the current active scorer.
32 */
33 boolean updateScores(in ScoredNetwork[] networks);
34
35 /**
36 * Clear all scores.
37 * @return whether the clear was successful.
Jeff Davidson14f1ec02014-04-29 11:58:26 -070038 * @throws SecurityException if the caller is neither the current active scorer nor the system.
Jeff Davidson6a4b2202014-04-16 17:29:40 -070039 */
40 boolean clearScores();
41
42 /**
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.
Jeff Davidson14f1ec02014-04-29 11:58:26 -070046 * @throws SecurityException if the caller is not the system.
Jeff Davidson6a4b2202014-04-16 17:29:40 -070047 */
48 boolean setActiveScorer(in String packageName);
Jeff Davidson14f1ec02014-04-29 11:58:26 -070049
50 /**
Jeff Davidson26fd1432014-07-29 09:39:52 -070051 * Disable the current active scorer and clear existing scores.
52 * @throws SecurityException if the caller is not the current scorer or the system.
53 */
54 void disableScoring();
55
56 /**
Jeff Davidson14f1ec02014-04-29 11:58:26 -070057 * Register a network subsystem for scoring.
58 *
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.
63 * @hide
64 */
65 void registerNetworkScoreCache(int networkType, INetworkScoreCache scoreCache);
66
Jeff Davidson6a4b2202014-04-16 17:29:40 -070067}