本文整理汇总了C++中AutoPtr::AddFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::AddFlags方法的具体用法?C++ AutoPtr::AddFlags怎么用?C++ AutoPtr::AddFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::AddFlags方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
void CSearchManagerService::MyPackageMonitor::UpdateSearchables()
{
Int32 changingUserId;
GetChangingUserId(&changingUserId);
{
// Update list of searchable activities
AutoLock lock(mHost->mLock);
Iterator it = mHost->mSearchables.Begin();
for(; it != mHost->mSearchables.End(); it++)
{
if(changingUserId == it->mFirst)
{
AutoPtr<ISearchables> searchable;
mHost->GetSearchables(it->mFirst, (ISearchables**)&searchable);
searchable->BuildSearchableList();
break;
}
}
}
// Inform all listeners that the list of searchables has been updated.
AutoPtr<IIntent> intent;
CIntent::New(ISearchManager::INTENT_ACTION_SEARCHABLES_CHANGED, (IIntent**)&intent);
intent->AddFlags(IIntent::FLAG_RECEIVER_REPLACE_PENDING
| IIntent::FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
AutoPtr<IUserHandle> handler;
CUserHandle::New(changingUserId,(IUserHandle**)&handler);
mHost->mContext->SendBroadcastAsUser(intent, handler);
}
示例2: HandleSendStatusChangeBroadcast
// Runs on the handler.
void WifiDisplayAdapter::HandleSendStatusChangeBroadcast()
{
AutoPtr<IIntent> intent;
{
AutoLock lock(GetSyncRoot());
if (!mPendingStatusChangeBroadcast) {
return;
}
mPendingStatusChangeBroadcast = FALSE;
CIntent::New(
IDisplayManager::ACTION_WIFI_DISPLAY_STATUS_CHANGED,
(IIntent**)&intent);
intent->AddFlags(IIntent::FLAG_RECEIVER_REGISTERED_ONLY);
AutoPtr<IWifiDisplayStatus> status = GetWifiDisplayStatusLocked();
intent->PutParcelableExtra(IDisplayManager::EXTRA_WIFI_DISPLAY_STATUS,
status != NULL ? IParcelable::Probe(status) : NULL);
}
AutoPtr<IUserHandle> all;
AutoPtr<IUserHandleHelper> helper;
CUserHandleHelper::AcquireSingleton((IUserHandleHelper**)&helper);
helper->GetALL((IUserHandle**)&all);
// Send protected broadcast about wifi display status to registered receivers.
GetContext()->SendBroadcastAsUser(intent, all);
}
示例3: RebootWipeUserData
ECode RecoverySystem::RebootWipeUserData(
/* [in] */ IContext* context,
/* [in] */ Boolean shutdown,
/* [in] */ const String& reason,
/* [in] */ Boolean wipeMedia)
{
AutoPtr<IUserManager> um;
FAIL_RETURN(context->GetSystemService(IContext::USER_SERVICE, (IInterface**)&um));
Boolean hasUR = FALSE;
um->HasUserRestriction(IUserManager::DISALLOW_FACTORY_RESET, &hasUR);
if (hasUR) {
// throw new SecurityException("Wiping data is not allowed for this user.");
return E_SECURITY_EXCEPTION;
}
AutoPtr<IConditionVariable> condition = new ConditionVariable();
AutoPtr<IIntent> intent;
FAIL_RETURN(CIntent::New(
String("android.intent.action.MASTER_CLEAR_NOTIFICATION"), (IIntent**)&intent));
intent->AddFlags(IIntent::FLAG_RECEIVER_FOREGROUND);
AutoPtr<IUserHandle> owner;
AutoPtr<IUserHandleHelper> helper;
CUserHandleHelper::AcquireSingleton((IUserHandleHelper**)&helper);
helper->GetOWNER((IUserHandle**)&owner);
AutoPtr<OpenConditionBroadcastReceiver> receiver = new OpenConditionBroadcastReceiver(condition);
context->SendOrderedBroadcastAsUser(intent, owner,
Elastos::Droid::Manifest::permission::MASTER_CLEAR,
receiver, NULL, 0, String(NULL), NULL);
// Block until the ordered broadcast has completed.
condition->Block();
String shutdownArg;
if (shutdown) {
shutdownArg = "--shutdown_after";
}
String reasonArg;
if (!reason.IsEmpty()) {
reasonArg = String("--reason=") + SanitizeArg(reason);
}
String localeArg("--locale=");
AutoPtr<ILocale> locale;
AutoPtr<ILocaleHelper> localeHelper;
CLocaleHelper::AcquireSingleton((ILocaleHelper**)&localeHelper);
localeHelper->GetDefault((ILocale**)&locale);
String defLocal;
locale->ToString(&defLocal);
localeArg += defLocal;
String cmd("--wipe_data\n");
if (wipeMedia) {
cmd += "--wipe_media\n";
}
return BootCommand(context, 4, shutdownArg.string(),
cmd.string(), reasonArg.string(), localeArg.string());
}
示例4:
AutoPtr<IIntent> MonkeyActivityEvent::GetEvent()
{
AutoPtr<IIntent> intent;
CIntent::New(IIntent::ACTION_MAIN, (IIntent**)&intent);
intent->AddCategory(IIntent::CATEGORY_LAUNCHER);
intent->SetComponent(mApp);
intent->AddFlags(IIntent::FLAG_ACTIVITY_NEW_TASK |
IIntent::FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
return intent;
}
示例5: StartGlobalSearch
void StartGlobalSearch(
/* [in] */ const String& initialQuery,
/* [in] */ Boolean selectInitialQuery,
/* [in] */ IBundle* appSearchData,
/* [in] */ IRect* sourceBounds)
{
AutoPtr<IComponentName> globalSearchActivity;
GetGlobalSearchActivity(&globalSearchActivity);
if (globalSearchActivity == NULL) {
//Log.w(TAG, "No global search activity found.");
return;
}
AutoPtr<IIntent> intent;
CIntent::New(ISearchManager::INTENT_ACTION_GLOBAL_SEARCH, &intent);
intent->AddFlags(IIntent::FLAG_ACTIVITY_NEW_TASK);
intent->SetComponent(globalSearchActivity);
// Make sure that we have a Bundle to put source in
if (appSearchData == NULL) {
CBundle::New(&appSearchData);
} else {
CBundle::New(&appSearchData, &appSearchData);
}
// Set source to package name of app that starts global search, if not set already.
Boolean b;
appSearchData->ContainsKey("source", &b);
if (!b) {
String name;
mContext->GetPackageName(&name);
appSearchData->PutString("source", name);
}
intent->PutExtra(ISearchManager::APP_DATA, appSearchData);
if (!TextUtils::IsEmpty(initialQuery)) {
intent->PutExtra(ISearchManager::QUERY, initialQuery);
}
if (selectInitialQuery) {
intent->PutExtra(ISearchManager::EXTRA_SELECT_QUERY, selectInitialQuery);
}
intent->SetSourceBounds(sourceBounds);
//try {
//if (DBG) Log.d(TAG, "Starting global search: " + intent.toUri(0));
mContext->StartActivity(intent);
//} catch (ActivityNotFoundException ex) {
// Log.e(TAG, "Global search activity not found: " + globalSearchActivity);
//}
}
示例6: GetLayoutInflater
ECode DialogFragment::GetLayoutInflater(
/* [in] */ IBundle* savedInstanceState,
/* [out] */ ILayoutInflater** inflater)
{
VALIDATE_NOT_NULL(inflater)
*inflater = NULL;
if (!mShowsDialog) {
return Fragment::GetLayoutInflater(savedInstanceState, inflater);
}
mDialog = NULL;
OnCreateDialog(savedInstanceState, (IDialog**)&mDialog);
switch (mStyle) {
case IDialogFragment::STYLE_NO_INPUT:
{
AutoPtr<IWindow> window;
mDialog->GetWindow((IWindow**)&window);
window->AddFlags(
IWindowManagerLayoutParams::FLAG_NOT_FOCUSABLE |
IWindowManagerLayoutParams::FLAG_NOT_TOUCHABLE);
// fall through...
}
case IDialogFragment::STYLE_NO_FRAME:
case IDialogFragment::STYLE_NO_TITLE:
{
Boolean support;
mDialog->RequestWindowFeature(IWindow::FEATURE_NO_TITLE, &support);
}
}
AutoPtr<IContext> ctx;
if (mDialog != NULL) {
mDialog->GetContext((IContext**)&ctx);
}
else {
ctx = IContext::Probe(mActivity);
}
AutoPtr<IInterface> obj;
ctx->GetSystemService(IContext::LAYOUT_INFLATER_SERVICE, (IInterface**)&obj);
*inflater = ILayoutInflater::Probe(obj);
REFCOUNT_ADD(*inflater)
return NOERROR;
}
示例7: GetIntentForStatusPanel
ECode CVpnConfig::GetIntentForStatusPanel(
/* [in] */ IContext* context,
/* [in] */ IVpnConfig* config,
/* [out] */ IPendingIntent** intent)
{
VALIDATE_NOT_NULL(intent);
*intent = NULL;
// TODO:
// Preconditions.checkNotNull(config);
AutoPtr<IIntent> newintent;
CIntent::New((IIntent**)&newintent);
newintent->SetClassName(IVpnConfig::DIALOGS_PACKAGE, IVpnConfig::DIALOGS_PACKAGE + ".ManageDialog");
newintent->PutExtra(String("config"), IParcelable::Probe(config));
newintent->AddFlags(IIntent::FLAG_ACTIVITY_NEW_TASK | IIntent::FLAG_ACTIVITY_NO_HISTORY |
IIntent::FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
AutoPtr<IPendingIntentHelper> helper;
CPendingIntentHelper::AcquireSingleton((IPendingIntentHelper**)&helper);
return helper->GetActivity(context, 0, newintent, IPendingIntent::FLAG_CANCEL_CURRENT, intent);
}
示例8: UpdateState
void UsbCameraDeviceManagerObserver::UpdateState(
/* [in] */ const String& name,
/* [in] */ Int32 state,
/* [in] */ Int32 totalNum,
/* [in] */ const String& extraMng)
{
AutoLock lock(mLock);
Logger::D(TAG, "name: %s state: %d totalNum: %d", name.string(), state, totalNum);
AutoPtr<IIntent> intent;
CIntent::New(IUsbCameraManager::ACTION_USB_CAMERA_PLUG_IN_OUT, (IIntent**)&intent);
intent->AddFlags(IIntent::FLAG_RECEIVER_REGISTERED_ONLY);
AutoPtr<IBundle> bundle;
CBundle::New((IBundle**)&bundle);
bundle->PutInt32(IUsbCameraManager::USB_CAMERA_STATE,state);
bundle->PutString(IUsbCameraManager::USB_CAMERA_NAME,name);
bundle->PutInt32(IUsbCameraManager::USB_CAMERA_TOTAL_NUMBER,totalNum);
if(extraMng != NULL){
bundle->PutString(IUsbCameraManager::EXTRA_MNG, extraMng);
}
intent->PutExtras(bundle);
ActivityManagerNative::BroadcastStickyIntent(intent, String(NULL), IUserHandle::USER_ALL);
}
示例9: SendSupplicantStateChangedBroadcast
void SupplicantStateTracker::SendSupplicantStateChangedBroadcast(
/* [in] */ SupplicantState state,
/* [in] */ Boolean failedAuth)
{
Int32 supplState;
switch (state) {
case Elastos::Droid::Wifi::SupplicantState_DISCONNECTED:
supplState = IBatteryStats::WIFI_SUPPL_STATE_DISCONNECTED; break;
case Elastos::Droid::Wifi::SupplicantState_INTERFACE_DISABLED:
supplState = IBatteryStats::WIFI_SUPPL_STATE_INTERFACE_DISABLED; break;
case Elastos::Droid::Wifi::SupplicantState_INACTIVE:
supplState = IBatteryStats::WIFI_SUPPL_STATE_INACTIVE; break;
case Elastos::Droid::Wifi::SupplicantState_SCANNING:
supplState = IBatteryStats::WIFI_SUPPL_STATE_SCANNING; break;
case Elastos::Droid::Wifi::SupplicantState_AUTHENTICATING:
supplState = IBatteryStats::WIFI_SUPPL_STATE_AUTHENTICATING; break;
case Elastos::Droid::Wifi::SupplicantState_ASSOCIATING:
supplState = IBatteryStats::WIFI_SUPPL_STATE_ASSOCIATING; break;
case Elastos::Droid::Wifi::SupplicantState_ASSOCIATED:
supplState = IBatteryStats::WIFI_SUPPL_STATE_ASSOCIATED; break;
case Elastos::Droid::Wifi::SupplicantState_FOUR_WAY_HANDSHAKE:
supplState = IBatteryStats::WIFI_SUPPL_STATE_FOUR_WAY_HANDSHAKE; break;
case Elastos::Droid::Wifi::SupplicantState_GROUP_HANDSHAKE:
supplState = IBatteryStats::WIFI_SUPPL_STATE_GROUP_HANDSHAKE; break;
case Elastos::Droid::Wifi::SupplicantState_COMPLETED:
supplState = IBatteryStats::WIFI_SUPPL_STATE_COMPLETED; break;
case Elastos::Droid::Wifi::SupplicantState_DORMANT:
supplState = IBatteryStats::WIFI_SUPPL_STATE_DORMANT; break;
case Elastos::Droid::Wifi::SupplicantState_UNINITIALIZED:
supplState = IBatteryStats::WIFI_SUPPL_STATE_UNINITIALIZED; break;
case Elastos::Droid::Wifi::SupplicantState_INVALID:
supplState = IBatteryStats::WIFI_SUPPL_STATE_INVALID; break;
default:
Logger::W(TAG, "Unknown supplicant state %d", state);
supplState = IBatteryStats::WIFI_SUPPL_STATE_INVALID;
break;
}
//try {
mBatteryStats->NoteWifiSupplicantStateChanged(supplState, failedAuth);
//} catch (RemoteException e) {
// Won't happen.
//}
AutoPtr<IIntent> intent;
CIntent::New(IWifiManager::SUPPLICANT_STATE_CHANGED_ACTION, (IIntent**)&intent);
intent->AddFlags(IIntent::FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
| IIntent::FLAG_RECEIVER_REPLACE_PENDING);
AutoPtr<ISupplicantState> iss;
CSupplicantState::New(state, (ISupplicantState**)&iss);
intent->PutExtra(IWifiManager::EXTRA_NEW_STATE, IParcelable::Probe(iss.Get()));
if (failedAuth) {
intent->PutExtra(
IWifiManager::EXTRA_SUPPLICANT_ERROR,
IWifiManager::ERROR_AUTHENTICATING);
}
AutoPtr<IUserHandleHelper> helper;
CUserHandleHelper::AcquireSingleton((IUserHandleHelper**)&helper);
AutoPtr<IUserHandle> ALL;
helper->GetALL((IUserHandle**)&ALL);
mContext->SendStickyBroadcastAsUser(intent, ALL);
}
示例10: OnActionItemClicked
ECode SelectActionModeCallback::OnActionItemClicked(
/* [in] */ IActionMode* mode,
/* [in] */ IMenuItem* item,
/* [out] */ Boolean* result)
{
VALIDATE_NOT_NULL(mode);
VALIDATE_NOT_NULL(item);
VALIDATE_NOT_NULL(result);
Int32 id;
item->GetItemId(&id);
switch(id) {
case R::id::cut:
mWebView->CutSelection();
mode->Finish();
break;
case R::id::copy: {
Boolean bFlag;
mWebView->CopySelection(&bFlag);
mode->Finish();
}
break;
case R::id::paste:
mWebView->PasteFromClipboard();
mode->Finish();
break;
case R::id::share: {
String selection = mWebView->GetSelection();
AutoPtr<IContext> context = mWebView->GetContext();
assert(0);
// AutoPtr<IBrowser> browser;
// CBrowser::AcquireSingleton((IBrowser**)&browser);
// browser->SendString(context, selection);
mode->Finish();
}
break;
case R::id::select_all:
mWebView->SelectAll();
break;
case R::id::find: {
String sel = mWebView->GetSelection();
mode->Finish();
Boolean bFlag;
mWebView->ShowFindDialog(sel, FALSE, &bFlag);
}
break;
case R::id::websearch: {
mode->Finish();
AutoPtr<IIntent> i;
CIntent::New(IIntent::ACTION_WEB_SEARCH, (IIntent**)&i);
i->PutBooleanExtra(ISearchManager::EXTRA_NEW_SEARCH, TRUE);
i->PutExtra(ISearchManager::QUERY, mWebView->GetSelection());
AutoPtr<IContext> context = mWebView->GetContext();
if (context->Probe(EIID_IActivity) == NULL) {
i->AddFlags(IIntent::FLAG_ACTIVITY_NEW_TASK);
}
context->StartActivity(i);
}
break;
default:
*result = FALSE;
return NOERROR;
}
*result = TRUE;
return NOERROR;
}