这是indexloc提供的服务,不要输入任何密码
Skip to content

aapt: Bump to 15.0.0.23 #23671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions packages/aapt/aapt2-io-Util.h.patch

This file was deleted.

37 changes: 26 additions & 11 deletions packages/aapt/aapt2-util-Util.cpp.patch
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
--- a/base/tools/aapt2/util/Util.cpp
+++ b/base/tools/aapt2/util/Util.cpp
@@ -24,7 +24,6 @@
#include "android-base/stringprintf.h"
#include "android-base/strings.h"
@@ -27,7 +27,6 @@
#include "androidfw/BigBuffer.h"
#include "androidfw/StringPiece.h"
#include "androidfw/Util.h"
-#include "build/version.h"
#include "text/Unicode.h"
#include "text/Utf8Iterator.h"
#include "util/BigBuffer.h"
@@ -230,17 +229,7 @@
#include "utils/Unicode.h"
@@ -229,32 +228,7 @@
// Update minor version whenever a feature or flag is added.
static const char* const sMinorVersion = "19";

- // The build id of aapt2 binary.
- static std::string sBuildId = android::build::GetBuildNumber();
- static const std::string sBuildId = [] {
- std::string buildNumber = android::build::GetBuildNumber();
-
- if (android::base::StartsWith(sBuildId, "eng.")) {
- time_t now = time(0);
- tm* ltm = localtime(&now);
- if (android::base::StartsWith(buildNumber, "eng.")) {
- // android::build::GetBuildNumber() returns something like "eng.user.20230725.214219" where
- // the latter two parts are "yyyyMMdd.HHmmss" at build time. Use "yyyyMM" in the fingerprint.
- std::vector<std::string> parts = util::Split(buildNumber, '.');
- int buildYear;
- int buildMonth;
- if (parts.size() < 3 || parts[2].length() < 6 ||
- !android::base::ParseInt(parts[2].substr(0, 4), &buildYear) ||
- !android::base::ParseInt(parts[2].substr(4, 2), &buildMonth)) {
- // Fallback to localtime() if GetBuildNumber() returns an unexpected output.
- time_t now = time(0);
- tm* ltm = localtime(&now);
- buildYear = 1900 + ltm->tm_year;
- buildMonth = 1 + ltm->tm_mon;
- }
-
- sBuildId = android::base::StringPrintf("eng.%d%d", 1900 + ltm->tm_year, 1 + ltm->tm_mon);
- }
- buildNumber = android::base::StringPrintf("eng.%04d%02d", buildYear, buildMonth);
- }
- return buildNumber;
- }();
-
- return android::base::StringPrintf("%s.%s-%s", sMajorVersion, sMinorVersion, sBuildId.c_str());
+ return android::base::StringPrintf("%s.%s", sMajorVersion, sMinorVersion);
Expand Down
278 changes: 278 additions & 0 deletions packages/aapt/aidl-aidl_language.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
--- a/aidl/aidl_language.h
+++ b/aidl/aidl_language.h
@@ -396,6 +396,137 @@ class AidlAnnotatable : public AidlCommentable {
vector<std::unique_ptr<AidlAnnotation>> annotations_;
};

+class AidlUnaryConstExpression;
+class AidlBinaryConstExpression;
+class AidlConstantReference;
+
+class AidlConstantValue : public AidlNode {
+ public:
+ enum class Type {
+ // WARNING: Don't change this order! The order is used to determine type
+ // promotion during a binary expression.
+ BOOLEAN,
+ INT8,
+ INT32,
+ INT64,
+ ARRAY,
+ CHARACTER,
+ STRING,
+ REF,
+ FLOATING,
+ UNARY,
+ BINARY,
+ ERROR,
+ };
+
+ // Returns the evaluated value. T> should match to the actual type.
+ template <typename T>
+ T EvaluatedValue() const {
+ is_evaluated_ || (CheckValid() && evaluate());
+ AIDL_FATAL_IF(!is_valid_, this);
+
+ if constexpr (is_vector<T>::value) {
+ AIDL_FATAL_IF(final_type_ != Type::ARRAY, this);
+ T result;
+ for (const auto& v : values_) {
+ result.push_back(v->EvaluatedValue<typename T::value_type>());
+ }
+ return result;
+ } else if constexpr (is_one_of<T, float, double>::value) {
+ AIDL_FATAL_IF(final_type_ != Type::FLOATING, this);
+ T result;
+ AIDL_FATAL_IF(!ParseFloating(value_, &result), this);
+ return result;
+ } else if constexpr (std::is_same<T, std::string>::value) {
+ AIDL_FATAL_IF(final_type_ != Type::STRING, this);
+ return final_string_value_.substr(1, final_string_value_.size() - 2); // unquote "
+ } else if constexpr (is_one_of<T, int8_t, int32_t, int64_t>::value) {
+ AIDL_FATAL_IF(final_type_ < Type::INT8 && final_type_ > Type::INT64, this);
+ return static_cast<T>(final_value_);
+ } else if constexpr (std::is_same<T, char16_t>::value) {
+ AIDL_FATAL_IF(final_type_ != Type::CHARACTER, this);
+ return final_string_value_.at(1); // unquote '
+ } else if constexpr (std::is_same<T, bool>::value) {
+ static_assert(std::is_same<T, bool>::value, "..");
+ AIDL_FATAL_IF(final_type_ != Type::BOOLEAN, this);
+ return final_value_ != 0;
+ } else {
+ static_assert(unsupported_type<T>::value);
+ }
+ }
+
+ virtual ~AidlConstantValue() = default;
+
+ // non-copyable, non-movable
+ AidlConstantValue(const AidlConstantValue&) = delete;
+ AidlConstantValue(AidlConstantValue&&) = delete;
+ AidlConstantValue& operator=(const AidlConstantValue&) = delete;
+ AidlConstantValue& operator=(AidlConstantValue&&) = delete;
+
+ // creates default value, when one isn't specified
+ // nullptr if no default available
+ static AidlConstantValue* Default(const AidlTypeSpecifier& specifier);
+
+ static AidlConstantValue* Boolean(const AidlLocation& location, bool value);
+ static AidlConstantValue* Character(const AidlLocation& location, const std::string& value);
+ // example: 123, -5498, maybe any size
+ static AidlConstantValue* Integral(const AidlLocation& location, const std::string& value);
+ static AidlConstantValue* Floating(const AidlLocation& location, const std::string& value);
+ static AidlConstantValue* Array(const AidlLocation& location,
+ std::unique_ptr<vector<unique_ptr<AidlConstantValue>>> values);
+ // example: "\"asdf\""
+ static AidlConstantValue* String(const AidlLocation& location, const string& value);
+
+ Type GetType() const { return final_type_; }
+ const std::string& Literal() const { return value_; }
+
+ bool Evaluate() const;
+ virtual bool CheckValid() const;
+
+ // Raw value of type (currently valid in C++ and Java). Empty string on error.
+ string ValueString(const AidlTypeSpecifier& type, const ConstantValueDecorator& decorator) const;
+
+ void TraverseChildren(std::function<void(const AidlNode&)> traverse) const override {
+ if (type_ == Type::ARRAY) {
+ for (const auto& v : values_) {
+ traverse(*v);
+ }
+ }
+ }
+ void DispatchVisit(AidlVisitor& visitor) const override { visitor.Visit(*this); }
+ size_t Size() const { return values_.size(); }
+ const AidlConstantValue& ValueAt(size_t index) const { return *values_.at(index); }
+ static string ToString(Type type);
+
+ private:
+ AidlConstantValue(const AidlLocation& location, Type parsed_type, int64_t parsed_value,
+ const string& checked_value);
+ AidlConstantValue(const AidlLocation& location, Type type, const string& checked_value);
+ AidlConstantValue(const AidlLocation& location, Type type,
+ std::unique_ptr<vector<unique_ptr<AidlConstantValue>>> values,
+ const std::string& value);
+ static bool ParseIntegral(const string& value, int64_t* parsed_value, Type* parsed_type);
+ static bool IsHex(const string& value);
+
+ virtual bool evaluate() const;
+ bool IsLiteral() const;
+
+ const Type type_ = Type::ERROR;
+ const vector<unique_ptr<AidlConstantValue>> values_; // if type_ == ARRAY
+ const string value_; // otherwise
+
+ // State for tracking evaluation of expressions
+ mutable bool is_valid_ = false; // cache of CheckValid, but may be marked false in evaluate
+ mutable bool is_evaluated_ = false; // whether evaluate has been called
+ mutable Type final_type_;
+ mutable int64_t final_value_;
+ mutable string final_string_value_ = "";
+
+ friend AidlUnaryConstExpression;
+ friend AidlBinaryConstExpression;
+ friend AidlConstantReference;
+};
+
// Represents `[]`
struct DynamicArray {};
// Represents `[N][M]..`
@@ -613,137 +744,6 @@ struct ArgumentAspect {
std::set<AidlArgument::Direction> possible_directions;
};

-class AidlUnaryConstExpression;
-class AidlBinaryConstExpression;
-class AidlConstantReference;
-
-class AidlConstantValue : public AidlNode {
- public:
- enum class Type {
- // WARNING: Don't change this order! The order is used to determine type
- // promotion during a binary expression.
- BOOLEAN,
- INT8,
- INT32,
- INT64,
- ARRAY,
- CHARACTER,
- STRING,
- REF,
- FLOATING,
- UNARY,
- BINARY,
- ERROR,
- };
-
- // Returns the evaluated value. T> should match to the actual type.
- template <typename T>
- T EvaluatedValue() const {
- is_evaluated_ || (CheckValid() && evaluate());
- AIDL_FATAL_IF(!is_valid_, this);
-
- if constexpr (is_vector<T>::value) {
- AIDL_FATAL_IF(final_type_ != Type::ARRAY, this);
- T result;
- for (const auto& v : values_) {
- result.push_back(v->EvaluatedValue<typename T::value_type>());
- }
- return result;
- } else if constexpr (is_one_of<T, float, double>::value) {
- AIDL_FATAL_IF(final_type_ != Type::FLOATING, this);
- T result;
- AIDL_FATAL_IF(!ParseFloating(value_, &result), this);
- return result;
- } else if constexpr (std::is_same<T, std::string>::value) {
- AIDL_FATAL_IF(final_type_ != Type::STRING, this);
- return final_string_value_.substr(1, final_string_value_.size() - 2); // unquote "
- } else if constexpr (is_one_of<T, int8_t, int32_t, int64_t>::value) {
- AIDL_FATAL_IF(final_type_ < Type::INT8 && final_type_ > Type::INT64, this);
- return static_cast<T>(final_value_);
- } else if constexpr (std::is_same<T, char16_t>::value) {
- AIDL_FATAL_IF(final_type_ != Type::CHARACTER, this);
- return final_string_value_.at(1); // unquote '
- } else if constexpr (std::is_same<T, bool>::value) {
- static_assert(std::is_same<T, bool>::value, "..");
- AIDL_FATAL_IF(final_type_ != Type::BOOLEAN, this);
- return final_value_ != 0;
- } else {
- static_assert(unsupported_type<T>::value);
- }
- }
-
- virtual ~AidlConstantValue() = default;
-
- // non-copyable, non-movable
- AidlConstantValue(const AidlConstantValue&) = delete;
- AidlConstantValue(AidlConstantValue&&) = delete;
- AidlConstantValue& operator=(const AidlConstantValue&) = delete;
- AidlConstantValue& operator=(AidlConstantValue&&) = delete;
-
- // creates default value, when one isn't specified
- // nullptr if no default available
- static AidlConstantValue* Default(const AidlTypeSpecifier& specifier);
-
- static AidlConstantValue* Boolean(const AidlLocation& location, bool value);
- static AidlConstantValue* Character(const AidlLocation& location, const std::string& value);
- // example: 123, -5498, maybe any size
- static AidlConstantValue* Integral(const AidlLocation& location, const std::string& value);
- static AidlConstantValue* Floating(const AidlLocation& location, const std::string& value);
- static AidlConstantValue* Array(const AidlLocation& location,
- std::unique_ptr<vector<unique_ptr<AidlConstantValue>>> values);
- // example: "\"asdf\""
- static AidlConstantValue* String(const AidlLocation& location, const string& value);
-
- Type GetType() const { return final_type_; }
- const std::string& Literal() const { return value_; }
-
- bool Evaluate() const;
- virtual bool CheckValid() const;
-
- // Raw value of type (currently valid in C++ and Java). Empty string on error.
- string ValueString(const AidlTypeSpecifier& type, const ConstantValueDecorator& decorator) const;
-
- void TraverseChildren(std::function<void(const AidlNode&)> traverse) const override {
- if (type_ == Type::ARRAY) {
- for (const auto& v : values_) {
- traverse(*v);
- }
- }
- }
- void DispatchVisit(AidlVisitor& visitor) const override { visitor.Visit(*this); }
- size_t Size() const { return values_.size(); }
- const AidlConstantValue& ValueAt(size_t index) const { return *values_.at(index); }
- static string ToString(Type type);
-
- private:
- AidlConstantValue(const AidlLocation& location, Type parsed_type, int64_t parsed_value,
- const string& checked_value);
- AidlConstantValue(const AidlLocation& location, Type type, const string& checked_value);
- AidlConstantValue(const AidlLocation& location, Type type,
- std::unique_ptr<vector<unique_ptr<AidlConstantValue>>> values,
- const std::string& value);
- static bool ParseIntegral(const string& value, int64_t* parsed_value, Type* parsed_type);
- static bool IsHex(const string& value);
-
- virtual bool evaluate() const;
- bool IsLiteral() const;
-
- const Type type_ = Type::ERROR;
- const vector<unique_ptr<AidlConstantValue>> values_; // if type_ == ARRAY
- const string value_; // otherwise
-
- // State for tracking evaluation of expressions
- mutable bool is_valid_ = false; // cache of CheckValid, but may be marked false in evaluate
- mutable bool is_evaluated_ = false; // whether evaluate has been called
- mutable Type final_type_;
- mutable int64_t final_value_;
- mutable string final_string_value_ = "";
-
- friend AidlUnaryConstExpression;
- friend AidlBinaryConstExpression;
- friend AidlConstantReference;
-};
-
// Represents "<type>.<field>" which resolves to a constant which is one of
// - constant declaration
// - enumerator
6 changes: 3 additions & 3 deletions packages/aapt/androidfw-AssetManager.cpp.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
--- a/base/libs/androidfw/AssetManager.cpp
+++ b/base/libs/androidfw/AssetManager.cpp
@@ -940,13 +940,9 @@
@@ -941,13 +941,9 @@

if (method == ZipFileRO::kCompressStored) {
pAsset = Asset::createFromUncompressedMap(std::move(*dataMap), mode);
- ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(),
- ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.c_str(),
- dataMap->file_name(), mode, pAsset.get());
} else {
pAsset = Asset::createFromCompressedMap(std::move(*dataMap),
static_cast<size_t>(uncompressedLen), mode);
- ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(),
- ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.c_str(),
- dataMap->file_name(), mode, pAsset.get());
}
if (pAsset == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion packages/aapt/androidfw-ResourceTypes.cpp.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/base/libs/androidfw/ResourceTypes.cpp
+++ b/base/libs/androidfw/ResourceTypes.cpp
@@ -43,7 +43,7 @@
@@ -45,7 +45,7 @@
#include <utils/String16.h>
#include <utils/String8.h>

Expand Down
Loading