Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07e272d2 authored by Brandon Liu's avatar Brandon Liu
Browse files

Sparse encoding fully drop config.sdkVersion check

Bug: 197642721
Test: Updated and verified affected atests pass
Change-Id: I0e5b7086e665340cd2995c11af8b901de85d321f
parent 2dbc157f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -173,8 +173,7 @@ class PackageFlattener {
      // Sparse encode if forced or sdk version is not set in context and config.
    } else {
      // Otherwise, only sparse encode if the entries will be read on platforms S_V2+.
      sparse_encode = sparse_encode &&
                      (context_->GetMinSdkVersion() >= SDK_S_V2 || config.sdkVersion >= SDK_S_V2);
      sparse_encode = sparse_encode && (context_->GetMinSdkVersion() >= SDK_S_V2);
    }

    // Only sparse encode if the offsets are representable in 2 bytes.
+3 −3
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ static std::unique_ptr<ResourceTable> BuildTableWithSparseEntries(
  return table;
}

TEST_F(TableFlattenerTest, FlattenSparseEntryWithMinSdkO) {
TEST_F(TableFlattenerTest, FlattenSparseEntryWithMinSdkSV2) {
  std::unique_ptr<IAaptContext> context = test::ContextBuilder()
                                              .SetCompilationPackage("android")
                                              .SetPackageId(0x01)
@@ -369,7 +369,7 @@ TEST_F(TableFlattenerTest, FlattenSparseEntryWithMinSdkO) {
  EXPECT_EQ(4u, value->value.data);
}

TEST_F(TableFlattenerTest, FlattenSparseEntryWithConfigSdkVersionO) {
TEST_F(TableFlattenerTest, FlattenSparseEntryWithConfigSdkVersionSV2) {
  std::unique_ptr<IAaptContext> context = test::ContextBuilder()
                                              .SetCompilationPackage("android")
                                              .SetPackageId(0x01)
@@ -388,7 +388,7 @@ TEST_F(TableFlattenerTest, FlattenSparseEntryWithConfigSdkVersionO) {
  std::string sparse_contents;
  ASSERT_TRUE(Flatten(context.get(), options, table_in.get(), &sparse_contents));

  EXPECT_GT(no_sparse_contents.size(), sparse_contents.size());
  EXPECT_EQ(no_sparse_contents.size(), sparse_contents.size());
}

TEST_F(TableFlattenerTest, FlattenSparseEntryRegardlessOfMinSdkWhenForced) {