1/**
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
19import android.net.INetworkScoreCache;
20import 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.
38     * @throws SecurityException if the caller is neither the current active scorer nor the system.
39     */
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.
46     * @throws SecurityException if the caller is not the system.
47     */
48    boolean setActiveScorer(in String packageName);
49
50    /**
51     * 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    /**
57     * 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
67}
68