Loading api/system-current.txt +12 −10 Original line number Diff line number Diff line Loading @@ -188,6 +188,7 @@ package android { field public static final String REMOTE_DISPLAY_PROVIDER = "android.permission.REMOTE_DISPLAY_PROVIDER"; field public static final String REMOVE_DRM_CERTIFICATES = "android.permission.REMOVE_DRM_CERTIFICATES"; field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS"; field public static final String REQUEST_NETWORK_SCORES = "android.permission.REQUEST_NETWORK_SCORES"; field public static final String REQUEST_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE"; field public static final String RESET_PASSWORD = "android.permission.RESET_PASSWORD"; field public static final String RESTORE_RUNTIME_PERMISSIONS = "android.permission.RESTORE_RUNTIME_PERMISSIONS"; Loading Loading @@ -6263,7 +6264,7 @@ package android.net { public class NetworkKey implements android.os.Parcelable { ctor public NetworkKey(android.net.WifiKey); method @Nullable public static android.net.NetworkKey createFromScanResult(@Nullable android.net.wifi.ScanResult); method @Nullable public static android.net.NetworkKey createFromScanResult(@NonNull android.net.wifi.ScanResult); method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkKey> CREATOR; Loading Loading @@ -6314,12 +6315,12 @@ package android.net { } public class NetworkScoreManager { method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, "android.permission.REQUEST_NETWORK_SCORES"}) public boolean clearScores() throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, "android.permission.REQUEST_NETWORK_SCORES"}) public void disableScoring() throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, "android.permission.REQUEST_NETWORK_SCORES"}) public String getActiveScorerPackage(); method @RequiresPermission("android.permission.REQUEST_NETWORK_SCORES") public void registerNetworkScoreCallback(int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.NetworkScoreManager.NetworkScoreCallback) throws java.lang.SecurityException; method @RequiresPermission("android.permission.REQUEST_NETWORK_SCORES") public boolean requestScores(@NonNull android.net.NetworkKey[]) throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, "android.permission.REQUEST_NETWORK_SCORES"}) public boolean setActiveScorer(String) throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, android.Manifest.permission.REQUEST_NETWORK_SCORES}) public boolean clearScores() throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, android.Manifest.permission.REQUEST_NETWORK_SCORES}) public void disableScoring() throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, android.Manifest.permission.REQUEST_NETWORK_SCORES}) public String getActiveScorerPackage(); method @RequiresPermission(android.Manifest.permission.REQUEST_NETWORK_SCORES) public void registerNetworkScoreCallback(int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.NetworkScoreManager.NetworkScoreCallback) throws java.lang.SecurityException; method @RequiresPermission(android.Manifest.permission.REQUEST_NETWORK_SCORES) public boolean requestScores(@NonNull java.util.Collection<android.net.NetworkKey>) throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, android.Manifest.permission.REQUEST_NETWORK_SCORES}) public boolean setActiveScorer(String) throws java.lang.SecurityException; method @RequiresPermission(android.Manifest.permission.SCORE_NETWORKS) public boolean updateScores(@NonNull android.net.ScoredNetwork[]) throws java.lang.SecurityException; field @Deprecated public static final String ACTION_CHANGE_ACTIVE = "android.net.scoring.CHANGE_ACTIVE"; field public static final String ACTION_CUSTOM_ENABLE = "android.net.scoring.CUSTOM_ENABLE"; Loading @@ -6334,9 +6335,10 @@ package android.net { field public static final int SCORE_FILTER_SCAN_RESULTS = 2; // 0x2 } public static interface NetworkScoreManager.NetworkScoreCallback { method public void clearScores(); method public void updateScores(@NonNull java.util.List<android.net.ScoredNetwork>); public abstract static class NetworkScoreManager.NetworkScoreCallback { ctor public NetworkScoreManager.NetworkScoreCallback(); method public abstract void onScoresInvalidated(); method public abstract void onScoresUpdated(@NonNull java.util.Collection<android.net.ScoredNetwork>); } public abstract class NetworkSpecifier { Loading core/java/android/net/NetworkKey.java +5 −4 Original line number Diff line number Diff line Loading @@ -75,11 +75,12 @@ public class NetworkKey implements Parcelable { * * @return A new {@link NetworkKey} instance or <code>null</code> if the given * {@link ScanResult} instance is malformed. * @throws IllegalArgumentException */ @Nullable public static NetworkKey createFromScanResult(@Nullable ScanResult result) { public static NetworkKey createFromScanResult(@NonNull ScanResult result) { if (result == null) { return null; throw new IllegalArgumentException("ScanResult cannot be null"); } final String ssid = result.SSID; if (TextUtils.isEmpty(ssid) || ssid.equals(WifiManager.UNKNOWN_SSID)) { Loading core/java/android/net/NetworkScoreManager.java +30 −9 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Collection; import java.util.List; import java.util.concurrent.Executor; Loading Loading @@ -385,7 +386,6 @@ public class NetworkScoreManager { * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.REQUEST_NETWORK_SCORES) public boolean requestScores(@NonNull NetworkKey[] networks) throws SecurityException { try { Loading @@ -395,6 +395,28 @@ public class NetworkScoreManager { } } /** * Request scoring for networks. * * <p> * Note: The results (i.e scores) for these networks, when available will be provided via the * callback registered with {@link #registerNetworkScoreCallback(int, int, Executor, * NetworkScoreCallback)}. The calling module is responsible for registering a callback to * receive the results before requesting new scores via this API. * * @return true if the request was successfully sent, or false if there is no active scorer. * @throws SecurityException if the caller does not hold the * {@link permission#REQUEST_NETWORK_SCORES} permission. * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.REQUEST_NETWORK_SCORES) public boolean requestScores(@NonNull Collection<NetworkKey> networks) throws SecurityException { return requestScores(networks.toArray(new NetworkKey[0])); } /** * Register a network score cache. * Loading Loading @@ -454,26 +476,25 @@ public class NetworkScoreManager { /** * Base class for network score cache callback. Should be extended by applications and set * when calling {@link #registerNetworkScoreCallback(int, int, NetworkScoreCallback, * Executor)} * when calling {@link #registerNetworkScoreCallback(int, int, Executor, NetworkScoreCallback)}. * * @hide */ @SystemApi public interface NetworkScoreCallback { public abstract static class NetworkScoreCallback { /** * Called when a new set of network scores are available. * This is triggered in response when the client invokes * {@link #requestScores(NetworkKey[])} to score a new set of networks. * {@link #requestScores(Collection)} to score a new set of networks. * * @param networks List of {@link ScoredNetwork} containing updated scores. */ void updateScores(@NonNull List<ScoredNetwork> networks); public abstract void onScoresUpdated(@NonNull Collection<ScoredNetwork> networks); /** * Invokes when all the previously provided scores are no longer valid. */ void clearScores(); public abstract void onScoresInvalidated(); } /** Loading @@ -492,7 +513,7 @@ public class NetworkScoreManager { public void updateScores(@NonNull List<ScoredNetwork> networks) { Binder.clearCallingIdentity(); mExecutor.execute(() -> { mCallback.updateScores(networks); mCallback.onScoresUpdated(networks); }); } Loading @@ -500,7 +521,7 @@ public class NetworkScoreManager { public void clearScores() { Binder.clearCallingIdentity(); mExecutor.execute(() -> { mCallback.clearScores(); mCallback.onScoresInvalidated(); }); } } Loading core/res/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1616,6 +1616,7 @@ <!-- Allows applications to request network recommendations and scores from the NetworkScoreService. @SystemApi <p>Not for use by third-party applications. @hide --> <permission android:name="android.permission.REQUEST_NETWORK_SCORES" android:protectionLevel="signature|setup" /> Loading Loading
api/system-current.txt +12 −10 Original line number Diff line number Diff line Loading @@ -188,6 +188,7 @@ package android { field public static final String REMOTE_DISPLAY_PROVIDER = "android.permission.REMOTE_DISPLAY_PROVIDER"; field public static final String REMOVE_DRM_CERTIFICATES = "android.permission.REMOVE_DRM_CERTIFICATES"; field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS"; field public static final String REQUEST_NETWORK_SCORES = "android.permission.REQUEST_NETWORK_SCORES"; field public static final String REQUEST_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE"; field public static final String RESET_PASSWORD = "android.permission.RESET_PASSWORD"; field public static final String RESTORE_RUNTIME_PERMISSIONS = "android.permission.RESTORE_RUNTIME_PERMISSIONS"; Loading Loading @@ -6263,7 +6264,7 @@ package android.net { public class NetworkKey implements android.os.Parcelable { ctor public NetworkKey(android.net.WifiKey); method @Nullable public static android.net.NetworkKey createFromScanResult(@Nullable android.net.wifi.ScanResult); method @Nullable public static android.net.NetworkKey createFromScanResult(@NonNull android.net.wifi.ScanResult); method public int describeContents(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkKey> CREATOR; Loading Loading @@ -6314,12 +6315,12 @@ package android.net { } public class NetworkScoreManager { method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, "android.permission.REQUEST_NETWORK_SCORES"}) public boolean clearScores() throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, "android.permission.REQUEST_NETWORK_SCORES"}) public void disableScoring() throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, "android.permission.REQUEST_NETWORK_SCORES"}) public String getActiveScorerPackage(); method @RequiresPermission("android.permission.REQUEST_NETWORK_SCORES") public void registerNetworkScoreCallback(int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.NetworkScoreManager.NetworkScoreCallback) throws java.lang.SecurityException; method @RequiresPermission("android.permission.REQUEST_NETWORK_SCORES") public boolean requestScores(@NonNull android.net.NetworkKey[]) throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, "android.permission.REQUEST_NETWORK_SCORES"}) public boolean setActiveScorer(String) throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, android.Manifest.permission.REQUEST_NETWORK_SCORES}) public boolean clearScores() throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, android.Manifest.permission.REQUEST_NETWORK_SCORES}) public void disableScoring() throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, android.Manifest.permission.REQUEST_NETWORK_SCORES}) public String getActiveScorerPackage(); method @RequiresPermission(android.Manifest.permission.REQUEST_NETWORK_SCORES) public void registerNetworkScoreCallback(int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.NetworkScoreManager.NetworkScoreCallback) throws java.lang.SecurityException; method @RequiresPermission(android.Manifest.permission.REQUEST_NETWORK_SCORES) public boolean requestScores(@NonNull java.util.Collection<android.net.NetworkKey>) throws java.lang.SecurityException; method @RequiresPermission(anyOf={android.Manifest.permission.SCORE_NETWORKS, android.Manifest.permission.REQUEST_NETWORK_SCORES}) public boolean setActiveScorer(String) throws java.lang.SecurityException; method @RequiresPermission(android.Manifest.permission.SCORE_NETWORKS) public boolean updateScores(@NonNull android.net.ScoredNetwork[]) throws java.lang.SecurityException; field @Deprecated public static final String ACTION_CHANGE_ACTIVE = "android.net.scoring.CHANGE_ACTIVE"; field public static final String ACTION_CUSTOM_ENABLE = "android.net.scoring.CUSTOM_ENABLE"; Loading @@ -6334,9 +6335,10 @@ package android.net { field public static final int SCORE_FILTER_SCAN_RESULTS = 2; // 0x2 } public static interface NetworkScoreManager.NetworkScoreCallback { method public void clearScores(); method public void updateScores(@NonNull java.util.List<android.net.ScoredNetwork>); public abstract static class NetworkScoreManager.NetworkScoreCallback { ctor public NetworkScoreManager.NetworkScoreCallback(); method public abstract void onScoresInvalidated(); method public abstract void onScoresUpdated(@NonNull java.util.Collection<android.net.ScoredNetwork>); } public abstract class NetworkSpecifier { Loading
core/java/android/net/NetworkKey.java +5 −4 Original line number Diff line number Diff line Loading @@ -75,11 +75,12 @@ public class NetworkKey implements Parcelable { * * @return A new {@link NetworkKey} instance or <code>null</code> if the given * {@link ScanResult} instance is malformed. * @throws IllegalArgumentException */ @Nullable public static NetworkKey createFromScanResult(@Nullable ScanResult result) { public static NetworkKey createFromScanResult(@NonNull ScanResult result) { if (result == null) { return null; throw new IllegalArgumentException("ScanResult cannot be null"); } final String ssid = result.SSID; if (TextUtils.isEmpty(ssid) || ssid.equals(WifiManager.UNKNOWN_SSID)) { Loading
core/java/android/net/NetworkScoreManager.java +30 −9 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Collection; import java.util.List; import java.util.concurrent.Executor; Loading Loading @@ -385,7 +386,6 @@ public class NetworkScoreManager { * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.REQUEST_NETWORK_SCORES) public boolean requestScores(@NonNull NetworkKey[] networks) throws SecurityException { try { Loading @@ -395,6 +395,28 @@ public class NetworkScoreManager { } } /** * Request scoring for networks. * * <p> * Note: The results (i.e scores) for these networks, when available will be provided via the * callback registered with {@link #registerNetworkScoreCallback(int, int, Executor, * NetworkScoreCallback)}. The calling module is responsible for registering a callback to * receive the results before requesting new scores via this API. * * @return true if the request was successfully sent, or false if there is no active scorer. * @throws SecurityException if the caller does not hold the * {@link permission#REQUEST_NETWORK_SCORES} permission. * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.REQUEST_NETWORK_SCORES) public boolean requestScores(@NonNull Collection<NetworkKey> networks) throws SecurityException { return requestScores(networks.toArray(new NetworkKey[0])); } /** * Register a network score cache. * Loading Loading @@ -454,26 +476,25 @@ public class NetworkScoreManager { /** * Base class for network score cache callback. Should be extended by applications and set * when calling {@link #registerNetworkScoreCallback(int, int, NetworkScoreCallback, * Executor)} * when calling {@link #registerNetworkScoreCallback(int, int, Executor, NetworkScoreCallback)}. * * @hide */ @SystemApi public interface NetworkScoreCallback { public abstract static class NetworkScoreCallback { /** * Called when a new set of network scores are available. * This is triggered in response when the client invokes * {@link #requestScores(NetworkKey[])} to score a new set of networks. * {@link #requestScores(Collection)} to score a new set of networks. * * @param networks List of {@link ScoredNetwork} containing updated scores. */ void updateScores(@NonNull List<ScoredNetwork> networks); public abstract void onScoresUpdated(@NonNull Collection<ScoredNetwork> networks); /** * Invokes when all the previously provided scores are no longer valid. */ void clearScores(); public abstract void onScoresInvalidated(); } /** Loading @@ -492,7 +513,7 @@ public class NetworkScoreManager { public void updateScores(@NonNull List<ScoredNetwork> networks) { Binder.clearCallingIdentity(); mExecutor.execute(() -> { mCallback.updateScores(networks); mCallback.onScoresUpdated(networks); }); } Loading @@ -500,7 +521,7 @@ public class NetworkScoreManager { public void clearScores() { Binder.clearCallingIdentity(); mExecutor.execute(() -> { mCallback.clearScores(); mCallback.onScoresInvalidated(); }); } } Loading
core/res/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1616,6 +1616,7 @@ <!-- Allows applications to request network recommendations and scores from the NetworkScoreService. @SystemApi <p>Not for use by third-party applications. @hide --> <permission android:name="android.permission.REQUEST_NETWORK_SCORES" android:protectionLevel="signature|setup" /> Loading