Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47b94ed3 authored by Adam Lesinski's avatar Adam Lesinski Committed by Android Git Automerger
Browse files

am bb8ac196: Add shared library support to aapt dump

* commit 'bb8ac19684449644bd5218b57c9b14b3de12818e':
  Add shared library support to aapt dump
parents 6dea9bec 63e646ee
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@
    android:versionCode="2">
    <application android:label="SharedLibrary">
        <library android:name="com.google.android.test.shared_library" />
        <activity android:name="ActivityMain">
        <activity android:name="ActivityMain"
                  android:icon="@drawable/size_48x48">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
+1.54 KiB
Loading image diff...
+17 −10
Original line number Diff line number Diff line
@@ -714,7 +714,6 @@ extern char CONSOLE_DATA[2925]; // see EOF
int doDump(Bundle* bundle)
{
    status_t result = UNKNOWN_ERROR;
    Asset* asset = NULL;

    if (bundle->getFileSpecCount() < 1) {
        fprintf(stderr, "ERROR: no dump option specified\n");
@@ -758,12 +757,21 @@ int doDump(Bundle* bundle)
    const ResTable& res = assets.getResources(false);
    if (&res == NULL) {
        fprintf(stderr, "ERROR: dump failed because no resource table was found\n");
        goto bail;
        return 1;
    } else if (res.getError() != NO_ERROR) {
        fprintf(stderr, "ERROR: dump failed because the resource table is invalid/corrupt.\n");
        goto bail;
        return 1;
    }

    const DynamicRefTable* dynamicRefTable = res.getDynamicRefTableForCookie(assetsCookie);
    if (dynamicRefTable == NULL) {
        fprintf(stderr, "ERROR: failed to find dynamic reference table for asset cookie %d\n",
                assetsCookie);
        return 1;
    }

    Asset* asset = NULL;

    if (strcmp("resources", option) == 0) {
#ifndef HAVE_ANDROID_OS
        res.print(bundle->getValues());
@@ -781,8 +789,8 @@ int doDump(Bundle* bundle)

        for (int i=2; i<bundle->getFileSpecCount(); i++) {
            const char* resname = bundle->getFileSpecEntry(i);
            ResXMLTree tree;
            asset = assets.openNonAsset(resname, Asset::ACCESS_BUFFER);
            ResXMLTree tree(dynamicRefTable);
            asset = assets.openNonAsset(assetsCookie, resname, Asset::ACCESS_BUFFER);
            if (asset == NULL) {
                fprintf(stderr, "ERROR: dump failed because resource %s found\n", resname);
                goto bail;
@@ -808,13 +816,13 @@ int doDump(Bundle* bundle)

        for (int i=2; i<bundle->getFileSpecCount(); i++) {
            const char* resname = bundle->getFileSpecEntry(i);
            ResXMLTree tree;
            asset = assets.openNonAsset(resname, Asset::ACCESS_BUFFER);
            asset = assets.openNonAsset(assetsCookie, resname, Asset::ACCESS_BUFFER);
            if (asset == NULL) {
                fprintf(stderr, "ERROR: dump failed because resource %s found\n", resname);
                goto bail;
            }

            ResXMLTree tree(dynamicRefTable);
            if (tree.setTo(asset->getBuffer(true),
                           asset->getLength()) != NO_ERROR) {
                fprintf(stderr, "ERROR: Resource %s is corrupt\n", resname);
@@ -826,14 +834,13 @@ int doDump(Bundle* bundle)
        }

    } else {
        ResXMLTree tree;
        asset = assets.openNonAsset("AndroidManifest.xml",
                                            Asset::ACCESS_BUFFER);
        asset = assets.openNonAsset(assetsCookie, "AndroidManifest.xml", Asset::ACCESS_BUFFER);
        if (asset == NULL) {
            fprintf(stderr, "ERROR: dump failed because no AndroidManifest.xml found\n");
            goto bail;
        }

        ResXMLTree tree(dynamicRefTable);
        if (tree.setTo(asset->getBuffer(true),
                       asset->getLength()) != NO_ERROR) {
            fprintf(stderr, "ERROR: AndroidManifest.xml is corrupt\n");