am 69920427
: Merge "Fix a variety of small publicly-reported bugs."
* commit '69920427ea01421d34f3a7576bdd135527b20859': Fix a variety of small publicly-reported bugs.
This commit is contained in:
@ -159,8 +159,8 @@ status_t BootAnimation::initTexture(void* buffer, size_t len)
|
|||||||
SkBitmap bitmap;
|
SkBitmap bitmap;
|
||||||
SkMemoryStream stream(buffer, len);
|
SkMemoryStream stream(buffer, len);
|
||||||
SkImageDecoder* codec = SkImageDecoder::Factory(&stream);
|
SkImageDecoder* codec = SkImageDecoder::Factory(&stream);
|
||||||
codec->setDitherImage(false);
|
|
||||||
if (codec) {
|
if (codec) {
|
||||||
|
codec->setDitherImage(false);
|
||||||
codec->decode(&stream, &bitmap,
|
codec->decode(&stream, &bitmap,
|
||||||
SkBitmap::kARGB_8888_Config,
|
SkBitmap::kARGB_8888_Config,
|
||||||
SkImageDecoder::kDecodePixels_Mode);
|
SkImageDecoder::kDecodePixels_Mode);
|
||||||
@ -270,7 +270,7 @@ status_t BootAnimation::readyToRun() {
|
|||||||
|
|
||||||
mAndroidAnimation = true;
|
mAndroidAnimation = true;
|
||||||
|
|
||||||
// If the device has encryption turned on or is in process
|
// If the device has encryption turned on or is in process
|
||||||
// of being encrypted we show the encrypted boot animation.
|
// of being encrypted we show the encrypted boot animation.
|
||||||
char decrypt[PROPERTY_VALUE_MAX];
|
char decrypt[PROPERTY_VALUE_MAX];
|
||||||
property_get("vold.decrypt", decrypt, "");
|
property_get("vold.decrypt", decrypt, "");
|
||||||
|
@ -335,6 +335,7 @@ static jint read_binder_stat(const char* stat)
|
|||||||
// loop until we have the block that represents this process
|
// loop until we have the block that represents this process
|
||||||
do {
|
do {
|
||||||
if (fgets(line, 1024, fp) == 0) {
|
if (fgets(line, 1024, fp) == 0) {
|
||||||
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} while (strncmp(compare, line, len));
|
} while (strncmp(compare, line, len));
|
||||||
@ -344,13 +345,16 @@ static jint read_binder_stat(const char* stat)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (fgets(line, 1024, fp) == 0) {
|
if (fgets(line, 1024, fp) == 0) {
|
||||||
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} while (strncmp(compare, line, len));
|
} while (strncmp(compare, line, len));
|
||||||
|
|
||||||
// we have the line, now increment the line ptr to the value
|
// we have the line, now increment the line ptr to the value
|
||||||
char* ptr = line + len;
|
char* ptr = line + len;
|
||||||
return atoi(ptr);
|
jint result = atoi(ptr);
|
||||||
|
fclose(fp);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint android_os_Debug_getBinderSentTransactions(JNIEnv *env, jobject clazz)
|
static jint android_os_Debug_getBinderSentTransactions(JNIEnv *env, jobject clazz)
|
||||||
|
@ -395,7 +395,7 @@ static int pid_compare(const void* v1, const void* v2)
|
|||||||
return *((const jint*)v1) - *((const jint*)v2);
|
return *((const jint*)v1) - *((const jint*)v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jlong getFreeMemoryImpl(const char* const sums[], const int sumsLen[], int num)
|
static jlong getFreeMemoryImpl(const char* const sums[], const size_t sumsLen[], size_t num)
|
||||||
{
|
{
|
||||||
int fd = open("/proc/meminfo", O_RDONLY);
|
int fd = open("/proc/meminfo", O_RDONLY);
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ static jlong getFreeMemoryImpl(const char* const sums[], const int sumsLen[], in
|
|||||||
}
|
}
|
||||||
buffer[len] = 0;
|
buffer[len] = 0;
|
||||||
|
|
||||||
int numFound = 0;
|
size_t numFound = 0;
|
||||||
jlong mem = 0;
|
jlong mem = 0;
|
||||||
|
|
||||||
char* p = buffer;
|
char* p = buffer;
|
||||||
@ -446,14 +446,14 @@ static jlong getFreeMemoryImpl(const char* const sums[], const int sumsLen[], in
|
|||||||
static jlong android_os_Process_getFreeMemory(JNIEnv* env, jobject clazz)
|
static jlong android_os_Process_getFreeMemory(JNIEnv* env, jobject clazz)
|
||||||
{
|
{
|
||||||
static const char* const sums[] = { "MemFree:", "Cached:", NULL };
|
static const char* const sums[] = { "MemFree:", "Cached:", NULL };
|
||||||
static const int sumsLen[] = { strlen("MemFree:"), strlen("Cached:"), 0 };
|
static const size_t sumsLen[] = { strlen("MemFree:"), strlen("Cached:"), 0 };
|
||||||
return getFreeMemoryImpl(sums, sumsLen, 2);
|
return getFreeMemoryImpl(sums, sumsLen, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jlong android_os_Process_getTotalMemory(JNIEnv* env, jobject clazz)
|
static jlong android_os_Process_getTotalMemory(JNIEnv* env, jobject clazz)
|
||||||
{
|
{
|
||||||
static const char* const sums[] = { "MemTotal:", NULL };
|
static const char* const sums[] = { "MemTotal:", NULL };
|
||||||
static const int sumsLen[] = { strlen("MemTotal:"), 0 };
|
static const size_t sumsLen[] = { strlen("MemTotal:"), 0 };
|
||||||
return getFreeMemoryImpl(sums, sumsLen, 1);
|
return getFreeMemoryImpl(sums, sumsLen, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,13 +711,13 @@ jboolean android_os_Process_parseProcLineArray(JNIEnv* env, jobject clazz,
|
|||||||
|
|
||||||
jsize end = -1;
|
jsize end = -1;
|
||||||
if ((mode&PROC_PARENS) != 0) {
|
if ((mode&PROC_PARENS) != 0) {
|
||||||
while (buffer[i] != ')' && i < endIndex) {
|
while (i < endIndex && buffer[i] != ')') {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
end = i;
|
end = i;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
while (buffer[i] != term && i < endIndex) {
|
while (i < endIndex && buffer[i] != term) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
@ -727,7 +727,7 @@ jboolean android_os_Process_parseProcLineArray(JNIEnv* env, jobject clazz,
|
|||||||
if (i < endIndex) {
|
if (i < endIndex) {
|
||||||
i++;
|
i++;
|
||||||
if ((mode&PROC_COMBINE) != 0) {
|
if ((mode&PROC_COMBINE) != 0) {
|
||||||
while (buffer[i] == term && i < endIndex) {
|
while (i < endIndex && buffer[i] == term) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ void AssetManager::setLocaleLocked(const char* locale)
|
|||||||
delete[] mLocale;
|
delete[] mLocale;
|
||||||
}
|
}
|
||||||
mLocale = strdupNew(locale);
|
mLocale = strdupNew(locale);
|
||||||
|
|
||||||
updateResourceParamsLocked();
|
updateResourceParamsLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,7 +674,7 @@ const ResTable* AssetManager::getResTable(bool required) const
|
|||||||
mZipSet.setZipResourceTableAsset(ap.path, ass);
|
mZipSet.setZipResourceTableAsset(ap.path, ass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0 && ass != NULL) {
|
if (i == 0 && ass != NULL) {
|
||||||
// If this is the first resource table in the asset
|
// If this is the first resource table in the asset
|
||||||
// manager, then we are going to cache it so that we
|
// manager, then we are going to cache it so that we
|
||||||
@ -688,7 +688,7 @@ const ResTable* AssetManager::getResTable(bool required) const
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ALOGV("loading resource table %s\n", ap.path.string());
|
ALOGV("loading resource table %s\n", ap.path.string());
|
||||||
Asset* ass = const_cast<AssetManager*>(this)->
|
ass = const_cast<AssetManager*>(this)->
|
||||||
openNonAssetInPathLocked("resources.arsc",
|
openNonAssetInPathLocked("resources.arsc",
|
||||||
Asset::ACCESS_BUFFER,
|
Asset::ACCESS_BUFFER,
|
||||||
ap);
|
ap);
|
||||||
@ -890,7 +890,7 @@ Asset* AssetManager::openInLocaleVendorLocked(const char* fileName, AccessMode m
|
|||||||
/* look at the filesystem on disk */
|
/* look at the filesystem on disk */
|
||||||
String8 path(createPathNameLocked(ap, locale, vendor));
|
String8 path(createPathNameLocked(ap, locale, vendor));
|
||||||
path.appendPath(fileName);
|
path.appendPath(fileName);
|
||||||
|
|
||||||
String8 excludeName(path);
|
String8 excludeName(path);
|
||||||
excludeName.append(kExcludeExtension);
|
excludeName.append(kExcludeExtension);
|
||||||
if (::getFileType(excludeName.string()) != kFileTypeNonexistent) {
|
if (::getFileType(excludeName.string()) != kFileTypeNonexistent) {
|
||||||
@ -898,28 +898,28 @@ Asset* AssetManager::openInLocaleVendorLocked(const char* fileName, AccessMode m
|
|||||||
//printf("+++ excluding '%s'\n", (const char*) excludeName);
|
//printf("+++ excluding '%s'\n", (const char*) excludeName);
|
||||||
return kExcludedAsset;
|
return kExcludedAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
pAsset = openAssetFromFileLocked(path, mode);
|
pAsset = openAssetFromFileLocked(path, mode);
|
||||||
|
|
||||||
if (pAsset == NULL) {
|
if (pAsset == NULL) {
|
||||||
/* try again, this time with ".gz" */
|
/* try again, this time with ".gz" */
|
||||||
path.append(".gz");
|
path.append(".gz");
|
||||||
pAsset = openAssetFromFileLocked(path, mode);
|
pAsset = openAssetFromFileLocked(path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAsset != NULL)
|
if (pAsset != NULL)
|
||||||
pAsset->setAssetSource(path);
|
pAsset->setAssetSource(path);
|
||||||
} else {
|
} else {
|
||||||
/* find in cache */
|
/* find in cache */
|
||||||
String8 path(createPathNameLocked(ap, locale, vendor));
|
String8 path(createPathNameLocked(ap, locale, vendor));
|
||||||
path.appendPath(fileName);
|
path.appendPath(fileName);
|
||||||
|
|
||||||
AssetDir::FileInfo tmpInfo;
|
AssetDir::FileInfo tmpInfo;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
String8 excludeName(path);
|
String8 excludeName(path);
|
||||||
excludeName.append(kExcludeExtension);
|
excludeName.append(kExcludeExtension);
|
||||||
|
|
||||||
if (mCache.indexOf(excludeName) != NAME_NOT_FOUND) {
|
if (mCache.indexOf(excludeName) != NAME_NOT_FOUND) {
|
||||||
/* go no farther */
|
/* go no farther */
|
||||||
//printf("+++ Excluding '%s'\n", (const char*) excludeName);
|
//printf("+++ Excluding '%s'\n", (const char*) excludeName);
|
||||||
@ -1738,7 +1738,7 @@ bool AssetManager::fncScanAndMergeDirLocked(
|
|||||||
|
|
||||||
// XXX This is broken -- the filename cache needs to hold the base
|
// XXX This is broken -- the filename cache needs to hold the base
|
||||||
// asset path separately from its filename.
|
// asset path separately from its filename.
|
||||||
|
|
||||||
partialPath = createPathNameLocked(ap, locale, vendor);
|
partialPath = createPathNameLocked(ap, locale, vendor);
|
||||||
if (dirName[0] != '\0') {
|
if (dirName[0] != '\0') {
|
||||||
partialPath.appendPath(dirName);
|
partialPath.appendPath(dirName);
|
||||||
|
@ -133,7 +133,7 @@ bool ObbFile::parseObbFile(int fd)
|
|||||||
{
|
{
|
||||||
lseek64(fd, fileLength - kFooterTagSize, SEEK_SET);
|
lseek64(fd, fileLength - kFooterTagSize, SEEK_SET);
|
||||||
|
|
||||||
char *footer = new char[kFooterTagSize];
|
char footer[kFooterTagSize];
|
||||||
actual = TEMP_FAILURE_RETRY(read(fd, footer, kFooterTagSize));
|
actual = TEMP_FAILURE_RETRY(read(fd, footer, kFooterTagSize));
|
||||||
if (actual != kFooterTagSize) {
|
if (actual != kFooterTagSize) {
|
||||||
ALOGW("couldn't read footer signature: %s\n", strerror(errno));
|
ALOGW("couldn't read footer signature: %s\n", strerror(errno));
|
||||||
|
@ -452,10 +452,11 @@ static status_t do_9patch(const char* imageName, image_info* image)
|
|||||||
|
|
||||||
int maxSizeXDivs = W * sizeof(int32_t);
|
int maxSizeXDivs = W * sizeof(int32_t);
|
||||||
int maxSizeYDivs = H * sizeof(int32_t);
|
int maxSizeYDivs = H * sizeof(int32_t);
|
||||||
int32_t* xDivs = (int32_t*) malloc(maxSizeXDivs);
|
int32_t* xDivs = image->info9Patch.xDivs = (int32_t*) malloc(maxSizeXDivs);
|
||||||
int32_t* yDivs = (int32_t*) malloc(maxSizeYDivs);
|
int32_t* yDivs = image->info9Patch.yDivs = (int32_t*) malloc(maxSizeYDivs);
|
||||||
uint8_t numXDivs = 0;
|
uint8_t numXDivs = 0;
|
||||||
uint8_t numYDivs = 0;
|
uint8_t numYDivs = 0;
|
||||||
|
|
||||||
int8_t numColors;
|
int8_t numColors;
|
||||||
int numRows;
|
int numRows;
|
||||||
int numCols;
|
int numCols;
|
||||||
@ -510,6 +511,10 @@ static status_t do_9patch(const char* imageName, image_info* image)
|
|||||||
goto getout;
|
goto getout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy patch size data into image...
|
||||||
|
image->info9Patch.numXDivs = numXDivs;
|
||||||
|
image->info9Patch.numYDivs = numYDivs;
|
||||||
|
|
||||||
// Find left and right of padding area...
|
// Find left and right of padding area...
|
||||||
if (get_horizontal_ticks(image->rows[H-1], W, transparent, false, &image->info9Patch.paddingLeft,
|
if (get_horizontal_ticks(image->rows[H-1], W, transparent, false, &image->info9Patch.paddingLeft,
|
||||||
&image->info9Patch.paddingRight, &errorMsg, NULL, false) != NO_ERROR) {
|
&image->info9Patch.paddingRight, &errorMsg, NULL, false) != NO_ERROR) {
|
||||||
@ -545,12 +550,6 @@ static status_t do_9patch(const char* imageName, image_info* image)
|
|||||||
image->layoutBoundsRight, image->layoutBoundsBottom));
|
image->layoutBoundsRight, image->layoutBoundsBottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy patch data into image
|
|
||||||
image->info9Patch.numXDivs = numXDivs;
|
|
||||||
image->info9Patch.numYDivs = numYDivs;
|
|
||||||
image->info9Patch.xDivs = xDivs;
|
|
||||||
image->info9Patch.yDivs = yDivs;
|
|
||||||
|
|
||||||
// If padding is not yet specified, take values from size.
|
// If padding is not yet specified, take values from size.
|
||||||
if (image->info9Patch.paddingLeft < 0) {
|
if (image->info9Patch.paddingLeft < 0) {
|
||||||
image->info9Patch.paddingLeft = xDivs[0];
|
image->info9Patch.paddingLeft = xDivs[0];
|
||||||
@ -957,7 +956,7 @@ static void analyze_image(const char *imageName, image_info &imageInfo, int gray
|
|||||||
gg = *row++;
|
gg = *row++;
|
||||||
bb = *row++;
|
bb = *row++;
|
||||||
aa = *row++;
|
aa = *row++;
|
||||||
|
|
||||||
if (isGrayscale) {
|
if (isGrayscale) {
|
||||||
*out++ = rr;
|
*out++ = rr;
|
||||||
} else {
|
} else {
|
||||||
|
@ -468,7 +468,7 @@ static int validateAttr(const String8& path, const ResTable& table,
|
|||||||
value.data);
|
value.data);
|
||||||
return ATTR_NOT_FOUND;
|
return ATTR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = table.getTableStringBlock(strIdx);
|
pool = table.getTableStringBlock(strIdx);
|
||||||
#if 0
|
#if 0
|
||||||
if (pool != NULL) {
|
if (pool != NULL) {
|
||||||
@ -704,7 +704,7 @@ bool addTagAttribute(const sp<XMLNode>& node, const char* ns8,
|
|||||||
// don't stop the build.
|
// don't stop the build.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
node->addAttribute(ns, attr, String16(value));
|
node->addAttribute(ns, attr, String16(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -755,7 +755,7 @@ status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
|
|||||||
bundle->getVersionName(), errorOnFailedInsert)) {
|
bundle->getVersionName(), errorOnFailedInsert)) {
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bundle->getMinSdkVersion() != NULL
|
if (bundle->getMinSdkVersion() != NULL
|
||||||
|| bundle->getTargetSdkVersion() != NULL
|
|| bundle->getTargetSdkVersion() != NULL
|
||||||
|| bundle->getMaxSdkVersion() != NULL) {
|
|| bundle->getMaxSdkVersion() != NULL) {
|
||||||
@ -764,7 +764,7 @@ status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
|
|||||||
vers = XMLNode::newElement(root->getFilename(), String16(), String16("uses-sdk"));
|
vers = XMLNode::newElement(root->getFilename(), String16(), String16("uses-sdk"));
|
||||||
root->insertChildAt(vers, 0);
|
root->insertChildAt(vers, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "minSdkVersion",
|
if (!addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "minSdkVersion",
|
||||||
bundle->getMinSdkVersion(), errorOnFailedInsert)) {
|
bundle->getMinSdkVersion(), errorOnFailedInsert)) {
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
@ -839,7 +839,7 @@ status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,7 +923,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
|
|
||||||
// resType -> leafName -> group
|
// resType -> leafName -> group
|
||||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||||
new KeyedVector<String8, sp<ResourceTypeSet> >;
|
new KeyedVector<String8, sp<ResourceTypeSet> >;
|
||||||
collect_files(assets, resources);
|
collect_files(assets, resources);
|
||||||
|
|
||||||
@ -953,7 +953,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
// now go through any resource overlays and collect their files
|
// now go through any resource overlays and collect their files
|
||||||
sp<AaptAssets> current = assets->getOverlay();
|
sp<AaptAssets> current = assets->getOverlay();
|
||||||
while(current.get()) {
|
while(current.get()) {
|
||||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||||
new KeyedVector<String8, sp<ResourceTypeSet> >;
|
new KeyedVector<String8, sp<ResourceTypeSet> >;
|
||||||
current->setResources(resources);
|
current->setResources(resources);
|
||||||
collect_files(current, resources);
|
collect_files(current, resources);
|
||||||
@ -1048,7 +1048,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
// compile resources
|
// compile resources
|
||||||
current = assets;
|
current = assets;
|
||||||
while(current.get()) {
|
while(current.get()) {
|
||||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||||
current->getResources();
|
current->getResources();
|
||||||
|
|
||||||
ssize_t index = resources->indexOfKey(String8("values"));
|
ssize_t index = resources->indexOfKey(String8("values"));
|
||||||
@ -1057,7 +1057,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
ssize_t res;
|
ssize_t res;
|
||||||
while ((res=it.next()) == NO_ERROR) {
|
while ((res=it.next()) == NO_ERROR) {
|
||||||
sp<AaptFile> file = it.getFile();
|
sp<AaptFile> file = it.getFile();
|
||||||
res = compileResourceFile(bundle, assets, file, it.getParams(),
|
res = compileResourceFile(bundle, assets, file, it.getParams(),
|
||||||
(current!=assets), &table);
|
(current!=assets), &table);
|
||||||
if (res != NO_ERROR) {
|
if (res != NO_ERROR) {
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
@ -1227,7 +1227,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
if (table.validateLocalizations()) {
|
if (table.validateLocalizations()) {
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasErrors) {
|
if (hasErrors) {
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
@ -1260,7 +1260,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
|
|
||||||
ResTable finalResTable;
|
ResTable finalResTable;
|
||||||
sp<AaptFile> resFile;
|
sp<AaptFile> resFile;
|
||||||
|
|
||||||
if (table.hasResources()) {
|
if (table.hasResources()) {
|
||||||
sp<AaptSymbols> symbols = assets->getSymbolsFor(String8("R"));
|
sp<AaptSymbols> symbols = assets->getSymbolsFor(String8("R"));
|
||||||
err = table.addSymbols(symbols);
|
err = table.addSymbols(symbols);
|
||||||
@ -1292,10 +1292,10 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
table.writePublicDefinitions(String16(assets->getPackage()), fp);
|
table.writePublicDefinitions(String16(assets->getPackage()), fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read resources back in,
|
// Read resources back in,
|
||||||
finalResTable.add(resFile->getData(), resFile->getSize(), NULL);
|
finalResTable.add(resFile->getData(), resFile->getSize(), NULL);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
NOISY(
|
NOISY(
|
||||||
printf("Generated resources:\n");
|
printf("Generated resources:\n");
|
||||||
@ -1303,7 +1303,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform a basic validation of the manifest file. This time we
|
// Perform a basic validation of the manifest file. This time we
|
||||||
// parse it with the comments intact, so that we can use them to
|
// parse it with the comments intact, so that we can use them to
|
||||||
// generate java docs... so we are not going to write this one
|
// generate java docs... so we are not going to write this one
|
||||||
@ -1398,7 +1398,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
ssize_t index = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE, "name");
|
ssize_t index = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE, "name");
|
||||||
const uint16_t* id = block.getAttributeStringValue(index, &len);
|
const uint16_t* id = block.getAttributeStringValue(index, &len);
|
||||||
if (id == NULL) {
|
if (id == NULL) {
|
||||||
fprintf(stderr, "%s:%d: missing name attribute in element <%s>.\n",
|
fprintf(stderr, "%s:%d: missing name attribute in element <%s>.\n",
|
||||||
manifestPath.string(), block.getLineNumber(),
|
manifestPath.string(), block.getLineNumber(),
|
||||||
String8(block.getElementName(&len)).string());
|
String8(block.getElementName(&len)).string());
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
@ -1556,7 +1556,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1678,7 +1678,7 @@ static status_t writeLayoutClasses(
|
|||||||
NA = idents.size();
|
NA = idents.size();
|
||||||
|
|
||||||
bool deprecated = false;
|
bool deprecated = false;
|
||||||
|
|
||||||
String16 comment = symbols->getComment(realClassName);
|
String16 comment = symbols->getComment(realClassName);
|
||||||
fprintf(fp, "%s/** ", indentStr);
|
fprintf(fp, "%s/** ", indentStr);
|
||||||
if (comment.size() > 0) {
|
if (comment.size() > 0) {
|
||||||
@ -1761,7 +1761,7 @@ static status_t writeLayoutClasses(
|
|||||||
if (deprecated) {
|
if (deprecated) {
|
||||||
fprintf(fp, "%s@Deprecated\n", indentStr);
|
fprintf(fp, "%s@Deprecated\n", indentStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"%spublic static final int[] %s = {\n"
|
"%spublic static final int[] %s = {\n"
|
||||||
"%s",
|
"%s",
|
||||||
@ -1806,9 +1806,9 @@ static status_t writeLayoutClasses(
|
|||||||
//printf("%s:%s/%s: 0x%08x\n", String8(package16).string(),
|
//printf("%s:%s/%s: 0x%08x\n", String8(package16).string(),
|
||||||
// String8(attr16).string(), String8(name16).string(), typeSpecFlags);
|
// String8(attr16).string(), String8(name16).string(), typeSpecFlags);
|
||||||
const bool pub = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
|
const bool pub = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
|
||||||
|
|
||||||
bool deprecated = false;
|
bool deprecated = false;
|
||||||
|
|
||||||
fprintf(fp, "%s/**\n", indentStr);
|
fprintf(fp, "%s/**\n", indentStr);
|
||||||
if (comment.size() > 0) {
|
if (comment.size() > 0) {
|
||||||
String8 cmt(comment);
|
String8 cmt(comment);
|
||||||
@ -2193,10 +2193,10 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
|
|||||||
|
|
||||||
status_t err = writeSymbolClass(fp, assets, includePrivate, symbols,
|
status_t err = writeSymbolClass(fp, assets, includePrivate, symbols,
|
||||||
className, 0, bundle->getNonConstantId());
|
className, 0, bundle->getNonConstantId());
|
||||||
|
fclose(fp);
|
||||||
if (err != NO_ERROR) {
|
if (err != NO_ERROR) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
if (textSymbolsDest != NULL && R == className) {
|
if (textSymbolsDest != NULL && R == className) {
|
||||||
String8 textDest(textSymbolsDest);
|
String8 textDest(textSymbolsDest);
|
||||||
@ -2215,10 +2215,10 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
|
|||||||
|
|
||||||
status_t err = writeTextSymbolClass(fp, assets, includePrivate, symbols,
|
status_t err = writeTextSymbolClass(fp, assets, includePrivate, symbols,
|
||||||
className);
|
className);
|
||||||
|
fclose(fp);
|
||||||
if (err != NO_ERROR) {
|
if (err != NO_ERROR) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we were asked to generate a dependency file, we'll go ahead and add this R.java
|
// If we were asked to generate a dependency file, we'll go ahead and add this R.java
|
||||||
|
@ -207,7 +207,7 @@ check_filename(const char* filename, const char* package, buffer_type* name)
|
|||||||
p = strchr(name->data, '.');
|
p = strchr(name->data, '.');
|
||||||
len = p ? p-name->data : strlen(name->data);
|
len = p ? p-name->data : strlen(name->data);
|
||||||
expected.append(name->data, len);
|
expected.append(name->data, len);
|
||||||
|
|
||||||
expected += ".aidl";
|
expected += ".aidl";
|
||||||
|
|
||||||
len = fn.length();
|
len = fn.length();
|
||||||
@ -473,7 +473,7 @@ check_method(const char* filename, int kind, method_type* m)
|
|||||||
err = 1;
|
err = 1;
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(kind == INTERFACE_TYPE_BINDER ? t->CanWriteToParcel() : t->CanWriteToRpcData())) {
|
if (!(kind == INTERFACE_TYPE_BINDER ? t->CanWriteToParcel() : t->CanWriteToRpcData())) {
|
||||||
fprintf(stderr, "%s:%d parameter %d: '%s %s' can't be marshalled.\n",
|
fprintf(stderr, "%s:%d parameter %d: '%s %s' can't be marshalled.\n",
|
||||||
filename, m->type.type.lineno, index,
|
filename, m->type.type.lineno, index,
|
||||||
@ -536,7 +536,7 @@ check_method(const char* filename, int kind, method_type* m)
|
|||||||
filename, m->name.lineno, index, arg->name.data);
|
filename, m->name.lineno, index, arg->name.data);
|
||||||
err = 1;
|
err = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
index++;
|
index++;
|
||||||
arg = arg->next;
|
arg = arg->next;
|
||||||
@ -787,7 +787,7 @@ parse_preprocessed_file(const string& filename)
|
|||||||
//printf("%s:%d:...%s...%s...%s...\n", filename.c_str(), lineno,
|
//printf("%s:%d:...%s...%s...%s...\n", filename.c_str(), lineno,
|
||||||
// type, packagename, classname);
|
// type, packagename, classname);
|
||||||
document_item_type* doc;
|
document_item_type* doc;
|
||||||
|
|
||||||
if (0 == strcmp("parcelable", type)) {
|
if (0 == strcmp("parcelable", type)) {
|
||||||
user_data_type* parcl = (user_data_type*)malloc(
|
user_data_type* parcl = (user_data_type*)malloc(
|
||||||
sizeof(user_data_type));
|
sizeof(user_data_type));
|
||||||
@ -837,6 +837,7 @@ parse_preprocessed_file(const string& filename)
|
|||||||
else {
|
else {
|
||||||
fprintf(stderr, "%s:%d: bad type in line: %s\n",
|
fprintf(stderr, "%s:%d: bad type in line: %s\n",
|
||||||
filename.c_str(), lineno, line);
|
filename.c_str(), lineno, line);
|
||||||
|
fclose(f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
err = gather_types(filename.c_str(), doc);
|
err = gather_types(filename.c_str(), doc);
|
||||||
@ -1093,13 +1094,13 @@ preprocess_aidl(const Options& options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write preprocessed file
|
// write preprocessed file
|
||||||
int fd = open( options.outputFileName.c_str(),
|
int fd = open( options.outputFileName.c_str(),
|
||||||
O_RDWR|O_CREAT|O_TRUNC|O_BINARY,
|
O_RDWR|O_CREAT|O_TRUNC|O_BINARY,
|
||||||
#ifdef HAVE_MS_C_RUNTIME
|
#ifdef HAVE_MS_C_RUNTIME
|
||||||
_S_IREAD|_S_IWRITE);
|
_S_IREAD|_S_IWRITE);
|
||||||
#else
|
#else
|
||||||
S_IRUSR|S_IWUSR|S_IRGRP);
|
S_IRUSR|S_IWUSR|S_IRGRP);
|
||||||
#endif
|
#endif
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
fprintf(stderr, "aidl: could not open file for write: %s\n",
|
fprintf(stderr, "aidl: could not open file for write: %s\n",
|
||||||
options.outputFileName.c_str());
|
options.outputFileName.c_str());
|
||||||
|
Reference in New Issue
Block a user