summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/androidfw/ApkAssets.cpp13
-rw-r--r--libs/androidfw/ZipFileRO.cpp15
-rw-r--r--libs/androidfw/tests/TestHelpers.cpp3
-rw-r--r--libs/hwui/JankTracker.cpp2
-rw-r--r--libs/hwui/tests/macrobench/TestSceneRunner.cpp6
-rw-r--r--libs/usb/tests/AccessoryChat/Android.bp24
-rw-r--r--libs/usb/tests/AccessoryChat/Android.mk28
7 files changed, 40 insertions, 51 deletions
diff --git a/libs/androidfw/ApkAssets.cpp b/libs/androidfw/ApkAssets.cpp
index 7b7599ff74ec..237c1e970b17 100644
--- a/libs/androidfw/ApkAssets.cpp
+++ b/libs/androidfw/ApkAssets.cpp
@@ -125,9 +125,8 @@ std::unique_ptr<const ApkAssets> ApkAssets::LoadImpl(
std::unique_ptr<ApkAssets> loaded_apk(new ApkAssets(unmanaged_handle, path, last_mod_time));
// Find the resource table.
- ::ZipString entry_name(kResourcesArsc.c_str());
::ZipEntry entry;
- result = ::FindEntry(loaded_apk->zip_handle_.get(), entry_name, &entry);
+ result = ::FindEntry(loaded_apk->zip_handle_.get(), kResourcesArsc, &entry);
if (result != 0) {
// There is no resources.arsc, so create an empty LoadedArsc and return.
loaded_apk->loaded_arsc_ = LoadedArsc::CreateEmpty();
@@ -165,9 +164,8 @@ std::unique_ptr<const ApkAssets> ApkAssets::LoadImpl(
std::unique_ptr<Asset> ApkAssets::Open(const std::string& path, Asset::AccessMode mode) const {
CHECK(zip_handle_ != nullptr);
- ::ZipString name(path.c_str());
::ZipEntry entry;
- int32_t result = ::FindEntry(zip_handle_.get(), name, &entry);
+ int32_t result = ::FindEntry(zip_handle_.get(), path, &entry);
if (result != 0) {
return {};
}
@@ -213,13 +211,12 @@ bool ApkAssets::ForEachFile(const std::string& root_path,
root_path_full += '/';
}
- ::ZipString prefix(root_path_full.c_str());
void* cookie;
- if (::StartIteration(zip_handle_.get(), &cookie, &prefix, nullptr) != 0) {
+ if (::StartIteration(zip_handle_.get(), &cookie, root_path_full, "") != 0) {
return false;
}
- ::ZipString name;
+ std::string name;
::ZipEntry entry;
// We need to hold back directories because many paths will contain them and we want to only
@@ -228,7 +225,7 @@ bool ApkAssets::ForEachFile(const std::string& root_path,
int32_t result;
while ((result = ::Next(cookie, &entry, &name)) == 0) {
- StringPiece full_file_path(reinterpret_cast<const char*>(name.name), name.name_length);
+ StringPiece full_file_path(name);
StringPiece leaf_file_path = full_file_path.substr(root_path_full.size());
if (!leaf_file_path.empty()) {
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index 6e2ca60cc3d3..e77ac3df474c 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -39,7 +39,7 @@ using namespace android;
class _ZipEntryRO {
public:
ZipEntry entry;
- ZipString name;
+ std::string_view name;
void *cookie;
_ZipEntryRO() : cookie(NULL) {}
@@ -96,9 +96,9 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const
{
_ZipEntryRO* data = new _ZipEntryRO;
- data->name = ZipString(entryName);
+ data->name = entryName;
- const int32_t error = FindEntry(mHandle, data->name, &(data->entry));
+ const int32_t error = FindEntry(mHandle, entryName, &(data->entry));
if (error) {
delete data;
return NULL;
@@ -149,11 +149,8 @@ bool ZipFileRO::startIteration(void** cookie) {
bool ZipFileRO::startIteration(void** cookie, const char* prefix, const char* suffix)
{
_ZipEntryRO* ze = new _ZipEntryRO;
- ZipString pe(prefix ? prefix : "");
- ZipString se(suffix ? suffix : "");
int32_t error = StartIteration(mHandle, &(ze->cookie),
- prefix ? &pe : NULL,
- suffix ? &se : NULL);
+ prefix ? prefix : "", suffix ? suffix : "");
if (error) {
ALOGW("Could not start iteration over %s: %s", mFileName != NULL ? mFileName : "<null>",
ErrorCodeString(error));
@@ -197,14 +194,14 @@ int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, size_t bufLen)
const
{
const _ZipEntryRO* zipEntry = reinterpret_cast<_ZipEntryRO*>(entry);
- const uint16_t requiredSize = zipEntry->name.name_length + 1;
+ const uint16_t requiredSize = zipEntry->name.length() + 1;
if (bufLen < requiredSize) {
ALOGW("Buffer too short, requires %d bytes for entry name", requiredSize);
return requiredSize;
}
- memcpy(buffer, zipEntry->name.name, requiredSize - 1);
+ memcpy(buffer, zipEntry->name.data(), requiredSize - 1);
buffer[requiredSize - 1] = '\0';
return 0;
diff --git a/libs/androidfw/tests/TestHelpers.cpp b/libs/androidfw/tests/TestHelpers.cpp
index 9e320a21b534..a81bb6ffab06 100644
--- a/libs/androidfw/tests/TestHelpers.cpp
+++ b/libs/androidfw/tests/TestHelpers.cpp
@@ -34,9 +34,8 @@ AssertionResult ReadFileFromZipToString(const std::string& zip_path, const std::
<< "': " << ::ErrorCodeString(result);
}
- ::ZipString name(file.c_str());
::ZipEntry entry;
- result = ::FindEntry(handle, name, &entry);
+ result = ::FindEntry(handle, file.c_str(), &entry);
if (result != 0) {
::CloseArchive(handle);
return AssertionFailure() << "Could not find file '" << file << "' in zip '" << zip_path
diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp
index ccbb6c10d3af..53c5ad8eff3c 100644
--- a/libs/hwui/JankTracker.cpp
+++ b/libs/hwui/JankTracker.cpp
@@ -139,7 +139,7 @@ void JankTracker::finishFrame(const FrameInfo& frame) {
(*mGlobalData)->reportJank();
}
- bool isTripleBuffered = mSwapDeadline > frame[FrameInfoIndex::IntendedVsync];
+ bool isTripleBuffered = (mSwapDeadline - frame[FrameInfoIndex::IntendedVsync]) > (mFrameInterval * 0.1);
mSwapDeadline = std::max(mSwapDeadline + mFrameInterval,
frame[FrameInfoIndex::IntendedVsync] + mFrameInterval);
diff --git a/libs/hwui/tests/macrobench/TestSceneRunner.cpp b/libs/hwui/tests/macrobench/TestSceneRunner.cpp
index aa579adfb2ce..9c845f04e820 100644
--- a/libs/hwui/tests/macrobench/TestSceneRunner.cpp
+++ b/libs/hwui/tests/macrobench/TestSceneRunner.cpp
@@ -82,7 +82,7 @@ void outputBenchmarkReport(const TestScene::Info& info, const TestScene::Options
// mean and stddev which doesn't make sense for our usage
std::vector<BenchmarkReporter::Run> reports;
BenchmarkReporter::Run report;
- report.run_name = info.name;
+ report.run_name.function_name = info.name;
report.iterations = static_cast<int64_t>(opts.count);
report.real_accumulated_time = durationInS;
report.cpu_accumulated_time = durationInS;
@@ -95,8 +95,8 @@ void outputBenchmarkReport(const TestScene::Info& info, const TestScene::Options
// in that test case than percentiles.
if (!opts.renderOffscreen) {
for (auto& ri : REPORTS) {
- reports[0].run_name = info.name;
- reports[0].run_name += ri.suffix;
+ reports[0].run_name.function_name = info.name;
+ reports[0].run_name.function_name += ri.suffix;
durationInS = proxy->frameTimePercentile(ri.percentile) / 1000.0;
reports[0].real_accumulated_time = durationInS;
reports[0].cpu_accumulated_time = durationInS;
diff --git a/libs/usb/tests/AccessoryChat/Android.bp b/libs/usb/tests/AccessoryChat/Android.bp
index 4af6274b7ece..63a670c67bfc 100644
--- a/libs/usb/tests/AccessoryChat/Android.bp
+++ b/libs/usb/tests/AccessoryChat/Android.bp
@@ -1 +1,25 @@
subdirs = ["accessorychat"]
+//
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+android_test {
+ name: "AccessoryChat",
+
+ srcs: ["**/*.java"],
+
+ platform_apis: true,
+
+}
diff --git a/libs/usb/tests/AccessoryChat/Android.mk b/libs/usb/tests/AccessoryChat/Android.mk
deleted file mode 100644
index cfe2da1eb471..000000000000
--- a/libs/usb/tests/AccessoryChat/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := AccessoryChat
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)