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

Commit 36ce643d authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru Committed by Android Git Automerger
Browse files

am cd839752: manual merge

parents 7ffa6a03 cd839752
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
@@ -27194,19 +27194,6 @@
 deprecated="not deprecated"
 visibility="public"
>
<method name="setKeyPrefix"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="keyPrefix" type="java.lang.String">
</parameter>
</method>
<method name="writeEntityData"
 return="int"
 abstract="false"
@@ -27241,28 +27228,6 @@
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<field name="OP_DELETE"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="OP_UPDATE"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<interface name="BackupHelper"
 abstract="true"
+8 −3
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ int main(int argc, char **argv) {
    OMXClient client;
    CHECK_EQ(client.connect(), OK);

#if 1
#if 0
    sp<MediaSource> source = createSource(argv[1]);

    if (source == NULL) {
@@ -165,14 +165,15 @@ int main(int argc, char **argv) {
    success = success && meta->findInt32(kKeyHeight, &height);
    CHECK(success);
#else
    int width = 800;
    int width = 720;
    int height = 480;
    sp<MediaSource> decoder = new DummySource(width, height);
#endif

    sp<MetaData> enc_meta = new MetaData;
    // enc_meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_H263);
    enc_meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_MPEG4);
    // enc_meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_MPEG4);
    enc_meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_AVC);
    enc_meta->setInt32(kKeyWidth, width);
    enc_meta->setInt32(kKeyHeight, height);

@@ -213,6 +214,8 @@ int main(int argc, char **argv) {

#if 0
    CameraSource *source = CameraSource::Create();
    source->start();

    printf("source = %p\n", source);

    for (int i = 0; i < 100; ++i) {
@@ -227,6 +230,8 @@ int main(int argc, char **argv) {
        buffer = NULL;
    }

    source->stop();

    delete source;
    source = NULL;
#endif
+1 −3
Original line number Diff line number Diff line
@@ -25,9 +25,6 @@ import java.io.IOException;
public class BackupDataOutput {
    int mBackupWriter;

    public static final int OP_UPDATE = 1;
    public static final int OP_DELETE = 2;

    /** @hide */
    public BackupDataOutput(FileDescriptor fd) {
        if (fd == null) throw new NullPointerException();
@@ -71,6 +68,7 @@ public class BackupDataOutput {
        }
    }

    /** @hide */
    public void setKeyPrefix(String keyPrefix) {
        setKeyPrefix_native(mBackupWriter, keyPrefix);
    }
+5 −20
Original line number Diff line number Diff line
@@ -574,7 +574,9 @@ public class Browser {
    }
    
    /**
     *  Request all icons from the database.
     *  Request all icons from the database.  This call must either be called
     *  in the main thread or have had Looper.prepare() invoked in the calling
     *  thread.
     *  Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
     *  @param  cr The ContentResolver used to access the database.
     *  @param  where Clause to be used to limit the query from the database.
@@ -584,25 +586,8 @@ public class Browser {
     */
    public static final void requestAllIcons(ContentResolver cr, String where,
            WebIconDatabase.IconListener listener) {
        Cursor c = null;
        try {
            c = cr.query(
                    BOOKMARKS_URI,
                    new String[] { BookmarkColumns.URL },
                    where, null, null);
            if (c.moveToFirst()) {
                final WebIconDatabase db = WebIconDatabase.getInstance();
                do {
                    db.requestIconForPageUrl(c.getString(0), listener);
                } while (c.moveToNext());
            }
        } catch (IllegalStateException e) {
            Log.e(LOGTAG, "requestAllIcons", e);
        } finally {
            if (c != null) {
                c.close();
            }
        }
        WebIconDatabase.getInstance()
                .bulkRequestIconForPageUrl(cr, where, listener);
    }

    public static class BookmarkColumns implements BaseColumns {
+74 −7
Original line number Diff line number Diff line
@@ -16,10 +16,15 @@

package android.webkit;

import android.content.ContentResolver;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import android.graphics.Bitmap;
import android.provider.Browser;
import android.util.Log;

import java.util.HashMap;
import java.util.Vector;

/**
@@ -30,6 +35,7 @@ import java.util.Vector;
 * single object.
 */
public final class WebIconDatabase {
    private static final String LOGTAG = "WebIconDatabase";
    // Global instance of a WebIconDatabase
    private static WebIconDatabase sIconDatabase;
    // EventHandler for handling messages before and after the WebCore thread is
@@ -45,6 +51,7 @@ public final class WebIconDatabase {
        static final int REQUEST_ICON = 3;
        static final int RETAIN_ICON  = 4;
        static final int RELEASE_ICON = 5;
        static final int BULK_REQUEST_ICON = 6;
        // Message for dispatching icon request results
        private static final int ICON_RESULT = 10;
        // Actual handler that runs in WebCore thread
@@ -100,12 +107,11 @@ public final class WebIconDatabase {
                            case REQUEST_ICON:
                                IconListener l = (IconListener) msg.obj;
                                String url = msg.getData().getString("url");
                                Bitmap icon = nativeIconForPageUrl(url);
                                if (icon != null) {
                                    EventHandler.this.sendMessage(
                                            Message.obtain(null, ICON_RESULT,
                                                new IconResult(url, icon, l)));
                                }
                                requestIconAndSendResult(url, l);
                                break;

                            case BULK_REQUEST_ICON:
                                bulkRequestIcons(msg);
                                break;

                            case RETAIN_ICON:
@@ -126,6 +132,10 @@ public final class WebIconDatabase {
            }
        }

        private synchronized boolean hasHandler() {
            return mHandler != null;
        }

        private synchronized void postMessage(Message msg) {
            if (mMessages != null) {
                mMessages.add(msg);
@@ -133,6 +143,39 @@ public final class WebIconDatabase {
                mHandler.sendMessage(msg);
            }
        }

        private void bulkRequestIcons(Message msg) {
            HashMap map = (HashMap) msg.obj;
            IconListener listener = (IconListener) map.get("listener");
            ContentResolver cr = (ContentResolver) map.get("contentResolver");
            String where = (String) map.get("where");

            Cursor c = null;
            try {
                c = cr.query(
                        Browser.BOOKMARKS_URI,
                        new String[] { Browser.BookmarkColumns.URL },
                        where, null, null);
                if (c.moveToFirst()) {
                    do {
                        String url = c.getString(0);
                        requestIconAndSendResult(url, listener);
                    } while (c.moveToNext());
                }
            } catch (IllegalStateException e) {
                Log.e(LOGTAG, "BulkRequestIcons", e);
            } finally {
                if (c != null) c.close();
            }
        }

        private void requestIconAndSendResult(String url, IconListener listener) {
            Bitmap icon = nativeIconForPageUrl(url);
            if (icon != null) {
                sendMessage(obtainMessage(ICON_RESULT,
                            new IconResult(url, icon, listener)));
            }
        }
    }

    /**
@@ -192,6 +235,30 @@ public final class WebIconDatabase {
        mEventHandler.postMessage(msg);
    }

    /** {@hide}
     */
    public void bulkRequestIconForPageUrl(ContentResolver cr, String where,
            IconListener listener) {
        if (listener == null) {
            return;
        }

        // Special case situation: we don't want to add this message to the
        // queue if there is no handler because we may never have a real
        // handler to service the messages and the cursor will never get
        // closed.
        if (mEventHandler.hasHandler()) {
            // Don't use Bundle as it is parcelable.
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put("contentResolver", cr);
            map.put("where", where);
            map.put("listener", listener);
            Message msg =
                    Message.obtain(null, EventHandler.BULK_REQUEST_ICON, map);
            mEventHandler.postMessage(msg);
        }
    }

    /**
     * Retain the icon for the given page url.
     * @param url The page's url.
Loading