编译调试
adb root & adb remount
- 单独编译frameworks mmm frameworks/base/services/
adb root & adb remount
adb push Z:\oywj\905\out\target\product\u202\system\framework\services.core.jar /system/framework
adb push Z:\oywj\905\out\target\product\u202\system\framework\services.jar /system/framework
adb push Z:\oywj\905\out\target\product\u202\system\framework\services.jar.prof /system/framework
adb push Z:\oywj\905\out\target\product\u202\system\framework\oat\arm\services.art /system/framework/oat/arm/
adb push Z:\oywj\905\out\target\product\u202\system\framework\oat\arm\services.core.odex /system/framework/oat/arm/
adb push Z:\oywj\905\out\target\product\u202\system\framework\oat\arm\services.core.vdex /system/framework/oat/arm/
adb push Z:\oywj\905\out\target\product\u202\system\framework\oat\arm\services.odex /system/framework/oat/arm/
adb push Z:\oywj\905\out\target\product\u202\system\framework\oat\arm\services.vdex /system/framework/oat/arm/
adb reboot
将文件push进取之后,重启生效
- 单独编译mmm frameworks/base/core/res/
adb push Z:\oywj\905\out\target\product\u202\system\framework\framework-res.apk /system/framework
- SettingsProvider 部分编译 mmma frameworks/base/packages/SettingsProvider/
adb push Z:\oywj\905\out\target\product\u202\system\priv-app\SettingsProvider /system/priv-app
恢复出厂设置来重新创建DataBaseHelper.java settings.db数据, loadSettings(db); System、Secure、Global
cat /dev/block/env Env值
cat /proc/sys/kernel/printk 7 4 1 7 //打印控制台日志等级
系统方案
- Android O 之后获取保存 Wifi 密码,解析/data/misc/wifi/WifiConfigStore.xml文件
/**
* 传入需要查询WIfi的名称(ssid), 项目是已经连接的Wifi
*/
private String readWifiPreSharedKey(String ssid){
Process process = null;
DataOutputStream dataOutputStream = null;
InputStream inputStream = null;
StringBuffer wifiConf = new StringBuffer();
try {
process = Runtime.getRuntime().exec("su");
dataOutputStream = new DataOutputStream(process.getOutputStream());
inputStream = process.getInputStream();
dataOutputStream
.writeBytes("cat /data/misc/wifi/WifiConfigStore.xml\n");
dataOutputStream.writeBytes("exit\n");
dataOutputStream.flush();
XmlPullParser xmlPullParser = Xml.newPullParser();
xmlPullParser.setInput(inputStream,"UTF-8");
int eventType = xmlPullParser.getEventType();
boolean isWifiInfo = false;
boolean isConnectWifi = false;
while(eventType != XmlPullParser.END_DOCUMENT){
switch (eventType) {
case XmlPullParser.START_DOCUMENT:
break;
case XmlPullParser.START_TAG:
String startTag = xmlPullParser.getName();
if(startTag.equals("WifiConfiguration")){
isWifiInfo = true;
break;
}
if(isWifiInfo) {
String name = xmlPullParser.getAttributeValue(null, "name");
if ("SSID".equals(name)) {
String _ssid = xmlPullParser.nextText();
if (_ssid.substring(1,_ssid.length() - 1).equals(ssid)) {
isConnectWifi = true;
break;
}
} else if (isConnectWifi && "PreSharedKey".equals(name)) {
String PreSharedKey = xmlPullParser.nextText();
return PreSharedKey.substring(1,PreSharedKey.length() - 1);
}
}
break;
case XmlPullParser.END_TAG:/**【元素结束事件】**/
String endTag = xmlPullParser.getName();
if(endTag.equals("WifiConfiguration"))
isWifiInfo = false;
break;
}
eventType = xmlPullParser.next();
}
process.waitFor();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (dataOutputStream != null) {
dataOutputStream.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
process.destroy();
}
return "";
}
静默开机方案
- Amlogic905平台 9.0
---- setDisplayInfoOverrideFromWindowManagerInternal
涉及git仓库:bootloader、common(kernel)、Customer、device、frameworks、packages
- 屏蔽Logo
bootloader/uboot-repo/bl33/board/amlogic/g12a_u202_v1/g12a_u202_v1.c
setenv("board_defined_bootup", "bootup_D3"); -> setenv("board_defined_bootup", "bootup_quiescent");
设置图片名称用静默(全黑)图片替换 device/amlogic/u202/logo_img_files/bootup_D3.bmp
bootloader/uboot-repo/bl33/common/cmd_imgread.c
[do_image_read_pic] ---- bootupOutmode[1] = picName = getenv("board_defined_bootup");
SystemControlManager.setenv
- 屏蔽开机动画
property: debug.sf.nobootanimation=1
*. 屏蔽开机动画之后屏幕唤醒
--- a/base/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/base/services/core/java/com/android/server/power/PowerManagerService.java
- mWakefulness = WAKEFULNESS_AWAKE;
-
+ mWakefulness = WAKEFULNESS_ASLEEP;
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ Slog.d(TAG, "PowerManagerService [wakeUp] delay 15s");
+ //new BinderService().wakeUp(SystemClock.uptimeMillis(), "android.policy:POWER", "android");
+ wakeUpInternal(SystemClock.uptimeMillis(), "android.policy:POWER",
+ Process.SYSTEM_UID, "android",Process.SYSTEM_UID);
+ goToSleepInternal(SystemClock.uptimeMillis(), PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON
+ , 0,Process.SYSTEM_UID);
+ }
+ },15 * 1000);
*. 屏蔽背光
1) logo 背光 在bootloader层
2) 开机动画背光
3) Android系统背光
- Hisi3751V811平台 8.
涉及仓库 packages、frameworks、Customer、bigfish、sdk
和Amlogic不同,海思并没有提供设置Boot Env的接口,不仅没有接口而且背光控制完全在Boot中(fastboot).
- 海思提供通过分区偏移地址读写接口 hi_flash.h
hFlash = HI_Flash_OpenByName(CUSTOM_DEVICE_NAME);
if(HI_INVALID_HANDLE != hFlash
{
stMtdInfo.u32Offset = CUSTOM_SLIENT_BOOT_OFFFSET;
(HI_VOID)HI_Flash_GetInfo(hFlash, &stFlashInfo);
stMtdInfo.u32Size = stFlashInfo.PartSize;
}
u32ReadLenth = stFlashInfo.PageSize > CUSTOM_DEF_DEVPARAM_SIZE ? stFlashInfo.PageSize : CUSTOM_DEF_DEVPARAM_SIZE;
if (0 == u32ReadLenth)
{
CUSTOM_LOG("ERR: u32ReadLenth, can not pass 0 to malloc\n");
return HI_FAILURE;
}
pBuf = (HI_U8 *)malloc(u32ReadLenth);
if (HI_NULL == pBuf)
{
CUSTOM_LOG("malloc buf err!");
s32Ret = HI_FAILURE;
goto FLASH_CLOSE;
}
memset(pBuf, 0x0, u32ReadLenth);
ReadLen = HI_Flash_Read(hFlash, (HI_U64)stMtdInfo.u32Offset, (HI_U8 *)pBuf, u32ReadLenth, HI_FLASH_RW_FLAG_RAW);
if(ReadLen < 0)
{
CUSTOM_LOG("ERR: HI_Flash_Read!");
s32Ret = HI_FAILURE;
goto FREE_BUF;
}
u32SlientBootStatus = ((HI_CUSTOM_DEV_PARAM_S*)pBuf)->u32PanelIndex;
FREE_BUF:
if (HI_NULL != pBuf)
{
free(pBuf);
}
FLASH_CLOSE:
HI_Flash_Close(hFlash);
RET:
return s32Ret;
- 获取值设置背光 msp/drv/panel/drv_panel_power.c kernel 层对msp做软连接
PANEL_DRV_SetPanelBlPowerTimer接口内通过获取u32SlientBootStatus判断是否为静默开机,从而屏蔽背光流程
C:Picture.cpp 开机启动时和Boot同步 enableBacklight
Java:PictureImpl.java 给Java曾的接口
屏蔽串口打印
u202:/proc/sys/kernel $ cat printk
7 4 1 7
+# -- 设置log等级 -- #
+if [[ "TYPE_LOG_LEVEL" = "CONSOLE_LOGLEVEL_MIN" || "TYPE_LOG_LEVEL" = "CONSOLE_LOGLEVEL_DEFAULT" || "TYPE_LOG_LEVEL" = "CONSOLE_LOGLEVEL_MOTORMOUTH" ]];then
- echo "$A905D3_CONSOLE_LOGLEVEL"
- sed -i 's/CONSOLE_LOGLEVEL_DEFAULT,.*/*\ console_loglevel\ *//'A905D3_CONSOLE_LOGLEVEL
+fi
uboot-repo/bl33/board/amlogic/configs/g12a_u202_v1.h
Customer
common
kernel/printk/printk.c
GoolgePlay
android.software.google_atv.xml > vendor