修改步骤与Android11是差不多的,只是有部分代码所在位置不一样。
Android 11®内置APP到data/app
Android 8(O)预置APP到data/app
默认内置应用到data会出错
1970-01-01 08:03:54.499 1177-1177/system_process I/PackageManager: /data/app/xx changed; collecting certs
1970-01-01 08:03:54.547 1177-1177/system_process W/PackageManager: Failed to scan /data/app/xx: Application package com.benew.ntt.cloud not found; ignoring.
1970-01-01 08:03:54.547 1177-1177/system_process W/PackageManager: Deleting invalid package at /data/app/xx
userdata.img只有几十k的问题
往data中加了几百M大小的app,在out/xx/data/app中也看到编译出来了,
但是编译后却发现userdata.img只有90k,是空的分区,
在.mk中修改userdata分区大小,.mk里面默认是64M, 改成512M解决了。
patch
diff --git a/device/sprd/mpool/module/generic/partition/main.mk b/device/sprd/mpool/module/generic/partition/main.mk
index 37b0b79d0e9..d2f2322d6b3 100755
--- a/device/sprd/mpool/module/generic/partition/main.mk
+++ b/device/sprd/mpool/module/generic/partition/main.mk
@@ -25,8 +25,8 @@ endif
$(call md-set, BOARD_BOOTIMAGE_PARTITION_SIZE, 67108864)
$(call md-set, BOARD_CACHEIMAGE_PARTITION_SIZE, 67108864)
-# default value is 64M, using resize to adapter real size
-BOARD_USERDATAIMAGE_PARTITION_SIZE ?= 67108864
+# default value is 512M, using resize to adapter real size
+BOARD_USERDATAIMAGE_PARTITION_SIZE ?= 536870912
实现
Android11中修改的是
frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
Android 13不同,需要修改
frameworks/base/services/core/java/com/android/server/pm/InstallPackageHelper.java
注释掉
else {
throw new PackageManagerException(INSTALL_FAILED_INVALID_INSTALL_LOCATION,
"Application package " + pkg.getPackageName()
+ " not found; ignoring.");
}
完整代码如下
java
if ((scanFlags & SCAN_REQUIRE_KNOWN) != 0) {
if (mPm.isExpectingBetter(pkg.getPackageName())) {
Slog.w(TAG, "Relax SCAN_REQUIRE_KNOWN requirement for package "
+ pkg.getPackageName());
} else {
PackageSetting known = mPm.mSettings.getPackageLPr(pkg.getPackageName());
if (known != null) {
if (DEBUG_PACKAGE_SCANNING) {
Log.d(TAG, "Examining " + pkg.getPath()
+ " and requiring known path " + known.getPathString());
}
if (!pkg.getPath().equals(known.getPathString())) {
throw new PackageManagerException(INSTALL_FAILED_PACKAGE_CHANGED,
"Application package " + pkg.getPackageName()
+ " found at " + pkg.getPath()
+ " but expected at " + known.getPathString()
+ "; ignoring.");
}
} /*else {
throw new PackageManagerException(INSTALL_FAILED_INVALID_INSTALL_LOCATION,
"Application package " + pkg.getPackageName()
+ " not found; ignoring.");
}*/
}
}
patch
diff --git a/system/core/init/util.cpp b/system/core/init/util.cpp
index d1e518b5795..bee7a8bb70d 100644
--- a/system/core/init/util.cpp
+++ b/system/core/init/util.cpp
@@ -485,7 +485,7 @@ static FscryptAction FscryptInferAction(const std::string& dir) {
std::vector<std::string> directories_to_exclude = {
"lost+found", "system_ce", "system_de", "misc_ce", "misc_de",
"vendor_ce", "vendor_de", "media", "data", "user",
- "user_de", "apex", "preloads", "app-staging", "gsi",
+ "user_de", "apex", "preloads", "app-staging", "gsi", "app",
};
for (const auto& d : directories_to_exclude) {
if ((prefix + d) == dir) {
diff --git a/system/core/rootdir/init.rc b/system/core/rootdir/init.rc
index 405667cf8df..1a8bc1215eb 100644
--- a/system/core/rootdir/init.rc
+++ b/system/core/rootdir/init.rc
@@ -853,7 +853,7 @@ on post-fs-data
mkdir /data/app-ephemeral 0771 system system encryption=Require
mkdir /data/app-asec 0700 root root encryption=Require
mkdir /data/app-lib 0771 system system encryption=Require
- mkdir /data/app 0771 system system encryption=Require
+ mkdir /data/app 0771 system system encryption=None
mkdir /data/property 0700 root root encryption=Require
# create directory for updated font files.
作者:帅得不敢出门 原创文件谢绝转载收录