summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Stanislav Zholnin <zholnin@google.com> 2019-03-25 10:03:55 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-03-25 10:03:55 +0000
commit7de5f2a8f400848ffdf1e18e3ded0761486bbcca (patch)
tree3942dc411250cd970c6e32a87ff7d749099f3a0c
parent9fed0296557aec0e8d3414045bad4a6f5a00cd42 (diff)
parent134115a5eff16d1d191e754718e49a506168bef9 (diff)
Merge "Use updated DeviceConfig API's new getters to simplify invocations."
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java24
1 files changed, 6 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
index 72f4fc7820a5..e57cff789a23 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java
@@ -118,7 +118,8 @@ public final class SmartReplyConstants {
mRequiresTargetingP = readDeviceConfigBooleanOrDefaultIfEmpty(
SystemUiDeviceConfigFlags.SSIN_REQUIRES_TARGETING_P,
mDefaultRequiresP);
- mMaxSqueezeRemeasureAttempts = readDeviceConfigIntegerOrDefaultIfEmpty(
+ mMaxSqueezeRemeasureAttempts = DeviceConfig.getInt(
+ DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.SSIN_MAX_SQUEEZE_REMEASURE_ATTEMPTS,
mDefaultMaxSqueezeRemeasureAttempts);
mEditChoicesBeforeSending = readDeviceConfigBooleanOrDefaultIfEmpty(
@@ -127,10 +128,12 @@ public final class SmartReplyConstants {
mShowInHeadsUp = readDeviceConfigBooleanOrDefaultIfEmpty(
SystemUiDeviceConfigFlags.SSIN_SHOW_IN_HEADS_UP,
mDefaultShowInHeadsUp);
- mMinNumSystemGeneratedReplies = readDeviceConfigIntegerOrDefaultIfEmpty(
+ mMinNumSystemGeneratedReplies = DeviceConfig.getInt(
+ DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.SSIN_MIN_NUM_SYSTEM_GENERATED_REPLIES,
mDefaultMinNumSystemGeneratedReplies);
- mMaxNumActions = readDeviceConfigIntegerOrDefaultIfEmpty(
+ mMaxNumActions = DeviceConfig.getInt(
+ DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.SSIN_MAX_NUM_ACTIONS,
mDefaultMaxNumActions);
}
@@ -152,21 +155,6 @@ public final class SmartReplyConstants {
return defaultValue;
}
- private static int readDeviceConfigIntegerOrDefaultIfEmpty(String propertyName,
- int defaultValue) {
- String value = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_SYSTEMUI, propertyName);
- if (TextUtils.isEmpty(value)) {
- return defaultValue;
- }
- try {
- return Integer.parseInt(value);
- } catch (NumberFormatException e) {
- Log.e(TAG, "Tried to read an integer flag, property name="
- + propertyName + ", value=" + value);
- return defaultValue;
- }
- }
-
/** Returns whether smart replies in notifications are enabled. */
public boolean isEnabled() {
return mEnabled;