android 系统软件 /system/app

  1. 拷贝test.apk到 /system/app/ 目录底下,并且执行chmod 777 test.apk,不然的话会安装不成功  
  2.    Android每次启动的时候会自动安装位于特定目录下的APK,这个过程会在packageManagerService这个类的构造方法中进行,这里会创建多个目录用于预查找:

[java]  view plain copy
  1. public PackageManagerService(Context context, boolean factoryTest) {  
  2.   
  3. ...  
  4.   
  5. mFrameworkDir = new File(Environment.getRootDirectory(), "framework"); // system/framework  
  6.   
  7. mSystemAppDir = new File(Environment.getRootDirectory(), "app"); // system/app  
  8.   
  9. mAppInstallDir = new File(dataDir, "app"); // data/app  
  10.   
  11. mDrmAppPrivateInstallDir = new File(dataDir, "app-private"); // data/app-private  
  12.   
  13. mAppDataDir = new File(dataDir, "data"); // data/data  
  14.   
  15. ...  
  16.   
  17. }  


它会在这5个地方寻找APK并通过Installer这个类来安装


以下转自:http://ricston.com/blog/explaining-behavior-android-application-system-apps-nonsystem-apps/

Explaining the behavior of an Android application: System apps vs Non-System apps


There exists a lot of contrariety on the web when it comes to the description of an Android System application. I will therefore explain the correct methodology here, which will hopefully enlighten you on whether you should place your Android application as a System application or not.

A System application is NOT an application which is signed by the OS’s platform signatures. This is a common mistake believed by many and we shall come to this later on. A System application is merely an application which is placed under /system/app folder in an Android device. An application can only be installed in that folder if we have access to the OS’s ROM (system.img). The application is placed under /app folder after the ROM has been extracted. A device which loads the custom ROM will have the new System application added. The benefit of a System application is that the application cannot be removed from the device (cannot be uninstalled by the user). This is only because /system/app is a read-only folder.

A non-System application is an ordinary application, which will be installed under /data/app folder, and which is read-write. A user can uninstall such applications normally from the Settings application. One can check if an application is a System application or not using “ApplicationInfo.FLAG_SYSTEM”. If the constant returns true, then the application in question is a System application.

Finally we shall explain the benefits of an application being signed by a particular ROM’s platform signatures. Certain permissions are protected under the “signatureOrSystem” protection level. Such permissions are not available to every application because they will grant risky privileges such as control over other applications, background installation and un-installation, among others. Such permissions can be utilized for malicious purposes, therefore Android will only grant them for System applications or Ordinary applications signed by platform signatures. System applications do not require signing by a platform signature to access these permissions. However, it is necessary for Ordinary applications to be signed before they can utilise these permissions.


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值