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

Commit 0426c97b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "media.metrics changes AString -> std::string"

parents 0b68d531 783bd0d7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ status_t reportMetricsGroup(const MetricsGroup& metricsGroup,

    // Report the package name.
    if (metricsGroup.has_app_package_name()) {
      AString app_package_name(metricsGroup.app_package_name().c_str(),
        std::string app_package_name(metricsGroup.app_package_name().c_str(),
                               metricsGroup.app_package_name().size());
      analyticsItem.setPkgName(app_package_name);
    }
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ cc_library_shared {
        "libaudiomanager",
        "libmedia_helper",
        "libmediametrics",
        "libstagefright_foundation",
    ],
    export_shared_lib_headers: ["libbinder"],

+7 −13
Original line number Diff line number Diff line
@@ -29,8 +29,6 @@
#include <utils/SortedVector.h>
#include <utils/threads.h>

#include <media/stagefright/foundation/AString.h>

#include <binder/IServiceManager.h>
#include <media/IMediaAnalyticsService.h>
#include <media/MediaAnalyticsItem.h>
@@ -205,15 +203,11 @@ uid_t MediaAnalyticsItem::getUid() const {
    return mUid;
}

MediaAnalyticsItem &MediaAnalyticsItem::setPkgName(AString pkgName) {
MediaAnalyticsItem &MediaAnalyticsItem::setPkgName(const std::string &pkgName) {
    mPkgName = pkgName;
    return *this;
}

AString MediaAnalyticsItem::getPkgName() const {
    return mPkgName;
}

MediaAnalyticsItem &MediaAnalyticsItem::setPkgVersionCode(int64_t pkgVersionCode) {
    mPkgVersionCode = pkgVersionCode;
    return *this;
@@ -727,11 +721,11 @@ int32_t MediaAnalyticsItem::writeToParcel(Parcel *data) {
}


AString MediaAnalyticsItem::toString() {
std::string MediaAnalyticsItem::toString() {
   return toString(-1);
}

AString MediaAnalyticsItem::toString(int version) {
std::string MediaAnalyticsItem::toString(int version) {

    // v0 : released with 'o'
    // v1 : bug fix (missing pid/finalized separator),
@@ -744,7 +738,7 @@ AString MediaAnalyticsItem::toString(int version) {
        version = PROTO_LAST;
    }

    AString result;
    std::string result;
    char buffer[512];

    if (version == PROTO_V0) {
@@ -841,7 +835,7 @@ bool MediaAnalyticsItem::selfrecord() {
bool MediaAnalyticsItem::selfrecord(bool forcenew) {

    if (DEBUG_API) {
        AString p = this->toString();
        std::string p = this->toString();
        ALOGD("selfrecord of: %s [forcenew=%d]", p.c_str(), forcenew);
    }

@@ -850,13 +844,13 @@ bool MediaAnalyticsItem::selfrecord(bool forcenew) {
    if (svc != NULL) {
        MediaAnalyticsItem::SessionID_t newid = svc->submit(this, forcenew);
        if (newid == SessionIDInvalid) {
            AString p = this->toString();
            std::string p = this->toString();
            ALOGW("Failed to record: %s [forcenew=%d]", p.c_str(), forcenew);
            return false;
        }
        return true;
    } else {
        AString p = this->toString();
        std::string p = this->toString();
        ALOGW("Unable to record: %s [forcenew=%d]", p.c_str(), forcenew);
        return false;
    }
+8 −10
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define ANDROID_MEDIA_MEDIAANALYTICSITEM_H

#include <cutils/properties.h>
#include <string>
#include <sys/types.h>
#include <utils/Errors.h>
#include <utils/KeyedVector.h>
@@ -25,13 +26,10 @@
#include <utils/StrongPointer.h>
#include <utils/Timers.h>

#include <media/stagefright/foundation/AString.h>

namespace android {



class IMediaAnalyticsService;
class Parcel;

// the class interface
//
@@ -66,7 +64,7 @@ class MediaAnalyticsItem {
        // values can be "component/component"
        // basic values: "video", "audio", "drm"
        // XXX: need to better define the format
        typedef AString Key;
        typedef std::string Key;
        static const Key kKeyNone;              // ""
        static const Key kKeyAny;               // "*"

@@ -170,8 +168,8 @@ class MediaAnalyticsItem {
        MediaAnalyticsItem &setUid(uid_t);
        uid_t getUid() const;

        MediaAnalyticsItem &setPkgName(AString);
        AString getPkgName() const;
        MediaAnalyticsItem &setPkgName(const std::string &pkgName);
        std::string getPkgName() const { return mPkgName; }

        MediaAnalyticsItem &setPkgVersionCode(int64_t);
        int64_t getPkgVersionCode() const;
@@ -180,8 +178,8 @@ class MediaAnalyticsItem {
        int32_t writeToParcel(Parcel *);
        int32_t readFromParcel(const Parcel&);

        AString toString();
        AString toString(int version);
        std::string toString();
        std::string toString(int version);

        // are we collecting analytics data
        static bool isEnabled();
@@ -204,7 +202,7 @@ class MediaAnalyticsItem {
        // to help validate that A doesn't mess with B's records
        pid_t     mPid;
        uid_t     mUid;
        AString   mPkgName;
        std::string   mPkgName;
        int64_t   mPkgVersionCode;

        // let's reuse a binder connection
+7 −7
Original line number Diff line number Diff line
@@ -389,7 +389,7 @@ status_t MediaAnalyticsService::dump(int fd, const Vector<String16>& args)
    nsecs_t ts_since = 0;
    String16 helpOption("-help");
    String16 onlyOption("-only");
    AString only;
    std::string only;
    int n = args.size();

    for (int i = 0; i < n; i++) {
@@ -553,7 +553,7 @@ void MediaAnalyticsService::dumpSummaries(String8 &result, nsecs_t ts_since, con
                if (only != NULL && strcmp(only, (*it)->getKey()) != 0) {
                    ALOGV("Told to omit '%s'", (*it)->getKey());
                }
                AString distilled = (*it)->dumpSummary(slot, only);
                std::string distilled = (*it)->dumpSummary(slot, only);
                result.append(distilled.c_str());
            }
        }
@@ -605,7 +605,7 @@ String8 MediaAnalyticsService::dumpQueue(List<MediaAnalyticsItem *> *theList, ns
                ALOGV("Omit '%s', it's not '%s'", (*it)->getKey().c_str(), only);
                continue;
            }
            AString entry = (*it)->toString(mDumpProto);
            std::string entry = (*it)->toString(mDumpProto);
            result.appendFormat("%5d: %s\n", slot, entry.c_str());
            slot++;
        }
@@ -746,7 +746,7 @@ void MediaAnalyticsService::deleteItem(List<MediaAnalyticsItem *> *l, MediaAnaly
    }
}

static AString allowedKeys[] =
static std::string allowedKeys[] =
{
    "codec",
    "extractor"
@@ -760,7 +760,7 @@ bool MediaAnalyticsService::contentValid(MediaAnalyticsItem *item, bool isTruste
    // untrusted uids can only send us a limited set of keys
    if (isTrusted == false) {
        // restrict to a specific set of keys
        AString key = item->getKey();
        std::string key = item->getKey();

        size_t i;
        for(i = 0; i < nAllowedKeys; i++) {
@@ -854,7 +854,7 @@ void MediaAnalyticsService::setPkgInfo(MediaAnalyticsItem *item, uid_t uid, bool
            return setPkgInfo(item, uid, setName, setVersion);
        }
    } else {
        AString pkg;
        std::string pkg;
        std::string installer = "";
        int64_t versionCode = 0;

@@ -896,7 +896,7 @@ void MediaAnalyticsService::setPkgInfo(MediaAnalyticsItem *item, uid_t uid, bool
            }

            // strip any leading "shared:" strings that came back
            if (pkg.startsWith("shared:")) {
            if (pkg.compare(0, 7, "shared:") == 0) {
                pkg.erase(0, 7);
            }

Loading