diff --git a/AndroidLibV2rayLite/interact.go b/AndroidLibV2rayLite/interact.go index 6b49ed3c..e05c00ea 100644 --- a/AndroidLibV2rayLite/interact.go +++ b/AndroidLibV2rayLite/interact.go @@ -119,7 +119,7 @@ func (v V2RayPoint) QueryStats(tag string, direct string) int64 { if v.statsManager == nil { return 0 } - counter := v.statsManager.GetCounter(fmt.Sprintf("inbound>>>%s>>>traffic>>>%s", tag, direct)) + counter := v.statsManager.GetCounter(fmt.Sprintf("outbound>>>%s>>>traffic>>>%s", tag, direct)) if counter == nil { return 0 } diff --git a/V2rayNG/app/src/main/assets/v2ray_config.json b/V2rayNG/app/src/main/assets/v2ray_config.json index c88ca53c..2783ec74 100644 --- a/V2rayNG/app/src/main/assets/v2ray_config.json +++ b/V2rayNG/app/src/main/assets/v2ray_config.json @@ -13,8 +13,8 @@ } }, "system": { - "statsInboundUplink": true, - "statsInboundDownlink": true + "statsOutboundUplink": true, + "statsOutboundDownlink": true } }, "inbounds": [{ diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt index a07941af..1a1dcebe 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt @@ -361,7 +361,7 @@ class V2RayVpnService : VpnService() { private fun updateNotification(contentText: String) { if (mBuilder != null) { - mBuilder?.setContentTitle(contentText) + mBuilder?.setStyle(NotificationCompat.BigTextStyle().bigText(contentText)) getNotificationManager().notify(NOTIFICATION_ID, mBuilder?.build()) } } @@ -382,13 +382,18 @@ class V2RayVpnService : VpnService() { mSubscription = Observable.interval(3, java.util.concurrent.TimeUnit.SECONDS) .subscribe { - val uplink = v2rayPoint.queryStats("socks", "uplink") - val downlink = v2rayPoint.queryStats("socks", "downlink") - val zero_speed = (uplink == 0L && downlink == 0L) + val proxyUplink = v2rayPoint.queryStats("proxy", "uplink") + val proxyDownlink = v2rayPoint.queryStats("proxy", "downlink") + val directUplink = v2rayPoint.queryStats("direct", "uplink") + val directDownlink = v2rayPoint.queryStats("direct", "downlink") + val zero_speed = (proxyUplink == 0L && proxyDownlink == 0L && directUplink == 0L && directDownlink == 0L) val queryTime = System.currentTimeMillis() if (!zero_speed || !last_zero_speed) { - updateNotification("${cf_name} • ${(uplink * 1000 / (queryTime - lastQueryTime)).toSpeedString()}↑" + - " ${(downlink * 1000 / (queryTime - lastQueryTime)).toSpeedString()}↓") + val sinceLastQueryInSeconds = (queryTime - lastQueryTime) / 1000.0 + updateNotification("proxy\t• ${(proxyUplink / sinceLastQueryInSeconds).toLong().toSpeedString()}↑ " + + "${(proxyDownlink / sinceLastQueryInSeconds).toLong().toSpeedString()}↓\n" + + "direct\t• ${(directUplink / sinceLastQueryInSeconds).toLong().toSpeedString()}↑ " + + "${(directDownlink / sinceLastQueryInSeconds).toLong().toSpeedString()}↓") } last_zero_speed = zero_speed lastQueryTime = queryTime