Merge "Get anomaly info from StringArrayList" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
512cb18c2e
@@ -51,6 +51,7 @@ import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settingslib.fuelgauge.PowerWhitelistBackend;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -126,10 +127,10 @@ public class AnomalyDetectionJobService extends JobService {
|
||||
bundle.getParcelable(StatsManager.EXTRA_STATS_DIMENSIONS_VALUE);
|
||||
final long timeMs = bundle.getLong(AnomalyDetectionReceiver.KEY_ANOMALY_TIMESTAMP,
|
||||
System.currentTimeMillis());
|
||||
final String[] cookies = bundle.getStringArray(
|
||||
final ArrayList<String> cookies = bundle.getStringArrayList(
|
||||
StatsManager.EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES);
|
||||
final AnomalyInfo anomalyInfo = new AnomalyInfo(
|
||||
!ArrayUtils.isEmpty(cookies) ? cookies[0] : "");
|
||||
!ArrayUtils.isEmpty(cookies) ? cookies.get(0) : "");
|
||||
Log.i(TAG, "Extra stats value: " + intentDimsValue.toString());
|
||||
|
||||
try {
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user