Пример #1
0
ECode CResources::ObtainAttributes(
    /* [in] */ IAttributeSet* set,
    /* [in] */ const ArrayOf<Int32>& attrs,
    /* [out] */ ITypedArray** array)
{
    VALIDATE_NOT_NULL(set);
    VALIDATE_NOT_NULL(array);
    *array = NULL;

    Int32 len = attrs.GetLength();
    FAIL_RETURN(GetCachedStyledAttributes(len, array));

    // XXX note that for now we only work with compiled XML files.
    // To support generic XML files we will need to manually parse
    // out the attributes from the XML file (applying type information
    // contained in the resources and such).
    AutoPtr<CTypedArray> a = (CTypedArray*)*array;
    AutoPtr<XmlBlock::Parser> parser = (XmlBlock::Parser*)set;
    mAssets->RetrieveAttributes(
            parser->mParseState, attrs, *a->mData, *a->mIndices);

    a->mRsrcs = attrs.Clone();
    a->mXml = parser;

    return NOERROR;
}
ECode CTestFeaturesSession::constructor(
    /* [in] */ Handle32 accounts,
    /* [in] */ IAccountManagerResponse* response,
    /* [in] */ IAccount* account,
    /* [in] */ const ArrayOf<String>& features,
    /* [in] */ IIAccountManager* host)
{
    String type;
    account->GetType(&type);
    FAIL_RETURN(Init((UserAccounts*)accounts, response,
            type, FALSE /* expectActivityLaunch */,
            TRUE /* stripAuthTokenFromResult */, (CAccountManagerService*)host));
    mFeatures = features.Clone();
    mAccount = account;
    return NOERROR;
}