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

Commit 8cc79523 authored by Brandon Liu's avatar Brandon Liu Committed by Android (Google) Code Review
Browse files

Merge "Sparse encoding fully drop config.sdkVersion check"

parents 5b63d18a 07e272d2
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) {