summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lyn <lynhan@google.com> 2023-08-22 20:51:39 +0000
committer Lyn <lynhan@google.com> 2023-08-22 22:13:57 +0000
commitbe29cc4d021fb7a3a88931ef18a785a788a9bbbf (patch)
treeeb54590edc868ad115128900ad36b930debbabb3
parent33adcdf669b6ed3b945d844953982410d8159f31 (diff)
Trace synchronized blocks in NotifSettingsController
Bug: 295015479 Test: make Change-Id: I20362f96e51d89adce35f4f651e31d44d74a8e37
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationSettingsController.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationSettingsController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationSettingsController.java
index 51e4537d7348..4ace19480984 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationSettingsController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationSettingsController.java
@@ -21,6 +21,7 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.os.HandlerExecutor;
+import android.os.Trace;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
@@ -69,6 +70,7 @@ public class NotificationSettingsController implements Dumpable {
mContentObserver = new ContentObserver(mBackgroundHandler) {
@Override
public void onChange(boolean selfChange, Uri uri) {
+ Trace.traceBegin(Trace.TRACE_TAG_APP, TAG + ".ContentObserver.onChange");
super.onChange(selfChange, uri);
synchronized (mListeners) {
if (mListeners.containsKey(uri)) {
@@ -79,12 +81,15 @@ public class NotificationSettingsController implements Dumpable {
}
}
}
+ Trace.traceEnd(Trace.TRACE_TAG_APP);
}
};
mCurrentUserTrackerCallback = new UserTracker.Callback() {
@Override
public void onUserChanged(int newUser, Context userContext) {
+ Trace.traceBegin(Trace.TRACE_TAG_APP, TAG + ".UserTracker.Callback.onUserChanged");
+
synchronized (mListeners) {
if (mListeners.size() > 0) {
mSecureSettings.unregisterContentObserver(mContentObserver);
@@ -94,6 +99,7 @@ public class NotificationSettingsController implements Dumpable {
}
}
}
+ Trace.traceEnd(Trace.TRACE_TAG_APP);
}
};
mUserTracker.addCallback(
@@ -113,6 +119,7 @@ public class NotificationSettingsController implements Dumpable {
if (uri == null || listener == null) {
return;
}
+ Trace.traceBegin(Trace.TRACE_TAG_APP, TAG + ".addCallback");
synchronized (mListeners) {
ArrayList<Listener> currentListeners = mListeners.get(uri);
if (currentListeners == null) {
@@ -132,10 +139,12 @@ public class NotificationSettingsController implements Dumpable {
String value = getCurrentSettingValue(uri, userId);
mMainHandler.post(() -> listener.onSettingChanged(uri, userId, value));
});
-
+ Trace.traceEnd(Trace.TRACE_TAG_APP);
}
public void removeCallback(Uri uri, Listener listener) {
+ Trace.traceBegin(Trace.TRACE_TAG_APP, TAG + ".removeCallback");
+
synchronized (mListeners) {
ArrayList<Listener> currentListeners = mListeners.get(uri);
@@ -150,10 +159,13 @@ public class NotificationSettingsController implements Dumpable {
mSecureSettings.unregisterContentObserver(mContentObserver);
}
}
+ Trace.traceEnd(Trace.TRACE_TAG_APP);
}
@Override
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
+ Trace.traceBegin(Trace.TRACE_TAG_APP, TAG + ".dump");
+
synchronized (mListeners) {
pw.println("Settings Uri Listener List:");
for (Uri uri : mListeners.keySet()) {
@@ -163,6 +175,7 @@ public class NotificationSettingsController implements Dumpable {
}
}
}
+ Trace.traceEnd(Trace.TRACE_TAG_APP);
}
private String getCurrentSettingValue(Uri uri, int userId) {