ipacm: fix the VTS error

On VTS IPACM_HAL unit-test, since wlan
tethering devive won't up, therefore the
addDownsream events are all cached in
IPACM_HAL and keep accumulated until
reaching IPACM's max cached and seeing
test-case starts failing. The fix is
to clean up the cache on Stopoffload.

CRs-fixed:2118600
Bug:65612227
Test: compile

Change-Id: I24f410f5c5ae3a6cad0e14293f266b067f643389
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Signed-off-by: Niranjan Pendharkar <npendhar@codeaurora.org>
(cherry picked from commit 5cf0a7159b173f627128cf87877a3e559a558f81)
diff --git a/msm8998/ipacm/src/IPACM_OffloadManager.cpp b/msm8998/ipacm/src/IPACM_OffloadManager.cpp
index ca54ea6..32606b9 100644
--- a/msm8998/ipacm/src/IPACM_OffloadManager.cpp
+++ b/msm8998/ipacm/src/IPACM_OffloadManager.cpp
@@ -493,12 +493,22 @@
 RET IPACM_OffloadManager::stopAllOffload()
 {
 	Prefix v4gw, v6gw;
+	RET result = SUCCESS;
+
 	memset(&v4gw, 0, sizeof(v4gw));
 	memset(&v6gw, 0, sizeof(v6gw));
 	v4gw.fam = V4;
 	v6gw.fam = V6;
 	IPACMDBG_H("posting setUpstream(NULL), ipv4-fam(%d) ipv6-fam(%d)\n", v4gw.fam, v6gw.fam);
-	return setUpstream(NULL, v4gw, v6gw);
+	result = setUpstream(NULL, v4gw, v6gw);
+
+	/* reset the event cache */
+	default_gw_index = INVALID_IFACE;
+	upstream_v4_up = false;
+	upstream_v6_up = false;
+	memset(event_cache, 0, MAX_EVENT_CACHE*sizeof(framework_event_cache));
+	latest_cache_index = 0;
+	return result;
 }
 
 RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, uint64_t mb/* limit */)