Power Monitor Addition frameworks wifi:

Frameworks Base section of power monitor addition. Since IPowerStats
does not have a java interface, we needed to make a native interface
into the code. I followed how the LowPowerStats collection is being
done.

Native code is located in
com_android_server_am_BatteryStatsService.cpp. We are calling the
getEnergyData to get all rails energy data that has been collecting from
boot. This energy data is collected in uWs (microWatt seconds). After
the rail data is collected at each update in the RailStats class, the
wifi and cellular total energy values will contain the energy that all
rails associated with the specific subsystem will have.

We update and collect the energy data using battery stats and propagate
it to telephony metrics. When we collect the total energy for an update
we need to zero out the energy data so it can be accumulated correctly.

Bug: 115929961
Test: adb shell dumpsys activity service TelephonyDebugService --metrics
Results Examples:
        Energy consumed by wifi (mAh): 2.41
        Energy consumed across measured wifi rails (mAh): 2.76
Dumpsys Example:
	  +4m23s712ms (2) 100 cc511a18 modemRailChargemAh=0.34 wifiRailChargemAh=1.17 +wifi_scan stats=0:"dump"
         +10m24s089ms (2) 100 c4511a18 modemRailChargemAh=0.71 wifiRailChargemAh=1.77 stats=0:"write"
         +11m24s228ms (3) 100 c4511a19 volt=4315 charge=3988 modemRailChargemAh=0.77 wifiRailChargemAh=1.94 wifi_signal_strength=2 stats=0:"battery-state"

Change-Id: Iac6459f5ed7118f3c3f8e601136b9376ac3b1fb6
2 files changed