Merge "Toast: Fix JE caused by service not bind"

This commit is contained in:
Chavi Weingarten
2022-05-31 15:27:20 +00:00
committed by Gerrit Code Review

View File

@@ -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);
}
}
}