Jeff Davidson | 6a4b220 | 2014-04-16 17:29:40 -0700 | [diff] [blame] | 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 | |
| 17 | package android.net; |
| 18 | |
Jeff Davidson | 14f1ec0 | 2014-04-29 11:58:26 -0700 | [diff] [blame] | 19 | import android.net.INetworkScoreCache; |
Jeff Davidson | 6a4b220 | 2014-04-16 17:29:40 -0700 | [diff] [blame] | 20 | import android.net.ScoredNetwork; |
| 21 | |
| 22 | /** |
| 23 | * A service for updating network scores from a network scorer application. |
| 24 | * @hide |
| 25 | */ |
| 26 | interface 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 Davidson | 14f1ec0 | 2014-04-29 11:58:26 -0700 | [diff] [blame] | 38 | * @throws SecurityException if the caller is neither the current active scorer nor the system. |
Jeff Davidson | 6a4b220 | 2014-04-16 17:29:40 -0700 | [diff] [blame] | 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. |
Jeff Davidson | 14f1ec0 | 2014-04-29 11:58:26 -0700 | [diff] [blame] | 46 | * @throws SecurityException if the caller is not the system. |
Jeff Davidson | 6a4b220 | 2014-04-16 17:29:40 -0700 | [diff] [blame] | 47 | */ |
| 48 | boolean setActiveScorer(in String packageName); |
Jeff Davidson | 14f1ec0 | 2014-04-29 11:58:26 -0700 | [diff] [blame] | 49 | |
| 50 | /** |
Jeff Davidson | 26fd143 | 2014-07-29 09:39:52 -0700 | [diff] [blame] | 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 | /** |
Jeff Davidson | 14f1ec0 | 2014-04-29 11:58:26 -0700 | [diff] [blame] | 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 | |
Jeff Davidson | 6a4b220 | 2014-04-16 17:29:40 -0700 | [diff] [blame] | 67 | } |