锁定安兔兔安装版本的逻辑就是在系统安装apk的时候,进行一个包名过滤,符合我要的包名的话,就会执行安装我给定路径的apk,逻辑就是这样,也可以锁定其他apk版本,具体实现如下: 首先是先拷贝进去一个apk
diff --git a/device/mediatek/system/common/apk/antutu-benchmark-v9.apk b/device/mediatek/system/common/apk/antutu-benchmark-v9.apk
new file mode 100755
index 00000000000..9ccfd3fe76c
Binary files /dev/null and b/device/mediatek/system/common/apk/antutu-benchmark-v9.apk differ
diff --git a/device/mediatek/system/common/device.mk b/device/mediatek/system/common/device.mk
index 5ffd2bcf3be..25b9e465783 100755
--- a/alps_mssi/device/mediatek/system/common/device.mk
+++ b/alps_mssi/device/mediatek/system/common/device.mk
@@ -4225,4 +4225,7 @@ PRODUCT_PACKAGES += QuarkBrowser
#PRODUCT_PACKAGES += YanXuan
#PRODUCT_PACKAGES += lazy_xxmk
PRODUCT_PACKAGES += android_11_lazyte
-PRODUCT_PACKAGES += lazytec_aizhijian
\ No newline at end of file
+PRODUCT_PACKAGES += lazytec_aizhijian
+# copy apk
+$(shell mkdir -p out_sys/target/product/mssi_t_64_cn/system/media/apk)
+$(shell cp device/mediatek/system/common/apk/antutu-benchmark-v9.apk out_sys/target/product/mssi_t_64_cn/system/media/apk)
\ No newline at end of file
后面就是实现上面说的那个逻辑了:
diff --git a/frameworks/base/services/core/java/com/android/server/pm/InstallParams.java b/frameworks/base/services/core/java/com/android/server/pm/InstallParams.java
old mode 100644
new mode 100755
index 67c26a003cf..be6a6b37e63
--- a/frameworks/base/services/core/java/com/android/server/pm/InstallParams.java
+++ b/frameworks/base/services/core/java/com/android/server/pm/InstallParams.java
@@ -52,9 +52,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import android.util.Log;
final class InstallParams extends HandlerParams {
- final OriginInfo mOriginInfo;
+ //final OriginInfo mOriginInfo;
+ OriginInfo mOriginInfo;
+ VerificationInfo mVerificationInfo;
final MoveInfo mMoveInfo;
final IPackageInstallObserver2 mObserver;
int mInstallFlags;
@@ -220,6 +223,14 @@ final class InstallParams extends HandlerParams {
if (DEBUG_INSTANT && ephemeral) {
Slog.v(TAG, "pkgLite for install: " + pkgLite);
}
+ if (pkgLite != null && pkgLite.packageName != null) {
+ Log.d("swl","install antutu");
+ if (pkgLite.packageName.contains("com.antutu.ABenchMark")) {
+ File originFile = new File("/system/media/apk/antutu-benchmark-v9.apk");
+ mOriginInfo = OriginInfo.fromExistingFile(originFile);
+ mVerificationInfo = null;
+ }
+ }
if (!mOriginInfo.mStaged && pkgLite.recommendedInstallLocation
== InstallLocationUtils.RECOMMEND_FAILED_INSUFFICIENT_STORAGE) {
这个方法我也是参考CSDN上写的一篇关于安卓十一锁定apk版本的博客,说白了我这也是cv了一下(cv工程师),链接:http://t.csdnimg.cn/q5abO,有兴趣的可以看一下,下面是如何让设备在5度的时候有一个温度过高的弹窗,60度关机,-5度弹窗,-10度关机,这个是在驱动层改的(傻逼公司让我们做应用的也搞一点驱动的东西,还不加钱),因为我做这个关机的项目是安卓十一(上面的是安卓十三),所以我用的是kernel-4.14,安卓十三用的是kernel-4.19或者是kernel-5.10,方法如下:
diff --git a/kernel-4.14/arch/arm64/boot/dts/mediatek/mt6739.dts b/kernel-4.14/arch/arm64/boot/dts/mediatek/mt6739.dts
index aa02a7b511a..39708a7c210 100755
--- a/kernel-4.14/arch/arm64/boot/dts/mediatek/mt6739.dts
+++ b/kernel-4.14/arch/arm64/boot/dts/mediatek/mt6739.dts
@@ -2332,10 +2332,10 @@ firmware_class.path=/vendor/firmware loop.max_part=7";
/* battery temperature protection */
enable_min_charge_temp;
- min_charge_temp = <0>;
- min_charge_temp_plus_x_degree = <6>;
- max_charge_temp = <50>;
- max_charge_temp_minus_x_degree = <47>;
+ min_charge_temp = <5>;
+ min_charge_temp_plus_x_degree = <0>;
+ max_charge_temp = <55>;
+ max_charge_temp_minus_x_degree = <50>;
/* PE 2.0 */
pe20_ichg_level_threshold = <1000000>; /* uA */
diff --git a/kernel-4.14/drivers/power/supply/mediatek/battery/mtk_power_misc.c b/kernel-4.14/drivers/power/supply/mediatek/battery/mtk_power_misc.c
index 7af23b80ff6..c9a0fe469af 100644
--- a/kernel-4.14/drivers/power/supply/mediatek/battery/mtk_power_misc.c
+++ b/kernel-4.14/drivers/power/supply/mediatek/battery/mtk_power_misc.c
@@ -539,7 +539,7 @@ int mtk_power_misc_psy_event(
psy, POWER_SUPPLY_PROP_TEMP, &val);
if (!ret) {
tmp = val.intval / 10;
- if (tmp >= BATTERY_SHUTDOWN_TEMPERATURE) {
+ if (tmp >= BATTERY_SHUTDOWN_TEMPERATURE||tmp<=-10) {
bm_err(
"battery temperature >= %d,shutdown",
tmp);
diff --git a/kernel-4.14/drivers/power/supply/mediatek/charger/mtk_charger.c b/kernel-4.14/drivers/power/supply/mediatek/charger/mtk_charger.c
index ba5af3f5f00..f6df66aef2c 100644
--- a/kernel-4.14/drivers/power/supply/mediatek/charger/mtk_charger.c
+++ b/kernel-4.14/drivers/power/supply/mediatek/charger/mtk_charger.c
@@ -1425,7 +1425,7 @@ static void mtk_battery_notify_VBatTemp_check(struct charger_manager *info)
}
} else {
#ifdef BAT_LOW_TEMP_PROTECT_ENABLE
- if (info->battery_temp < info->thermal.min_charge_temp) {
+ if (info->battery_temp < (-info->thermal.min_charge_temp)) {
info->notify_code |= CHG_BAT_LT_STATUS;
chr_err("bat_temp(%d) out of range(too low)\n",
info->battery_temp);
@@ -1617,7 +1617,7 @@ static void charger_check_status(struct charger_manager *info)
} else {
if (thermal->enable_min_charge_temp) {
- if (temperature < thermal->min_charge_temp) {
+ if (temperature < (-thermal->min_charge_temp)) {
chr_err("Battery Under Temperature or NTC fail %d %d\n",
temperature, thermal->min_charge_temp);
thermal->sm = BAT_TEMP_LOW;
diff --git a/kernel-4.14/drivers/power/supply/mediatek/charger/mtk_charger_init.h b/kernel-4.14/drivers/power/supply/mediatek/charger/mtk_charger_init.h
index d0bd797a5c2..3abce13b189 100644
--- a/kernel-4.14/drivers/power/supply/mediatek/charger/mtk_charger_init.h
+++ b/kernel-4.14/drivers/power/supply/mediatek/charger/mtk_charger_init.h
@@ -100,7 +100,7 @@
/* battery warning */
#define BATTERY_NOTIFY_CASE_0001_VCHARGER
#define BATTERY_NOTIFY_CASE_0002_VBATTEMP
-
+#define BAT_LOW_TEMP_PROTECT_ENABLE
/* pe4 */
#define PE40_MAX_VBUS 11000
#define PE40_MAX_IBUS 3000
我公司做的是MTK平台的机器,这个温度弹窗、关机什么的MTK是已经写好了(低温的没有,高温的有),只需要改一下就可以了,不过低温的那个宏(#define BAT_LOW_TEMP_PROTECT_ENABLE)是一定要加的,不然低温是不会关机的,高温的就是改那个mt6739.dts就可以了,最近这一个多月都在搞一个项目的GMS,客户需求做的很少,也没时间写笔记,后面有时间写一篇解决GMS一些fail项方法的文章,这个解谷歌GMS的fail项的文章网上写的很少,可能现在我们国家对出口安卓产品的数量不多或者那些大佬对于这些方法都是偷着藏着的,哈哈哈