Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c7b6a25 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4383937 from 8bd54d45 to oc-mr1-release

Change-Id: I34062a839a5fb307eff417bf1bb304f33824f8ec
parents 5fd4ca7c 8bd54d45
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- Copied from frameworks/base/core/res/res/layout/simple_spinner_item.xml and modified
     layout height and added padding. -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@android:id/text1"
          style="?android:attr/spinnerItemStyle"
          android:singleLine="true"
          android:layout_width="match_parent"
          android:layout_height="?android:attr/listPreferredItemHeightSmall"
          android:ellipsize="marquee"
          android:textAlignment="inherit"
          android:gravity="center"
          android:paddingStart="30dp"
          android:paddingEnd="30dp"/>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ public class BillingCycleSettings extends DataUsageBase implements
                formatter.getUnitDisplayName(MeasureUnit.GIGABYTE)
            };
            final ArrayAdapter<String> adapter = new ArrayAdapter<String>(
                    getContext(), android.R.layout.simple_spinner_item, unitNames);
                    getContext(), R.layout.data_usage_spinner_item, unitNames);
            type.setAdapter(adapter);

            if (bytes > 1.5f * GB_IN_BYTES) {
+34 −6
Original line number Diff line number Diff line
@@ -17,12 +17,17 @@
package com.android.settings.fuelgauge.anomaly;

import android.content.Context;
import android.net.Uri;
import android.provider.Settings;
import android.support.annotation.VisibleForTesting;
import android.text.format.DateUtils;
import android.util.KeyValueListParser;
import android.util.Log;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Class to store the policy for anomaly detection, which comes from
 * {@link android.provider.Settings.Global}
@@ -43,6 +48,8 @@ public class AnomalyDetectionPolicy {
    @VisibleForTesting
    static final String KEY_WAKEUP_ALARM_THRESHOLD = "wakeup_alarm_threshold";
    @VisibleForTesting
    static final String KEY_WAKEUP_BLACKLISTED_TAGS = "wakeup_blacklisted_tags";
    @VisibleForTesting
    static final String KEY_BLUETOOTH_SCAN_THRESHOLD = "bluetooth_scan_threshold";

    /**
@@ -93,6 +100,14 @@ public class AnomalyDetectionPolicy {
     */
    public final long wakeupAlarmThreshold;

    /**
     * Array of blacklisted wakeups, by tag.
     *
     * @see Settings.Global#ANOMALY_DETECTION_CONSTANTS
     * @see #KEY_WAKEUP_BLACKLISTED_TAGS
     */
    public final Set<String> wakeupBlacklistedTags;

    /**
     * Threshold for bluetooth unoptimized scanning time in milli seconds
     *
@@ -119,15 +134,18 @@ public class AnomalyDetectionPolicy {
            Log.e(TAG, "Bad anomaly detection constants");
        }

        anomalyDetectionEnabled = mParserWrapper.getBoolean(KEY_ANOMALY_DETECTION_ENABLED, true);
        wakeLockDetectionEnabled = mParserWrapper.getBoolean(KEY_WAKELOCK_DETECTION_ENABLED, true);
        wakeupAlarmDetectionEnabled = mParserWrapper.getBoolean(KEY_WAKEUP_ALARM_DETECTION_ENABLED,
                false);
        anomalyDetectionEnabled =
                mParserWrapper.getBoolean(KEY_ANOMALY_DETECTION_ENABLED, false);
        wakeLockDetectionEnabled =
                mParserWrapper.getBoolean(KEY_WAKELOCK_DETECTION_ENABLED,false);
        wakeupAlarmDetectionEnabled =
                mParserWrapper.getBoolean(KEY_WAKEUP_ALARM_DETECTION_ENABLED,false);
        bluetoothScanDetectionEnabled = mParserWrapper.getBoolean(
                KEY_BLUETOOTH_SCAN_DETECTION_ENABLED, true);
                KEY_BLUETOOTH_SCAN_DETECTION_ENABLED, false);
        wakeLockThreshold = mParserWrapper.getLong(KEY_WAKELOCK_THRESHOLD,
                DateUtils.HOUR_IN_MILLIS);
        wakeupAlarmThreshold = mParserWrapper.getLong(KEY_WAKEUP_ALARM_THRESHOLD, 60);
        wakeupAlarmThreshold = mParserWrapper.getLong(KEY_WAKEUP_ALARM_THRESHOLD, 10);
        wakeupBlacklistedTags = parseStringSet(KEY_WAKEUP_BLACKLISTED_TAGS, null);
        bluetoothScanThreshold = mParserWrapper.getLong(KEY_BLUETOOTH_SCAN_THRESHOLD,
                30 * DateUtils.MINUTE_IN_MILLIS);
    }
@@ -148,4 +166,14 @@ public class AnomalyDetectionPolicy {
                return false; // Disabled when no this type
        }
    }

    private Set<String> parseStringSet(final String key, final Set<String> defaultSet) {
        final String value = mParserWrapper.getString(key, null);
        if (value != null) {
            return Arrays.stream(value.split(":"))
                    .map(String::trim).map(Uri::decode).collect(Collectors.toSet());
        } else {
            return defaultSet;
        }
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -43,6 +43,14 @@ public interface KeyValueListParserWrapper {
     */
    void setString(String str) throws IllegalArgumentException;

    /**
     * Get the value for key as a string.
     * @param key The key to lookup.
     * @param defaultValue The value to return if the key was not found.
     * @return the string value associated with the key.
     */
    String getString(String key, String defaultValue);

    /**
     * Get the value for key as a boolean.
     * @param key The key to lookup.
+5 −0
Original line number Diff line number Diff line
@@ -38,6 +38,11 @@ public class KeyValueListParserWrapperImpl implements KeyValueListParserWrapper
        mParser.setString(str);
    }

    @Override
    public String getString(String key, String defaultValue) {
        return mParser.getString(key, defaultValue);
    }

    @Override
    public boolean getBoolean(String key, boolean defaultValue) {
        return mParser.getBoolean(key, defaultValue);
Loading