From 130cf070175379491c779a3a37a7ab17ae12d3bf Mon Sep 17 00:00:00 2001 From: Hugues Evrard Date: Mon, 11 Mar 2019 10:47:30 +0000 Subject: [PATCH] Report whether we can open asset as file descriptor --- gapir/cc/android/asset_replay_service.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gapir/cc/android/asset_replay_service.cpp b/gapir/cc/android/asset_replay_service.cpp index 727fc9b137..9e3ceb170a 100644 --- a/gapir/cc/android/asset_replay_service.cpp +++ b/gapir/cc/android/asset_replay_service.cpp @@ -29,9 +29,18 @@ namespace gapir { std::unique_ptr AssetReplayService::getPayload( const std::string& id) { + AAsset* asset_payload = AAssetManager_open( mAssetManager, kAssetPathPayloadBin, AASSET_MODE_STREAMING); + off64_t outStart; + off64_t outLength; + int fd = AAsset_openFileDescriptor64(asset_payload, &outStart, &outLength); + GAPID_INFO("HUG file descriptor: %d", fd); + if (fd < 0) { + GAPID_INFO("HUG cannot open payload asset as a file descriptor"); + } + // Load payload as a string to be able to use ParseFromString from protobuf // Payload may be quite big, we may have to use file descriptor access to the // asset, but we have to make sure the asset is not compressed.