Add packages/apps/Car/libs missing visibility to fix the build. am: 45c56c6e6a am: 3fbfb27c92
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/robolectric-shadows/+/21651247
Change-Id: If82be8a07fd499572ecfe8e0b08ea08dcc92a861
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Android.bp b/Android.bp
index a6563ce..33d2ea8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -105,6 +105,7 @@
"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 9767b9a..b79f70a 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 @@
// });
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 @@
// 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 dbb2c6f..2176caf 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 @@
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 @@
}
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 ffd4827..7e802e1 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 @@
* 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 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);
}
};