Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e81bf58 authored by The Android Automerger's avatar The Android Automerger
Browse files

Merge branch 'eclair' into eclair-release

parents c8cb6a36 5ff24d5d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.RegisteredServicesCache;
import android.content.pm.ProviderInfo;
import android.content.pm.RegisteredServicesCacheListener;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
@@ -344,6 +345,14 @@ class SyncManager implements OnAccountsUpdateListener {
        mPackageManager = null;

        mSyncAdapters = new SyncAdaptersCache(mContext);
        mSyncAdapters.setListener(new RegisteredServicesCacheListener<SyncAdapterType>() {
            public void onServiceChanged(SyncAdapterType type, boolean removed) {
                if (!removed) {
                    scheduleSync(null, type.authority, null, 0 /* no delay */,
                            false /* onlyThoseWithUnkownSyncableState */);
                }
            }
        }, mSyncHandler);

        mSyncAlarmIntent = PendingIntent.getBroadcast(
                mContext, 0 /* ignored */, new Intent(ACTION_SYNC_ALARM), 0);
+20 −48
Original line number Diff line number Diff line
@@ -536,10 +536,8 @@ public class WebView extends AbsoluteLayout
    static int DEFAULT_SCALE_PERCENT;
    private float mDefaultScale;

    // set to true temporarily during ScaleGesture triggered zoom
    // set to true temporarily while the zoom control is being dragged
    private boolean mPreviewZoomOnly = false;
    // extra scale during zoom preview
    private float mPreviewExtraZoomScale = 1.0f;

    // computed scale and inverse, from mZoomWidth.
    private float mActualScale;
@@ -2812,9 +2810,7 @@ public class WebView extends AbsoluteLayout
        nativeRecordButtons(hasFocus() && hasWindowFocus(),
                mTouchMode == TOUCH_SHORTPRESS_START_MODE
                || mTrackballDown || mGotCenterDown, false);
        // use the DKGRAY as background when drawing zoom preview
        drawCoreAndCursorRing(canvas, mPreviewZoomOnly ? Color.DKGRAY
                : mBackgroundColor, mDrawCursorRing);
        drawCoreAndCursorRing(canvas, mBackgroundColor, mDrawCursorRing);
    }

    @Override
@@ -2824,12 +2820,6 @@ public class WebView extends AbsoluteLayout
            return;
        }
        int saveCount = canvas.save();
        if (mPreviewZoomOnly) {
            // scale after canvas.save() so that the child, like titlebar, will
            // not be scaled.
            canvas.scale(mPreviewExtraZoomScale, mPreviewExtraZoomScale,
                    mZoomCenterX + mScrollX, mZoomCenterY + mScrollY);
        }
        if (mTitleBar != null) {
            canvas.translate(0, (int) mTitleBar.getHeight());
        }
@@ -2838,8 +2828,8 @@ public class WebView extends AbsoluteLayout
        }
        canvas.restoreToCount(saveCount);

        // Now draw the shadow, skip if it is in zoom preview mode.
        if ((mTitleBar != null && !mPreviewZoomOnly)) {
        // Now draw the shadow.
        if (mTitleBar != null) {
            int y = mScrollY + getVisibleTitleHeight();
            int height = (int) (5f * getContext().getResources()
                    .getDisplayMetrics().density);
@@ -3744,8 +3734,6 @@ public class WebView extends AbsoluteLayout
    private class ScaleDetectorListener implements
            ScaleGestureDetector.OnScaleGestureListener {

        float mStartX, mStartY;

        public boolean onScaleBegin(ScaleGestureDetector detector) {
            // cancel the single touch handling
            cancelTouch();
@@ -3759,9 +3747,6 @@ public class WebView extends AbsoluteLayout
            if (inEditingMode() && nativeFocusCandidateIsPassword()) {
                mWebTextView.setInPassword(false);
            }
            mPreviewExtraZoomScale = 1.0f;
            mStartX = detector.getFocusX();
            mStartY = detector.getFocusY();
            return true;
        }

@@ -3770,12 +3755,13 @@ public class WebView extends AbsoluteLayout
                mPreviewZoomOnly = false;
                mAnchorX = viewToContentX((int) mZoomCenterX + mScrollX);
                mAnchorY = viewToContentY((int) mZoomCenterY + mScrollY);
                float scale = mPreviewExtraZoomScale * mActualScale;
                // don't reflow when zoom in; when zoom out, do reflow if the
                // new scale is almost minimum scale;
                boolean reflowNow = (scale - mMinZoomScale <= 0.01f)
                        || ((scale <= 0.8 * mTextWrapScale));
                setNewZoomScale(scale, reflowNow, false);
                boolean reflowNow = (mActualScale - mMinZoomScale <= 0.01f)
                        || ((mActualScale <= 0.8 * mTextWrapScale));
                // force zoom after mPreviewZoomOnly is set to false so that the
                // new view size will be passed to the WebKit
                setNewZoomScale(mActualScale, reflowNow, true);
                // call invalidate() to draw without zoom filter
                invalidate();
            }
@@ -3792,34 +3778,19 @@ public class WebView extends AbsoluteLayout
        }

        public boolean onScale(ScaleGestureDetector detector) {
            float currScale = mPreviewExtraZoomScale * mActualScale;
            float scale = (float) (Math.round(detector.getScaleFactor()
                    * currScale * 100) / 100.0);
                    * mActualScale * 100) / 100.0);
            if (Math.abs(scale - mActualScale) >= PREVIEW_SCALE_INCREMENT) {
                mPreviewZoomOnly = true;
                // limit the scale change per step
            if (scale > currScale) {
                scale = Math.min(scale, currScale * 1.25f);
                if (scale > mActualScale) {
                    scale = Math.min(scale, mActualScale * 1.25f);
                } else {
                // the preview scale can be 80% of mMinZoomScale for feedback
                scale = Math.max(Math.max(scale, currScale * 0.8f),
                        mMinZoomScale * 0.8f);
                    scale = Math.max(scale, mActualScale * 0.8f);
                }
            if (Math.abs(scale - currScale) >= PREVIEW_SCALE_INCREMENT) {
                mPreviewZoomOnly = true;
                // FIXME: mZoomCenterX/Y need to be relative to mActualScale.
                // Ideally the focusX/Y should be a fixed point. But currently
                // it just returns the center of the two pointers. If only one
                // pointer is moving, the center is shifting. Currently we only
                // adjust it for zoom in case to get better result.
                if (mPreviewExtraZoomScale > 1.0f) {
                    mZoomCenterX = mStartX - (mStartX - detector.getFocusX())
                            / mPreviewExtraZoomScale;
                    mZoomCenterY = mStartY - (mStartY - detector.getFocusY())
                            / mPreviewExtraZoomScale;
                } else {
                mZoomCenterX = detector.getFocusX();
                mZoomCenterY = detector.getFocusY();
                }
                mPreviewExtraZoomScale = scale / mActualScale;
                setNewZoomScale(scale, false, false);
                invalidate();
                return true;
            }
@@ -4000,7 +3971,8 @@ public class WebView extends AbsoluteLayout

        // FIXME: we may consider to give WebKit an option to handle multi-touch
        // events later.
        if (mSupportMultiTouch && ev.getPointerCount() > 1) {
        if (mSupportMultiTouch && mMinZoomScale < mMaxZoomScale
                && ev.getPointerCount() > 1) {
            mScaleDetector.onTouchEvent(ev);
            if (mScaleDetector.isInProgress()) {
                mLastTouchTime = eventTime;
+74 −21
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
            mNoPhotoResource = R.drawable.ic_contact_picture_3;
        }

        mQueryHandler = new QueryHandler(mContentResolver);
        resetAsyncQueryHandler();
    }

    public void enableClickListeners() {
@@ -237,6 +237,11 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
        @Override
        protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
            try{
                if (this != mQueryHandler) {
                    Log.d(TAG, "onQueryComplete: discard result, the query handler is reset!");
                    return;
                }

                switch (token) {
                    case TOKEN_PHOTO_QUERY: {
                        //Set the photo
@@ -263,8 +268,14 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
                            bindContactInfo(cursor);
                            Uri lookupUri = Contacts.getLookupUri(cursor.getLong(ContactQuery._ID),
                                    cursor.getString(ContactQuery.LOOKUP_KEY));
                            startPhotoQuery(cursor.getLong(ContactQuery.PHOTO_ID), lookupUri);
                            startPhotoQuery(cursor.getLong(ContactQuery.PHOTO_ID),
                                    lookupUri, false /* don't reset query handler */);
                            invalidate();
                        } else {
                            // shouldn't really happen
                            setDisplayName(null, null);
                            setSocialSnippet(null);
                            setPhoto(loadPlaceholderPhoto(null));
                        }
                        break;
                    }
@@ -273,11 +284,13 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
                            long contactId = cursor.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX);
                            String lookupKey = cursor.getString(
                                    PHONE_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
                            bindFromContactUri(Contacts.getLookupUri(contactId, lookupKey));
                            bindFromContactUriInternal(Contacts.getLookupUri(contactId, lookupKey),
                                    false /* don't reset query handler */);
                        } else {
                            String phoneNumber = (String) cookie;
                            setDisplayName(phoneNumber, null);
                            setSocialSnippet(null);
                            setPhoto(loadPlaceholderPhoto(null));
                            mPhotoView.assignContactFromPhone(phoneNumber, true);
                        }
                        break;
@@ -287,11 +300,13 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
                            long contactId = cursor.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
                            String lookupKey = cursor.getString(
                                    EMAIL_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
                            bindFromContactUri(Contacts.getLookupUri(contactId, lookupKey));
                            bindFromContactUriInternal(Contacts.getLookupUri(contactId, lookupKey),
                                    false /* don't reset query handler */);
                        } else {
                            String emailAddress = (String) cookie;
                            setDisplayName(emailAddress, null);
                            setSocialSnippet(null);
                            setPhoto(loadPlaceholderPhoto(null));
                            mPhotoView.assignContactFromEmail(emailAddress, true);
                        }
                        break;
@@ -397,22 +412,22 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
     * Convenience method for binding all available data from an existing
     * contact.
     *
     * @param conatctUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
     * @param contactLookupUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
     */
    public void bindFromContactLookupUri(Uri contactLookupUri) {
        mContactUri = contactLookupUri;
        startContactQuery(contactLookupUri);
        bindFromContactUriInternal(contactLookupUri, true /* reset query handler */);
    }

    /**
     * Convenience method for binding all available data from an existing
     * contact.
     *
     * @param conatctUri a {Contacts.CONTENT_URI} style URI.
     * @param contactUri a {Contacts.CONTENT_URI} style URI.
     * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
     */
    public void bindFromContactUri(Uri contactUri) {
    private void bindFromContactUriInternal(Uri contactUri, boolean resetQueryHandler) {
        mContactUri = contactUri;
        startContactQuery(contactUri);
        startContactQuery(contactUri, resetQueryHandler);
    }

    /**
@@ -424,6 +439,8 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
     * address, one of them will be chosen to bind to.
     */
    public void bindFromEmail(String emailAddress) {
        resetAsyncQueryHandler();

        mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP, emailAddress,
                Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(emailAddress)),
                EMAIL_LOOKUP_PROJECTION, null, null, null);
@@ -438,35 +455,71 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
     * number, one of them will be chosen to bind to.
     */
    public void bindFromPhoneNumber(String number) {
        resetAsyncQueryHandler();

        mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP, number,
                Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)),
                PHONE_LOOKUP_PROJECTION, null, null, null);
    }

    /**
     * Method to force this widget to forget everything it knows about the contact.
     * The widget isn't automatically updated or redrawn.
     * startContactQuery
     *
     * internal method to query contact by Uri.
     *
     * @param contactUri the contact uri
     * @param resetQueryHandler whether to use a new AsyncQueryHandler or not
     */
    public void wipeClean() {
        setDisplayName(null, null);
        setPhoto(null);
        setSocialSnippet(null);
        mContactUri = null;
        mExcludeMimes = null;
    private void startContactQuery(Uri contactUri, boolean resetQueryHandler) {
        if (resetQueryHandler) {
            resetAsyncQueryHandler();
        }

    private void startContactQuery(Uri contactUri) {
        mQueryHandler.startQuery(TOKEN_CONTACT_INFO, null, contactUri, ContactQuery.COLUMNS,
                null, null, null);
    }

    protected void startPhotoQuery(long photoId, Uri lookupKey) {
    /**
     * startPhotoQuery
     *
     * internal method to query contact photo by photo id and uri.
     *
     * @param photoId the photo id.
     * @param lookupKey the lookup uri.
     * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
     */
    protected void startPhotoQuery(long photoId, Uri lookupKey, boolean resetQueryHandler) {
        if (resetQueryHandler) {
            resetAsyncQueryHandler();
        }

        mQueryHandler.startQuery(TOKEN_PHOTO_QUERY, lookupKey,
                ContentUris.withAppendedId(Data.CONTENT_URI, photoId), PhotoQuery.COLUMNS,
                null, null, null);
    }

    /**
     * Method to force this widget to forget everything it knows about the contact.
     * We need to stop any existing async queries for phone, email, contact, and photos.
     */
    public void wipeClean() {
        resetAsyncQueryHandler();

        setDisplayName(null, null);
        setPhoto(loadPlaceholderPhoto(null));
        setSocialSnippet(null);
        setPresence(0);
        mContactUri = null;
        mExcludeMimes = null;
    }


    private void resetAsyncQueryHandler() {
        // the api AsyncQueryHandler.cancelOperation() doesn't really work. Since we really
        // need the old async queries to be cancelled, let's do it the hard way.
        mQueryHandler = new QueryHandler(mContentResolver);
    }

    /**
     * Bind the contact details provided by the given {@link Cursor}.
     */
+1 −0
Original line number Diff line number Diff line
@@ -503,6 +503,7 @@
    <string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Není vložena SIM karta."</string>
    <string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"V telefonu není žádná karta SIM."</string>
    <string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Prosím vložte kartu SIM."</string>
    <string name="emergency_calls_only" msgid="6733978304386365407">"Pouze tísňová volání"</string>
    <string name="lockscreen_network_locked_message" msgid="143389224986028501">"Síť je blokována"</string>
    <string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"Karta SIM je zablokována pomocí kódu PUK."</string>
    <string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Další informace naleznete v uživatelské příručce, nebo kontaktujte podporu zákazníků."</string>
+1 −0
Original line number Diff line number Diff line
@@ -503,6 +503,7 @@
    <string name="lockscreen_missing_sim_message_short" msgid="7381499217732227295">"Der er ikke noget SIM-kort."</string>
    <string name="lockscreen_missing_sim_message" msgid="2186920585695169078">"Der er ikke noget SIM-kort i telefonen."</string>
    <string name="lockscreen_missing_sim_instructions" msgid="8874620818937719067">"Indsæt et SIM-kort."</string>
    <string name="emergency_calls_only" msgid="6733978304386365407">"Kun nødopkald"</string>
    <string name="lockscreen_network_locked_message" msgid="143389224986028501">"Netværket er låst"</string>
    <string name="lockscreen_sim_puk_locked_message" msgid="7441797339976230">"SIM-kortet er låst med PUK-koden."</string>
    <string name="lockscreen_sim_puk_locked_instructions" msgid="635967534992394321">"Se brugervejledningen, eller kontakt kundeservice."</string>
Loading