$ sudo add-apt-repository ppa:oem-solutions-engineers/oem-projects-meta
$ sudo apt install oem-somerville-tentacool-meta
$ sudo apt update
$ sudo apt full-upgrade
$ sudo systemctl poweroff
then it works
$ sudo add-apt-repository ppa:oem-solutions-engineers/oem-projects-meta
$ sudo apt install oem-somerville-tentacool-meta
$ sudo apt update
$ sudo apt full-upgrade
$ sudo systemctl poweroff
then it works
I did below key rotation on Android 13 emulator and Pixel 5 (Android 10 Emulator not work)
create 3 key store owen1.jks, owen2.jks and owen3.jks
keytool -keystore owen1.jks -genkey -alias owen1 -keyalg rsa
keytool -keystore owen2.jks -genkey -alias owen2 -keyalg rsa
keytool -keystore owen3.jks -genkey -alias owen3 -keyalg rsa
create rotation lineage file
apksigner rotate --out SigningCertificateLineage.owen1.owen2 --old-signer --ks owen1.jks --new-signer --ks owen2.jks
apksigner rotate --out SigningCertificateLineage.owen2.owen3 --old-signer --ks owen2.jks --new-signer --ks owen3.jks
sign serial.apk with each jks
apksigner sign --ks owen1.jks --in serial.apk --out serial.SignedOwen1.apk
apksigner sign --ks owen2.jks --in serial.apk --out serial.SignedOwen2.apk
apksigner sign --ks owen3.jks --in serial.apk --out serial.SignedOwen3.apk
sign serial.apk with rotation data
apksigner sign --ks owen1.jks --next-signer --ks owen2.jks --lineage SigningCertificateLineage.owen1.owen2 --in serial.apk --out serial.rotate.owen1.owen2.apk
apksigner sign --ks owen2.jks --next-signer --ks owen3.jks --lineage SigningCertificateLineage.owen2.owen3 --in serial.apk --out serial.rotate.owen2.owen3.apk
so let’s try the rotation as below steps
[0] 12/29 15:41:51 owenwen@dell:~/jks$ adb install serial.SignedOwen1.apk
Performing Incremental Install
Serving...
All files should be loaded. Notifying the device.
Success
Install command complete in 931 ms
[0] 12/29 15:42:42 owenwen@dell:~/jks$ adb install serial.rotate.owen1.owen2.apk
Performing Incremental Install
Serving...
All files should be loaded. Notifying the device.
Success
Install command complete in 629 ms
[0] 12/29 15:42:52 owenwen@dell:~/jks$ adb install serial.SignedOwen2.apk
Performing Incremental Install
Serving...
All files should be loaded. Notifying the device.
Success
Install command complete in 467 ms
[0] 12/29 15:42:59 owenwen@dell:~/jks$ adb install serial.rotate.owen2.owen3.apk
Performing Incremental Install
Serving...
All files should be loaded. Notifying the device.
Success
Install command complete in 570 ms
[0] 12/29 15:43:05 owenwen@dell:~/jks$ adb install serial.SignedOwen3.apk
Performing Incremental Install
Serving...
All files should be loaded. Notifying the device.
Success
Install command complete in 728 ms
[0] 12/29 15:43:10 owenwen@dell:~/jks$ adb install serial.SignedOwen1.apk
Performing Incremental Install
Serving...
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.sample.app signatures do not match newer version; ignoring!]
Performing Streamed Install
adb: failed to install serial.SignedOwen1.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.sample.app signatures do not match newer version; ignoring!]
[1] 12/29 15:43:14 owenwen@dell:~/jks$ adb shell getprop | grep fingerprint
[ro.bootimage.build.fingerprint]: [google/redfin/redfin:13/TQ1A.221205.011/9244662:user/release-keys]
struct dqblk dq;
dq.dqb_valid = QIF_BLIMITS | QIF_BTIME;
dq.dqb_bhardlimit = hardLimit;
dq.dqb_bsoftlimit = softLimit;
dq.dqb_btime = gracePeriod;
// get userdata file system path from /proc/mounts
std::ifstream in("/proc/mounts");
if (!in.is_open()) {
return error("Failed to read mounts");
}
std::string source;
std::string target;
std::string ignored;
while (!in.eof()) {
std::getline(in, source, ' ');
std::getline(in, target, ' ');
std::getline(in, ignored);
if (target.compare(0, 5, "/data") == 0) {
LOG(DEBUG) << "Found /data mount " << source << " at " << target;
break;
}
}
if (quotactl(QCMD(Q_SETQUOTA, USRQUOTA), source.c_str(), userId,
reinterpret_cast<char*>(&dq)) != 0) {
PLOG(ERROR) << "Failed to set quota for " << userId;
return error("setQuota failed");
} else {
LOG(DEBUG) << "setQuota for " << userId << ", softLimit: " << softLimit << ", hardLimit: "
<< hardLimit << ", gracePeriod: " << gracePeriod;
}
~/SDK/cmdline-tools/bin/sdkmanager –sdk_root=~/SDK/cmdline-tools/ ‘patcher;v4’
this command will create license file in “~" directory at the place you run the command
~/SDK/cmdline-tools/bin/sdkmanager –sdk_root=$HOME/SDK/cmdline-tools/ ‘patcher;v4’
change ~ to $HOME or using your SDK folder full path
I tried on Android 10, kernel 4.14.117
, userdata format f2fs
git clone https://git.code.sf.net/p/linuxquota/code
export NDK=~/Android/Sdk/ndk/25.1.8937393/
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
export TARGET=armv7a-linux-androideabi
export API=31
export AR=$TOOLCHAIN/bin/llvm-ar
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export AS=$CC
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip
and make some diff
$ git diff
diff --git a/edquota.c b/edquota.c
index a77106c..78e3c29 100644
--- a/edquota.c
+++ b/edquota.c
@@ -238,7 +238,7 @@ int main(int argc, char **argv)
if (getuid() == geteuid() && getgid() == getegid())
tmpdir = getenv("TMPDIR");
if (!tmpdir)
- tmpdir = _PATH_TMP;
+ tmpdir = "/data/local/tmp/";
tmpfil = smalloc(strlen(tmpdir) + strlen("/EdP.aXXXXXX") + 1);
strcpy(tmpfil, tmpdir);
strcat(tmpfil, "/EdP.aXXXXXX");
diff --git a/quotaops.c b/quotaops.c
index 96086f4..b0dc2aa 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -206,7 +206,7 @@ int editprivs(char *tmpfile)
die(1, _("%s failed: %s\n"), "setuid", strerror(errno));
if (!(ed = getenv("VISUAL")))
if (!(ed = getenv("EDITOR")))
- ed = _PATH_VI;
+ ed = "/usr/bin/vim";
i = 0;
ed = actp = sstrdup(ed);
while (actp) {
diff --git a/quotasys.c b/quotasys.c
index 3f50e32..c958a2c 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -1258,7 +1258,7 @@ static int cache_mnt_table(int flags)
if (mntf)
goto alloc;
/* Fallback to fstab when mtab not available */
- if (!(mntf = setmntent(_PATH_MNTTAB, "r"))) {
+ if (!(mntf = setmntent("/etc/fstab", "r"))) {
errstr(_("Cannot open any file with mount points.\n"));
return -1;
}
upload source and prebuilt file as below
https://drive.google.com/file/d/15VNpOfMO1FH1grdizi9uLvmi6Q-IK_vJ/view?usp=sharing
lpunpack
which means logical partition unpack
http://aospxref.com/ provide code search on AOSP 7-13
https://cs.android.com/ provide code search on latest AOSP and easily to get reference link by click
08-03 08:32:33.461 W/BroadcastQueue( 653): Background execution not allowed: receiving Intent { act=android.intent.action.BOOT_COMPLETED flg=0x400010 } to ro.pub.acs.startonboot/.StartMyActivityAtBootReceiver
Solution: specify the package name in command
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -n ro.pub.acs.startonboot/.StartMyActivityAtBootReceiver
root first, then run below command and then you can run as system with system_app context “context=u:r:system_app:s0″
runcon u:r:system_app:s0 su system
static auto mark = time(nullptr);
auto mark_str = std::string(",") + std::to_string(mark);
auto marked_system_boot_reason = system_boot_reason + mark_str;
the number after “," looks like simply from time(nullptr)
$ adb shell getprop persist.sys.boot.reason.history cold,28 cold,29 cold,27 reboot,factory_reset,1653457758