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

Commit 39a77f19 authored by Dan Willemsen's avatar Dan Willemsen Committed by Gerrit Code Review
Browse files

Merge changes from topic "R"

* changes:
  master designated for R. Update MAX_PLATFORM_VERSION, etc.
  AAPT2: Update SDK development codename to Q
parents 5d832d29 3a60b9c4
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -497,9 +497,9 @@ Maybe<int> ParseSdkVersion(const StringPiece& str) {
  }

  // Try parsing the code name.
  std::pair<StringPiece, int> entry = GetDevelopmentSdkCodeNameAndVersion();
  if (entry.first == trimmed_str) {
    return entry.second;
  Maybe<int> entry = GetDevelopmentSdkCodeNameVersion(trimmed_str);
  if (entry) {
    return entry.value();
  }
  return {};
}
+9 −5
Original line number Diff line number Diff line
@@ -18,15 +18,17 @@

#include <algorithm>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using android::StringPiece;

namespace aapt {

static const char* sDevelopmentSdkCodeName = "P";
static ApiVersion sDevelopmentSdkLevel = 28;
static ApiVersion sDevelopmentSdkLevel = 10000;
static const auto sDevelopmentSdkCodeNames = std::unordered_set<StringPiece>({
    "Q", "R"
});

static const std::vector<std::pair<uint16_t, ApiVersion>> sAttrIdMap = {
    {0x021c, 1},
@@ -54,6 +56,7 @@ static const std::vector<std::pair<uint16_t, ApiVersion>> sAttrIdMap = {
    {0x0530, SDK_NOUGAT_MR1},
    {0x0568, SDK_O},
    {0x056d, SDK_O_MR1},
    {0x0586, SDK_P},
};

static bool less_entry_id(const std::pair<uint16_t, ApiVersion>& p, uint16_t entryId) {
@@ -71,8 +74,9 @@ ApiVersion FindAttributeSdkLevel(const ResourceId& id) {
  return iter->second;
}

std::pair<StringPiece, ApiVersion> GetDevelopmentSdkCodeNameAndVersion() {
  return std::make_pair(StringPiece(sDevelopmentSdkCodeName), sDevelopmentSdkLevel);
Maybe<ApiVersion> GetDevelopmentSdkCodeNameVersion(const StringPiece& code_name) {
  return (sDevelopmentSdkCodeNames.find(code_name) == sDevelopmentSdkCodeNames.end())
      ? Maybe<ApiVersion>() : sDevelopmentSdkLevel;
}

}  // namespace aapt
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ enum : ApiVersion {
};

ApiVersion FindAttributeSdkLevel(const ResourceId& id);
std::pair<android::StringPiece, ApiVersion> GetDevelopmentSdkCodeNameAndVersion();
Maybe<ApiVersion> GetDevelopmentSdkCodeNameVersion(const android::StringPiece& code_name);

}  // namespace aapt

+10 −21
Original line number Diff line number Diff line
@@ -705,35 +705,24 @@ TEST_F(ConfigurationParserTest, AndroidSdkGroupAction_InvalidVersion) {
}

TEST_F(ConfigurationParserTest, AndroidSdkGroupAction_NonNumeric) {
  static constexpr const char* xml = R"xml(
  auto doc = test::BuildXmlDom(R"xml(
      <android-sdk
          label="P"
          label="Q"
          minSdkVersion="25"
          targetSdkVersion="%s"
          maxSdkVersion="%s">
      </android-sdk>)xml";

  const auto& dev_sdk = GetDevelopmentSdkCodeNameAndVersion();
  const char* codename = dev_sdk.first.data();
  const ApiVersion& version = dev_sdk.second;

  auto doc = test::BuildXmlDom(StringPrintf(xml, codename, codename));
          targetSdkVersion="Q"
          maxSdkVersion="Q">
      </android-sdk>)xml");

  PostProcessingConfiguration config;
  bool ok = AndroidSdkTagHandler(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
  ASSERT_TRUE(ok);

  ASSERT_TRUE(AndroidSdkTagHandler(&config, NodeCast<Element>(doc.get()->root.get()), &diag_));
  ASSERT_EQ(1ul, config.android_sdks.size());
  ASSERT_EQ(1u, config.android_sdks.count("P"));

  auto& out = config.android_sdks["P"];
  ASSERT_EQ(1u, config.android_sdks.count("Q"));

  AndroidSdk sdk;
  sdk.min_sdk_version = 25;
  sdk.target_sdk_version = version;
  sdk.max_sdk_version = version;

  ASSERT_EQ(sdk, out);
  sdk.target_sdk_version = 10000;
  sdk.max_sdk_version = 10000;
  ASSERT_EQ(sdk, config.android_sdks["Q"]);
}

TEST_F(ConfigurationParserTest, GlTextureGroupAction) {