当前位置: 首页 > news >正文

Android S - 恢复部分应用安装

使用展锐提供的代码编译出来的固件,不包含DeskClock等应用。

之前也遇到过这个情况,只是时间太久忘记了,在这里再次记录!

frameworks/native/data/etc/android.app.remove.xml<?xml version="1.0" encoding="utf-8"?><permissions><customized-restricted-app config="persist.remove.app"  value="1"><!-- <path name="Messages"/><path name="messaging"/><path name="MessagesGo"/> --><path name="FMRadio"/><path name="SprdFMRadio"/><path name="DreamFMRadioPrebuilt"/><path name="DreamSoundRecorderPrebuilt"/><path name="Email2"/><path name="GMailGo"/><path name="GMailGo_1G"/><path name="Gmail2"/><path name="Gmail2_2G"/><path name="DeskClock"/>  需要去掉<path name="SprdDeskClock"/><path name="DeskClockGoogle"/><path name="SprdCalendar"/><path name="SprdCalendarProvider"/><path name="SprdCalendarProviderPrebuilt"/><path name="Calendar"/><path name="CalendarGoogle"/></customized-restricted-app>
</permissions>

然后记录一下原因。

首先日志检索  DeskClock 发现只有这么三行,很好定位到源码。

18:11:19.933 SystemConfig              D  readCustomizedRestrictedPathsByConfig DeskClock, apkType = 0
18:11:19.934 SystemConfig              D  readCustomizedRestrictedPathsByConfig SprdDeskClock, apkType = 0
18:11:19.935 SystemConfig              D  readCustomizedRestrictedPathsByConfig DeskClockGoogle, apkType = 0
 

         从xml文件中读取权限651     private void readPermissionsFromXml(File permFile, int permissionFlag) {652         FileReader permReader = null;653         try {654             permReader = new FileReader(permFile);655         } catch (FileNotFoundException e) {656             Slog.w(TAG, "Couldn't find or open permissions file " + permFile);657             return;658         }659         Slog.i(TAG, "Reading permissions from " + permFile);660 661         final boolean lowRam = ActivityManager.isLowRamDeviceStatic();662 663         try {664             XmlPullParser parser = Xml.newPullParser();665             parser.setInput(permReader);666 667             int type;668             while ((type=parser.next()) != parser.START_TAG669                        && type != parser.END_DOCUMENT) {670                 ;671             }682             final boolean allowAll = permissionFlag == ALLOW_ALL;686             final boolean allowAppConfigs = (permissionFlag & ALLOW_APP_CONFIGS) != 0;687             final boolean allowPrivappPermissions = (permissionFlag & ALLOW_PRIVAPP_PERMISSIONS)688                     != 0;689             final boolean allowOemPermissions = (permissionFlag & ALLOW_OEM_PERMISSIONS) != 0;690             final boolean allowApiWhitelisting = (permissionFlag & ALLOW_HIDDENAPI_WHITELISTING)698             while (true) {699                 XmlUtils.nextElement(parser);700                 if (parser.getEventType() == XmlPullParser.END_DOCUMENT) {701                     break;702                 }703 704                 String name = parser.getName();705                 if (name == null) {706                     XmlUtils.skipCurrentTag(parser);707                     continue;708                 }709                 switch (name) {
...可以看出customized-restricted-app就是获取xml文件中的name
1277                     case "customized-restricted-app": {
1278                         String config = parser.getAttributeValue(null, "config");
1279                         String value = parser.getAttributeValue(null, "value");
1280                         if (TextUtils.isEmpty(config) || TextUtils.isEmpty(value)) {
1281                             Slog.w(TAG, "Tag config" + config + " or value " + value + " in "
1282                                 + permFile + " at " + parser.getPositionDescription() + " is empty");
1283                             XmlUtils.skipCurrentTag(parser);
1284                         }
1285                         List<String> restrictedPermission = Arrays.asList(config, value);
1286                         mCustomizedRestrictedPaths.put(restrictedPermission,
1287                                 readCustomizedRestrictedPathsByConfig(parser));
1288 
1289                     } break;读取限制的xml文件
1676     private HashMap<String, Integer> readCustomizedRestrictedPathsByConfig(XmlPullParser parser)
1677             throws IOException, XmlPullParserException {
1678         HashMap<String, Integer> customizedRestrictedPaths = new HashMap<String, Integer>();
1679         int packageDepth = parser.getDepth();
1680         int type;
1681         int depth = parser.getDepth();
1682         while (XmlUtils.nextElementWithin(parser, depth)) {
1683             String tagName = parser.getName();
1684             if (tagName.equals("path")) {
1685                 String name = parser.getAttributeValue(null, "name");
1686                 Integer apkType = 0;
1687                 try {
1688                     apkType = Integer.valueOf(parser.getAttributeValue(null, "type"));
1689                 } catch (NumberFormatException e) {
1690                 }日志在这里打印
1691                 Slog.d(TAG, "readCustomizedRestrictedPathsByConfig " + name +
1692                         ", apkType = " + apkType);
1693                 customizedRestrictedPaths.put(name, apkType);
1694             } else {
1695                 Slog.w(TAG, "Unknown element under <customized-restricted-app>: "
1696                       + parser.getName());
1697             }
1698         }
1699         return customizedRestrictedPaths;
1700     }

然后检索一下 customized-restricted-app

来看一下定义

device/sprd/xxx/xxx/module/app/md.mk#add for not install unused app
PRODUCT_PRODUCT_PROPERTIES += persist.remove.app=1
PRODUCT_COPY_FILES += \frameworks/native/data/etc/android.app.remove.xml:product/etc/permissions/android.app.remove.xml


 

相关文章:

  • 使用Gitlab CI/CD结合docker容器实现自动化部署
  • javascript入门
  • RT-Thread Studio 配置使用详细教程
  • Spring Cloud Gateway 介绍
  • 金蝶K3 ERP 跨网段访问服务器卡顿问题排查和解决方法
  • 用户态与内核态是什么?有什么作用?两者在什么时候切换?为什么要切换?
  • word用endnote插入国标参考文献
  • 【C++】多重继承与虚继承
  • IDEA2025(2025.1.1)都更新了什么???
  • DevSecOps实践:用Terraform策略检查筑牢基础设施安全防线
  • 蓝桥杯20112 不同的总分值
  • 金属切削机床制造企业如何破局?探索项目管理数字化转型
  • Redis:渐进式遍历
  • vue3 数据过滤方法
  • Linux笔记之Ubuntu22.04安装 fcitx5 输入法
  • 观点 | 科技企业到了品牌建设的历史性窗口期
  • PRIMES“中国校准实验室”正式运营,携手东隆科技共筑精准测量新标准
  • ROS2 工作空间中, CMakeLists.txt, setup.py和 package.xml的作用分别是?
  • [免费]微信小程序音乐播放器(爬取网易云音乐数据)(node.js后端)【论文+源码】
  • 智能眼镜销量暴涨 800%,科技革新引发消费热潮
  • 做网站自己买服务器好还是用别人的/怎么做网站
  • wordpress cgi漏洞/百度seo还有前景吗
  • 营销型的网站要多少钱/群推广
  • 越秀区做网站/宁波seo外包平台
  • 合肥市建设工程市场信息价网站/淘宝的关键词排名怎么查
  • 广扬建设集团网站/中国seo关键词优化工具