Search in sources :

Example 1 with Feature

use of edu.berkeley.cs.amplab.carat.thrift.Feature in project carat by amplab.

the class SamplingLibrary method getSample.

public static Sample getSample(Context context, Intent intent, String lastBatteryState) {
    final String TAG = "SamplingLibrary.getSample";
    Log.d(TAG, "getSample() was invoked.");
    String action = intent.getAction();
    Log.d(TAG, "action = " + action);
    // Construct sample and return it in the end
    Sample mySample = new Sample();
    SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context);
    String uuId = p.getString(CaratApplication.getRegisteredUuid(), null);
    mySample.setUuId(uuId);
    mySample.setTriggeredBy(action);
    // required always
    long now = System.currentTimeMillis();
    mySample.setTimestamp(now / 1000.0);
    // Record first data point for CPU usage
    long[] idleAndCpu1 = readUsagePoint();
    // If the sampler is running because of the SCREEN_ON or SCREEN_OFF
    // event/action,
    // we want to get the info of all installed apps/packages, not only
    // those running.
    // This is because we need the traffic info of all apps, some might not
    // be running when
    // those events (screen on / screen off) occur
    // TODO: let's comment out these lines for debugging purpose
    // if (action.equals(Intent.ACTION_SCREEN_ON) ||
    // action.equals(Intent.ACTION_SCREEN_OFF)) {
    // Log.d(TAG,
    // "the action has been Intent.ACTION_SCREEN_ON or SCREEN_OFF. Taking sample of ALL INSTALLED packages (rather than running processes)");
    // Map<String, ProcessInfo> installedPackages =
    // getInstalledPackages(context, false);
    // List<ProcessInfo> processes = new ArrayList<ProcessInfo>();
    // processes.addAll(installedPackages.values());
    // } else {
    // Log.d(TAG,
    // "the action has NOT been Intent.ACTION_SCREEN_ON or SCREEN_OFF. Taking sample of running processes.");
    List<ProcessInfo> processes = getRunningProcessInfoForSample(context);
    mySample.setPiList(processes);
    // }
    int screenBrightness = SamplingLibrary.getScreenBrightness(context);
    mySample.setScreenBrightness(screenBrightness);
    boolean autoScreenBrightness = SamplingLibrary.isAutoBrightness(context);
    if (autoScreenBrightness)
        // Auto
        mySample.setScreenBrightness(-1);
    // boolean gpsEnabled = SamplingLibrary.getGpsEnabled(context);
    // Location providers
    List<String> enabledLocationProviders = SamplingLibrary.getEnabledLocationProviders(context);
    mySample.setLocationProviders(enabledLocationProviders);
    // TODO: not in Sample yet
    // int maxNumSatellite = SamplingLibrary.getMaxNumSatellite(context);
    String network = SamplingLibrary.getNetworkStatus(context);
    String networkType = SamplingLibrary.getNetworkType(context);
    String mobileNetworkType = SamplingLibrary.getMobileNetworkType(context);
    // Required in new Carat protocol
    if (network.equals(NETWORKSTATUS_CONNECTED)) {
        if (networkType.equals("WIFI"))
            mySample.setNetworkStatus(networkType);
        else
            mySample.setNetworkStatus(mobileNetworkType);
    } else
        mySample.setNetworkStatus(network);
    // String ns = mySample.getNetworkStatus();
    // Log.d(STAG, "Set networkStatus="+ns);
    // Network details
    NetworkDetails nd = new NetworkDetails();
    // Network type
    nd.setNetworkType(networkType);
    nd.setMobileNetworkType(mobileNetworkType);
    boolean roamStatus = SamplingLibrary.getRoamingStatus(context);
    nd.setRoamingEnabled(roamStatus);
    String dataState = SamplingLibrary.getDataState(context);
    nd.setMobileDataStatus(dataState);
    String dataActivity = SamplingLibrary.getDataActivity(context);
    nd.setMobileDataActivity(dataActivity);
    // Wifi stuff
    String wifiState = SamplingLibrary.getWifiState(context);
    nd.setWifiStatus(wifiState);
    int wifiSignalStrength = SamplingLibrary.getWifiSignalStrength(context);
    nd.setWifiSignalStrength(wifiSignalStrength);
    int wifiLinkSpeed = SamplingLibrary.getWifiLinkSpeed(context);
    nd.setWifiLinkSpeed(wifiLinkSpeed);
    // Add NetworkDetails substruct to Sample
    mySample.setNetworkDetails(nd);
    /* Calling Information */
    // List<String> callInfo;
    // callInfo=SamplingLibrary.getCallInfo(context);
    /* Total call time */
    // long totalCallTime=0;
    // totalCallTime=SamplingLibrary.getTotalCallDur(context);
    /*
		 * long[] incomingOutgoingIdle = getCalltimesSinceBoot(context);
		 * Log.d(STAG, "Call time since boot: Incoming=" +
		 * incomingOutgoingIdle[0] + " Outgoing=" + incomingOutgoingIdle[1] +
		 * " idle=" + incomingOutgoingIdle[2]);
		 * 
		 * // Summary Call info CallInfo ci = new CallInfo(); String callState =
		 * SamplingLibrary.getCallState(context); ci.setCallStatus(callState);
		 * ci.setIncomingCallTime(incomingOutgoingIdle[0]);
		 * ci.setOutgoingCallTime(incomingOutgoingIdle[1]);
		 * ci.setNonCallTime(incomingOutgoingIdle[2]);
		 * 
		 * mySample.setCallInfo(ci);
		 */
    // Bundle b = intent.getExtras();
    int health = intent.getIntExtra(BatteryManager.EXTRA_HEALTH, 0);
    int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, 0);
    // This is really an int.
    // FIXED: Not used yet, Sample needs more fields
    int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
    String batteryTechnology = intent.getExtras().getString(BatteryManager.EXTRA_TECHNOLOGY);
    // FIXED: Not used yet, Sample needs more fields
    String batteryHealth = "Unknown";
    String batteryStatus = "Unknown";
    switch(health) {
        case BatteryManager.BATTERY_HEALTH_DEAD:
            batteryHealth = "Dead";
            break;
        case BatteryManager.BATTERY_HEALTH_GOOD:
            batteryHealth = "Good";
            break;
        case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:
            batteryHealth = "Over voltage";
            break;
        case BatteryManager.BATTERY_HEALTH_OVERHEAT:
            batteryHealth = "Overheat";
            break;
        case BatteryManager.BATTERY_HEALTH_UNKNOWN:
            batteryHealth = "Unknown";
            break;
        case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:
            batteryHealth = "Unspecified failure";
            break;
    }
    switch(status) {
        case BatteryManager.BATTERY_STATUS_CHARGING:
            batteryStatus = "Charging";
            break;
        case BatteryManager.BATTERY_STATUS_DISCHARGING:
            batteryStatus = "Discharging";
            break;
        case BatteryManager.BATTERY_STATUS_FULL:
            batteryStatus = "Full";
            break;
        case BatteryManager.BATTERY_STATUS_NOT_CHARGING:
            batteryStatus = "Not charging";
            break;
        case BatteryManager.BATTERY_STATUS_UNKNOWN:
            batteryStatus = "Unknown";
            break;
        default:
            batteryStatus = lastBatteryState != null ? lastBatteryState : "Unknown";
    }
    // FIXED: Not used yet, Sample needs more fields
    String batteryCharger = "unplugged";
    switch(plugged) {
        case BatteryManager.BATTERY_PLUGGED_AC:
            batteryCharger = "ac";
            break;
        case BatteryManager.BATTERY_PLUGGED_USB:
            batteryCharger = "usb";
            break;
    }
    BatteryDetails bd = new BatteryDetails();
    // otherInfo.setCPUIdleTime(totalIdleTime);
    // IMPORTANT: All of the battery details fields were never set (=always
    // zero), like the last battery level.
    // Now all must have been fixed.
    // current battery temperature in degrees Centigrade (the unit of the
    // temperature value
    // (returned by BatteryManager) is not Centigrade, it should be divided
    // by 10)
    int temperature = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, 0) / 10;
    bd.setBatteryTemperature(temperature);
    // otherInfo.setBatteryTemperature(temperature);
    // current battery voltage in VOLTS (the unit of the returned value by
    // BatteryManager is millivolts)
    double voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, 0) / 1000;
    bd.setBatteryVoltage(voltage);
    // otherInfo.setBatteryVoltage(voltage);
    bd.setBatteryTechnology(batteryTechnology);
    bd.setBatteryCharger(batteryCharger);
    bd.setBatteryHealth(batteryHealth);
    mySample.setBatteryDetails(bd);
    mySample.setBatteryLevel(currentBatteryLevel);
    mySample.setBatteryState(batteryStatus);
    int[] usedFreeActiveInactive = SamplingLibrary.readMeminfo();
    if (usedFreeActiveInactive != null && usedFreeActiveInactive.length == 4) {
        mySample.setMemoryUser(usedFreeActiveInactive[0]);
        mySample.setMemoryFree(usedFreeActiveInactive[1]);
        mySample.setMemoryActive(usedFreeActiveInactive[2]);
        mySample.setMemoryInactive(usedFreeActiveInactive[3]);
    }
    // TODO: Memory Wired should have memory that is "unevictable", that
    // will always be used even when all apps are killed
    // Log.d(STAG, "serial=" + getBuildSerial());
    // Record second data point for cpu/idle time
    now = System.currentTimeMillis();
    long[] idleAndCpu2 = readUsagePoint();
    CpuStatus cs = new CpuStatus();
    cs.setCpuUsage(getUsage(idleAndCpu1, idleAndCpu2));
    cs.setUptime(getUptime());
    mySample.setCpuStatus(cs);
    mySample.setDeveloperMode(isDeveloperModeOn(context));
    mySample.setUnknownSources(allowUnknownSources(context));
    mySample.setScreenOn(isScreenOn(context));
    mySample.setTimeZone(getTimeZone(context));
    // printAverageFeaturePower(context);
    // If there are extra fields, include them into the sample.
    List<Feature> extras = getExtras(context);
    if (extras != null && extras.size() > 0)
        mySample.setExtra(extras);
    return mySample;
}
Also used : CpuStatus(edu.berkeley.cs.amplab.carat.thrift.CpuStatus) SharedPreferences(android.content.SharedPreferences) Sample(edu.berkeley.cs.amplab.carat.thrift.Sample) NetworkDetails(edu.berkeley.cs.amplab.carat.thrift.NetworkDetails) RunningAppProcessInfo(android.app.ActivityManager.RunningAppProcessInfo) ProcessInfo(edu.berkeley.cs.amplab.carat.thrift.ProcessInfo) Feature(edu.berkeley.cs.amplab.carat.thrift.Feature) BatteryDetails(edu.berkeley.cs.amplab.carat.thrift.BatteryDetails)

Example 2 with Feature

use of edu.berkeley.cs.amplab.carat.thrift.Feature in project carat by amplab.

the class SamplingLibrary method getVmVersion.

//TODO: disabled for debugging
//	private static TrafficRecord getAppTraffic(Integer uid) {
//		TrafficRecord trafficRecord = new TrafficRecord();
//		trafficRecord.setTx(TrafficStats.getUidTxBytes(uid));
//		trafficRecord.setRx(TrafficStats.getUidRxBytes(uid));
//		return trafficRecord;
//	}
/**
	 * Get the java.vm.version system property as a Feature("vm", version).
	 * @param context the Context.
	 * @return a Feature instance with the key "vm" and value of the "java.vm.version" system property. 
	 */
private static Feature getVmVersion(Context context) {
    String vm = System.getProperty("java.vm.version");
    if (vm == null)
        vm = "";
    Feature vmVersion = new Feature();
    vmVersion.setKey("vm");
    vmVersion.setValue(vm);
    return vmVersion;
}
Also used : Feature(edu.berkeley.cs.amplab.carat.thrift.Feature)

Example 3 with Feature

use of edu.berkeley.cs.amplab.carat.thrift.Feature in project carat by amplab.

the class SampleReader method writeSample.

/**
     * For simplicity, this method relies on the fact that
     * only the piList of Sample has any List type elements.
     * This will fail to record those from substructs (NetworkDetails, BatteryDetails, CpuStatus),
     * and will need to be changed if those are added.
     * 
     * Does not record CallInfo, CellInfo, or CallMonth types.
     */
public static final HashMap<String, String> writeSample(Sample s) {
    HashMap<String, String> m = new HashMap<String, String>();
    for (_Fields sf : Sample.metaDataMap.keySet()) {
        FieldMetaData md = Sample.metaDataMap.get(sf);
        switch(md.valueMetaData.type) {
            case org.apache.thrift.protocol.TType.STRING:
                m.put(sf.getFieldName(), cleanStr(s.getFieldValue(sf).toString()));
                break;
            case org.apache.thrift.protocol.TType.I32:
            case org.apache.thrift.protocol.TType.DOUBLE:
                m.put(sf.getFieldName(), s.getFieldValue(sf).toString());
                break;
            case org.apache.thrift.protocol.TType.STRUCT:
                if (md.fieldName.equals(Sample._Fields.NETWORK_DETAILS.getFieldName()) && s.networkDetails != null) {
                    int len = NetworkDetails._Fields.values().length;
                    StringBuilder b = new StringBuilder();
                    for (int i = 1; i <= len; i++) {
                        b.append(cleanStr("" + s.networkDetails.getFieldValue(NetworkDetails._Fields.findByThriftId(i))));
                        if (i < len)
                            b.append("\n");
                    }
                    m.put(sf.getFieldName(), b.toString());
                } else if (md.fieldName.equals(Sample._Fields.BATTERY_DETAILS.getFieldName()) && s.batteryDetails != null) {
                    int len = BatteryDetails._Fields.values().length;
                    StringBuilder b = new StringBuilder();
                    for (int i = 1; i <= len; i++) {
                        b.append(cleanStr("" + s.batteryDetails.getFieldValue(BatteryDetails._Fields.findByThriftId(i))));
                        if (i < len)
                            b.append("\n");
                    }
                    m.put(sf.getFieldName(), b.toString());
                } else if (md.fieldName.equals(Sample._Fields.CPU_STATUS.getFieldName()) && s.cpuStatus != null) {
                    int len = CpuStatus._Fields.values().length;
                    StringBuilder b = new StringBuilder();
                    for (int i = 1; i <= len; i++) {
                        b.append(cleanStr("" + s.cpuStatus.getFieldValue(CpuStatus._Fields.findByThriftId(i))));
                        if (i < len)
                            b.append("\n");
                    }
                    m.put(sf.getFieldName(), b.toString());
                }
                /*
                  * else if (md.fieldName.equals("CallInfo")){ }
                  */
                break;
            case org.apache.thrift.protocol.TType.LIST:
                if (md.fieldName.equals(Sample._Fields.EXTRA.getFieldName()) && s.extra != null) {
                    StringBuilder b = new StringBuilder();
                    for (Feature f : s.extra) {
                        b.append(cleanStr(f.key) + ";" + cleanStr(f.value) + "\n");
                    }
                    if (b.length() > 1)
                        b.deleteCharAt(b.lastIndexOf("\n"));
                    m.put(sf.getFieldName(), b.toString());
                } else if (md.fieldName.equals(Sample._Fields.LOCATION_PROVIDERS.getFieldName()) && s.locationProviders != null) {
                    StringBuilder b = new StringBuilder();
                    for (String lp : s.locationProviders) b.append(lp + "\n");
                    if (b.length() > 1)
                        b.deleteCharAt(b.lastIndexOf("\n"));
                    m.put(sf.getFieldName(), b.toString());
                } else if (md.fieldName.equals(Sample._Fields.PI_LIST.getFieldName()) && s.piList != null) {
                    StringBuilder b = new StringBuilder();
                    for (ProcessInfo pi : s.piList) {
                        int len = ProcessInfo._Fields.values().length;
                        for (int i = 1; i <= len; i++) {
                            ProcessInfo._Fields pif = ProcessInfo._Fields.findByThriftId(i);
                            FieldMetaData pmd = ProcessInfo.metaDataMap.get(pif);
                            if (pmd.valueMetaData.type == org.apache.thrift.protocol.TType.LIST) {
                                if (pi.appSignatures != null) {
                                    for (int j = 0; j < pi.appSignatures.size(); j++) {
                                        String sig = pi.appSignatures.get(j);
                                        b.append(sig);
                                        if (j + 1 < len)
                                            b.append("#");
                                    }
                                }
                            } else {
                                b.append(cleanStr("" + pi.getFieldValue(pif)));
                            }
                            if (i < len)
                                b.append(";");
                        }
                        b.append("\n");
                    }
                    if (b.length() > 1)
                        b.deleteCharAt(b.lastIndexOf("\n"));
                    m.put(sf.getFieldName(), b.toString());
                }
                break;
            default:
        }
    }
    return m;
}
Also used : Sample._Fields(edu.berkeley.cs.amplab.carat.thrift.Sample._Fields) FieldMetaData(org.apache.thrift.meta_data.FieldMetaData) HashMap(java.util.HashMap) ProcessInfo(edu.berkeley.cs.amplab.carat.thrift.ProcessInfo) Feature(edu.berkeley.cs.amplab.carat.thrift.Feature)

Example 4 with Feature

use of edu.berkeley.cs.amplab.carat.thrift.Feature in project carat by amplab.

the class SampleReader method readSample.

/**
     * Read a Sample from a HashMap stored in the Carat Sample db.
     * @param data
     * @return
     */
public static final Sample readSample(Object data) {
    Sample s = null;
    if (data != null && data instanceof HashMap<?, ?>) {
        HashMap<String, String> m = (HashMap<String, String>) data;
        s = new Sample();
        NetworkDetails n = new NetworkDetails();
        BatteryDetails bd = new BatteryDetails();
        // CellInfo ci = new CellInfo();
        // CallInfo calli = new CallInfo();
        // CallMonth cm = new CallMonth();
        CpuStatus cs = new CpuStatus();
        // Set single fields automatically:
        for (String k : m.keySet()) {
            _Fields sf = Sample._Fields.findByName(k);
            if (sf != null) {
                // Top level Sample field.
                FieldMetaData md = Sample.metaDataMap.get(sf);
                String cleaned = origStr(m.get(k));
                switch(md.valueMetaData.type) {
                    case org.apache.thrift.protocol.TType.STRING:
                        s.setFieldValue(sf, cleaned);
                        break;
                    case org.apache.thrift.protocol.TType.I32:
                        try {
                            s.setFieldValue(sf, Integer.parseInt(cleaned));
                        } catch (NumberFormatException e) {
                            Log.e(TAG, "Could not read " + md.fieldName + ": \"" + cleaned + "\" as an int");
                        }
                        break;
                    case org.apache.thrift.protocol.TType.DOUBLE:
                        try {
                            s.setFieldValue(sf, Double.parseDouble(cleaned));
                        } catch (NumberFormatException e) {
                            Log.e(TAG, "Could not read " + md.fieldName + ": \"" + cleaned + "\" as a double");
                        }
                        break;
                    case org.apache.thrift.protocol.TType.STRUCT:
                        if (md.fieldName.equals(Sample._Fields.NETWORK_DETAILS.getFieldName())) {
                            fillNetworkDetails(m.get(k), n);
                            s.setNetworkDetails(n);
                        } else if (md.fieldName.equals(Sample._Fields.BATTERY_DETAILS.getFieldName())) {
                            fillBatteryDetails(m.get(k), bd);
                            s.setBatteryDetails(bd);
                        } else if (md.fieldName.equals(Sample._Fields.CPU_STATUS.getFieldName())) {
                            fillCpuStatusDetails(m.get(k), cs);
                            s.setCpuStatus(cs);
                        }
                        /*
                          * else if (md.fieldName.equals("CallInfo")){ }
                          */
                        break;
                    case org.apache.thrift.protocol.TType.LIST:
                        if (md.fieldName.equals(Sample._Fields.EXTRA.getFieldName())) {
                            List<Feature> list = new LinkedList<Feature>();
                            String[] extras = m.get(k).split("\n");
                            for (String e : extras) {
                                Feature f = new Feature();
                                String[] feat = e.split(";");
                                if (feat.length > 1) {
                                    f.setKey(origStr(feat[0]));
                                    f.setValue(origStr(feat[1]));
                                }
                                list.add(f);
                            }
                            s.setExtra(list);
                        } else if (md.fieldName.equals(Sample._Fields.LOCATION_PROVIDERS.getFieldName())) {
                            List<String> list = new LinkedList<String>();
                            String[] arr = m.get(k).split("\n");
                            for (String lp : arr) list.add(lp);
                            s.setLocationProviders(list);
                        } else if (md.fieldName.equals(Sample._Fields.PI_LIST.getFieldName())) {
                            // Set piList fields automatically:
                            LinkedList<ProcessInfo> piList = new LinkedList<ProcessInfo>();
                            String[] processes = m.get(md.fieldName).split("\n");
                            for (String process : processes) {
                                String[] items = process.split(";");
                                ProcessInfo pi = new ProcessInfo();
                                /*
                                 * Items are in the same order as they appear in ProcessInfo
                                 * protocol class, so I can use Thrift ID for setting the fields
                                 * automatically.
                                 */
                                for (int i = 1; i <= items.length; i++) {
                                    if (items[i - 1] == null)
                                        continue;
                                    ProcessInfo._Fields pif = ProcessInfo._Fields.findByThriftId(i);
                                    FieldMetaData pmd = ProcessInfo.metaDataMap.get(pif);
                                    cleaned = origStr(items[i - 1]);
                                    switch(pmd.valueMetaData.type) {
                                        case org.apache.thrift.protocol.TType.STRING:
                                            pi.setFieldValue(pif, cleaned);
                                            break;
                                        case org.apache.thrift.protocol.TType.I32:
                                            try {
                                                pi.setFieldValue(pif, Integer.parseInt(cleaned));
                                            } catch (NumberFormatException e) {
                                                Log.e(TAG, "Could not read " + md.fieldName + ": \"" + cleaned + "\" as an int");
                                            }
                                            break;
                                        case org.apache.thrift.protocol.TType.DOUBLE:
                                            try {
                                                pi.setFieldValue(pif, Double.parseDouble(cleaned));
                                            } catch (NumberFormatException e) {
                                                Log.e(TAG, "Could not read " + md.fieldName + ": \"" + cleaned + "\" as a double");
                                            }
                                            break;
                                        case org.apache.thrift.protocol.TType.BOOL:
                                            try {
                                                pi.setFieldValue(pif, Boolean.parseBoolean(cleaned));
                                            } catch (NumberFormatException e) {
                                                Log.e(TAG, "Could not read " + md.fieldName + ": \"" + cleaned + "\" as a bool");
                                            }
                                            break;
                                        case org.apache.thrift.protocol.TType.LIST:
                                            List<String> list = new LinkedList<String>();
                                            String[] arr = cleaned.split("#");
                                            for (String sig : arr) list.add(sig);
                                            pi.setFieldValue(pif, list);
                                            break;
                                        default:
                                    }
                                }
                                piList.add(pi);
                            }
                            s.setPiList(piList);
                        }
                        break;
                    default:
                }
            }
        }
    }
    return s;
}
Also used : CpuStatus(edu.berkeley.cs.amplab.carat.thrift.CpuStatus) Sample._Fields(edu.berkeley.cs.amplab.carat.thrift.Sample._Fields) HashMap(java.util.HashMap) Sample(edu.berkeley.cs.amplab.carat.thrift.Sample) NetworkDetails(edu.berkeley.cs.amplab.carat.thrift.NetworkDetails) ProcessInfo(edu.berkeley.cs.amplab.carat.thrift.ProcessInfo) Feature(edu.berkeley.cs.amplab.carat.thrift.Feature) LinkedList(java.util.LinkedList) FieldMetaData(org.apache.thrift.meta_data.FieldMetaData) BatteryDetails(edu.berkeley.cs.amplab.carat.thrift.BatteryDetails) List(java.util.List) LinkedList(java.util.LinkedList)

Example 5 with Feature

use of edu.berkeley.cs.amplab.carat.thrift.Feature in project carat by amplab.

the class CommunicationManager method getFeatures.

private List<Feature> getFeatures(String key1, String val1, String key2, String val2) {
    List<Feature> features = new ArrayList<Feature>();
    if (key1 == null || val1 == null || key2 == null || val2 == null) {
        Log.e("getFeatures", "Null key or value given to getFeatures!");
        System.exit(1);
        return features;
    }
    Feature feature = new Feature();
    feature.setKey(key1);
    feature.setValue(val1);
    features.add(feature);
    feature = new Feature();
    feature.setKey(key2);
    feature.setValue(val2);
    features.add(feature);
    return features;
}
Also used : ArrayList(java.util.ArrayList) Feature(edu.berkeley.cs.amplab.carat.thrift.Feature)

Aggregations

Feature (edu.berkeley.cs.amplab.carat.thrift.Feature)5 ProcessInfo (edu.berkeley.cs.amplab.carat.thrift.ProcessInfo)3 BatteryDetails (edu.berkeley.cs.amplab.carat.thrift.BatteryDetails)2 CpuStatus (edu.berkeley.cs.amplab.carat.thrift.CpuStatus)2 NetworkDetails (edu.berkeley.cs.amplab.carat.thrift.NetworkDetails)2 Sample (edu.berkeley.cs.amplab.carat.thrift.Sample)2 Sample._Fields (edu.berkeley.cs.amplab.carat.thrift.Sample._Fields)2 HashMap (java.util.HashMap)2 FieldMetaData (org.apache.thrift.meta_data.FieldMetaData)2 RunningAppProcessInfo (android.app.ActivityManager.RunningAppProcessInfo)1 SharedPreferences (android.content.SharedPreferences)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1