Android 乱七八糟的设置记录
1、添加永不休眠
frameworks/base/packages/SettingsProvider/res/values/defaults.xml
<integer name="def_screen_off_timeout">0</integer> // 默认休眠时间设为0
frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
private void updateLockScreenTimeout() {
synchronized (mScreenLockTimeout) {
boolean enable = (mAllowLockscreenWhenOn && mAwake &&
mKeyguardDelegate != null && mKeyguardDelegate.isSecure(mCurrentUserId));
if (mLockScreenTimerActive != enable) {
if (enable) {
if (localLOGV) Log.v(TAG, "setting lockscreen timer");
mHandler.removeCallbacks(mScreenLockTimeout); // remove any pending requests
if (mLockScreenTimeout != 0) { // 添加判断,时间为0则永不休眠,不为0继续执行
mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout);
}
} else {
if (localLOGV) Log.v(TAG, "clearing lockscreen timer");
mHandler.removeCallbacks(mScreenLockTimeout);
}
mLockScreenTimerActive = enable;
}
}
}
frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
private void updateUserActivitySummaryLocked(long now, int dirty) {
// Update the status of the user activity timeout timer.
if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY
| DIRTY_WAKEFULNESS | DIRTY_SETTINGS)) != 0) {
mHandler.removeMessages(MSG_USER_ACTIVITY_TIMEOUT);
long nextTimeout = 0;
if (mWakefulness == WAKEFULNESS_AWAKE
|| mWakefulness == WAKEFULNESS_DREAMING
|| mWakefulness == WAKEFULNESS_DOZING) {
......
// 如果设置时间为0,则跳过 {
if (mScreenOffTimeoutSetting != 0) { // never screenOff
if (mUserActivitySummary != 0 && nextTimeout >= 0) {
Message msg = mHandler.obtainMessage(MSG_USER_ACTIVITY_TIMEOUT);
msg.setAsynchronous(true);
mHandler.sendMessageAtTime(msg, nextTimeout);
}
} else {
mUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT;
}
// }
} else {
mUserActivitySummary = 0;
}
......
}
}
packages/apps/Settings/res/values/arrays.xml
<string-array name="screen_timeout_entries">
<!-- 设置中添加never选项 -->
<item>never</item>
<string-array name="screen_timeout_values" translatable="false">
<!-- 设置中添加nerver时间 0 -->
<item>0</item>
2、刷完bootimage WIFI无法打开
相同环境下编译 vendor/qcom/opensource/wlan/prima/ 目录下代码,生成 pronto_wlan.ko
push到机器 vendor/lib/modules/pronto/ 目录即可
3、设置persist.sys属性值
属性值以persist.sys.开头的属于持久化的,即重启后设置的值依然保存。需要系统权限,即使用系统签名并在AndroidManifest.xml 声明android:sharedUserId=“android.uid.system”
4、android 源码网站
https://www.androidos.net.cn/sourcecode
5、fastboot 常见指令
fastboot erase system 擦除分区
fastboot getvar secure 查看是否secure boot签名的
fastboot --set-active=a 设置A/B分区
6、签名及查看签名
java -jar signapk.jar testkey.x509.pem testkey.pk8 old.apk new.apk
keytool -printcert -file META-INF/CERT.RSA
7、Linux权限说明
权限说明(共十位):一些系统文件有权限限制,随意push不同步修改还原权限会导致手机无法开机,例如build.prop文件
-rw-------
1位:d:文件夹
-:文件
2-4位:当前用户权限
5-7位:当前用户所在组权限
8-10位:其他用户权限
权限都有三个二进制数字组成,代表不同的权限。
如:二进制110 —> rw- 转换为十进制为6 代表rw-可读可写
111 rwx 转换为十进制为7 代表rwx可读可写可运行
chown root:shell xxx 修改文件用户和组,仅限root用户使用
chmod 0777 xxx 修改文件权限为0777