diff options
author | Xin Li <delphij@google.com> | 2022-12-09 10:29:11 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2022-12-09 10:29:11 -0800 |
commit | 47fd612f2b63d95421a50c992df55f7dffda70e0 (patch) | |
tree | 58941af0e4d43e663d9594360543271329f9c52a | |
parent | 06d12dd555b30f9078ef58d1ec6e732dbefdf3fb (diff) | |
parent | fcb5a99c6b3b8411af7672dedbb932f18c0d7f50 (diff) | |
download | robolectric-shadows-main-16k-with-phones.tar.gz |
Merge Android 13 QPR1main-16k-with-phones
Bug: 261731544
Merged-In: I0d0877b131686cc046c11221cf2765e1bd66307c
Change-Id: I8d1c26bfe54a291dfe9f3036c7e13709b326b463
5 files changed, 17 insertions, 18 deletions
diff --git a/Android.bp b/Android.bp index 3245fbdfe..3b6ea2b09 100644 --- a/Android.bp +++ b/Android.bp @@ -84,6 +84,7 @@ java_device_for_host { "services.accessibility", "telephony-common", "android.car", + "android.car.builtin", ], } diff --git a/resources/src/main/java/org/robolectric/res/android/LoadedArsc.java b/resources/src/main/java/org/robolectric/res/android/LoadedArsc.java index 9767b9a5e..b79f70a62 100644 --- a/resources/src/main/java/org/robolectric/res/android/LoadedArsc.java +++ b/resources/src/main/java/org/robolectric/res/android/LoadedArsc.java @@ -395,15 +395,17 @@ public class LoadedArsc { // }); ResTable_sparseTypeEntry result = null; for (int i = 0; i < entry_count; i++) { - ResTable_sparseTypeEntry entry = new ResTable_sparseTypeEntry(type_chunk.myBuf(), - type_chunk.myOffset() + offsets_offset); - if (entry.idxOrOffset >= entry_index) { + ResTable_sparseTypeEntry entry = + new ResTable_sparseTypeEntry( + type_chunk.myBuf(), + type_chunk.myOffset() + offsets_offset + i * ResTable_sparseTypeEntry.SIZEOF); + if (entry.idx >= entry_index) { result = entry; break; } } - if (result == null || dtohs(result.idxOrOffset) != entry_index) { + if (result == null || dtohs(result.idx) != entry_index) { // No entry found. return ResTable_type.NO_ENTRY; } @@ -411,7 +413,7 @@ public class LoadedArsc { // Extract the offset from the entry. Each offset must be a multiple of 4 so we store it as // the real offset divided by 4. // return int{dtohs(result.offset)} * 4u; - return dtohs(result.idxOrOffset) * 4; + return dtohs(result.offset) * 4; } // This type is encoded as a dense array. diff --git a/resources/src/main/java/org/robolectric/res/android/ResTable.java b/resources/src/main/java/org/robolectric/res/android/ResTable.java index dbb2c6fc1..2176cafab 100644 --- a/resources/src/main/java/org/robolectric/res/android/ResTable.java +++ b/resources/src/main/java/org/robolectric/res/android/ResTable.java @@ -630,18 +630,18 @@ public class ResTable { sparseIndices, new ResTable_sparseTypeEntry(buf, sparseIndices.myOffset() + dtohl(thisType.entryCount)), new ResTable_sparseTypeEntry(buf, realEntryIndex), - (a, b) -> dtohs(a.idxOrOffset) < dtohs(b.idxOrOffset)); + (a, b) -> dtohs(a.idx) < dtohs(b.idx)); // if (result == sparseIndices + dtohl(thisType.entryCount) // || dtohs(result.idx) != realEntryIndex) { if (result.myOffset() == sparseIndices.myOffset() + dtohl(thisType.entryCount) - || dtohs(result.idxOrOffset) != realEntryIndex) { + || dtohs(result.idx) != realEntryIndex) { // No entry found. continue; } // Extract the offset from the entry. Each offset must be a multiple of 4 // so we store it as the real offset divided by 4. // thisOffset = dtohs(result->offset) * 4u; - thisOffset = dtohs(result.idxOrOffset) * 4; + thisOffset = dtohs(result.offset) * 4; } else { if (realEntryIndex >= dtohl(thisType.entryCount)) { // Entry does not exist. @@ -986,11 +986,6 @@ public class ResTable { } Type t = typeList.get(typeList.size() - 1); - if (newEntryCount != t.entryCount) { - ALOGE("ResTable_type entry count inconsistent: given %d, previously %d", - (int) newEntryCount, (int) t.entryCount); - return (mError = BAD_TYPE); - } if (t._package_ != _package) { ALOGE("No TypeSpec for type %d", type.id); diff --git a/resources/src/main/java/org/robolectric/res/android/ResourceTypes.java b/resources/src/main/java/org/robolectric/res/android/ResourceTypes.java index ffd482715..7e802e12d 100644 --- a/resources/src/main/java/org/robolectric/res/android/ResourceTypes.java +++ b/resources/src/main/java/org/robolectric/res/android/ResourceTypes.java @@ -1246,12 +1246,13 @@ public static class ResTable_ref * An entry in a ResTable_type with the flag `FLAG_SPARSE` set. */ static class ResTable_sparseTypeEntry extends WithOffset { - public static final int SIZEOF = 6; + public static final int SIZEOF = 4; // Holds the raw uint32_t encoded value. Do not read this. int entry; - short idxOrOffset; + short idx; + short offset; // struct { // The index of the entry. // uint16_t idx; @@ -1263,8 +1264,8 @@ public static class ResTable_ref public ResTable_sparseTypeEntry(ByteBuffer buf, int offset) { super(buf, offset); - entry = buf.getInt(offset); - idxOrOffset = buf.getShort(offset + 4); + this.idx = buf.getShort(offset); + this.offset = buf.getShort(offset + 2); } }; diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayManagerGlobal.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayManagerGlobal.java index b9691d104..8f730a9cb 100644 --- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayManagerGlobal.java +++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayManagerGlobal.java @@ -81,7 +81,7 @@ public class ShadowDisplayManagerGlobal { } // @Override // todo: use @Implements/@Implementation for signature checking - public int[] getDisplayIds(boolean includeDisabledDisplays) throws RemoteException { + public int[] getDisplayIds() throws RemoteException { int[] ids = new int[displayInfos.size()]; int i = 0; for (Integer displayId : displayInfos.keySet()) { |