OSDN Git Service

AssetManager2: Allow out of order type/type spec
authorAdam Lesinski <adamlesinski@google.com>
Thu, 8 Feb 2018 22:50:38 +0000 (14:50 -0800)
committerAdam Lesinski <adamlesinski@google.com>
Thu, 8 Feb 2018 23:16:32 +0000 (15:16 -0800)
commit78695c354342bd95ba5f63937b4e789139b50072
tree3449df64a8cd96dd2760f13401174d401809ac9c
parentac5438c501bca164ab2a39f32c2c660d2d4d7c90
AssetManager2: Allow out of order type/type spec

AssetManager2 assumes that RES_TABLE_TYPE_SPEC_TYPEs must immediately
precede their associated RES_TABLE_TYPE_TYPEs. This is not correct.
RES_TABLE_TYPE_SPEC_TYPEs must precede their associated
RES_TABLE_TYPE_TYPEs, but they do not need to immediately precede them.

For example, this is what we currently expect:

  RES_TABLE_TYPE_SPEC_TYPE id=1
  RES_TABLE_TYPE_TYPE id=1
  RES_TABLE_TYPE_SPEC_TYPE id=2
  RES_TABLE_TYPE_TYPE id=2

but this is also valid:

  RES_TABLE_TYPE_SPEC_TYPE id=1
  RES_TABLE_TYPE_SPEC_TYPE id=2
  RES_TABLE_TYPE_TYPE id=1
  RES_TABLE_TYPE_TYPE id=2

Bug: 73052092
Test: make libandroidfw_tests
Change-Id: I1f3c43760f8108eee24c2c6ed7bc16f70e951c2b
libs/androidfw/LoadedArsc.cpp
libs/androidfw/tests/LoadedArsc_test.cpp
libs/androidfw/tests/data/out_of_order_types/AndroidManifest.xml [new file with mode: 0644]
libs/androidfw/tests/data/out_of_order_types/build [new file with mode: 0755]
libs/androidfw/tests/data/out_of_order_types/edited_resources.arsc.txt [new file with mode: 0644]
libs/androidfw/tests/data/out_of_order_types/out_of_order_types.apk [new file with mode: 0644]
libs/androidfw/tests/data/out_of_order_types/res/values/values.xml [new file with mode: 0644]