MediaMetrics: Make submit one-way

Remove the unused session id to improve speed and clarity.

Test: dumpsys media.metrics sanity, mediametrics_tests
Change-Id: Ide5e9218811e110997fed19f43eb6a5fdc5812ec
diff --git a/media/libmediametrics/include/IMediaAnalyticsService.h b/media/libmediametrics/include/IMediaAnalyticsService.h
index f2e7710..1453b5f 100644
--- a/media/libmediametrics/include/IMediaAnalyticsService.h
+++ b/media/libmediametrics/include/IMediaAnalyticsService.h
@@ -40,24 +40,15 @@
     DECLARE_META_INTERFACE(MediaAnalyticsService);
 
     /**
-     * Returns a unique sessionID to use across multiple requests;
-     * 'unique' is within this device, since last reboot.
-     */
-    virtual MediaAnalyticsItem::SessionID_t generateUniqueSessionID() = 0;
-
-    /**
      * Submits the indicated record to the mediaanalytics service, where
      * it will be merged (if appropriate) with incomplete records that
      * share the same key and sessionID.
      *
      * \param item the item to submit.
-     * \param forcenew marks any matching incomplete record as complete before
-     *                 inserting this new record.
-     *
-     * \return the sessionID associated with that item or
-     *         MediaAnalyticsItem::SessionIDInvalid on failure.
+     * \return status which is negative if an error is detected (some errors
+               may be silent and return 0 - success).
      */
-    virtual MediaAnalyticsItem::SessionID_t submit(MediaAnalyticsItem *item, bool forcenew) = 0;
+    virtual status_t submit(MediaAnalyticsItem *item) = 0;
 };
 
 // ----------------------------------------------------------------------------
@@ -69,6 +60,11 @@
                         const Parcel& data,
                         Parcel* reply,
                         uint32_t flags = 0) override;
+
+protected:
+    // Internal call where release is true if the service is to delete the item.
+    virtual status_t submitInternal(
+            MediaAnalyticsItem *item, bool release) = 0;
 };
 
 }; // namespace android
diff --git a/media/libmediametrics/include/MediaAnalyticsItem.h b/media/libmediametrics/include/MediaAnalyticsItem.h
index 3024c84..b37eff43 100644
--- a/media/libmediametrics/include/MediaAnalyticsItem.h
+++ b/media/libmediametrics/include/MediaAnalyticsItem.h
@@ -56,12 +56,6 @@
                 kTypeRate = 5,
             };
 
-        // sessionid
-        // unique within device, within boot,
-        typedef int64_t SessionID_t;
-        static constexpr SessionID_t SessionIDInvalid = -1;
-        static constexpr SessionID_t SessionIDNone = 0;
-
         // Key: the record descriminator
         // values for the record discriminator
         // values can be "component/component"
@@ -102,16 +96,6 @@
         // access functions for the class
         ~MediaAnalyticsItem();
 
-        // SessionID ties multiple submissions for same key together
-        // so that if video "height" and "width" are known at one point
-        // and "framerate" is only known later, they can be be brought
-        // together.
-        MediaAnalyticsItem &setSessionID(SessionID_t);
-        MediaAnalyticsItem &clearSessionID();
-        SessionID_t getSessionID() const;
-        // generates and stores a new ID iff mSessionID == SessionIDNone
-        SessionID_t generateSessionID();
-
         // reset all contents, discarding any extra data
         void clear();
         MediaAnalyticsItem *dup();
@@ -149,10 +133,7 @@
         bool getCString(Attr, char **value);
         bool getString(Attr, std::string *value);
 
-        // parameter indicates whether to close any existing open
-        // record with same key before establishing a new record
-        // caller retains ownership of 'this'.
-        bool selfrecord(bool);
+        // Deliver the item to MediaMetrics
         bool selfrecord();
 
         // remove indicated attributes and their values
@@ -231,12 +212,8 @@
         static void dropInstance();
 
         // tracking information
-        SessionID_t mSessionID;         // grouping similar records
         nsecs_t mTimestamp;             // ns, system_time_monotonic
 
-        // will this record accept further updates
-        bool mFinalized;
-
         Key mKey;
 
         struct Prop {