Time:
The company does not allow csdn before 2021/03/05, and the notes are written elsewhere. recently tidied up
1. Modify the default value in the setting in the framework
https://blog.csdn.net/deng0zhaotai/article/details/41380307
2. Enable AccessibilityService by default
//MyAccessibilityService
loadSetting(stmt,
Settings.Secure.ACCESSIBILITY_ENABLED,1);
loadSetting(stmt,
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
"com.aarogyasetu.scanner/com.aarogyasetu.scanner.MyAccessibilityService");
loadSetting(stmt,
Settings.Secure.TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
"com.aarogyasetu.scanner/com.aarogyasetu.scanner.MyAccessibilityService");
3. Activate the device manager by default
https://blog.csdn.net/zhanghao19960914/article/details/83934854
4. Sensitive permissions and default permission configuration
https://blog.csdn.net/qiangzai110110/article/details/51767485
//默认敏感权限配置
//xml配置
/system/etc/permissions/aaa.xml
//代码部分
frameworks/base/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
private static final ArrayList<String> scannerPermissionList = new ArrayList();
static {
scannerPermissionList.add("android.permission.CAMERA");
}
restorePermissionState()中
//add start
if("com.aarogyasetu.scanner".equals(pkg.packageName)){
if(scannerPermissionList.contains(perm)){
grant = GRANT_INSTALL;
}
}
//add end
if (grant != GRANT_DENIED) {
if (!ps.isSystem() && ps.areInstallPermissionsFixed() && !bp.isRuntime()) {
// If this is an existing, non-system package, then
// we can't add any new permissions to it. Runtime
// permissions can be added any time - they ad dynamic.
if (!allowedSig && !origPermissions.hasInstallPermission(perm)) {
// Except... if this is a permission that was added
// to the platform (note: need to only do this when
// updating the platform).
if (!isNewPlatformPermissionForPackage(perm, pkg)) {
grant = GRANT_DENIED;
}
}
}
//省电模式策略 允许应用始终运行在后台默认配置权限
<allow-in-power-save package="com.aarogyasetu.scanner" />
5. Double-click to turn off the screen
https://blog.csdn.net/dreamfly130/article/details/82759750
//PowerManager需要系统应用权限
PowerManager.goToSleep(SystemClock.uptimeMillis());
6. CPU status policy
https://blog.csdn.net/su749520/article/details/79026493
https://blog.csdn.net/wejfoasdbsdg/article/details/50765409
7. Taskview startup application fuzzy problem
When the application is hot-started, the application interface of the go version is blurred and then becomes clear (obviously)
When Google solves the problem of hot-starting applications, for the sake of user experience, it first loads a snapshot (a picture with the same content as when exiting the application) to cover the startup process of the application to ensure the flow of application loading. The reason for this phenomenon is that Google designed the
snapshot In addition to compression, the size of the snapshot is lower than the resolution of the application, resulting in a change in clarity from the snapshot to the real interface of the application.
This function is defined in:frameworks/base/services/core/java/com/android/server/wm/TaskSnapshotPersister.java
如果想要修改,请修改TaskSnapshotPersister.java中如下变量:
图片的压缩参数
private static final float REDUCED_SCALE = .5f;
private static final float LOW_RAM_REDUCED_SCALE = .6f;
private static final float LOW_RAM_RECENTS_REDUCED_SCALE = .1f;
可以将上述值都修改为1f
修改可能导致打开应用时,内存的消耗变多
图片保存到本地的压缩质量:
private static final int QUALITY = 95
可以将其修改为
private static final int QUALITY = 100,
但是修改该值可能导致储存空间使用变多
还请评估下是否修改
8. Spreadtrum platform android11 unlocks the debugging code by default
--- a/idh.code/bsp/bootloader/u-boot15/lib/secureboot/common/sec_common.c
+++ b/idh.code/bsp/bootloader/u-boot15/lib/secureboot/common/sec_common.c
@@ -1324,12 +1324,17 @@ unsigned int get_lock_status(void)
ret = sprd_sec_verify_lockstatus(lock_flag, PDT_INFO_LOCK_FLAG_MAX_SIZE);
- if(ret != 0) {
- g_DeviceStatus = VBOOT_STATUS_LOCK; /*default lock status.*/
- }
- else {
- g_DeviceStatus = VBOOT_STATUS_UNLOCK; /*unlock status.*/
- }
+
+ if(ret != 0) {
+#ifdef DEBUG
+ g_DeviceStatus = VBOOT_STATUS_UNLOCK; /*default lock status.*/
+#else
+ g_DeviceStatus = VBOOT_STATUS_LOCK; /*default lock status.*/
+#endif
+ }
+ else {
+ g_DeviceStatus = VBOOT_STATUS_UNLOCK; /*unlock status.*/
+ }
return g_DeviceStatus;
}
9. The built-in application can be uninstalled
9.1. mtk is built-in as a system application
include $(CLEAR_VARS)
LOCAL_MODULE := facebook
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := Facebook/system/app/facebook/facebook-stub.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_DEX_PREOPT := true
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
vendor/mediatek/proprietary/frameworks/base/data/etc/pms_sysapp_removable_system_list.txt
plus application package name
com.android.quicksearchbox
com.facebook.katana
9.2. The Spreadtrum platform already supports the preloadapp directory, which can be directly prefabricated
include $(CLEAR_VARS)
LOCAL_MODULE := facebook
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := Facebook/base.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_DEX_PREOPT := false
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_MODULE_PATH := $(TARGET_OUT)/preloadapp
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
frameworks/base/core/java/android/content/pm/PackageManager.java中isPreloadOrVitalApp核校:
10. Built-in three-party application crash
https://blog.csdn.net/u014316462/article/details/76634235/
Log:avc: denied
013F5 <5> [ 2003.716115][02-24 14:14:43.716] audit: type=1400 audit(1614154484.751:727): avc: denied {
open } for pid=15722 comm="m.facebook.lite" path="/data/app-lib/Lite/libsuperpack-jni.so" dev="mmcblk0p41" ino=478 scontext=u:r:untrusted_app:s0:c143,c256,c512,c768 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=0
根据log添加对应权限
device/sprd/sharkl3/common/sepolicy/untrusted_app.te中
allow untrusted_app system_data_file:file {
open execute };