1.在AIDL中添加自定义的系统接口
frameworks/base/core/JAVA/Android/App/IActivityManager.aidl
如:void setDeviceName(String name);
2.在Manager中添加对外的API接口
frameworks/base/core/java/android/app/ActivityManager.java
如:
public void setDeviceName(@Nullable String name){
try{
getService().setDeviceName(name);
} catch (Exception e) {
Log.d(TAG,"e.getMessaage()= "+e.getMessage());
}
}
3.在Service中实现自定义接口的功能
frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
如:
public void setDeviceName(String name){
//功能的实现
}
4.更新系统API接口
frameworks/base/api/current.txt
+ method public void setDeviceName(@Nullable String);
frameworks/base/non-updatable-api/current.txt
+ method public void setDeviceName(@Nullable String);