Get anomaly info from StringArrayList

Statsd populates the anomaly info in StringArrayList, not StringArray. So
in settings we should use the correct API to get the data.

Bug: 77141809
Test: RunSettingsRoboTests
Change-Id: I56fc096106b5c040422fd7f5bb8cb4be7fe71d9d
This commit is contained in:
Lei Yu
2018-03-27 16:10:54 -07:00
parent 4e25277f60
commit bb90c955df
3 changed files with 14 additions and 6 deletions

View File

@@ -17,17 +17,21 @@
package com.android.settings.fuelgauge.batterytip;
import android.util.KeyValueListParser;
import android.util.Log;
/**
* Model class to parse and store anomaly info from westworld
*/
public class AnomalyInfo {
private static final String TAG = "AnomalyInfo";
private static final String KEY_ANOMALY_TYPE = "anomaly_type";
private static final String KEY_AUTO_RESTRICTION = "auto_restriction";
public final Integer anomalyType;
public final boolean autoRestriction;
public AnomalyInfo(String info) {
Log.i(TAG, "anomalyInfo: " + info);
KeyValueListParser parser = new KeyValueListParser(',');
parser.setString(info);
anomalyType = parser.getInt(KEY_ANOMALY_TYPE, -1);