summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jay Aliomer <aaliomer@google.com> 2021-09-23 16:59:09 -0400
committer Dave Mankoff <mankoff@google.com> 2021-10-12 19:01:53 +0000
commit722473e7ff98795f010afe82166980e940e3b2a6 (patch)
tree004587db1ecbde60490f58e70de62a1ffcba72bf
parent6db6e348df3a73c80278327a66bdc3cece75070e (diff)
Added a debug and release version of flag reader
Bug: 196602427 Test: manually tested with log statements Change-Id: Ie01af22ef51504db5aadc0da1d367961b6aa42d4 Merged-In: Ie01af22ef51504db5aadc0da1d367961b6aa42d4 (cherry picked from commit 97d4fc7d158bb31ae30b63027f7ec483cd4b0a58)
-rw-r--r--packages/SystemUI/Android.bp16
-rw-r--r--packages/SystemUI/src-debug/com/android/systemui/flags/FeatureFlagManager.java43
-rw-r--r--packages/SystemUI/src/com/android/systemui/flags/FeatureFlagManager.java36
3 files changed, 95 insertions, 0 deletions
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index 6671308ef66a..c6cca5adaeb0 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -50,6 +50,16 @@ java_library {
srcs: ["src/com/android/systemui/EventLogTags.logtags"],
}
+filegroup {
+ name: "ReleaseJavaFiles",
+ srcs: ["src/com/android/systemui/flags/FeatureFlagManager.java"],
+}
+
+filegroup {
+ name: "DebugJavaFiles",
+ srcs: ["src-debug/com/android/systemui/flags/FeatureFlagManager.java"],
+}
+
android_library {
name: "SystemUI-core",
srcs: [
@@ -57,6 +67,12 @@ android_library {
"src/**/*.java",
"src/**/I*.aidl",
],
+ product_variables: {
+ debuggable: {
+ srcs: [":DebugJavaFiles"],
+ exclude_srcs: [":ReleaseJavaFiles"],
+ },
+ },
resource_dirs: [
"res-product",
"res-keyguard",
diff --git a/packages/SystemUI/src-debug/com/android/systemui/flags/FeatureFlagManager.java b/packages/SystemUI/src-debug/com/android/systemui/flags/FeatureFlagManager.java
new file mode 100644
index 000000000000..5c4f08edc784
--- /dev/null
+++ b/packages/SystemUI/src-debug/com/android/systemui/flags/FeatureFlagManager.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+package com.android.systemui.flags;
+import android.util.ArraySet;
+
+import com.android.systemui.dagger.SysUISingleton;
+
+/**
+ * Concrete implementation of the a Flag manager that returns default values for debug builds
+ */
+@SysUISingleton
+public class FeatureFlagManager {
+ public boolean isEnabled(int key, boolean defaultValue) {
+ return isEnabled(Integer.toString(key), defaultValue);
+ }
+
+ public boolean isEnabled(String key, boolean defaultValue) {
+ // TODO
+ return false;
+ }
+
+ public void setEnabled(int key, boolean value) {
+ setEnabled(Integer.toString(key), value);
+ }
+
+ public void setEnabled(String key, boolean value) {
+ // TODO
+ }
+} \ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/flags/FeatureFlagManager.java b/packages/SystemUI/src/com/android/systemui/flags/FeatureFlagManager.java
new file mode 100644
index 000000000000..dc09f2aa2492
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/flags/FeatureFlagManager.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+package com.android.systemui.flags;
+
+import com.android.systemui.dagger.SysUISingleton;
+
+/**
+ * Default implementation of the a Flag manager that returns default values for release builds
+ */
+@SysUISingleton
+public class FeatureFlagManager {
+ public boolean getBoolean(int key, boolean defaultValue) {
+ return defaultValue;
+ }
+ public void setBoolean(int key, boolean value) {}
+ public boolean getBoolean(String key, boolean defaultValue) {
+ return defaultValue;
+ }
+ public void setBoolean(String key, boolean value) {}
+ public void addFlagChangedListener(Runnable run) {}
+ public void removeFlagUpdatedListener(Runnable run) {}
+}