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

Commit a28f6f11 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Suppress the logging of URLs when in incognito mode."

parents 26c9612f 53182c43
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ status_t StagefrightPlayer::initCheck() {

status_t StagefrightPlayer::setDataSource(
        const char *url, const KeyedVector<String8, String8> *headers) {
    LOGI("setDataSource('%s')", url);
    return mPlayer->setDataSource(url, headers);
}

+5 −2
Original line number Diff line number Diff line
@@ -33,8 +33,9 @@

namespace android {

NuPlayer::HTTPLiveSource::HTTPLiveSource(const char *url)
NuPlayer::HTTPLiveSource::HTTPLiveSource(const char *url, uint32_t flags)
    : mURL(url),
      mFlags(flags),
      mEOS(false),
      mOffset(0) {
}
@@ -49,7 +50,9 @@ void NuPlayer::HTTPLiveSource::start() {
    mLiveLooper->setName("http live");
    mLiveLooper->start();

    mLiveSession = new LiveSession;
    mLiveSession = new LiveSession(
            (mFlags & kFlagIncognito) ? LiveSession::kFlagIncognito : 0);

    mLiveLooper->registerHandler(mLiveSession);

    mLiveSession->connect(mURL.c_str());
+6 −1
Original line number Diff line number Diff line
@@ -27,7 +27,11 @@ struct ATSParser;
struct LiveSession;

struct NuPlayer::HTTPLiveSource : public NuPlayer::Source {
    HTTPLiveSource(const char *url);
    enum Flags {
        // Don't log any URLs.
        kFlagIncognito = 1,
    };
    HTTPLiveSource(const char *url, uint32_t flags = 0);

    virtual void start();

@@ -46,6 +50,7 @@ protected:

private:
    AString mURL;
    uint32_t mFlags;
    bool mEOS;
    off64_t mOffset;
    sp<ALooper> mLiveLooper;
+11 −1
Original line number Diff line number Diff line
@@ -72,7 +72,17 @@ void NuPlayer::setDataSource(
        const char *url, const KeyedVector<String8, String8> *headers) {
    sp<AMessage> msg = new AMessage(kWhatSetDataSource, id());

    msg->setObject("source", new HTTPLiveSource(url));
    uint32_t flags = 0;

    if (headers) {
        ssize_t index = headers->indexOfKey(String8("x-hide-urls-from-log"));

        if (index >= 0) {
            flags |= HTTPLiveSource::kFlagIncognito;
        }
    }

    msg->setObject("source", new HTTPLiveSource(url, flags));
    msg->post();
}

+18 −1
Original line number Diff line number Diff line
@@ -247,6 +247,22 @@ status_t AwesomePlayer::setDataSource_l(

    if (headers) {
        mUriHeaders = *headers;

        ssize_t index = mUriHeaders.indexOfKey(String8("x-hide-urls-from-log"));
        if (index >= 0) {
            // Browser is in "incognito" mode, suppress logging URLs.

            // This isn't something that should be passed to the server.
            mUriHeaders.removeItemsAt(index);

            mFlags |= INCOGNITO;
        }
    }

    if (!(mFlags & INCOGNITO)) {
        LOGI("setDataSource_l('%s')", mUri.string());
    } else {
        LOGI("setDataSource_l(URL suppressed)");
    }

    // The actual work will be done during preparation in the call to
@@ -1538,7 +1554,8 @@ status_t AwesomePlayer::finishSetDataSource_l() {

    if (!strncasecmp("http://", mUri.string(), 7)
            || !strncasecmp("https://", mUri.string(), 8)) {
        mConnectingDataSource = new NuHTTPDataSource;
        mConnectingDataSource = new NuHTTPDataSource(
                (mFlags & INCOGNITO) ? NuHTTPDataSource::kFlagIncognito : 0);

        mLock.unlock();
        status_t err = mConnectingDataSource->connect(mUri, &mUriHeaders);
Loading