diff options
| -rw-r--r-- | services/core/java/com/android/server/servicewatcher/ServiceWatcher.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/servicewatcher/ServiceWatcher.java b/services/core/java/com/android/server/servicewatcher/ServiceWatcher.java index 23b5d98de59f..030bbd2bc652 100644 --- a/services/core/java/com/android/server/servicewatcher/ServiceWatcher.java +++ b/services/core/java/com/android/server/servicewatcher/ServiceWatcher.java @@ -176,7 +176,7 @@ public interface ServiceWatcher { if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof BoundServiceInfo)) { return false; } diff --git a/services/core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java b/services/core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java index 7757a7a096db..e718ba3b17cf 100644 --- a/services/core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java +++ b/services/core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java @@ -147,13 +147,23 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements @Override public String toString() { - return mServiceConnection.getBoundServiceInfo().toString(); + MyServiceConnection serviceConnection; + synchronized (this) { + serviceConnection = mServiceConnection; + } + + return serviceConnection.getBoundServiceInfo().toString(); } @Override public void dump(PrintWriter pw) { - pw.println("target service=" + mServiceConnection.getBoundServiceInfo()); - pw.println("connected=" + mServiceConnection.isConnected()); + MyServiceConnection serviceConnection; + synchronized (this) { + serviceConnection = mServiceConnection; + } + + pw.println("target service=" + serviceConnection.getBoundServiceInfo()); + pw.println("connected=" + serviceConnection.isConnected()); } // runs on the handler thread, and expects most of it's methods to be called from that thread |