当前位置:   article > 正文

Android OTA升级新旧版本任意升级_android 7.1 ota 编译修改支持高版本升级到低版本时间戳

android 7.1 ota 编译修改支持高版本升级到低版本时间戳

1. Android升级到较新的版本后,想用.zip升级包升回旧的版本时,在升级时会发错。这是由于android系统时对升级文件有版本检测。

2. build/tools/releasetools/ota_from_target_files:

  1. def main(argv):
  2. def option_handler(o, a):
  3. if o == "--board_config":
  4. pass # deprecated
  5. elif o in ("-k", "--package_key"):
  6. OPTIONS.package_key = a
  7. elif o in ("-i", "--incremental_from"):
  8. OPTIONS.incremental_source = a
  9. elif o in ("-w", "--wipe_user_data"):
  10. OPTIONS.wipe_user_data = True
  11. elif o in ("-n", "--no_prereq"):
  12. OPTIONS.omit_prereq = True
  13. elif o in ("-o", "--oem_settings"):
  14. OPTIONS.oem_source = a
  15. elif o in ("-e", "--extra_script"):
  16. OPTIONS.extra_script = a
  17. elif o in ("-a", "--aslr_mode"):
  18. if a in ("on", "On", "true", "True", "yes", "Yes"):
  19. OPTIONS.aslr_mode = True
  20. else:
  21. OPTIONS.aslr_mode = False
  22. elif o in ("-t", "--worker_threads"):


3. build/tools/releasetools/edify_generator.py 比较时间戳就是在这里

  def AssertOlderBuild(self, timestamp, timestamp_text):
    """Assert that the build on the device is older (or the same as)
    the given timestamp."""
    self.script.append(
        ('(!less_than_int(%s, getprop("ro.build.date.utc"))) || '
         'abort("Can\'t install this package (%s) over newer '
         'build (" + getprop("ro.build.date") + ").");'
         ) % (timestamp, timestamp_text))

4. 如果不想系统检测版本,将ota_from_target_files文件中改为OPTIONS.omit_prereq = False

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/119296
推荐阅读
相关标签
  

闽ICP备14008679号