Android 网络服务类提供的服务接口_android registerscanresultscallback-程序员宅基地

技术标签: wifi  Network  Android  

1. NetworkManagementService

继承了 INetworkManagementService.Stub,因此提供对应的 AIDL 定义的服务:

在 frameworks/base/core/java/android/os/INetworkManagementService.aidl 中定义

interface INetworkManagementService
{

    /* Register and unregister an observer to receive events. */
    void registerObserver(INetworkManagementEventObserver obs);
    void unregisterObserver(INetworkManagementEventObserver obs);

    /* Returns a list of currently known network interfaces */
    String[] listInterfaces();

    /* Retrieves the specified interface config */
    InterfaceConfiguration getInterfaceConfig(String iface);

    /* Sets the configuration of the specified interface */
    void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);

    /* Clear all IP addresses on the specified interface */
    void clearInterfaceAddresses(String iface);

    /* Set interface up or down */
    void setInterfaceDown(String iface);
    void setInterfaceUp(String iface);

    ... /* IPv6 related */

    /* Add or remove the specified route to the interface.*/
    void addRoute(int netId, in RouteInfo route);
    void removeRoute(int netId, in RouteInfo route);

    /* Set the specified MTU size */
    void setMtu(String iface, int mtu);

    /* Shuts down the service */
    void shutdown();

    ....../* tethering related */

    /* Set or remove quota for an interface. */
    void setInterfaceQuota(String iface, long quotaBytes);
    void removeInterfaceQuota(String iface);

    /* Set or remove alert for an interface; requires that iface already has quota. */
    void setInterfaceAlert(String iface, long alertBytes);
    void removeInterfaceAlert(String iface);

    /* Set alert across all interfaces. */
    void setGlobalAlert(long alertBytes);

    /* Control network activity of a UID over interfaces with a quota limit. */
    void setUidMeteredNetworkDenylist(int uid, boolean enable);
    void setUidMeteredNetworkAllowlist(int uid, boolean enable);
    boolean setDataSaverModeEnabled(boolean enable);

    void setUidCleartextNetworkPolicy(int uid, int policy);

    /* Return status of bandwidth control module. */
    boolean isBandwidthControlEnabled();

    /* Sets or remove idletimer for an interface.
     *
     * This either initializes a new idletimer or increases its
     * reference-counting if an idletimer already exists for given
     * {@code iface}.
     *
     * {@code type} is the type of the interface, such as TYPE_MOBILE.
     *
     * Every {@code addIdleTimer} should be paired with a
     * {@link removeIdleTimer} to cleanup when the network disconnects.
     */
    void addIdleTimer(String iface, int timeout, int type);
    void removeIdleTimer(String iface);

    void setFirewallEnabled(boolean enabled);
    boolean isFirewallEnabled();
    void setFirewallInterfaceRule(String iface, boolean allow);
    void setFirewallUidRule(int chain, int uid, int rule);
    void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
    void setFirewallChainEnabled(int chain, boolean enable);

    /* VPN related */
    void addVpnUidRanges(int netId, in UidRange[] ranges);
    void removeVpnUidRanges(int netId, in UidRange[] ranges);

    /* Start listening for mobile activity state changes. */
    void registerNetworkActivityListener(INetworkActivityListener listener);

    /* Stop listening for mobile activity state changes.*/
    void unregisterNetworkActivityListener(INetworkActivityListener listener);

    /* Check whether the mobile radio is currently active. */
    boolean isNetworkActive();

    /* Add or remove an interface to a network. */
    void addInterfaceToNetwork(String iface, int netId);
    void removeInterfaceFromNetwork(String iface, int netId);

    void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid);

    void setDefaultNetId(int netId);
    void clearDefaultNetId();

    /* Set permission for a network.
     * @param permission PERMISSION_NONE to clear permissions.
     *                   PERMISSION_NETWORK or PERMISSION_SYSTEM to set permission.
     */
    void setNetworkPermission(int netId, int permission);

    /* Allow or deny UID to call protect(). */
    void allowProtect(int uid);
    void denyProtect(int uid);

    void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes);
    void removeInterfaceFromLocalNetwork(String iface);
    int removeRoutesFromLocalNetwork(in List<RouteInfo> routes);

    boolean isNetworkRestricted(int uid);
}

2.  WIFI_SERVICE_CLASS 服务

初始化发生在 WifiService 类,实际实现在 WifiServiceImpl 类,而继承了 BaseWifiService,实现了 IWifiManager (IWifiManager.Stub)的接口,即为对客户端层面需要提供的服务。

IWifiManager 定义如下:

文件为:frameworks/base/wifi/java/android/net/wifi/IWifiManager.aidl

interface IWifiManager
{
    long getSupportedFeatures();

    oneway void getWifiActivityEnergyInfoAsync(in IOnWifiActivityEnergyInfoListener listener);

    ParceledListSlice getConfiguredNetworks(String packageName, String featureId);

    ParceledListSlice getPrivilegedConfiguredNetworks(String packageName, String featureId);

    Map getAllMatchingFqdnsForScanResults(in List<ScanResult> scanResult);

    Map getMatchingOsuProviders(in List<ScanResult> scanResult);

    Map getMatchingPasspointConfigsForOsuProviders(in List<OsuProvider> osuProviders);

    int addOrUpdateNetwork(in WifiConfiguration config, String packageName);

    boolean addOrUpdatePasspointConfiguration(in PasspointConfiguration config, String packageName);

    boolean removePasspointConfiguration(in String fqdn, String packageName);

    List<PasspointConfiguration> getPasspointConfigurations(in String packageName);

    List<WifiConfiguration> getWifiConfigsForPasspointProfiles(in List<String> fqdnList);

    void queryPasspointIcon(long bssid, String fileName);

    int matchProviderWithCurrentNetwork(String fqdn);

    void deauthenticateNetwork(long holdoff, boolean ess);

    boolean removeNetwork(int netId, String packageName);

   

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Vince_/article/details/115203280

智能推荐

一条全表扫描sql语句的分析-程序员宅基地

文章浏览阅读128次。今天在对生产系统做监控的时候,发现一个process的cpu消耗很高,抓取了对应的session和执行的sql语句。发现是一个简单的update语句,这样一条如果CPU消耗较大,很可能是由于全表扫描的。UPDATECOMM_ACTIVITY SET COMM_ACTIVITY.EXTRACT_STATUS = N..._sql全表扫描语句

hadoop: hdfs:删除文件、文件夹等常用命令_hadoop删除文件命令-程序员宅基地

文章浏览阅读5w次,点赞7次,收藏28次。配置了环境变量直接执行:要从HDFS中删除文件,可以使用以下命令:hadoop fs -rm -r -skipTrash /path_to_file/file_name要从HDFS中删除文件夹,可以使用以下命令:hadoop fs -rm -r -skipTrash /folder_name..._hadoop删除文件命令

Spring(五)Spring整合Hibernate-程序员宅基地

文章浏览阅读275次。Spring整合Hibernate_spring整合hibernate

Eclipse 常用快捷键及使用技巧-程序员宅基地

文章浏览阅读78次。做 java 开发的,经常会用 Eclipse 或者 MyEclise 集成开发环境,一些实用的 Eclipse 快捷键和使用技巧,可以在平常开发中节约出很多时间提高工作效率,下面我就结合自己开发中的使用和大家分享一下 Eclipse 中常用到的快捷键和技巧。15 个 Eclipse 常用开发快捷键使用技巧1、alt+?或alt+/:自动补全代码或者提示代码这个是我最得意的快捷键组..._eclipese 使用技巧大全

42 SAP报错:作业类型 ACT001 没有为成本中心 1088 1200990001 设置(Activity type ATC001 not set up for cost center XXX)_作业类型 lab 没有为成本中心 ql99 1001 设置-程序员宅基地

文章浏览阅读567次,点赞6次,收藏11次。解决方案:CO模块使用前台事务码KP26维护活动类型价格,即可。业务操作:PP模块前台事务码CR02维护活动类型时,报错如上。报错原因:CO模块没有为活动类型进行价格维护。CO模块KP26维护作业类型价格完毕。2024年1月26日 写于上海。事务码KP26进入,_作业类型 lab 没有为成本中心 ql99 1001 设置

TortoiseGit解决TortoiseGitPlink要求输入密码-程序员宅基地

文章浏览阅读3.2k次,点赞4次,收藏10次。解决TortoiseGitPlink要求输入密码_tortoisegitplink

随便推点

关于Spacy_pip install spacy python -m spacy download en_vect-程序员宅基地

文章浏览阅读1.0k次。关于Spacy安装遇到的错误_pip install spacy python -m spacy download en_vectors_web_lg

人体姿态估计 HRNet C++版_hrnet的速度-程序员宅基地

文章浏览阅读3.7k次,点赞8次,收藏44次。最近由于项目原因,需要用到HRNet网络,加上前面的目标检测部分,使用python版本的代码运行太慢,于是想到了用c++来重写HRNet,将pytorch的模型文件转换为onnx,采用onnx的c++的推理库。然后目标检测网络采用轻量级的nanodet,同时也采用onnx进行推理。最后,在我的笔记本电脑上(GTX960M)进行单人的姿态估计也跑到了20帧左右。其中nanodet是0.01s左右,hrnet是0.04s左右,hrnet是w32_256*192的模型转换而来的。多人的话时间就是成倍增长。_hrnet的速度

@SuppressLint or @TargetApi_you can suppress the error with @suppresslint-程序员宅基地

文章浏览阅读788次。@TargetApi and @SuppressLint have the same core effect: they suppress the Lint error.The difference is that with @TargetApi, you declare, via the parameter, what API level you have addressed i_you can suppress the error with @suppresslint

关于Error in callback for watcher “data“: “TypeError: data.indexOf is not a function“的错误_error in callback for watcher "data": "typeerror: -程序员宅基地

文章浏览阅读2.8w次,点赞10次,收藏12次。关于Error in callback for watcher “data”: "TypeError: data.indexOf is not a function"的错误说明原因:表格显示需要数组包含对象的形式,每个对象是一行数据,拿到的数据格式不对。错误例子:从后台获取数据res.data,显示在表格中。只有一条数据,六个内容,应该是一行六列,但是出现了六行六列,且都为空。报三个..._error in callback for watcher "data": "typeerror: data.indexof is not a func

Tomcat Session(CVE-2020-9484)反序列化漏洞复现_禁止使用session持久化功能filestore-程序员宅基地

文章浏览阅读1.2k次。北京时间2020年05月20日,Apache官方发布了 Apache Tomcat 远程代码执行 的风险通告,该漏洞编号为 CVE-2020-9484。Apache Tomcat 是一个开放源代码、运行servlet和JSP Web应用软件的基于Java的Web应用软件容器。当Tomcat使用了自带session同步功能时,使用不安全的配置(没有使用EncryptInterceptor)会存在反序列化漏洞,攻击者通过精心构造的数据包, 可以对使用了自带session同步功能的Tomcat服务器进行攻击。_禁止使用session持久化功能filestore

java漏洞提权_CVE-2018-3211:Java Usage Tracker本地提权漏洞分析-程序员宅基地

文章浏览阅读170次。一、前言我们发现Java Usage Tracker中存在设计缺陷(或者脆弱点),攻击者可以利用该缺陷创建任意文件、注入攻击者指定的参数以及提升本地权限。这些攻击手段也能组合使用实现权限提升,以便访问受影响系统中其他应用或者用户不能访问的某些保护资源。我们通过Zero Day Initiative与Oracle合作修复了这个漏洞,厂商已经在10月份补丁中推出了安全更新。因此,用户以及企业应当尽快安..._java防范代码问题的提权脱库

推荐文章

热门文章

相关标签