summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Xiaowen Lei <xilei@google.com> 2022-10-20 19:01:15 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-10-20 19:01:15 +0000
commitdfd09a636928861cdd04db8df0e20ca97ffc7a9c (patch)
tree5c43fd29716f7ba2c393b40d7e2aafcbfb3f291a
parent39413173c6c07f15dd00b31477e3456a9a2506b7 (diff)
parentc73bfe321195e9641fe2d176a1798ae13c543124 (diff)
Merge "Add/update access method/level for mTag and shouldLog()." into tm-qpr-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/util/condition/Condition.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/util/condition/Monitor.java3
2 files changed, 7 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/util/condition/Condition.java b/packages/SystemUI/src/com/android/systemui/util/condition/Condition.java
index ecb365f43e3f..2c317dd391c0 100644
--- a/packages/SystemUI/src/com/android/systemui/util/condition/Condition.java
+++ b/packages/SystemUI/src/com/android/systemui/util/condition/Condition.java
@@ -172,10 +172,14 @@ public abstract class Condition implements CallbackController<Condition.Callback
return Boolean.TRUE.equals(mIsConditionMet);
}
- private boolean shouldLog() {
+ protected final boolean shouldLog() {
return Log.isLoggable(mTag, Log.DEBUG);
}
+ protected final String getTag() {
+ return mTag;
+ }
+
/**
* Callback that receives updates about whether the condition has been fulfilled.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/util/condition/Monitor.java b/packages/SystemUI/src/com/android/systemui/util/condition/Monitor.java
index 4824f6744c6e..cb430ba454f0 100644
--- a/packages/SystemUI/src/com/android/systemui/util/condition/Monitor.java
+++ b/packages/SystemUI/src/com/android/systemui/util/condition/Monitor.java
@@ -117,6 +117,7 @@ public class Monitor {
final SubscriptionState state = new SubscriptionState(subscription);
mExecutor.execute(() -> {
+ if (shouldLog()) Log.d(mTag, "adding subscription");
mSubscriptions.put(token, state);
// Add and associate conditions.
@@ -143,7 +144,7 @@ public class Monitor {
*/
public void removeSubscription(@NotNull Subscription.Token token) {
mExecutor.execute(() -> {
- if (shouldLog()) Log.d(mTag, "removing callback");
+ if (shouldLog()) Log.d(mTag, "removing subscription");
if (!mSubscriptions.containsKey(token)) {
Log.e(mTag, "subscription not present:" + token);
return;