Giter Site home page Giter Site logo

android-settings-ethernet's Introduction

Android-Settings-Ethernet

Android 9.0, Add Ethernet Options on Settings.

In Android 9.0, Default Settings is not have Ethernet Options(TV Settings have). But sometimes, we need to choose Ethernet Mode(DHCP or Static IP), and edit Static IP Address.

Architecture

  • UI
  • Framework

UI

  • Settings -> Network & internet -> Ethernet
  • Ethernet Info
  • Edit Static IP

Add Ethernet for Settings -> Network & internet -> Ethernet

在这里插入图片描述

  • xml(/packages/apps/Settings/res/xml/network_and_internet.xml)
  • icon(/packages/apps/Settings/res/drawable/ic_ethernet.xml -- new file)
  • string.xml(/packages/apps/Settings/res/values/strings.xml)

Add Ethernet Info (optional)

在这里插入图片描述

在这里插入图片描述

res

  • xml(/packages/apps/Settings/res/xml/ethernet_settings.xml -- new file)
    • Preference(IP Adress/Netmask/Gateway/DNS1/DNS2 Informantion)
    • List Preference(Show Ethernet Mode: DHCP or Static)
    • CheckBox(Ethernet Mode: DHCP or Static)
  • string.xml(/packages/apps/Settings/res/values/strings.xml)
  • array.xml(/packages/apps/Settings/res/values/arrays.xml)

Reference: Android User Guide -> User Interface -> Settings

java

  • AndroidManifest.xml(/packages/apps/Settings/AndroidManifest.xml)
  • EthernetSettings.java(new file)

Edit Static IP

在这里插入图片描述

Framework

  • /frameworks/opt/net/ethernet/java/com/android/server/ethernet/EthernetServiceImpl.java
  • /frameworks/base/core/java/android/net/EthernetManager.java
  • /frameworks/base/core/java/android/net/IEthernetManager.aidl

APP will call Framework API from EthernetManager, but this API implement in EthernetServiceImpl, and interface is IEthernetManager.aidl.

For example, when APP need change Static IP, you need write updateIPAddress() function.

EthernetManager.java

void updateIPAddress(){
  //mService is Proxy of EthernetServiceImpl
  mService.updateIPAddress(); 
}

IEthernetManager.aidl

void updateIPAddress();

EthernetServiceImpl.java

void updateIPAddress(){
  /*
  how to update
  */
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.