- Our Purpose
- Introduction
- Our Advantages
- Access Note
- Applying for debugging permission
- [Use maven dependency](#Use maven dependency)
- APIs
- Applying for fromal permission
- More cooperation
All for users, make users getting the best experience!
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.
- 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.
MiBridge.jar
You can import this jar.
TestMiBridge
Inclued:
mibridge: Source code of MiBridge.jar
app: Testing application code.
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?
- VAID means Vender Anonymous Device ID
- Refer http://msa-alliance.cn/col.jsp?id=120
- You can refer to the example in TestMiBridge. (Testing getVAID)
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"
...
}
Permission apis
-
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 -
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 theauthentication code
.parameters:
pkg : Package Name
uid : android.os.Process.myUid()return value:
true: Permission granted
false: Permission not granted
APIs for request system resouce
-
int requestCpuHighFreq(int uid, int level, int timeoutms)
Description: Reqeust CPU frequencyparameters:
uid : android.os.Process.myUid()
level : Expected cpu frequency level,system will set different CPU frequency according to different modelsLevel 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.5GHz3 Level 3 Set the CPU frequency to above normal
example:Xiaomi 8, Set big core at least 1.9GHz, little core at least 1.0GHzAttention:Please using Level 1 with caution。Level 1 scenarios is limited to 5,
Level 2 is limited to 20,Level 3 no limits。
timeoutms : durationreturn value:
0: Success
-1: Fail
-2: Permission not granted! -
int cancelCpuHighFreq(int uid)
Description:Cancle cpu frequency requestparameters:
uid : android.os.Process.myUid()return value:
0: Success
-1: Fail
-2: Permission not granted! -
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 : durationreturn value:
0: Success
-1: Fail
-2: Permission not granted! -
int cancelThreadPriority (int uid, int req_tid)
Description:Cancel requestparameters:
uid : android.os.Process.myUid()
req_tid : thread idreturn value:
0: Success
-1: Fail
-2: Permission not granted!
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 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.