以编程方式重新执行操作系统和APK更新[已关闭] -- updates 领域 和 ota-update 领域 和 application-autoupdate 领域 android 相关 的问题

Sliently perform OS and APK update programmatically [closed]


简体版||繁體版
-2
vote

问题

中文
关闭。这个问题是 off-topic 。它目前不接受答案。

想要改进这个问题?更新这个问题,所以它是关于android爱好者堆栈交换的主题。

关闭 3年前

改善这个问题

我正在尝试创建一个用于在我的Android设备上执行APK和OS的空中更新的系统。一旦下载了操作系统和APK的软件包,我的问题就符合实际执行升级的部分。请注意以下内容:

  1. 我不能使用播放商/播放服务,因为我的设备没有安装在它上的播放服务。
  2. 我需要默默地完成APK和操作系统的更新过程,而无需任何用户干预。
  3. 我在设备上有root / admin权限。
  4. 我将使用的Android版本是Kitkat,棒棒糖和棉花糖。
  5. 我有一个在设备上运行的APK,检查来自我的服务器的更新并下载它。然后,我希望它从代码中启动APK和OS的更新。

关于apk更新:

我已经尝试并通过运行shell命令 pm install -r $PATH_TO_DOWNLOADED_APK ,从 abcdefghijklmn1 获取我的应用程序代码中获取shell命令 abcdefghijklmn0 ,成功执行APK更新。

我的问题是:

    如果在安装apk时出现问题的情况下出现问题 - 例如,如果设备发生在更新时,则在APK包中存在一些问题或类似于那样的问题 - 在这种情况下,在这种情况下,Android会确保Android滚动正确返回上一个版本,没有数据丢失或有些我需要在我的代码中照顾。

关于操作系统更新:

我提到了以下链接: https://source.android.com/devices / Tech / OTA / ,我不完全理解它。

我的问题是:

  1. 有一个特定文件夹,我需要保留下载的操作系统包?如果是,那么哪个是文件夹?如果没有,那么我如何指定它的路径?
  2. 在操作系统更新的情况下 pm install -r $PATH_TO_APK 的等价命令是什么?
  3. 如何在链接中提到的"恢复模式" 以"恢复模式" 引导设备?
  4. 设备中的启动和恢复分区在哪里?它是否因设备而异?在我与我的一个设备中,我没有看到任何/启动或/恢复文件夹?启动意味着/(root)文件夹?
  5. 如果由于某种原因,OS更新失败的情况下(更新期间关闭,更新包中存在问题) - Android是否确保了正确的回滚,并且设备处于一致状态,并且没有数据丢失的?如果没有,那么该代码应该如何处理它?<​​/ li>
english

I am trying to create a system for performing over-the-air updates for APK and OS on my android devices. My question pertains to the part of actually performing the upgrade once the packages for OS and APK have been downloaded. Please note the following:

  1. I cannot use play-store/play-services since my device does not have play-services installed on it.
  2. I need the update process for both APK and OS to be done silently without any user intervention.
  3. I have root/admin privileges on the devices.
  4. The android versions I will be using are Kitkat, Lollipop and Marshmallow.
  5. I have an APK running on the device which checks for updates from my server and downloads it. I then want it to initiate update for both APK and OS from the code.

Regarding APK update:

I have actually tried and successfully performed APK update by running the shell command pm install -r $PATH_TO_DOWNLOADED_APK, after getting the shell from Runtime.getRuntime().exec("su") in my App code.

My Questions are:

  1. In case something goes wrong while installing the APK- for example if the device shuts down while update is happening , or there was some issue in the APK package or something like that - in this case will android ensure that the APP is rolled back to the previous version correctly and no data is lost or there is something I need to take care of in my code.

Regarding OS update:

I referred to the following link: https://source.android.com/devices/tech/ota/ However, I didn't understand it completely.

My questions are:

  1. Is there a particular folder where I need to keep the downloaded OS package? If yes, then which is the folder? If no then how do I specify the path to it?
  2. What is the equivalent command for pm install -r $PATH_TO_APK in case of OS updates?
  3. How do I boot a device in "recovery mode" as mentioned in point # 3, in the link?
  4. Where are the boot and recovery partitions in the device? Does it vary from device to device? In one of the devices which I have with me, I don't see any /boot or /recovery folder? Does boot mean the / (root) folder?
  5. In case the OS update fails due to some reason( the device shuts down during the update, there was issue in the update package etc)- does android ensure proper rollback and that the device is in a consistent state and no data is lost? If no then how should the code which initiates it handle this?
        
 
 

回答列表

1
 
vote

是否有一个特定文件夹,我需要保留下载的操作系统包?如果是,那么哪个是文件夹?如果没有,那么我如何指定它的路径?

android将下载的包保存在缓存分区中,因为现在数据分区被概要加密,它不能在恢复模式下通过Android安装而不提供解密密钥,并且没有其他分区足以存储更大的文件以存储更大的文件。使用root访问将文件移动到/缓存中。您可能必须在其上设置适当的权限。

在OS更新的情况下

pm install -r $PATH_TO_APK 的等效命令是什么?

OS更新在恢复模式(鞍骨OS)中发生,恢复可能有一个规定才能允许自动执行命令。 Android库存恢复(&lt; 3e&gt;)读取 cache / recovery / command 并自动执行它们。如果它是TWRP v2.1或以上,则该文件是 / cache / recovery / OpenRecoveryscript 。检查他们的链接以了解更多信息。

如何在"恢复模式" 中引导设备,如点#3中所提到的链接?

我的答案在这里已覆盖。

设备中的引导和恢复分区在哪里?它是否因设备而异?在我与我的一个设备中,我没有看到任何/启动或/恢复文件夹?启动是否意味着/(root)文件夹?

它们因设备而异,但您可以在 / Cache 上找到安装的缓存分区。不需要安装引导分区,因为在启动期间所有内容都自动加载到内存中。您必须搜索互联网以查找特定设备的分区方案。 izzy的 q&amp; a 可以帮助。

no, boot 并不意味着 / 文件夹。它甚至不是现实目录,而是最大的根树(文件层次结构)每次创建和填充Android靴子。

如果由于某种原因,操作系统更新失败(设备在更新期间关闭,则更新包等问题) - Android确保正确回滚,并且设备处于一致状态,并且没有数据丢失?

否,如果恢复开始修改系统分区并被中断,则没有返回。即使进程正常完成,引导过程可能会陷入困境 。

最后,OS更新/升级根本不能被称为沉默,因为屏幕上有很大的情况发生了。

 

Is there a particular folder where I need to keep the downloaded OS package? If yes, then which is the folder? If no then how do I specify the path to it?

Android keeps the downloaded package in cache partition, since data partition is supposedly encrypted nowadays which cannot be mounted by Android in recovery mode without supplying decryption key and there is no other partition big enough to store bigger files. Use root access to move the file into /cache. You may have to set appropriate permission on it as well.

What is the equivalent command for pm install -r $PATH_TO_APK in case of OS updates?

The OS update occurs in recovery mode (a barebone OS) and the recovery may have a provision to allow automatic execution of commands. Android stock recovery (<3e>) reads /cache/recovery/command and executes them automatically. If it is TWRP v2.1 or above, the file is /cache/recovery/openrecoveryscript. Check their links to know more.

How do I boot a device in "recovery mode" as mentioned in point # 3, in the link?

My answer here has it covered.

Where are the boot and recovery partitions in the device? Does it vary from device to device? In one of the devices which I have with me, I don't see any /boot or /recovery folder? Does boot mean the / (root) folder?

They vary from device to device but you can find the cache partition mounted at /cache. Boot partition need not be mounted since all of its content is automatically loaded into memory during boot. You would have to search internet to find partition scheme for your particular device. Izzy's Q&A could help too.

No, boot doesn't mean / folder. It is not even a directory in reality but the root of the largest tree (file hierarchy) created and populated each time the Android boots.

In case the OS update fails due to some reason( the device shuts down during the update, there was issue in the update package etc)- does android ensure proper rollback and that the device is in a consistent state and no data is lost?

No, if recovery starts modifying the system partition and is interrupted, there is no going back. Even if the process completes normally, the boot process may get into trouble.

Finally, OS update/upgrade cannot be called silent at all since there is so much happening on the screen.

 
 
 
 

相关问题

0  可以通过播放商店更新系统​​/ riv-应用程序中的应用程序是否更新?  ( Can applications predinstalled in system priv app be updated via play store ) 
我们正在尝试在手机中制作自定义启动器默认值。由于它需要系统级别权限(放置窗口小部件),我们将其放在System / Priv-App中,并且它最终正常工作。问题是它不是从播放商店的新版本更新。 - 在下载更新后,我们在安装过程开始时获得错误505 提前谢谢! 布尔 y ...

-1  三星S5830中没有连接错误  ( No connection error in samsung s5830 ) 
"我有三星Galaxy Ace S5830 在哪个市场和你的管子在谷歌正常工作时显示"没有连接" 错误"我该怎么办? ...

0  无法从Android Marketplace安装应用程序时自动更新工作吗? [关闭]  ( Can automatic update work when app is not installed from android marketplace ) 
关闭。这个问题是 off-topic 。它目前不接受答案。 想要改进这个问题?更新这个问题,所以它是关于android爱好者堆栈交换的主题。 关闭 ...

2  自动更新安全性  ( Auto update security ) 
我发现了这个评论:任何原因不允许自动更新应用程序? - 是在任何地方记录的安全功能吗?我即将打开自动更新,但我不觉得这样做不舒服,没有坚定的证据,它不会妥协安全性。 ...

12  如何停止Adobe Flash Player更新从安装自己?  ( How do i stop the adobe flash player updates from installing themselves ) 
Adob​​e Flash Player 11.0更新保留在我的HTC愿望上安装自己。超过17 MB,将我推入"低空间" 区域,然后我的Gmail停止刷新等等......这是一场灾难。 现在我可以进入设置 - &gt;应用程序并可以卸载更新(将我与股票版本的Flash播放器留给我,这对我很好),几个小时后闪光再次...

6  如何为应用程序关闭“允许自动更新”?  ( How can i turn off the allow automatic updating for an app ) 
一旦我检查了市场上的应用程序的"允许自动更新" 框,就可以在没有卸载和重新安装应用程序的情况下撤消此操作? moto droid运行2.2 更新:显然我正在失去它。最初它发生在Pdanet中。我不小心点击了复选框,一旦我的选项就会消失。我尝试重新启动市场,重新启动手机,但选项永远不会重新出版。我卸载了它并重新安...

5  如何禁用市场应用程序的自动更新?  ( How can i disable auto updating of market apps ) 
是否有任何方式关闭Android Market应用程序的自动更新?我的手机会提示我有用的更新,它在后台运行,我认为它正在吸引宝贵的电池电量。 ...

0  Facebook每两天更新一次  ( Facebook updates every two days ) 
我刚买了一个Nexus 5(美国版),在过去的2到3周内,我注意到Facebook每次连接到Wi-Fi时,我都意味着我是一个开发人员,所以我可以想象更新出来但我不经常假设。我应该只打开自动更新,或者是否有其他可以完成的东西? ...

18  限制WiFi网络的市场更新  ( Restrict market updates to wifi network ) 
为了在我的数据计划上保存一些卷,我希望在我连接到WiFi时将市场上的更新限制在时代。并且,随着每个好的极客,如果我连接到WiFi网络,检查并从市场上安装更新(对于我允许自动更新的应用程序安装更新,则可以自动化。有没有办法这样做? 我正在运行Android 2.2在HTC的欲望上。如果它有帮助,我已安装Tasker。 ...

11  任何原因不允许自动更新应用程序?  ( Any reason not to allow automatic updating for an app ) 
自Android 2.2(froyo),您可以选择"允许自动更新" 。出于某种原因,我还没有开始使用它。利益是节省时间,但有没有任何好的原因 not 使用此功能? ...




© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有