ECode CPhoneStatusBarView::SelectPanelForTouch( /* [in] */ IMotionEvent* touch, /* [out] */ IPanelView** view) { VALIDATE_NOT_NULL(view); // No double swiping. If either panel is open, nothing else can be pulled down. Float v = 0; *view = (mNotificationPanel->GetExpandedHeight(&v), v) > 0 ? NULL : mNotificationPanel; REFCOUNT_ADD(*view); return NOERROR; }
ECode Int32PropertyValuesHolder::Clone( /* [out] */ IPropertyValuesHolder** holder) { AutoPtr<Int32PropertyValuesHolder> v = new Int32PropertyValuesHolder(mPropertyName, mInt32KeyframeSet); CloneSuperData(v); v->mJniSetter = mJniSetter; v->mInt32KeyframeSet = mInt32KeyframeSet; v->mInt32AnimatedValue = mInt32AnimatedValue; *holder = v; REFCOUNT_ADD(*holder); return NOERROR; }
ECode CExpandableListPositionHelper::Obtain( /* [in] */ Int32 type, /* [in] */ Int32 groupPos, /* [in] */ Int32 childPos, /* [in] */ Int32 flatListPos, /* [out] */ IExpandableListPosition** position) { VALIDATE_NOT_NULL(position); AutoPtr<IExpandableListPosition> temp = ExpandableListPosition::Obtain(type, groupPos, childPos, flatListPos); *position = temp; REFCOUNT_ADD(*position); return NOERROR; }
ECode CVpnConfig::GetIntentForConfirmation( /* [out] */ IIntent** intent) { VALIDATE_NOT_NULL(intent); *intent = NULL; AutoPtr<IIntent> newintent; CIntent::New((IIntent**)&newintent); newintent->SetClassName(IVpnConfig::DIALOGS_PACKAGE, IVpnConfig::DIALOGS_PACKAGE + ".ConfirmDialog"); *intent = newintent; REFCOUNT_ADD(*intent); return NOERROR; }
ECode RectEvaluator::Evaluate( /* [in] */ Float fraction, /* [in] */ IInterface* startValue, /* [in] */ IInterface* endValue, /* [out] */ IInterface** rect) { VALIDATE_NOT_NULL(rect); Int32 v1 = 0, v2 = 0; AutoPtr<IRect> realSV = IRect::Probe(startValue); AutoPtr<IRect> realEV = IRect::Probe(endValue); realSV->GetLeft(&v1); realEV->GetLeft(&v2); Int32 left = v1 + (Int32) ((v2 - v1) * fraction); realSV->GetTop(&v1); realEV->GetTop(&v2); Int32 top = v1 + (Int32) ((v2 - v1) * fraction); realSV->GetRight(&v1); realEV->GetRight(&v2); Int32 right = v1 + (Int32) ((v2 - v1) * fraction); realSV->GetBottom(&v1); realEV->GetBottom(&v2); Int32 bottom = v1 + (Int32) ((v2 - v1) * fraction); if (mRect == NULL) { AutoPtr<IRect> r; CRect::New(left, top, right, bottom, (IRect**)&r); *rect = r; REFCOUNT_ADD(*rect); return NOERROR; } mRect->Set(left, top, right, bottom); *rect = mRect; REFCOUNT_ADD(*rect); return NOERROR; }
ECode URLUtil::Decode( /* [in] */ ArrayOf<Byte>* url, /* [out, callee] */ ArrayOf<Byte>** urlList) { VALIDATE_NOT_NULL(url); VALIDATE_NOT_NULL(urlList); if (url->GetLength() == 0) { *urlList = ArrayOf<Byte>::Alloc(0); REFCOUNT_ADD(*urlList); return NOERROR; } // Create a new byte array with the same length to ensure capacity AutoPtr< ArrayOf<Byte> > tempData = ArrayOf<Byte>::Alloc(url->GetLength());; Int32 tempCount = 0; for (Int32 i = 0; i < url->GetLength(); i++) { Byte b = (*url)[i]; if (b == '%') { if (url->GetLength() - i > 2) { Int32 byte1, byte2; FAIL_RETURN(ParseHex((*url)[i + 1], &byte1)); FAIL_RETURN(ParseHex((*url)[i + 2], &byte2)); b = (Byte) (byte1 * 16 + byte2); i += 2; } else { //throw new IllegalArgumentException("Invalid format"); return E_ILLEGAL_ARGUMENT_EXCEPTION; } } (*tempData)[tempCount++] = b; } *urlList = ArrayOf<Byte>::Alloc(tempCount); (*urlList)->Copy(tempData, tempCount); REFCOUNT_ADD(*urlList); return NOERROR; }
ECode HdmiTimerRecordSources::OfAnalogueSource( /* [in] */ IHdmiTimerRecordSourcesTimerInfo* timerInfo, /* [in] */ IHdmiRecordSourcesAnalogueServiceSource* source, /* [out] */ ITimerRecordSource** result) { VALIDATE_NOT_NULL(result); *result = NULL; FAIL_RETURN(CheckTimerRecordSourceInputs(timerInfo, source)) AutoPtr<ITimerRecordSource> tmp = new TimerRecordSource(timerInfo, source); *result = tmp; REFCOUNT_ADD(*result); return NOERROR; }
ECode CTaskStackBuilder::EditIntentAt( /* [in] */ Int32 index, /* [out] */ IIntent **intent) { VALIDATE_NOT_NULL(intent); if(index < mIntents.GetSize()-1) { *intent = mIntents[index]; } else { *intent = NULL; } REFCOUNT_ADD(*intent); return NOERROR; }
ECode CDrmRawContent::GetContentInputStream( /* [in] */ IDrmRights* mRights, /* [out] */ IInputStream** rights) { VALIDATE_NOT_NULL(mRights); if (NULL == mRights){ return E_NULL_POINTER_EXCEPTION; } *rights = new DrmInputStream(mRights, this); REFCOUNT_ADD(*rights); return NOERROR; }
ECode InsetDrawable::Mutate( /* [out] */ IDrawable** drawable) { VALIDATE_NOT_NULL(drawable); AutoPtr<IDrawable> tmp; if (!mMutated && (Drawable::Mutate((IDrawable**)&tmp), tmp.Get()) == THIS_PROBE(IDrawable)) { tmp = NULL; mInsetState->mDrawable->Mutate((IDrawable**)&tmp); mMutated = TRUE; } *drawable = THIS_PROBE(IDrawable); REFCOUNT_ADD(*drawable); return NOERROR; }
ECode CResolveInfo::LoadLabel( /* [in] */ IPackageManager* pm, /* [out] */ ICharSequence** label) { VALIDATE_NOT_NULL(label); *label = NULL; if (mNonLocalizedLabel != NULL) { *label = mNonLocalizedLabel; REFCOUNT_ADD(*label); return NOERROR; } if (!mResolvePackageName.IsNull() && mLabelRes != 0) { pm->GetText(mResolvePackageName, mLabelRes, NULL, label); if (*label != NULL) { String str; (*label)->ToString(&str); *label = NULL; return CStringWrapper::New(str.Trim(), label); } } AutoPtr<IComponentInfo> ci = mActivityInfo != NULL ? (IComponentInfo*)mActivityInfo.Get() : (IComponentInfo*)mServiceInfo.Get(); AutoPtr<IApplicationInfo> ai; ci->GetApplicationInfo((IApplicationInfo**)&ai); if (mLabelRes != 0) { String packageName; ci->GetPackageName(&packageName); pm->GetText(packageName, mLabelRes, ai, label); if (*label != NULL) { String str; (*label)->ToString(&str); *label = NULL; return CStringWrapper::New(str.Trim(), label); } } AutoPtr<ICharSequence> data; ci->LoadLabel(pm, (ICharSequence**)&data); // Make the data safe if (data != NULL) { String str; data->ToString(&str); CStringWrapper::New(str.Trim(), label); } return NOERROR; }
ECode CPicture::BeginRecording( /* [in] */ Int32 width, /* [in] */ Int32 height, /* [out] */ ICanvas** canvas) { VALIDATE_NOT_NULL(canvas); Int64 ni = NativeBeginRecording(mNativePicture, width, height); AutoPtr<RecordingCanvas> rc = new RecordingCanvas(this); rc->constructor(ni); mRecordingCanvas = rc.Get(); *canvas = mRecordingCanvas; REFCOUNT_ADD(*canvas); return NOERROR; }
ECode HdmiTimerRecordSources::TimeOf( /* [in] */ Int32 hour, /* [in] */ Int32 minute, /* [out] */ IHdmiTimerRecordSourcesTime** _time) { VALIDATE_NOT_NULL(_time); *_time = NULL; FAIL_RETURN(CheckTimeValue(hour, minute)) AutoPtr<IHdmiTimerRecordSourcesTime> tmp = new Time(hour, minute); *_time = tmp; REFCOUNT_ADD(*_time); return NOERROR; }
ECode HdmiTimerRecordSources::DurationOf( /* [in] */ Int32 hour, /* [in] */ Int32 minute, /* [out] */ IHdmiTimerRecordSourcesDuration** result) { VALIDATE_NOT_NULL(result); *result = NULL; FAIL_RETURN(CheckDurationValue(hour, minute)) AutoPtr<IHdmiTimerRecordSourcesDuration> tmp = new Duration(hour, minute); *result = tmp; REFCOUNT_ADD(*result); return NOERROR; }
ECode CWallpaperManager::PeekFastDrawable( /* [out] */ IDrawable** drawable) { VALIDATE_NOT_NULL(drawable); AutoPtr<IBitmap> bm = sGlobals->PeekWallpaperBitmap(mContext, FALSE); if (bm != NULL) { AutoPtr<IFastBitmapDrawable> fd; CFastBitmapDrawable::New(bm, (IFastBitmapDrawable**)&fd); *drawable = IDrawable::Probe(fd.Get()); REFCOUNT_ADD(*drawable); return NOERROR; } *drawable = NULL; return NOERROR; }
ECode ObjectAnimator::Clone( /* [out] */ IAnimator** object) { AutoPtr<CObjectAnimator> newObject; CObjectAnimator::NewByFriend((CObjectAnimator**)&newObject); CloneSuperData(newObject.Get()); CloneInternal(newObject); ObjectAnimator* anim = newObject; anim->mTarget = mTarget; anim->mPropertyName = mPropertyName; anim->mProperty = mProperty; *object = (IAnimator*)newObject->Probe(EIID_IAnimator); REFCOUNT_ADD(*object); return NOERROR; }
/** * Return two lists, a list of addresses that would be removed from * mLinkAddresses and a list of addresses that would be added to * mLinkAddress which would then result in target and mLinkAddresses * being the same list. * * @param target is a LinkProperties with the new list of addresses * @return the removed and added lists. */ ECode CLinkProperties::CompareAddresses( /* [in] */ ILinkProperties* target, /* [out] */ ICompareResult** result) { VALIDATE_NOT_NULL(result); /* * Duplicate the LinkAddresses into removed, we will be removing * address which are common between mLinkAddresses and target * leaving the addresses that are different. And address which * are in target but not in mLinkAddresses are placed in the * addedAddresses. */ List< AutoPtr<ILinkAddress> > cprRemoved(mLinkAddresses); List< AutoPtr<ILinkAddress> >::Iterator iter; AutoPtr<ICompareResult> cprResult; CCompareResult::New((ICompareResult**)&cprResult); if (target != NULL) { AutoPtr<IObjectContainer> container; FAIL_RETURN(target->GetLinkAddresses((IObjectContainer **)&container)); AutoPtr<IObjectEnumerator> emu; FAIL_RETURN(container->GetObjectEnumerator((IObjectEnumerator **)&emu)) Boolean hasNext; while (emu->MoveNext(&hasNext), hasNext) { AutoPtr<ILinkAddress> newAddress; emu->Current((IInterface**)&newAddress); iter = Find(cprRemoved.Begin(), cprRemoved.End(), newAddress); if (iter == cprRemoved.End()) { cprResult->AddAdded(newAddress); } else { cprRemoved.Erase(iter); } } } for (iter = cprRemoved.Begin(); iter != cprRemoved.End(); ++iter) { cprResult->AddRemoved(*iter); } *result = cprResult; REFCOUNT_ADD(*result); return NOERROR; }
ECode CStrictModeThreadPolicyBuilder::Build( /* [out] */ IStrictModeThreadPolicy** policy) { // If there are detection bits set but no violation bits // set, enable simple logging. VALIDATE_NOT_NULL(policy); if (mMask != 0 && (mMask & (IStrictMode::PENALTY_DEATH | IStrictMode::PENALTY_LOG | IStrictMode::PENALTY_DROPBOX | IStrictMode::PENALTY_DIALOG)) == 0) { PenaltyLog(); } AutoPtr<IStrictModeThreadPolicy> tp = new CStrictMode::ThreadPolicy(mMask); *policy = tp; REFCOUNT_ADD(*policy); return NOERROR; }
IFilter* SenderPermissionFilter::FACTORY_FilterFactory::NewFilter( /* in */ IXmlPullParser* parser) { String permission; parser->GetAttributeValue(String(NULL), ATTR_NAME, &permission); if (permission == NULL) { //throw new XmlPullParserException( // "A package name must be specified.", parser, null); return NULL; } AutoPtr<SenderPermissionFilter> spFilter = new SenderPermissionFilter(permission); REFCOUNT_ADD(spFilter); return (IFilter*)spFilter; }
ECode CMediaCodec::GetOutputBuffers( /* [out] */ ArrayOf<IByteBuffer*>** result) { VALIDATE_NOT_NULL(result); *result = NULL; if (mCodec == NULL) { return E_ILLEGAL_STATE_EXCEPTION; } AutoPtr<ArrayOf<IByteBuffer*> > temp; GetBuffers(FALSE /* input */, (ArrayOf<IByteBuffer*>**)&temp); *result = temp; REFCOUNT_ADD(*result); return NOERROR; }
ECode FilePreferencesImpl::ChildrenNamesSpi( /* [out, callee] */ ArrayOf<String>** list) { VALIDATE_NOT_NULL(list); AutoPtr<FilenameFilter> filter = new FilenameFilter(this); AutoPtr<ArrayOf<String> > names; mDir->List((IFilenameFilter*)filter->Probe(EIID_IFilenameFilter), (ArrayOf<String>**)&names); if (names == NULL) {// file is not a directory, exception case // throw new BackingStoreException("Cannot get child names for " + toString() // + " (path is " + path + ")"); return E_BACKING_STORE_EXCEPTION; } *list = names; REFCOUNT_ADD(*list); return NOERROR; }
ECode CLinkProperties::GetRoutes( /* [out] */ IObjectContainer** result) { VALIDATE_NOT_NULL(result); *result = NULL; AutoPtr<IObjectContainer> out; FAIL_RETURN(CParcelableObjectContainer::New((IObjectContainer**)&out)); List< AutoPtr<IRouteInfo> >::Iterator iter; for (iter = mRoutes.Begin(); iter != mRoutes.End(); ++iter) { out->Add(*iter); } *result = out.Get(); REFCOUNT_ADD(*result); return NOERROR; }
ECode CCompatibilityInfoHolder::GetIfNeeded( /* [out] */ ICompatibilityInfo** compatInfo) { VALIDATE_NOT_NULL(compatInfo); ICompatibilityInfo* ci = mCompatInfo; if (mCompatInfo == NULL || mCompatInfo == CCompatibilityInfo::DEFAULT_COMPATIBILITY_INFO) { *compatInfo = NULL; } else { *compatInfo = mCompatInfo; REFCOUNT_ADD(*compatInfo); } return NOERROR; }
ECode HdmiTimerRecordSources::OfExternalPhysicalAddress( /* [in] */ IHdmiTimerRecordSourcesTimerInfo* timerInfo, /* [in] */ IHdmiRecordSourcesExternalPhysicalAddress* source, /* [out] */ ITimerRecordSource** result) { VALIDATE_NOT_NULL(result); *result = NULL; FAIL_RETURN(CheckTimerRecordSourceInputs(timerInfo, source)) AutoPtr<ExternalSourceDecorator> decorator = new ExternalSourceDecorator(source, EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PHYSICAL_ADDRESS); AutoPtr<ITimerRecordSource> tmp = new TimerRecordSource(timerInfo, decorator); *result = tmp; REFCOUNT_ADD(*result); return NOERROR; }
ECode CGestureStore::GetGestureEntries( /* [out] */ IObjectContainer **entries) { VALIDATE_NOT_NULL(entries); AutoPtr<IObjectContainer> container; HashMap<String, AutoPtr<GestureList> >::Iterator iter = mNamedGestures.Begin(); for (; iter != mNamedGestures.End(); ++iter) { AutoPtr<ICharSequence> keystr = NULL; CString::New(iter->mFirst, (ICharSequence**)&keystr); container->Add(keystr); } *entries = container; REFCOUNT_ADD(*entries); return NOERROR; }
ECode CAuthenticatorDescription::NewKey( /* [in] */ const String& type, /* [out] */ IAuthenticatorDescription** description) { VALIDATE_NOT_NULL(description); if (type.IsNull()) { Slogger::E(TAG, "type cannot be null"); return E_ILLEGAL_ARGUMENT_EXCEPTION; // throw new IllegalArgumentException("type cannot be null"); } AutoPtr<CAuthenticatorDescription> cdescription; FAIL_RETURN(CAuthenticatorDescription::NewByFriend(type, (CAuthenticatorDescription**)&cdescription)); *description = cdescription; REFCOUNT_ADD(*description); return NOERROR; }
/** * Parse the given raw event into {@link NativeDaemonEvent} instance. * * @throws IllegalArgumentException when line doesn't match format expected * from native side. */ ECode NativeDaemonEvent::ParseRawEvent( /* [in] */ const String& rawEvent, /* [out] */ NativeDaemonEvent** event) { VALIDATE_NOT_NULL(event); *event = NULL; AutoPtr< ArrayOf<String> > parsed; StringUtils::Split(rawEvent, String(" "), (ArrayOf<String>**)&parsed); if (parsed->GetLength() < 2) { // throw new IllegalArgumentException("Insufficient arguments"); return E_ILLEGAL_ARGUMENT_EXCEPTION; } Int32 skiplength = 0; Int32 code; // try { code = StringUtils::ParseInt32((*parsed)[0]); skiplength = (*parsed)[0].GetLength() + 1; // } catch (NumberFormatException e) { // throw new IllegalArgumentException("problem parsing code", e); // } Int32 cmdNumber = -1; if (IsClassUnsolicited(code) == FALSE) { if (parsed->GetLength()< 3) { // throw new IllegalArgumentException("Insufficient arguemnts"); return E_ILLEGAL_ARGUMENT_EXCEPTION; } // try { cmdNumber = StringUtils::ParseInt32((*parsed)[1]); skiplength += (*parsed)[1].GetLength() + 1; // } catch (NumberFormatException e) { // throw new IllegalArgumentException("problem parsing cmdNumber", e); // } } String message = rawEvent.Substring(skiplength); *event = new NativeDaemonEvent(cmdNumber, code, message, rawEvent); REFCOUNT_ADD(*event); return NOERROR; }
ECode TestCase::GetFailures( /* [out, callee] */ ArrayOf<ITestFailure*>** failures) { VALIDATE_NOT_NULL(failures); AutoPtr< ArrayOf<ITestFailure*> > failureArray; if (!mFailures.IsEmpty()) { Int32 size = mFailures.GetSize(); failureArray = ArrayOf<ITestFailure*>::Alloc(size); List< AutoPtr<ITestFailure> >::Iterator it; Int32 i; for (it = mFailures.Begin(), i = 0; it != mFailures.End(); ++it, ++i) { failureArray->Set(i, *it); } } *failures = failureArray; REFCOUNT_ADD(*failures); return NOERROR; }
ECode RILParcel::ReadStringArray( /* [out] */ ArrayOf<String>** result) { VALIDATE_NOT_NULL(result); Int32 length = 0; ReadInt32(&length); if (length >= 0) { AutoPtr<ArrayOf<String> > array = ArrayOf<String>::Alloc(length); for (Int32 i = 0; i < length; ++i) { String str; ReadString(&str); array->Set(i, str); } *result = array; REFCOUNT_ADD(*result); } return NOERROR; }
ECode FilePreferencesImpl::KeysSpi( /* [out, callee] */ ArrayOf<String>** spi) { AutoPtr<ISet> ks; IMap::Probe(mPrefs)->GetKeySet((ISet**)&ks); Int32 size = 0; IMap::Probe(ks)->GetSize(&size); AutoPtr<ArrayOf<IInterface*> > datas = ArrayOf<IInterface*>::Alloc(size); ks->ToArray((ArrayOf<IInterface*>**)&datas); *spi = ArrayOf<String>::Alloc(size); for (Int32 i = 0; i < size; i++) { String value; IObject::Probe((*datas)[i])->ToString(&value); (*spi)->Set(i, value); } REFCOUNT_ADD(*spi); return NOERROR; }