Categories
Android

Android apk forward lock

forward lock 干啥用?Android market有用到,开发者上传apk时候,可以设置。官方文档也说明了

http://developer.android.com/guide/appendix/market-filters.html

Forward-Locked Applications

To forward lock an application, set copy protection to “On” when you upload the application to Market. Market will not show copy-protected applications on developer devices or unreleased devices.

查看源代码,frameworks/base/core/java/android/content/pm/PackageManager.java 注释说明:

标识本应用属于受限应用,应用将会被安装到保护目录,只有该应用可以访问代码段和不属于resource的asset资源。

那么安装这样的一个 apk,需要设置 FORWARD LOCK 标志位。

1758     public abstract void installPackage(
1759             Uri packageURI, IPackageInstallObserver observer, int flags,
1760             String installerPackageName);

Android 1.5, PackageManager.FORWARD_LOCK_PACKAGE = 0x00000001;

Android 2.2 改成了 INSTALL_FORWARD_LOCK

If you enjoyed this post, make sure you subscribe to my RSS feed!

Leave a Reply

Your email address will not be published. Required fields are marked *