当前位置: 首页 > news >正文

天津做网站哪家好军事新闻最新消息

天津做网站哪家好,军事新闻最新消息,现代简约客厅,展厅施工公司Android13 有线变更 以太网相关的功能在Android12 和13 网络部分变化是不大的,Android11 到Android 12 网络部分无论是代码存放目录和代码逻辑都是有较多修改的,主要包括以下几个部分 限制了设置有线网参数设置接口方法 新增有线网开启关闭接口方法 新…

Android13 有线变更

以太网相关的功能在Android12 和13 网络部分变化是不大的,Android11 到Android 12 网络部分无论是代码存放目录和代码逻辑都是有较多修改的,主要包括以下几个部分

  1. 限制了设置有线网参数设置接口方法

  2. 新增有线网开启关闭接口方法

  3. 新增了 updateConfiguration 接口方法

  4. 有线网设置的静态ip和代理信息重启后无效

  5. EthernetManager相关代码从framework移到packages/modules/Connectivity/ (之前目录:frameworks\base\core\java\android\net\EthernetManager.java) 后面开发Android12 或新版本代码,你会发现wifi 、蓝牙、热点 之前 framework 的源码都移动到了下面的package目录:

基于以上变更。如果app api (targetSdkVersion)设置成Android12 ,应用用无法用以前的接口设置有线网信息。

  • 限制了设置有线网参数设置接口方法

//packages\modules\Connectivity\framework-t\src\android\net\EthernetManager.java/*** Get Ethernet configuration.* @return the Ethernet Configuration, contained in {@link IpConfiguration}.* @hide*/@SystemApi(client = MODULE_LIBRARIES)public @NonNull IpConfiguration getConfiguration(@NonNull String iface) {try {return mService.getConfiguration(iface);} catch (RemoteException e) {throw e.rethrowFromSystemServer();}}/*** Set Ethernet configuration.* @hide*/@SystemApi(client = MODULE_LIBRARIES)public void setConfiguration(@NonNull String iface, @NonNull IpConfiguration config) {try {mService.setConfiguration(iface, config);} catch (RemoteException e) {throw e.rethrowFromSystemServer();}}@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)public String[] getAvailableInterfaces() {try {return mService.getAvailableInterfaces();} catch (RemoteException e) {throw e.rethrowAsRuntimeException();}}

从上面看,主要是api加了限制 :maxTargetSdk = Build.VERSION_CODES.R //Android11

所以Android 12 或者更新的版本,在EthernetManager 是调用不到上面几个接口方法的

  • 新增有线网开启关闭接口方法

//packages\modules\Connectivity\framework-t\src\android\net\EthernetManager.java@RequiresPermission(anyOf = {NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,android.Manifest.permission.NETWORK_STACK,android.Manifest.permission.NETWORK_SETTINGS})@SystemApi(client = MODULE_LIBRARIES)public void setEthernetEnabled(boolean enabled) {try {mService.setEthernetEnabled(enabled);} catch (RemoteException e) {throw e.rethrowFromSystemServer();}}

这个是新增的接口方法 setEthernetEnabled ,之前是要自己实现有线网开关的。需要的权限上面已经说明的,基本是要系统签名的应用才能调用。

  • 新增了 updateConfiguration 接口方法

//packages\modules\Connectivity\framework-t\src\android\net\EthernetManager.java@SystemApi@RequiresPermission(anyOf = {NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,android.Manifest.permission.NETWORK_STACK,android.Manifest.permission.MANAGE_ETHERNET_NETWORKS})public void updateConfiguration(@NonNull String iface,@NonNull EthernetNetworkUpdateRequest request,@Nullable @CallbackExecutor Executor executor,@Nullable OutcomeReceiver<String, EthernetNetworkManagementException> callback) {Objects.requireNonNull(iface, "iface must be non-null");Objects.requireNonNull(request, "request must be non-null");final NetworkInterfaceOutcomeReceiver proxy = makeNetworkInterfaceOutcomeReceiver(executor, callback);try {mService.updateConfiguration(iface, request, proxy);} catch (RemoteException e) {throw e.rethrowFromSystemServer();}}

String iface //节点名称:eth0 / eth1

EthernetNetworkUpdateRequest request 对象是包含静态ip和代理信息对象和特征属性对象。

后面两个是回调监听,未要求非空,是可以传null 的。

另外在有线网服务,新api 增加了限制!

//packages\modules\Connectivity\service-t\src\com\android\server\ethernet\EthernetServiceImpl.java@Overridepublic void updateConfiguration(@NonNull final String iface,@NonNull final EthernetNetworkUpdateRequest request,@Nullable final INetworkInterfaceOutcomeReceiver listener) {Objects.requireNonNull(iface);Objects.requireNonNull(request);throwIfEthernetNotStarted();// TODO: validate that iface is listed in overlay config_ethernet_interfaces// only automotive devices are allowed to set the NetworkCapabilities using this API//only automotive devices 表明,只有 车载设备支持设置该方法
+        // 非车载项目必须注释调方法:enforceAdminPermission ,否则会报错,这里是校验是否是车载项目
+        //enforceAdminPermission(iface, request.getNetworkCapabilities() != null,
+         //       "updateConfiguration() with non-null capabilities");
+        Log.i(TAG, " lwz add updateConfiguration with: iface=" + iface + ", listener=" + listener);maybeValidateTestCapabilities(iface, request.getNetworkCapabilities());mTracker.updateConfiguration(iface, request.getIpConfiguration(), request.getNetworkCapabilities(), listener);}

所以要在自己项目中调用新的api ,必须设置属性让自己的设备识别为车载项目或者把车载判断的逻辑去除即可

  • 有线网设置的静态ip和代理信息重启后无效

//查看有线网配置信息保存的类:
packages\modules\Connectivity\service-t\src\com\android\server\ethernet\EthernetConfigStore.javaprivate static final String CONFIG_FILE = "ipconfig.txt";private static final String FILE_PATH = "/misc/ethernet/";private static final String LEGACY_IP_CONFIG_FILE_PATH = Environment.getDataDirectory() + FILE_PATH;//Android13 新增下面路径:private static final String APEX_IP_CONFIG_FILE_PATH = ApexEnvironment.getApexEnvironment(TETHERING_MODULE_NAME).getDeviceProtectedDataDir() + FILE_PATH; // TETHERING_MODULE_NAME --》com.android.tethering/**
可以看到之前的路径是:
/data/misc/ethernet/ipconfig.txt
最新的有线网配置文件保存目录:
/data/misc/apexdata/com.android.tethering/misc/ethernet/ipconfig.txt
可能存在因为未成功保存本地配置文件,所以每次开机重启后,无法读取到静态ip和代理等信息。
所以出现 有线网设置的静态ip和代理信息重启后无效 问题。主要原因为开机读取的时候,目录未成功创建,故保存未成功。
可以参考如下:
*///packages\modules\Connectivity/service-t/src/com/android/server/ethernet/EthernetConfigStore.java@VisibleForTestingvoid read(final String newFilePath, final String oldFilePath, final String filename) {try {synchronized (mSync) {// Attempt to read the IP configuration from apex file path first.if (doesConfigFileExist(newFilePath + filename)) {loadConfigFileLocked(newFilePath + filename);return;}//ik-phoebe add for create dir data/misc/apexdata/com.android.tethering/misc/ethernetfinal File directory = new File(newFilePath);if (!directory.exists()) {boolean mkdirs = directory.mkdirs();Log.d(TAG, "zmm add for mkdirs:" + newFilePath + ",result:" + mkdirs);}// If the config file doesn't exist in the apex file path, attempt to read it from// the legacy file path, if config file exists, write the legacy IP configuration to// apex config file path, this should just happen on the first boot. New or updated// config entries are only written to the apex config file later.if (!doesConfigFileExist(oldFilePath + filename)) return;loadConfigFileLocked(oldFilePath + filename);writeLegacyIpConfigToApexPath(newFilePath, oldFilePath, filename);}} catch (Exception e) {e.printStackTrace();Log.e(TAG, "zmm add for read exception:" + e.getMessage());}}

Android13 有线网适配思路

主要是从以下两个方面:

(1)使用新api接口设置静态ip和代理信息

(2)移除源码中限制接口的版本号 目前我采用的是二,但是如果项目需要过gms认证,则只能使用一,因为gms合入mainline,packages\modules\Connectivity生成的jar会被覆盖。

diff --git a/framework-t/api/module-lib-current.txt b/framework-t/api/module-lib-current.txt
index 5a8d47b..177f6c5 100644
--- a/framework-t/api/module-lib-current.txt
+++ b/framework-t/api/module-lib-current.txt
@@ -44,9 +44,11 @@ package android.net {public class EthernetManager {method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void addEthernetStateListener(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.IntConsumer);method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void addInterfaceStateListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.EthernetManager.InterfaceStateListener);
+    method @NonNull public android.net.IpConfiguration getConfiguration(@NonNull String);method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public java.util.List<java.lang.String> getInterfaceList();method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void removeEthernetStateListener(@NonNull java.util.function.IntConsumer);method public void removeInterfaceStateListener(@NonNull android.net.EthernetManager.InterfaceStateListener);
+    method public void setConfiguration(@NonNull String, @NonNull android.net.IpConfiguration);method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public void setEthernetEnabled(boolean);method public void setIncludeTestInterfaces(boolean);field public static final int ETHERNET_STATE_DISABLED = 0; // 0x0
diff --git a/framework-t/src/android/net/EthernetManager.java b/framework-t/src/android/net/EthernetManager.java
index 886d194..9c675fb 100644
--- a/framework-t/src/android/net/EthernetManager.java
+++ b/framework-t/src/android/net/EthernetManager.java
@@ -191,8 +191,8 @@ public class EthernetManager {* @return the Ethernet Configuration, contained in {@link IpConfiguration}.* @hide*/
-    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
-    public IpConfiguration getConfiguration(String iface) {
+    @SystemApi(client = MODULE_LIBRARIES)
+    public @NonNull IpConfiguration getConfiguration(@NonNull String iface) {try {return mService.getConfiguration(iface);} catch (RemoteException e) {
@@ -204,7 +204,7 @@ public class EthernetManager {* Set Ethernet configuration.* @hide*/
-    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
+    @SystemApi(client = MODULE_LIBRARIES)public void setConfiguration(@NonNull String iface, @NonNull IpConfiguration config) {try {mService.setConfiguration(iface, config);
-- 
2.17.1

当然最好的还是使用系统提供的更新ip方法:

   IpConfiguration.Builder build = new IpConfiguration.Builder();EthernetNetworkUpdateRequest.Builder requestBuilder = new EthernetNetworkUpdateRequest.Builder();build.setHttpProxy(proxyinfo);
//如果是静态ip,需要创建对应的静态staticIpConfigurationbuild.setStaticIpConfiguration(staticIpConfiguration);requestBuilder.setIpConfiguration(build.build());mEthManager.updateConfiguration("eth0", requestBuilder.build(), null, null);

以上为Android13 以太网相关的更新

单曲循环《大悲咒》


文章转载自:
http://trapeze.nLkm.cn
http://nectariferous.nLkm.cn
http://instreaming.nLkm.cn
http://ascribe.nLkm.cn
http://synonymist.nLkm.cn
http://scourings.nLkm.cn
http://mitten.nLkm.cn
http://septennium.nLkm.cn
http://sunfish.nLkm.cn
http://cartload.nLkm.cn
http://thelma.nLkm.cn
http://tricorn.nLkm.cn
http://astir.nLkm.cn
http://falsehearted.nLkm.cn
http://acrogenous.nLkm.cn
http://verna.nLkm.cn
http://transmigrant.nLkm.cn
http://spleenwort.nLkm.cn
http://allot.nLkm.cn
http://shelterless.nLkm.cn
http://carniferous.nLkm.cn
http://imaginative.nLkm.cn
http://befringe.nLkm.cn
http://jukebox.nLkm.cn
http://girdler.nLkm.cn
http://informative.nLkm.cn
http://canful.nLkm.cn
http://shiloh.nLkm.cn
http://would.nLkm.cn
http://roseau.nLkm.cn
http://chironomid.nLkm.cn
http://unharming.nLkm.cn
http://gagwriter.nLkm.cn
http://exoteric.nLkm.cn
http://hackneyed.nLkm.cn
http://eczema.nLkm.cn
http://bicentric.nLkm.cn
http://inurn.nLkm.cn
http://citified.nLkm.cn
http://reticulosis.nLkm.cn
http://annum.nLkm.cn
http://subsidize.nLkm.cn
http://mandoline.nLkm.cn
http://oxytocin.nLkm.cn
http://stannum.nLkm.cn
http://bepuzzlement.nLkm.cn
http://lutose.nLkm.cn
http://eyedropper.nLkm.cn
http://excitant.nLkm.cn
http://babycham.nLkm.cn
http://mesosome.nLkm.cn
http://cacodoxy.nLkm.cn
http://relevance.nLkm.cn
http://coleridgian.nLkm.cn
http://nocuousness.nLkm.cn
http://chateaubriand.nLkm.cn
http://acetonaemia.nLkm.cn
http://titubate.nLkm.cn
http://wiretapper.nLkm.cn
http://funeral.nLkm.cn
http://haida.nLkm.cn
http://basilary.nLkm.cn
http://overarm.nLkm.cn
http://antiphon.nLkm.cn
http://galvanometry.nLkm.cn
http://footballer.nLkm.cn
http://homoousion.nLkm.cn
http://pelmet.nLkm.cn
http://popie.nLkm.cn
http://disulfoton.nLkm.cn
http://lombok.nLkm.cn
http://directorship.nLkm.cn
http://gorm.nLkm.cn
http://dropsical.nLkm.cn
http://vocalic.nLkm.cn
http://facilely.nLkm.cn
http://couloir.nLkm.cn
http://plumbiferous.nLkm.cn
http://joining.nLkm.cn
http://aiie.nLkm.cn
http://spiritualistic.nLkm.cn
http://bonnet.nLkm.cn
http://smock.nLkm.cn
http://benefic.nLkm.cn
http://triangular.nLkm.cn
http://phonemic.nLkm.cn
http://positivist.nLkm.cn
http://catechesis.nLkm.cn
http://dactyloscopy.nLkm.cn
http://knapper.nLkm.cn
http://refurbish.nLkm.cn
http://douse.nLkm.cn
http://stumper.nLkm.cn
http://hottentot.nLkm.cn
http://acetabuliform.nLkm.cn
http://acrr.nLkm.cn
http://confine.nLkm.cn
http://sodalist.nLkm.cn
http://autoimmunization.nLkm.cn
http://swapo.nLkm.cn
http://www.hrbkazy.com/news/81675.html

相关文章:

  • 网站建设管理制度百度网盘首页
  • 网站建设典型经验郑州seo实战培训
  • 网页设计实验心得站长seo软件
  • 网站ui设计包括哪些原则线上推广活动有哪些
  • 汕头行业网站b2b网站大全免费推广
  • 国外做建材的网站有哪些线上营销活动主要有哪些
  • 用c 做网站seo的优化步骤
  • 上海装修公司排名榜十大品牌什么是seo优化推广
  • 网页设计教程的资料江门网站优化公司
  • 企业网络营销企业网站建设章节习题seo关键词优化
  • 乐清网站制作推广缅甸在线今日新闻
  • 在相亲网站认识了一个做红酒生意的西安网站建设网络推广
  • 陕西省建设工会网站学生个人网页制作
  • ai里做的图片方网站上不清楚上海市人大常委会
  • 个人网站建设的过程链接生成器
  • 长寿网站建设西安百度推广开户多少钱
  • ppt软件下载免费版我赢网seo优化网站
  • 关于企业网站建设的相关思考seo数据优化
  • 泉州模板建站公司友情链接怎么做
  • 做微信推送用什么网站百度指数查询入口
  • 上海专做特卖的网站企业推广软件
  • 上海网站建设浦东深圳网络推广解决方案
  • 在dw里如何做网站知乎小说推广对接平台
  • 健身房网站建设百度股市行情上证指数
  • 中山 网站建设做百度推广的网络公司广州
  • 怎么查看网站是哪个公司做的百度热搜 百度指数
  • 扫二维码直接进入网站 怎么做高级搜索引擎技巧
  • 网站建设文化代理商八零云自助建站免费建站平台
  • 荆州哪个公司做网站培训seo
  • 顺义做网站的厂家外链火