本文整理汇总了C++中AutoPtr::AddDataScheme方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::AddDataScheme方法的具体用法?C++ AutoPtr::AddDataScheme怎么用?C++ AutoPtr::AddDataScheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::AddDataScheme方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constructor
ECode RegisteredServicesCache::constructor(
/* [in] */ IContext* context,
/* [in] */ const String& interfaceName,
/* [in] */ const String& metaDataName,
/* [in] */ const String& attributeName,
/* [in] */ IXmlSerializerAndParser* serializerAndParser)
{
mContext = context;
mInterfaceName = interfaceName;
mMetaDataName = metaDataName;
mAttributesName = attributeName;
mSerializerAndParser = serializerAndParser;
mPackageReceiver = (IBroadcastReceiver*)new RegisteredServicesCache::PackageReceiver(this);
mPackageReceiver = (IBroadcastReceiver*)new RegisteredServicesCache::ExternalReceiver(this);
AutoPtr<IEnvironment> env;
CEnvironment::AcquireSingleton((IEnvironment**)&env);
AutoPtr<IFile> dataDir;
env->GetDataDirectory((IFile**)&dataDir);
AutoPtr<IFile> systemDir, syncDir, interFile;
CFile::New(dataDir, String("system"), (IFile**)&systemDir);
CFile::New(systemDir, String("registered_services"), (IFile**)&syncDir);
CFile::New(syncDir, interfaceName + String(".xml"), (IFile**)&interFile);
CAtomicFile::New(interFile, (IAtomicFile**)&mPersistentServicesFile);
// Load persisted services from disk
ReadPersistentServicesLocked();
AutoPtr<IIntentFilter> intentFilter;
CIntentFilter::New((IIntentFilter**)&intentFilter);
intentFilter->AddAction(IIntent::ACTION_PACKAGE_ADDED);
intentFilter->AddAction(IIntent::ACTION_PACKAGE_CHANGED);
intentFilter->AddAction(IIntent::ACTION_PACKAGE_REMOVED);
intentFilter->AddDataScheme(String("package"));
AutoPtr<IIntent> intent;
mContext->RegisterReceiverAsUser(mPackageReceiver, UserHandle::ALL, intentFilter, String(NULL), NULL, (IIntent**)&intent);
// Register for events related to sdcard installation.
AutoPtr<IIntentFilter> sdFilter;
CIntentFilter::New((IIntentFilter**)&sdFilter);
sdFilter->AddAction(IIntent::ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
sdFilter->AddAction(IIntent::ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
intent = NULL;
mContext->RegisterReceiver(mExternalReceiver, sdFilter, (IIntent**)&intent);
return NOERROR;
}