logd: liblog: logcat: Add LogWhiteBlackList

- liblog android_logger_get_log_size and android_logger_get_readable_size
  adjusted to return long instead of int because of -G flag extending range

NB: ifdef'd only for userdebug and eng builds

- liblog Add android_logger_[sg]et_prune_list and android_logger_set_log_size
- logcat Add -P, -p and -G flags
- logd Add LogWhiteBlackList and configurable log size

(cherry picked from commit 18a5432158ad43b8faefe4950b30e760200ce0b4)

Change-Id: I1572338c1b34bd968ad7867857ef708156ec3b6a
diff --git a/logd/LogBuffer.h b/logd/LogBuffer.h
index 92dd107..0745e56 100644
--- a/logd/LogBuffer.h
+++ b/logd/LogBuffer.h
@@ -26,6 +26,7 @@
 #include "LogBufferElement.h"
 #include "LogTimes.h"
 #include "LogStatistics.h"
+#include "LogWhiteBlackList.h"
 
 typedef android::List<LogBufferElement *> LogBufferElementCollection;
 
@@ -35,6 +36,12 @@
 
     LogStatistics stats;
 
+#ifdef USERDEBUG_BUILD
+    PruneList mPrune;
+
+    unsigned long mMaxSize[LOG_ID_MAX];
+#endif
+
 public:
     LastLogTimes &mTimes;
 
@@ -49,9 +56,18 @@
 
     void clear(log_id_t id);
     unsigned long getSize(log_id_t id);
+#ifdef USERDEBUG_BUILD
+    int setSize(log_id_t id, unsigned long size);
+#endif
     unsigned long getSizeUsed(log_id_t id);
     // *strp uses malloc, use free to release.
-    size_t formatStatistics(char **strp, uid_t uid, unsigned int logMask);
+    void formatStatistics(char **strp, uid_t uid, unsigned int logMask);
+
+#ifdef USERDEBUG_BUILD
+    int initPrune(char *cp) { return mPrune.init(cp); }
+    // *strp uses malloc, use free to release.
+    void formatPrune(char **strp) { mPrune.format(strp); }
+#endif
 
 private:
     void maybePrune(log_id_t id);