diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/androidfw/ApkAssets.cpp | 13 | ||||
| -rw-r--r-- | libs/androidfw/AssetManager.cpp | 4 | ||||
| -rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 4 | ||||
| -rw-r--r-- | libs/androidfw/ZipFileRO.cpp | 15 | ||||
| -rw-r--r-- | libs/androidfw/include/androidfw/AssetManager.h | 2 | ||||
| -rw-r--r-- | libs/androidfw/tests/TestHelpers.cpp | 3 | ||||
| -rw-r--r-- | libs/hwui/Android.bp | 6 | ||||
| -rw-r--r-- | libs/hwui/DamageAccumulator.h | 2 | ||||
| -rw-r--r-- | libs/hwui/JankTracker.cpp | 2 | ||||
| -rw-r--r-- | libs/hwui/pipeline/skia/LayerDrawable.cpp | 60 | ||||
| -rw-r--r-- | libs/hwui/service/GraphicsStatsService.cpp | 6 | ||||
| -rw-r--r-- | libs/hwui/surfacetexture/ImageConsumer.cpp | 18 | ||||
| -rw-r--r-- | libs/hwui/surfacetexture/ImageConsumer.h | 5 | ||||
| -rw-r--r-- | libs/hwui/tests/macrobench/TestSceneRunner.cpp | 6 | ||||
| -rw-r--r-- | libs/protoutil/include/android/util/ProtoOutputStream.h | 1 | ||||
| -rw-r--r-- | libs/protoutil/src/ProtoOutputStream.cpp | 28 | ||||
| -rw-r--r-- | libs/usb/tests/AccessoryChat/Android.bp | 24 | ||||
| -rw-r--r-- | libs/usb/tests/AccessoryChat/Android.mk | 28 |
18 files changed, 134 insertions, 93 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/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 4755cb866310..f7c83371f79c 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -74,7 +74,7 @@ const char* AssetManager::RESOURCES_FILENAME = "resources.arsc"; const char* AssetManager::IDMAP_BIN = "/system/bin/idmap"; const char* AssetManager::VENDOR_OVERLAY_DIR = "/vendor/overlay"; const char* AssetManager::PRODUCT_OVERLAY_DIR = "/product/overlay"; -const char* AssetManager::PRODUCT_SERVICES_OVERLAY_DIR = "/product_services/overlay"; +const char* AssetManager::SYSTEM_EXT_OVERLAY_DIR = "/system_ext/overlay"; const char* AssetManager::ODM_OVERLAY_DIR = "/odm/overlay"; const char* AssetManager::OEM_OVERLAY_DIR = "/oem/overlay"; const char* AssetManager::OVERLAY_THEME_DIR_PROPERTY = "ro.boot.vendor.overlay.theme"; @@ -575,7 +575,7 @@ bool AssetManager::appendPathToResTable(asset_path& ap, bool appAsLib) const { mZipSet.setZipResourceTableAsset(ap.path, ass); } } - + if (nextEntryIdx == 0 && ass != NULL) { // If this is the first resource table in the asset // manager, then we are going to cache it so that we diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 2ad2e76cc696..66df59b4c83b 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -7403,12 +7403,12 @@ void ResTable::print_value(const Package* pkg, const Res_value& value) const print_complex(value.data, true); printf("\n"); } else if (value.dataType >= Res_value::TYPE_FIRST_COLOR_INT - || value.dataType <= Res_value::TYPE_LAST_COLOR_INT) { + && value.dataType <= Res_value::TYPE_LAST_COLOR_INT) { printf("(color) #%08x\n", value.data); } else if (value.dataType == Res_value::TYPE_INT_BOOLEAN) { printf("(boolean) %s\n", value.data ? "true" : "false"); } else if (value.dataType >= Res_value::TYPE_FIRST_INT - || value.dataType <= Res_value::TYPE_LAST_INT) { + && value.dataType <= Res_value::TYPE_LAST_INT) { printf("(int) 0x%08x or %d\n", value.data, value.data); } else { printf("(unknown type) t=0x%02x d=0x%08x (s=0x%04x r=0x%02x)\n", 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/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h index 66fba26b7289..ce0985b38986 100644 --- a/libs/androidfw/include/androidfw/AssetManager.h +++ b/libs/androidfw/include/androidfw/AssetManager.h @@ -61,7 +61,7 @@ public: static const char* IDMAP_BIN; static const char* VENDOR_OVERLAY_DIR; static const char* PRODUCT_OVERLAY_DIR; - static const char* PRODUCT_SERVICES_OVERLAY_DIR; + static const char* SYSTEM_EXT_OVERLAY_DIR; static const char* ODM_OVERLAY_DIR; static const char* OEM_OVERLAY_DIR; /* 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/Android.bp b/libs/hwui/Android.bp index ebba4cb79dfb..f51848e5691a 100644 --- a/libs/hwui/Android.bp +++ b/libs/hwui/Android.bp @@ -26,8 +26,10 @@ cc_defaults { // a problem "-Wno-free-nonheap-object", - // clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629 - "-Wno-missing-braces", + // Clang is producing non-determistic binary when the new pass manager is + // enabled. Disable the new PM as a temporary workaround. + // b/142372146 + "-fno-experimental-new-pass-manager", ], include_dirs: [ diff --git a/libs/hwui/DamageAccumulator.h b/libs/hwui/DamageAccumulator.h index 7d0b6877a71a..030a20f31c42 100644 --- a/libs/hwui/DamageAccumulator.h +++ b/libs/hwui/DamageAccumulator.h @@ -27,7 +27,7 @@ // Smaller than INT_MIN/INT_MAX because we offset these values // and thus don't want to be adding offsets to INT_MAX, that's bad #define DIRTY_MIN (-0x7ffffff - 1) -#define DIRTY_MAX (0x7ffffff) +#define DIRTY_MAX (0x8000000) namespace android { namespace uirenderer { 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/pipeline/skia/LayerDrawable.cpp b/libs/hwui/pipeline/skia/LayerDrawable.cpp index eed19420a78a..f839213e9007 100644 --- a/libs/hwui/pipeline/skia/LayerDrawable.cpp +++ b/libs/hwui/pipeline/skia/LayerDrawable.cpp @@ -33,21 +33,38 @@ void LayerDrawable::onDraw(SkCanvas* canvas) { } } -// This is a less-strict matrix.isTranslate() that will still report being translate-only -// on imperceptibly small scaleX & scaleY values. -static bool isBasicallyTranslate(const SkMatrix& matrix) { - if (!matrix.isScaleTranslate()) return false; - return MathUtils::isOne(matrix.getScaleX()) && MathUtils::isOne(matrix.getScaleY()); +static inline SkScalar isIntegerAligned(SkScalar x) { + return fabsf(roundf(x) - x) <= NON_ZERO_EPSILON; } -static bool shouldFilter(const SkMatrix& matrix) { - if (!matrix.isScaleTranslate()) return true; - - // We only care about meaningful scale here - bool noScale = MathUtils::isOne(matrix.getScaleX()) && MathUtils::isOne(matrix.getScaleY()); - bool pixelAligned = - SkScalarIsInt(matrix.getTranslateX()) && SkScalarIsInt(matrix.getTranslateY()); - return !(noScale && pixelAligned); +// Disable filtering when there is no scaling in screen coordinates and the corners have the same +// fraction (for translate) or zero fraction (for any other rect-to-rect transform). +static bool shouldFilterRect(const SkMatrix& matrix, const SkRect& srcRect, const SkRect& dstRect) { + if (!matrix.rectStaysRect()) return true; + SkRect dstDevRect = matrix.mapRect(dstRect); + float dstW, dstH; + if (MathUtils::isZero(matrix.getScaleX()) && MathUtils::isZero(matrix.getScaleY())) { + // Has a 90 or 270 degree rotation, although total matrix may also have scale factors + // in m10 and m01. Those scalings are automatically handled by mapRect so comparing + // dimensions is sufficient, but swap width and height comparison. + dstW = dstDevRect.height(); + dstH = dstDevRect.width(); + } else { + // Handle H/V flips or 180 rotation matrices. Axes may have been mirrored, but + // dimensions are still safe to compare directly. + dstW = dstDevRect.width(); + dstH = dstDevRect.height(); + } + if (!(MathUtils::areEqual(dstW, srcRect.width()) && + MathUtils::areEqual(dstH, srcRect.height()))) { + return true; + } + // Device rect and source rect should be integer aligned to ensure there's no difference + // in how nearest-neighbor sampling is resolved. + return !(isIntegerAligned(srcRect.x()) && + isIntegerAligned(srcRect.y()) && + isIntegerAligned(dstDevRect.x()) && + isIntegerAligned(dstDevRect.y())); } bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer, @@ -114,24 +131,21 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer skiaDestRect = SkRect::MakeIWH(layerWidth, layerHeight); } matrixInv.mapRect(&skiaDestRect); - // If (matrix is identity or an integer translation) and (src/dst buffers size match), + // If (matrix is a rect-to-rect transform) + // and (src/dst buffers size match in screen coordinates) + // and (src/dst corners align fractionally), // then use nearest neighbor, otherwise use bilerp sampling. - // Integer translation is defined as when src rect and dst rect align fractionally. // Skia TextureOp has the above logic build-in, but not NonAAFillRectOp. TextureOp works // only for SrcOver blending and without color filter (readback uses Src blending). - bool isIntegerTranslate = - isBasicallyTranslate(totalMatrix) && - SkScalarFraction(skiaDestRect.fLeft + totalMatrix[SkMatrix::kMTransX]) == - SkScalarFraction(skiaSrcRect.fLeft) && - SkScalarFraction(skiaDestRect.fTop + totalMatrix[SkMatrix::kMTransY]) == - SkScalarFraction(skiaSrcRect.fTop); - if (layer->getForceFilter() || !isIntegerTranslate) { + if (layer->getForceFilter() || + shouldFilterRect(totalMatrix, skiaSrcRect, skiaDestRect)) { paint.setFilterQuality(kLow_SkFilterQuality); } canvas->drawImageRect(layerImage.get(), skiaSrcRect, skiaDestRect, &paint, SkCanvas::kFast_SrcRectConstraint); } else { - if (layer->getForceFilter() || shouldFilter(totalMatrix)) { + SkRect imageRect = SkRect::MakeIWH(layerImage->width(), layerImage->height()); + if (layer->getForceFilter() || shouldFilterRect(totalMatrix, imageRect, imageRect)) { paint.setFilterQuality(kLow_SkFilterQuality); } canvas->drawImage(layerImage.get(), 0, 0, &paint); diff --git a/libs/hwui/service/GraphicsStatsService.cpp b/libs/hwui/service/GraphicsStatsService.cpp index 8a16b2077f6f..f79c8d3351e0 100644 --- a/libs/hwui/service/GraphicsStatsService.cpp +++ b/libs/hwui/service/GraphicsStatsService.cpp @@ -234,9 +234,9 @@ void dumpAsTextToFd(protos::GraphicsStatsProto* proto, int fd) { return; } dprintf(fd, "\nPackage: %s", proto->package_name().c_str()); - dprintf(fd, "\nVersion: %lld", proto->version_code()); - dprintf(fd, "\nStats since: %lldns", proto->stats_start()); - dprintf(fd, "\nStats end: %lldns", proto->stats_end()); + dprintf(fd, "\nVersion: %" PRId64, proto->version_code()); + dprintf(fd, "\nStats since: %" PRId64 "ns", proto->stats_start()); + dprintf(fd, "\nStats end: %" PRId64 "ns", proto->stats_end()); auto summary = proto->summary(); dprintf(fd, "\nTotal frames rendered: %d", summary.total_frames()); dprintf(fd, "\nJanky frames: %d (%.2f%%)", summary.janky_frames(), diff --git a/libs/hwui/surfacetexture/ImageConsumer.cpp b/libs/hwui/surfacetexture/ImageConsumer.cpp index bae616bbc636..17ee17d5cd1d 100644 --- a/libs/hwui/surfacetexture/ImageConsumer.cpp +++ b/libs/hwui/surfacetexture/ImageConsumer.cpp @@ -71,13 +71,16 @@ public: void makeImage(sp<GraphicBuffer>& graphicBuffer, android_dataspace dataspace, GrContext* context); + void newBufferContent(GrContext* context); + private: // The only way to invoke dtor is with unref, when mUsageCount is 0. ~AutoBackendTextureRelease() {} GrBackendTexture mBackendTexture; GrAHardwareBufferUtils::DeleteImageProc mDeleteProc; - GrAHardwareBufferUtils::DeleteImageCtx mDeleteCtx; + GrAHardwareBufferUtils::UpdateImageProc mUpdateProc; + GrAHardwareBufferUtils::TexImageCtx mImageCtx; // Starting with refcount 1, because the first ref is held by SurfaceTexture. Additional refs // are held by SkImages. @@ -101,7 +104,8 @@ AutoBackendTextureRelease::AutoBackendTextureRelease(GrContext* context, Graphic buffer->getWidth(), buffer->getHeight(), &mDeleteProc, - &mDeleteCtx, + &mUpdateProc, + &mImageCtx, createProtectedImage, backendFormat, false); @@ -123,7 +127,7 @@ void AutoBackendTextureRelease::unref(bool releaseImage) { mUsageCount--; if (mUsageCount <= 0) { if (mBackendTexture.isValid()) { - mDeleteProc(mDeleteCtx); + mDeleteProc(mImageCtx); mBackendTexture = {}; } delete this; @@ -154,6 +158,12 @@ void AutoBackendTextureRelease::makeImage(sp<GraphicBuffer>& graphicBuffer, } } +void AutoBackendTextureRelease::newBufferContent(GrContext* context) { + if (mBackendTexture.isValid()) { + mUpdateProc(mImageCtx, context); + } +} + void ImageConsumer::ImageSlot::createIfNeeded(sp<GraphicBuffer> graphicBuffer, android_dataspace dataspace, bool forceCreate, GrContext* context) { @@ -166,6 +176,8 @@ void ImageConsumer::ImageSlot::createIfNeeded(sp<GraphicBuffer> graphicBuffer, if (!mTextureRelease) { mTextureRelease = new AutoBackendTextureRelease(context, graphicBuffer.get()); + } else { + mTextureRelease->newBufferContent(context); } mDataspace = dataspace; diff --git a/libs/hwui/surfacetexture/ImageConsumer.h b/libs/hwui/surfacetexture/ImageConsumer.h index 2fdece989876..3e2a91a251f7 100644 --- a/libs/hwui/surfacetexture/ImageConsumer.h +++ b/libs/hwui/surfacetexture/ImageConsumer.h @@ -26,11 +26,6 @@ #include <gui/BufferItem.h> #include <system/graphics.h> -namespace GrAHardwareBufferUtils { -typedef void* DeleteImageCtx; -typedef void (*DeleteImageProc)(DeleteImageCtx); -} - namespace android { namespace uirenderer { 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/protoutil/include/android/util/ProtoOutputStream.h b/libs/protoutil/include/android/util/ProtoOutputStream.h index a6af4757a140..42bf03e6de05 100644 --- a/libs/protoutil/include/android/util/ProtoOutputStream.h +++ b/libs/protoutil/include/android/util/ProtoOutputStream.h @@ -98,6 +98,7 @@ public: bool write(uint64_t fieldId, double val); bool write(uint64_t fieldId, float val); bool write(uint64_t fieldId, int val); + bool write(uint64_t fieldId, long val); bool write(uint64_t fieldId, long long val); bool write(uint64_t fieldId, bool val); bool write(uint64_t fieldId, std::string val); diff --git a/libs/protoutil/src/ProtoOutputStream.cpp b/libs/protoutil/src/ProtoOutputStream.cpp index 6cfa357b580b..ea9b79a0353f 100644 --- a/libs/protoutil/src/ProtoOutputStream.cpp +++ b/libs/protoutil/src/ProtoOutputStream.cpp @@ -116,6 +116,34 @@ ProtoOutputStream::write(uint64_t fieldId, int val) } bool +ProtoOutputStream::write(uint64_t fieldId, long val) +{ + if (mCompact) return false; + const uint32_t id = (uint32_t)fieldId; + switch (fieldId & FIELD_TYPE_MASK) { + case FIELD_TYPE_DOUBLE: writeDoubleImpl(id, (double)val); break; + case FIELD_TYPE_FLOAT: writeFloatImpl(id, (float)val); break; + case FIELD_TYPE_INT64: writeInt64Impl(id, (long long)val); break; + case FIELD_TYPE_UINT64: writeUint64Impl(id, (uint64_t)val); break; + case FIELD_TYPE_INT32: writeInt32Impl(id, (int)val); break; + case FIELD_TYPE_FIXED64: writeFixed64Impl(id, (uint64_t)val); break; + case FIELD_TYPE_FIXED32: writeFixed32Impl(id, (uint32_t)val); break; + case FIELD_TYPE_UINT32: writeUint32Impl(id, (uint32_t)val); break; + case FIELD_TYPE_SFIXED32: writeSFixed32Impl(id, (int)val); break; + case FIELD_TYPE_SFIXED64: writeSFixed64Impl(id, (long long)val); break; + case FIELD_TYPE_SINT32: writeZigzagInt32Impl(id, (int)val); break; + case FIELD_TYPE_SINT64: writeZigzagInt64Impl(id, (long long)val); break; + case FIELD_TYPE_ENUM: writeEnumImpl(id, (int)val); break; + case FIELD_TYPE_BOOL: writeBoolImpl(id, val != 0); break; + default: + ALOGW("Field type %d is not supported when writing long val.", + (int)((fieldId & FIELD_TYPE_MASK) >> FIELD_TYPE_SHIFT)); + return false; + } + return true; +} + +bool ProtoOutputStream::write(uint64_t fieldId, long long val) { return internalWrite(fieldId, val, "long long"); 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) |