在 Android TV 5.1.1 上的 /system/priv-app 中安装困难

difficulties installing in /system/priv-app on Android TV 5.1.1

我已将我的应用程序复制到 /system/priv-app/ 并重新启动系统。该应用程序不再出现在已下载的应用程序下,而是现在出现在系统应用程序下。但是,只有当我不删除 /data/app/ 下应用程序的原始副本时才会发生这种情况。如果我确实删除了 /data/app/ 下的原始副本并重新启动,该应用程序根本不会出现在任何地方,即使在 /system/priv-app/ 下有它的副本也是如此。此外,我使用 getPackageManager().getApplicationInfo(getPackageName(), 0).sourceDir 验证了当应用程序执行 运行(如果我在 /data/app/ 中仍有副本)时,它是 运行ning 从非特权目录,即使我从系统应用程序下启动它。

我的权限和所有权与 /system/priv-app/ 目录中的所有其他应用程序一致: drwxr-xr-x根根

我发现了一些相关的 Whosebug 问题,其中据说有时需要在复制到 /system/priv-app/ 后对 APK 进行 运行 chcon。我的系统发出错误消息 "Could not label [my path] with u:object_r:app_data_file:s0: Operation not supported on transport endpoint"。我发现一些文档说,"You are limited to changing the context of files whose partition is formatted with the ext4 file system. Any attempt to change the context of a file on another system results in the [error message I got]." 所以显然 chcon 不是我的解决方案。

如有任何提示可让我的应用程序显示在 /system/priv-app/ 目录中的系统应用程序和 运行 下,我将不胜感激。

谢谢!

编辑添加:我还使用已用于关键系统应用程序的系统密钥对我的 APK 进行了签名。这也没有效果。

事实证明,我需要先使用 Android 程序包管理器 从其原始位置卸载程序包,然后系统才能选择该应用程序安装。以前,我只是在命令行上将其从原始位置删除。这次,我将文件从 /data/app/ 复制到 /system/priv-app/,运行 pm uninstall [my package name],然后重新启动。当系统重新启动时,该程序已成功安装。