Giter Club home page Giter Club logo

mibridge's Introduction

MiBridge
MiSpeed

Powerful yet simple to use .

GNU/Linux Build Status Windows Build Status MacOS Build Status Nightly Build

MiSpeed

Other language versions

简体中文

Index

Our Purpose

All for users, make users getting the best experience!

Introduction

Xiaomi Application Accelerator (MiSpeed) provides developers with the interface to apply for system resources,
which can improve the performance of developers in key application scenarios and enhance the user experience.

Our Advantages

  • Lightweight Access
    Accessing through JAR file, the size is only a few KB, which will not burden developers' applications.
  • Fast System Communication
    Communicate with the system layer directly through binder, request system resources, fast and efficient.
  • Scenario Customization
    Provide different levels of system resources in different scenarios.

Access Note

MiBridge.jar
  You can import this jar.
TestMiBridge
  Inclued:
  mibridge: Source code of MiBridge.jar
  app: Testing application code.

Applying for debugging permission

Please provide the following information and send it to [email protected] to apply for debugging permission.
Subject:xx Company,Applying for MiSpeed debugging permission。

PackageName CompanyName Requestor Device model MIUI version VAID num
com.mi.testmibridge Xx Tony Redmi K20 Pro MIUI 11 20.3.5 Beta ec8ec830b8e8031c

We will reply you with an authentication code for debugging.

Note: What is VAID, how to get it?

  1. VAID means Vender Anonymous Device ID
  2. Refer http://msa-alliance.cn/col.jsp?id=120
  3. You can refer to the example in TestMiBridge. (Testing getVAID)

Support Devices

Use maven dependency

1.Configure the Maven repository address of Xiaomi App Accelerator

Open the Android Studio project-level "build.gradle" file. Configure the Maven repository address of Xiaomi App Accelerator in "allprojects > repositories".

allprojects {
 repositories {
        ...
  //增加小米应用加速器的Maven仓库地址
  maven {
    url "https://repos.xiaomi.com/maven"
    credentials {
      username 'mi-bridge'
      password 'AKCp8nH4XbDQshne9w5PgaLroZ7kozqtAPo6Kw6pfZLBWzPEtAJoFzU73RHryxXkmcL5biUL2'
      }
    }
  }
}

2. Add compilation dependencies

Open the app-level "build.gradle" file.

dependencies {
    ...
    //1.0.xx is the version number of mibridge. Subsequent upgrades should also modify the corresponding version number.
    implementation "com.xiaomi.mibridge:mibridge:1.0.18"
    ...
}

APIs

Permission apis

  1. boolean checkDebugPermission(Context context, String pkg, int uid, String auth_key)
    Description:Check whether the application has debugging permission.

    parameters:
    context : application context
    pkg : Package Name
    uid : android.os.Process.myUid()
    auth_key : authentication code

    return value:
    true : Permission granted
    false : Permission not granted

  2. boolean checkPermission(String pkg, int uid)
    Description:Check whether the application has formal permission,please refer 3.Applying for fromal permission
    After obtaining the formal permission, use this interface to check the permission without using the authentication code.

    parameters:
    pkg : Package Name
    uid : android.os.Process.myUid()

    return value:
    true: Permission granted
    false: Permission not granted

APIs for request system resouce

  1. int requestCpuHighFreq(int uid, int level, int timeoutms)
    Description: Reqeust CPU frequency

    parameters:
    uid : android.os.Process.myUid()
    level : Expected cpu frequency level,system will set different CPU frequency according to different models

    Level Explanation (take Xiaomi 8 as an example)
    1 Level 1 Set the CPU frequency to MAX
    2 Level 2 Set the CPU frequency to higher
    example:Xiaomi 8, Set big core at least 2.2GHz, little core at least 1.5GHz
    3 Level 3 Set the CPU frequency to above normal
    example:Xiaomi 8, Set big core at least 1.9GHz, little core at least 1.0GHz

    Attention:Please using Level 1 with caution。Level 1 scenarios is limited to 5,
    Level 2 is limited to 20,Level 3 no limits。
    timeoutms : duration

    return value:
    0: Success
    -1: Fail
    -2: Permission not granted!

  2. int cancelCpuHighFreq(int uid)
    Description:Cancle cpu frequency request

    parameters:
    uid : android.os.Process.myUid()

    return value:
    0: Success
    -1: Fail
    -2: Permission not granted!

  3. int requestThreadPriority(int uid, int req_tid, int timeoutms)
    Description:Request thread for higher priority, running in big core.

    parameters:
    uid : android.os.Process.myUid()
    req_tid : thread id
    timeoutms : duration

    return value:
    0: Success
    -1: Fail
    -2: Permission not granted!

  4. int cancelThreadPriority (int uid, int req_tid)
    Description:Cancel request

    parameters:
    uid : android.os.Process.myUid()
    req_tid : thread id

    return value:
    0: Success
    -1: Fail
    -2: Permission not granted!

Applying for fromal permission

Please provide the following information and send it to [email protected] to apply for formal permission.
Subject:xx Company,Applying for MiSpeed formal permission。
Note:To apply for formal permission,relevant business agreements need to be signed.
1. APIs using scenarios

Scenarios Cpu level Thread priority Timeout (ms)
Open xx activity 1 0 100
Scroll in xx activity 2 0 1000
Scenario 3 3 1 500
Scenario4 1 0 100
Scenario 5 0 1 2000

2. Performance Test

Scenarios Detail test Before After Diff
Open xx activity the duration of open activity 100 ms 80 ms 20%
Scroll drop frames 10% 6% 40%
Scenario 3 Test 3 .. .. ..

Note:We will also do performance test according to the scenarios provided by you.

3. Power consumption test

Scenarios Before After Diff
Scenario 1 1000 mA 1050 mA 50
Scenario 2 .. .. ..

Note:We will also do power consumption test according to the scenarios provided by you.

More cooperation

More APIs will be supported in the future
requestGpuHighFreq,requestIOHighFreq,requestMemory,requestNetwork and so on.

Other supports that can be provided in the future
Provide more support for your application (e.g. memory leak detection), improve the performance of the application, and improve the user satisfaction.

mibridge's People

Contributors

changwangwu-xiaomi avatar guyunjian-xiaomi avatar mi-code avatar zh0903 avatar ziqiangge-xiaomi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mibridge's Issues

关于 requestCpuHighFreq 函数的疑问

对于直播类的APP来说, 对于直播间秒开可能有很大的帮助.对于该函数的调用, 有如下2个问题.

  1. 直播间如果连续有人送全屏礼物, 如果int timeoutms参数设置时间很短的话, 可能要连续不断调用该函数. 连续调用 int requestCpuHighFreq(int uid, int level, int timeoutms)该函数, 系统会有调用频率的限制吗?

  2. 一次调用过程中int timeoutms参数可以设置很长时间吗? 比如20分钟.

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.