| 3550 | } |
| 3551 | |
| 3552 | sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry, |
| 3553 | const SourcePos& sourcePos, |
| 3554 | const ResTable_config* config, |
| 3555 | bool doSetIndex, |
| 3556 | bool overlay, |
| 3557 | bool autoAddOverlay) |
| 3558 | { |
| 3559 | int pos = -1; |
| 3560 | sp<ConfigList> c = mConfigs.valueFor(entry); |
| 3561 | if (c == NULL) { |
| 3562 | if (overlay && !autoAddOverlay && mCanAddEntries.indexOf(entry) < 0) { |
| 3563 | sourcePos.error("Resource at %s appears in overlay but not" |
| 3564 | " in the base package; use <add-resource> to add.\n", |
| 3565 | String8(entry).string()); |
| 3566 | return NULL; |
| 3567 | } |
| 3568 | c = new ConfigList(entry, sourcePos); |
| 3569 | mConfigs.add(entry, c); |
| 3570 | pos = (int)mOrderedConfigs.size(); |
| 3571 | mOrderedConfigs.add(c); |
| 3572 | if (doSetIndex) { |
| 3573 | c->setEntryIndex(pos); |
| 3574 | } |
| 3575 | } |
| 3576 | |
| 3577 | ConfigDescription cdesc; |
| 3578 | if (config) cdesc = *config; |
| 3579 | |
| 3580 | sp<Entry> e = c->getEntries().valueFor(cdesc); |
| 3581 | if (e == NULL) { |
| 3582 | if (config != NULL) { |
| 3583 | NOISY(printf("New entry at %s:%d: imsi:%d/%d lang:%c%c cnt:%c%c " |
| 3584 | "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d " |
| 3585 | "sw%ddp w%ddp h%ddp dir:%d\n", |
| 3586 | sourcePos.file.string(), sourcePos.line, |
| 3587 | config->mcc, config->mnc, |
| 3588 | config->language[0] ? config->language[0] : '-', |
| 3589 | config->language[1] ? config->language[1] : '-', |
| 3590 | config->country[0] ? config->country[0] : '-', |
| 3591 | config->country[1] ? config->country[1] : '-', |
| 3592 | config->orientation, |
| 3593 | config->touchscreen, |
| 3594 | config->density, |
| 3595 | config->keyboard, |
| 3596 | config->inputFlags, |
| 3597 | config->navigation, |
| 3598 | config->screenWidth, |
| 3599 | config->screenHeight, |
| 3600 | config->smallestScreenWidthDp, |
| 3601 | config->screenWidthDp, |
| 3602 | config->screenHeightDp, |
| 3603 | config->layoutDirection)); |
| 3604 | } else { |
| 3605 | NOISY(printf("New entry at %s:%d: NULL config\n", |
| 3606 | sourcePos.file.string(), sourcePos.line)); |
| 3607 | } |
| 3608 | e = new Entry(entry, sourcePos); |
| 3609 | c->addEntry(cdesc, e); |