Skip to content

Commit

Permalink
Report whether we can open asset as file descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
hevrard committed Mar 11, 2019
1 parent 655ac5e commit 130cf07
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gapir/cc/android/asset_replay_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ namespace gapir {

std::unique_ptr<ReplayService::Payload> 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.
Expand Down

0 comments on commit 130cf07

Please sign in to comment.