Migrate to official API getWifiActivityEnergyInfoAsync()
getControllerActivityEnergyInfo() is an @hide API, migrate to getWifiActivityEnergyInfoAsync() which is an @SystemApi. Bug: 145244073 Test: m Development && adb install Development.apk, open Dev Tools app, go to Connectivity page, tap on Link Stats button, ensure link stats printed in text box below. Change-Id: I0a9edfff7d924a31c5a3470a89e03bd161f1a8fb
This commit is contained in:
@@ -699,13 +699,13 @@ public class Connectivity extends Activity {
|
||||
private void onLinkStats() {
|
||||
Log.e(TAG, "LINK STATS: ");
|
||||
try {
|
||||
WifiActivityEnergyInfo info =
|
||||
mWm.getControllerActivityEnergyInfo();
|
||||
if (info != null) {
|
||||
mLinkStatsResults.setText(" power " + info.toString());
|
||||
} else {
|
||||
mLinkStatsResults.setText(" null! ");
|
||||
}
|
||||
mWm.getWifiActivityEnergyInfoAsync(getMainExecutor(), info -> {
|
||||
if (info != null) {
|
||||
mLinkStatsResults.setText(" power " + info.toString());
|
||||
} else {
|
||||
mLinkStatsResults.setText(" null! ");
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
mLinkStatsResults.setText(" failed! " + e.toString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user