diff options
| -rw-r--r-- | core/java/android/widget/MultiAutoCompleteTextView.java | 6 | ||||
| -rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 3 | ||||
| -rw-r--r-- | libs/rs/Android.mk | 1 | ||||
| -rw-r--r-- | libs/rs/rs.spec | 1 | ||||
| -rw-r--r-- | libs/rs/rsElement.cpp | 6 | ||||
| -rw-r--r-- | libs/rs/rsFifo.cpp | 31 | ||||
| -rw-r--r-- | libs/rs/rsFifo.h | 49 | ||||
| -rw-r--r-- | libs/rs/rsFifoSocket.cpp | 72 | ||||
| -rw-r--r-- | libs/rs/rsFifoSocket.h | 54 | ||||
| -rw-r--r-- | libs/rs/rsg_generator.c | 182 | ||||
| -rw-r--r-- | libs/rs/spec.l | 19 | ||||
| -rw-r--r-- | media/libstagefright/OggExtractor.cpp | 19 | ||||
| -rw-r--r-- | services/java/com/android/server/pm/PackageManagerService.java | 66 | ||||
| -rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | 1 | 
14 files changed, 455 insertions, 55 deletions
diff --git a/core/java/android/widget/MultiAutoCompleteTextView.java b/core/java/android/widget/MultiAutoCompleteTextView.java index 02c1ec757cd8..134e4c43ef52 100644 --- a/core/java/android/widget/MultiAutoCompleteTextView.java +++ b/core/java/android/widget/MultiAutoCompleteTextView.java @@ -30,7 +30,7 @@ import android.widget.MultiAutoCompleteTextView.Tokenizer;   * can show completion suggestions for the substring of the text where   * the user is typing instead of necessarily for the entire thing.   * <p> - * You must must provide a {@link Tokenizer} to distinguish the + * You must provide a {@link Tokenizer} to distinguish the   * various substrings.   *   * <p>The following code snippet shows how to create a text view which suggests @@ -41,7 +41,7 @@ import android.widget.MultiAutoCompleteTextView.Tokenizer;   *     protected void onCreate(Bundle savedInstanceState) {   *         super.onCreate(savedInstanceState);   *         setContentView(R.layout.autocomplete_7); - *  + *   *         ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,   *                 android.R.layout.simple_dropdown_item_1line, COUNTRIES);   *         MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit); @@ -132,7 +132,7 @@ public class MultiAutoCompleteTextView extends AutoCompleteTextView {       * Instead of validating the entire text, this subclass method validates       * each token of the text individually.  Empty tokens are removed.       */ -    @Override  +    @Override      public void performValidation() {          Validator v = getValidator(); diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 445f4b5c74e6..2eaedaa5424a 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -320,8 +320,7 @@ nElementCreate2(JNIEnv *_env, jobject _this, RsContext con, jintArray _ids, jobj      }      jint id = (jint)rsElementCreate2(con,                                       (RsElement *)ids, fieldCount, -                                     nameArray, fieldCount, -                                     sizeArray, fieldCount, +                                     nameArray, fieldCount * sizeof(size_t),  sizeArray,                                       (const uint32_t *)arraySizes, fieldCount);      for (int ct=0; ct < fieldCount; ct++) {          jstring s = (jstring)_env->GetObjectArrayElement(_names, ct); diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk index c336c0d6a710..ef00b30d4c3f 100644 --- a/libs/rs/Android.mk +++ b/libs/rs/Android.mk @@ -91,6 +91,7 @@ LOCAL_SRC_FILES:= \  	rsDevice.cpp \  	rsElement.cpp \  	rsFBOCache.cpp \ +	rsFifoSocket.cpp \  	rsFileA3D.cpp \  	rsFont.cpp \  	rsLocklessFifo.cpp \ diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec index 5370e25ff82e..00e3a0af91ed 100644 --- a/libs/rs/rs.spec +++ b/libs/rs/rs.spec @@ -176,7 +176,6 @@ ElementCreate {  ElementCreate2 {  	param const RsElement * elements  	param const char ** names -	param const size_t * nameLengths  	param const uint32_t * arraySize  	ret RsElement  	} diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp index d5d5ca5c9032..2b58e9eb0e03 100644 --- a/libs/rs/rsElement.cpp +++ b/libs/rs/rsElement.cpp @@ -347,13 +347,15 @@ RsElement rsi_ElementCreate(Context *rsc,      return (RsElement)e;  } +  RsElement rsi_ElementCreate2(Context *rsc,                               const RsElement * ein,                               size_t ein_length, +                               const char ** names, -                             size_t names_length, -                             const size_t * nameLengths,                               size_t nameLengths_length, +                             const size_t * nameLengths, +                               const uint32_t * arraySizes,                               size_t arraySizes_length) {      const Element *e = Element::create(rsc, ein_length, (const Element **)ein, names, nameLengths, arraySizes); diff --git a/libs/rs/rsFifo.cpp b/libs/rs/rsFifo.cpp new file mode 100644 index 000000000000..3d5d8c45b3c1 --- /dev/null +++ b/libs/rs/rsFifo.cpp @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#include "rsFifoSocket.h" +#include "utils/Timers.h" +#include "utils/StopWatch.h" + +using namespace android; +using namespace android::renderscript; + +Fifo::Fifo() { + +} + +Fifo::~Fifo() { + +} + diff --git a/libs/rs/rsFifo.h b/libs/rs/rsFifo.h new file mode 100644 index 000000000000..f924b958f5aa --- /dev/null +++ b/libs/rs/rsFifo.h @@ -0,0 +1,49 @@ +/* + * 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. + */ + +#ifndef ANDROID_RS_FIFO_H +#define ANDROID_RS_FIFO_H + + +#include "rsUtils.h" + +namespace android { +namespace renderscript { + + +// A simple FIFO to be used as a producer / consumer between two +// threads.  One is writer and one is reader.  The common cases +// will not require locking.  It is not threadsafe for multiple +// readers or writers by design. + +class Fifo { +protected: +    Fifo(); +    virtual ~Fifo(); + +public: +    void virtual writeAsync(const void *data, size_t bytes) = 0; +    void virtual writeWaitReturn(void *ret, size_t retSize) = 0; +    size_t virtual read(void *data, size_t bytes) = 0; +    void virtual readReturn(const void *data, size_t bytes) = 0; + +    void virtual flush() = 0; + +}; + +} +} +#endif diff --git a/libs/rs/rsFifoSocket.cpp b/libs/rs/rsFifoSocket.cpp new file mode 100644 index 000000000000..1ce57b99e895 --- /dev/null +++ b/libs/rs/rsFifoSocket.cpp @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#include "rsFifoSocket.h" +#include "utils/Timers.h" +#include "utils/StopWatch.h" + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/socket.h> + +using namespace android; +using namespace android::renderscript; + +FifoSocket::FifoSocket() { +    sequence = 1; +} + +FifoSocket::~FifoSocket() { + +} + +bool FifoSocket::init() { +    int ret = socketpair(AF_UNIX, SOCK_STREAM, 0, sv); +    return false; +} + +void FifoSocket::shutdown() { +} + +void FifoSocket::writeAsync(const void *data, size_t bytes) { +    size_t ret = ::write(sv[0], data, bytes); +    rsAssert(ret == bytes); +} + +void FifoSocket::writeWaitReturn(void *retData, size_t retBytes) { +    size_t ret = ::read(sv[1], retData, retBytes); +    rsAssert(ret == retBytes); +} + +size_t FifoSocket::read(void *data, size_t bytes) { +    size_t ret = ::read(sv[0], data, bytes); +    rsAssert(ret == bytes); +    return ret; +} + +void FifoSocket::readReturn(const void *data, size_t bytes) { +    size_t ret = ::write(sv[1], data, bytes); +    rsAssert(ret == bytes); +} + + +void FifoSocket::flush() { +} + + diff --git a/libs/rs/rsFifoSocket.h b/libs/rs/rsFifoSocket.h new file mode 100644 index 000000000000..7df2b67d2e9f --- /dev/null +++ b/libs/rs/rsFifoSocket.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#ifndef ANDROID_RS_FIFO_SOCKET_H +#define ANDROID_RS_FIFO_SOCKET_H + + +#include "rsFifo.h" + +namespace android { +namespace renderscript { + + +class FifoSocket { +public: +    FifoSocket(); +    virtual ~FifoSocket(); + +    bool init(); +    void shutdown(); + + + +    void virtual writeAsync(const void *data, size_t bytes); +    void virtual writeWaitReturn(void *ret, size_t retSize); +    size_t virtual read(void *data, size_t bytes); +    void virtual readReturn(const void *data, size_t bytes); + +    void virtual flush(); + +protected: +    int sv[2]; +    uint32_t sequence; + + +}; + +} +} + +#endif diff --git a/libs/rs/rsg_generator.c b/libs/rs/rsg_generator.c index 1d8b9b571213..d550712cc4e0 100644 --- a/libs/rs/rsg_generator.c +++ b/libs/rs/rsg_generator.c @@ -189,6 +189,7 @@ void printApiCpp(FILE *f) {      fprintf(f, "#include \"rsThreadIO.h\"\n");      //fprintf(f, "#include \"rsgApiStructs.h\"\n");      fprintf(f, "#include \"rsgApiFuncDecl.h\"\n"); +    fprintf(f, "#include \"rsFifo.h\"\n");      fprintf(f, "\n");      fprintf(f, "using namespace android;\n");      fprintf(f, "using namespace android::renderscript;\n"); @@ -290,11 +291,103 @@ void printApiCpp(FILE *f) {              if (api->ret.typeName[0]) {                  fprintf(f, "    return reinterpret_cast<"); -                printVarTypeAndName(f, &api->ret); +                printVarType(f, &api->ret);                  fprintf(f, ">(io->mToCoreRet);\n");              }          }          fprintf(f, "};\n\n"); + + +        fprintf(f, "static "); +        printFuncDecl(f, api, "RF_", 0, 0); +        fprintf(f, "\n{\n"); +        fprintf(f, "    Fifo *f = NULL;\n"); +        fprintf(f, "    RS_CMD_%s cmd;\n", api->name); +        fprintf(f, "    const uint32_t cmdSize = sizeof(cmd);\n"); +        fprintf(f, "    const uint32_t cmdID = RS_CMD_ID_%s;\n", api->name); +        fprintf(f, "    f->writeAsync(&cmdID, sizeof(cmdID));\n"); + +        if (api->handcodeApi) { +            fprintf(f, "    rsHCAPI_%s(rsc", api->name); +            for (ct2=0; ct2 < api->paramCount; ct2++) { +                const VarType *vt = &api->params[ct2]; +                if (ct2 > 0 || !api->nocontext) { +                    fprintf(f, ", "); +                } +                fprintf(f, "%s", vt->name); +            } +            fprintf(f, ");\n"); +        } else { +            fprintf(f, "    intptr_t offset = cmdSize;\n"); +            fprintf(f, "    uint32_t dataSize = 0;\n"); +            for (ct2=0; ct2 < api->paramCount; ct2++) { +                const VarType *vt = &api->params[ct2]; +                if (vt->isConst && vt->ptrLevel) { +                    switch(vt->ptrLevel) { +                    case 1: +                        fprintf(f, "    dataSize += %s_length;\n", vt->name); +                        break; +                    case 2: +                        fprintf(f, "    for (size_t ct = 0; ct < (%s_length_length / sizeof(%s_length)); ct++) {\n", vt->name, vt->name); +                        fprintf(f, "        dataSize += %s_length[ct];\n", vt->name); +                        fprintf(f, "    }\n"); +                        break; +                    default: +                        printf("pointer level not handled!!"); +                    } +                } +            } +            fprintf(f, "\n"); + +            for (ct2=0; ct2 < api->paramCount; ct2++) { +                const VarType *vt = &api->params[ct2]; +                switch(vt->ptrLevel) { +                case 0: +                    fprintf(f, "    cmd.%s = %s;\n", vt->name, vt->name); +                    break; +                case 1: +                    fprintf(f, "    cmd.%s = (", vt->name); +                    printVarType(f, vt); +                    fprintf(f, ")offset;\n"); +                    fprintf(f, "    offset += %s_length;\n", vt->name); +                    break; +                case 2: +                    fprintf(f, "    cmd.%s = (", vt->name); +                    printVarType(f, vt); +                    fprintf(f, ")offset;\n"); +                    fprintf(f, "    for (size_t ct = 0; ct < (%s_length_length / sizeof(%s_length)); ct++) {\n", vt->name, vt->name); +                    fprintf(f, "        offset += %s_length[ct];\n", vt->name); +                    fprintf(f, "    }\n"); +                    break; +                default: +                    printf("pointer level not handled!!"); +                } +            } +            fprintf(f, "\n"); + +            fprintf(f, "    f->writeAsync(&cmd, cmdSize);\n"); +            for (ct2=0; ct2 < api->paramCount; ct2++) { +                const VarType *vt = &api->params[ct2]; +                if (vt->ptrLevel == 1) { +                    fprintf(f, "    f->writeAsync(%s, %s_length);\n", vt->name, vt->name); +                } +                if (vt->ptrLevel == 2) { +                    fprintf(f, "    for (size_t ct = 0; ct < (%s_length_length / sizeof(%s_length)); ct++) {\n", vt->name, vt->name); +                    fprintf(f, "        f->writeAsync(%s, %s_length[ct]);\n", vt->name, vt->name); +                    fprintf(f, "        offset += %s_length[ct];\n", vt->name); +                    fprintf(f, "    }\n"); +                } +            } + +            if (api->ret.typeName[0]) { +                fprintf(f, "    "); +                printVarType(f, &api->ret); +                fprintf(f, " retValue;\n"); +                fprintf(f, "    f->writeWaitReturn(&retValue, sizeof(retValue));\n"); +                fprintf(f, "    return retValue;\n"); +            } +        } +        fprintf(f, "}\n\n");      }      fprintf(f, "\n"); @@ -304,8 +397,14 @@ void printApiCpp(FILE *f) {      }      fprintf(f, "};\n"); -    fprintf(f, "static RsApiEntrypoints_t *s_CurrentTable = &s_LocalTable;\n\n"); +    fprintf(f, "\n"); +    fprintf(f, "static RsApiEntrypoints_t s_RemoteTable = {\n"); +    for (ct=0; ct < apiCount; ct++) { +        fprintf(f, "    RF_%s,\n", apis[ct].name); +    } +    fprintf(f, "};\n"); +    fprintf(f, "static RsApiEntrypoints_t *s_CurrentTable = &s_LocalTable;\n\n");      for (ct=0; ct < apiCount; ct++) {          int needFlush = 0;          const ApiEntry * api = &apis[ct]; @@ -357,8 +456,7 @@ void printPlaybackCpp(FILE *f) {              continue;          } -        fprintf(f, "void rsp_%s(Context *con, const void *vp, size_t cmdSizeBytes)\n", api->name); -        fprintf(f, "{\n"); +        fprintf(f, "void rsp_%s(Context *con, const void *vp, size_t cmdSizeBytes) {\n", api->name);          //fprintf(f, "    LOGE(\"play command %s\\n\");\n", api->name);          fprintf(f, "    const RS_CMD_%s *cmd = static_cast<const RS_CMD_%s *>(vp);\n", api->name, api->name); @@ -377,7 +475,63 @@ void printPlaybackCpp(FILE *f) {          fprintf(f, "};\n\n");      } -    fprintf(f, "RsPlaybackFunc gPlaybackFuncs[%i] = {\n", apiCount + 1); +    for (ct=0; ct < apiCount; ct++) { +        const ApiEntry * api = &apis[ct]; + +        fprintf(f, "void rspr_%s(Context *con, Fifo *f, uint8_t *scratch, size_t scratchSize) {\n", api->name); + +        //fprintf(f, "    LOGE(\"play command %s\\n\");\n", api->name); +        fprintf(f, "    RS_CMD_%s cmd;\n", api->name); +        fprintf(f, "    f->read(&cmd, sizeof(cmd));\n"); + +        for (ct2=0; ct2 < api->paramCount; ct2++) { +            const VarType *vt = &api->params[ct2]; +            if (vt->ptrLevel == 1) { +                fprintf(f, "    cmd.%s = (", vt->name); +                printVarType(f, vt); +                fprintf(f, ")scratch;\n"); +                fprintf(f, "    f->read(scratch, cmd.%s_length);\n", vt->name); +                fprintf(f, "    scratch += cmd.%s_length;\n", vt->name); +            } +            if (vt->ptrLevel == 2) { +                fprintf(f, "    size_t sum_%s = 0;\n", vt->name); +                fprintf(f, "    for (size_t ct = 0; ct < (cmd.%s_length_length / sizeof(cmd.%s_length)); ct++) {\n", vt->name, vt->name); +                fprintf(f, "        ((size_t *)scratch)[ct] = cmd.%s_length[ct];\n", vt->name); +                fprintf(f, "        sum_%s += cmd.%s_length[ct];\n", vt->name, vt->name); +                fprintf(f, "    }\n"); +                fprintf(f, "    f->read(scratch, sum_%s);\n", vt->name); +                fprintf(f, "    scratch += sum_%s;\n", vt->name); +            } +        } +        fprintf(f, "\n"); + +        if (api->ret.typeName[0]) { +            fprintf(f, "    "); +            printVarType(f, &api->ret); +            fprintf(f, " ret =\n"); +        } + +        fprintf(f, "    rsi_%s(", api->name); +        if (!api->nocontext) { +            fprintf(f, "con"); +        } +        for (ct2=0; ct2 < api->paramCount; ct2++) { +            const VarType *vt = &api->params[ct2]; +            if (ct2 > 0 || !api->nocontext) { +                fprintf(f, ",\n"); +            } +            fprintf(f, "           cmd.%s", vt->name); +        } +        fprintf(f, ");\n"); + +        if (api->ret.typeName[0]) { +            fprintf(f, "    f->readReturn(&ret, sizeof(ret));\n"); +        } + +        fprintf(f, "};\n\n"); +    } + +    fprintf(f, "RsPlaybackLocalFunc gPlaybackFuncs[%i] = {\n", apiCount + 1);      fprintf(f, "    NULL,\n");      for (ct=0; ct < apiCount; ct++) {          if (apis[ct].direct) { @@ -388,6 +542,13 @@ void printPlaybackCpp(FILE *f) {      }      fprintf(f, "};\n"); +    fprintf(f, "RsPlaybackRemoteFunc gPlaybackRemoteFuncs[%i] = {\n", apiCount + 1); +    fprintf(f, "    NULL,\n"); +    for (ct=0; ct < apiCount; ct++) { +        fprintf(f, "    %s%s,\n", "rspr_", apis[ct].name); +    } +    fprintf(f, "};\n"); +      fprintf(f, "};\n");      fprintf(f, "};\n");  } @@ -422,14 +583,21 @@ int main(int argc, char **argv) {          {              fprintf(f, "\n");              fprintf(f, "#include \"rsContext.h\"\n"); +            fprintf(f, "#include \"rsFifo.h\"\n");              fprintf(f, "\n");              fprintf(f, "namespace android {\n");              fprintf(f, "namespace renderscript {\n");              printStructures(f);              printFuncDecls(f, "rsi_", 1);              printPlaybackFuncs(f, "rsp_"); -            fprintf(f, "\n\ntypedef void (*RsPlaybackFunc)(Context *, const void *, size_t sizeBytes);\n"); -            fprintf(f, "extern RsPlaybackFunc gPlaybackFuncs[%i];\n", apiCount + 1); +            fprintf(f, "\n\ntypedef struct RsPlaybackRemoteHeaderRec {\n"); +            fprintf(f, "    uint32_t command;\n"); +            fprintf(f, "    uint32_t size;\n"); +            fprintf(f, "} RsPlaybackRemoteHeader;\n\n"); +            fprintf(f, "typedef void (*RsPlaybackLocalFunc)(Context *, const void *, size_t sizeBytes);\n"); +            fprintf(f, "typedef void (*RsPlaybackRemoteFunc)(Context *, Fifo *, uint8_t *scratch, size_t scratchSize);\n"); +            fprintf(f, "extern RsPlaybackLocalFunc gPlaybackFuncs[%i];\n", apiCount + 1); +            fprintf(f, "extern RsPlaybackRemoteFunc gPlaybackRemoteFuncs[%i];\n", apiCount + 1);              fprintf(f, "}\n");              fprintf(f, "}\n"); diff --git a/libs/rs/spec.l b/libs/rs/spec.l index dcd4435963c0..a24bfd33add5 100644 --- a/libs/rs/spec.l +++ b/libs/rs/spec.l @@ -21,15 +21,26 @@ ID       [a-zA-Z_][a-zA-Z0-9_]*     int typeNextState;     void checkPointerType() { -       VarType *lastType = currType; -       if (lastType->ptrLevel) { +       VarType *baseType = currType; +       int curPtrLevel = 0; +       while (curPtrLevel < baseType->ptrLevel) {             currType = &apis[apiCount].params[apis[apiCount].paramCount];             currType->type = 4; +           currType->ptrLevel = curPtrLevel; +           if (currType->ptrLevel > 0) { +              currType->isConst = 1; +           }             sprintf(currType->typeName, "%s", "size_t"); -           if (lastType->name[0]) { -               sprintf(currType->name, "%s_length", lastType->name); +           switch(baseType->ptrLevel - curPtrLevel) { +           case 1: +              sprintf(currType->name, "%s_length", baseType->name); +              break; +           case 2: +              sprintf(currType->name, "%s_length_length", baseType->name); +              break;             }             apis[apiCount].paramCount++; +           curPtrLevel ++;         }     } diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp index 6538a051ac6d..1560b8ed35d7 100644 --- a/media/libstagefright/OggExtractor.cpp +++ b/media/libstagefright/OggExtractor.cpp @@ -378,12 +378,19 @@ status_t MyVorbisExtractor::seekToOffset(off64_t offset) {  ssize_t MyVorbisExtractor::readPage(off64_t offset, Page *page) {      uint8_t header[27]; -    if (mSource->readAt(offset, header, sizeof(header)) +    ssize_t n; +    if ((n = mSource->readAt(offset, header, sizeof(header)))              < (ssize_t)sizeof(header)) { -        LOGV("failed to read %d bytes at offset 0x%016llx", -             sizeof(header), offset); +        LOGV("failed to read %d bytes at offset 0x%016llx, got %ld bytes", +             sizeof(header), offset, n); -        return ERROR_IO; +        if (n < 0) { +            return n; +        } else if (n == 0) { +            return ERROR_END_OF_STREAM; +        } else { +            return ERROR_IO; +        }      }      if (memcmp(header, "OggS", 4)) { @@ -498,8 +505,8 @@ status_t MyVorbisExtractor::readNextPacket(MediaBuffer **out) {                      packetSize);              if (n < (ssize_t)packetSize) { -                LOGV("failed to read %d bytes at 0x%016llx", -                     packetSize, dataOffset); +                LOGV("failed to read %d bytes at 0x%016llx, got %ld bytes", +                     packetSize, dataOffset, n);                  return ERROR_IO;              } diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 6e1093f0ece0..de439caff67c 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -2855,8 +2855,8 @@ public class PackageManagerService extends IPackageManager.Stub {      }      private File getDataPathForPackage(String packageName, int userId) { -        return new File(mUserAppDataDir.getAbsolutePath() + File.separator -                    + userId + File.separator + packageName); +        return new File(mUserAppDataDir.getAbsolutePath() + File.separator + userId +                + File.separator + packageName);      }      private PackageParser.Package scanPackageLI(PackageParser.Package pkg, @@ -3319,36 +3319,42 @@ public class PackageManagerService extends IPackageManager.Stub {               *        only for non-system apps and system app upgrades.               */              if (pkg.applicationInfo.nativeLibraryDir != null) { -                final File nativeLibraryDir = new File(pkg.applicationInfo.nativeLibraryDir); -                final String dataPathString = dataPath.getPath(); +                try { +                    final File nativeLibraryDir = new File(pkg.applicationInfo.nativeLibraryDir); +                    final String dataPathString = dataPath.getCanonicalFile().getPath(); -                if (isSystemApp(pkg) && !isUpdatedSystemApp(pkg)) { -                    /* -                     * Upgrading from a previous version of the OS sometimes -                     * leaves native libraries in the /data/data/<app>/lib -                     * directory for system apps even when they shouldn't be. -                     * Recent changes in the JNI library search path -                     * necessitates we remove those to match previous behavior. -                     */ -                    if (NativeLibraryHelper.removeNativeBinariesFromDirLI(nativeLibraryDir)) { -                        Log.i(TAG, "removed obsolete native libraries for system package " + path); +                    if (isSystemApp(pkg) && !isUpdatedSystemApp(pkg)) { +                        /* +                         * Upgrading from a previous version of the OS sometimes +                         * leaves native libraries in the /data/data/<app>/lib +                         * directory for system apps even when they shouldn't be. +                         * Recent changes in the JNI library search path +                         * necessitates we remove those to match previous behavior. +                         */ +                        if (NativeLibraryHelper.removeNativeBinariesFromDirLI(nativeLibraryDir)) { +                            Log.i(TAG, "removed obsolete native libraries for system package " +                                    + path); +                        } +                    } else if (nativeLibraryDir.getCanonicalFile().getParent() +                            .equals(dataPathString)) { +                        /* +                         * If this is an internal application or our +                         * nativeLibraryPath points to our data directory, unpack +                         * the libraries. The native library path pointing to the +                         * data directory for an application in an ASEC container +                         * can happen for older apps that existed before an OTA to +                         * Gingerbread. +                         */ +                        Slog.i(TAG, "Unpacking native libraries for " + path); +                        mInstaller.unlinkNativeLibraryDirectory(dataPathString); +                        NativeLibraryHelper.copyNativeBinariesLI(scanFile, nativeLibraryDir); +                    } else { +                        Slog.i(TAG, "Linking native library dir for " + path); +                        mInstaller.linkNativeLibraryDirectory(dataPathString, +                                pkg.applicationInfo.nativeLibraryDir);                      } -                } else if (nativeLibraryDir.getParent().equals(dataPathString)) { -                    /* -                     * If this is an internal application or our -                     * nativeLibraryPath points to our data directory, unpack -                     * the libraries. The native library path pointing to the -                     * data directory for an application in an ASEC container -                     * can happen for older apps that existed before an OTA to -                     * Gingerbread. -                     */ -                    Slog.i(TAG, "Unpacking native libraries for " + path); -                    mInstaller.unlinkNativeLibraryDirectory(dataPathString); -                    NativeLibraryHelper.copyNativeBinariesLI(scanFile, nativeLibraryDir); -                } else { -                    Slog.i(TAG, "Linking native library dir for " + path); -                    mInstaller.linkNativeLibraryDirectory(dataPathString, -                            pkg.applicationInfo.nativeLibraryDir); +                } catch (IOException ioe) { +                    Log.e(TAG, "Unable to get canonical file " + ioe.toString());                  }              }              pkg.mScanPath = path; diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index 8d3fd1d722d0..e3ff1b76a58a 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -125,6 +125,7 @@ public class TestShellActivity extends Activity implements LayoutTestController      }      private void setDumpTimeout(long timeout) { +        Log.v(LOGTAG, "setting dump timeout at " + timeout);          Message msg = mHandler.obtainMessage(MSG_DUMP_TIMEOUT);          mHandler.sendMessageDelayed(msg, timeout);      }  |