summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chavi Weingarten <chaviw@google.com> 2022-05-31 15:27:20 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-05-31 15:27:20 +0000
commitddf2f52d9fa070750e0cd2fbcaee9ef6a045c70b (patch)
treeb589f3bc8571ebd739f1df8dc30479ef8805bf1b
parentab498bff17442bb2315ac28ec403763e5e7e9d36 (diff)
parent86bcd37b8f11e62752571b8cfe885946f5d92637 (diff)
Merge "Toast: Fix JE caused by service not bind"
-rw-r--r--services/core/java/com/android/server/wm/DisplayHashController.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayHashController.java b/services/core/java/com/android/server/wm/DisplayHashController.java
index 64a57588113c..543d4ad6b507 100644
--- a/services/core/java/com/android/server/wm/DisplayHashController.java
+++ b/services/core/java/com/android/server/wm/DisplayHashController.java
@@ -369,9 +369,6 @@ public class DisplayHashController {
if (mServiceConnection == null) {
if (DEBUG) Slog.v(TAG, "creating connection");
- // Create the connection
- mServiceConnection = new DisplayHashingServiceConnection();
-
final ComponentName component = getServiceComponentName();
if (DEBUG) Slog.v(TAG, "binding to: " + component);
if (component != null) {
@@ -379,6 +376,8 @@ public class DisplayHashController {
intent.setComponent(component);
final long token = Binder.clearCallingIdentity();
try {
+ // Create the connection
+ mServiceConnection = new DisplayHashingServiceConnection();
mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
if (DEBUG) Slog.v(TAG, "bound");
} finally {
@@ -387,7 +386,9 @@ public class DisplayHashController {
}
}
- mServiceConnection.runCommandLocked(command);
+ if (mServiceConnection != null) {
+ mServiceConnection.runCommandLocked(command);
+ }
}
}