Improve the logic for mapping target dynamic partitions. am: 1d9077f65d
am: 87d1587557

Change-Id: Ia64df615a83a11ad7781b89f56cd74e84155620b