Loading core/java/com/android/server/servicewatcher/ServiceWatcher.java +21 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package com.android.server.servicewatcher; import static android.content.Context.BIND_AUTO_CREATE; import static android.content.Context.BIND_NOT_FOREGROUND; import static android.content.Context.BIND_NOT_VISIBLE; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.content.ComponentName; Loading Loading @@ -146,6 +150,10 @@ public interface ServiceWatcher { protected final @Nullable String mAction; protected final int mUid; protected final ComponentName mComponentName; private final int mFlags; private static final int DEFAULT_FLAGS = BIND_AUTO_CREATE | BIND_NOT_FOREGROUND | BIND_NOT_VISIBLE; protected BoundServiceInfo(String action, ResolveInfo resolveInfo) { this(action, resolveInfo.serviceInfo.applicationInfo.uid, Loading @@ -153,9 +161,14 @@ public interface ServiceWatcher { } protected BoundServiceInfo(String action, int uid, ComponentName componentName) { this(action, uid, componentName, DEFAULT_FLAGS); } protected BoundServiceInfo(String action, int uid, ComponentName componentName, int flags) { mAction = action; mUid = uid; mComponentName = Objects.requireNonNull(componentName); mFlags = flags; } /** Returns the action associated with this bound service. */ Loading @@ -173,6 +186,11 @@ public interface ServiceWatcher { return UserHandle.getUserId(mUid); } /** Returns flags used when binding the service. */ public int getFlags() { return mFlags; } @Override public final boolean equals(Object o) { if (this == o) { Loading @@ -185,12 +203,13 @@ public interface ServiceWatcher { BoundServiceInfo that = (BoundServiceInfo) o; return mUid == that.mUid && Objects.equals(mAction, that.mAction) && mComponentName.equals(that.mComponentName); && mComponentName.equals(that.mComponentName) && mFlags == that.mFlags; } @Override public final int hashCode() { return Objects.hash(mAction, mUid, mComponentName); return Objects.hash(mAction, mUid, mComponentName, mFlags); } @Override Loading core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java +1 −5 Original line number Diff line number Diff line Loading @@ -16,10 +16,6 @@ package com.android.server.servicewatcher; import static android.content.Context.BIND_AUTO_CREATE; import static android.content.Context.BIND_NOT_FOREGROUND; import static android.content.Context.BIND_NOT_VISIBLE; import android.annotation.Nullable; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -214,7 +210,7 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements mBoundServiceInfo.getComponentName()); try { if (!mContext.bindServiceAsUser(bindIntent, this, BIND_AUTO_CREATE | BIND_NOT_FOREGROUND | BIND_NOT_VISIBLE, mBoundServiceInfo.getFlags(), mHandler, UserHandle.of(mBoundServiceInfo.getUserId()))) { Log.e(TAG, "[" + mTag + "] unexpected bind failure - retrying later"); mRebinder = this::bind; Loading Loading
core/java/com/android/server/servicewatcher/ServiceWatcher.java +21 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package com.android.server.servicewatcher; import static android.content.Context.BIND_AUTO_CREATE; import static android.content.Context.BIND_NOT_FOREGROUND; import static android.content.Context.BIND_NOT_VISIBLE; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.content.ComponentName; Loading Loading @@ -146,6 +150,10 @@ public interface ServiceWatcher { protected final @Nullable String mAction; protected final int mUid; protected final ComponentName mComponentName; private final int mFlags; private static final int DEFAULT_FLAGS = BIND_AUTO_CREATE | BIND_NOT_FOREGROUND | BIND_NOT_VISIBLE; protected BoundServiceInfo(String action, ResolveInfo resolveInfo) { this(action, resolveInfo.serviceInfo.applicationInfo.uid, Loading @@ -153,9 +161,14 @@ public interface ServiceWatcher { } protected BoundServiceInfo(String action, int uid, ComponentName componentName) { this(action, uid, componentName, DEFAULT_FLAGS); } protected BoundServiceInfo(String action, int uid, ComponentName componentName, int flags) { mAction = action; mUid = uid; mComponentName = Objects.requireNonNull(componentName); mFlags = flags; } /** Returns the action associated with this bound service. */ Loading @@ -173,6 +186,11 @@ public interface ServiceWatcher { return UserHandle.getUserId(mUid); } /** Returns flags used when binding the service. */ public int getFlags() { return mFlags; } @Override public final boolean equals(Object o) { if (this == o) { Loading @@ -185,12 +203,13 @@ public interface ServiceWatcher { BoundServiceInfo that = (BoundServiceInfo) o; return mUid == that.mUid && Objects.equals(mAction, that.mAction) && mComponentName.equals(that.mComponentName); && mComponentName.equals(that.mComponentName) && mFlags == that.mFlags; } @Override public final int hashCode() { return Objects.hash(mAction, mUid, mComponentName); return Objects.hash(mAction, mUid, mComponentName, mFlags); } @Override Loading
core/java/com/android/server/servicewatcher/ServiceWatcherImpl.java +1 −5 Original line number Diff line number Diff line Loading @@ -16,10 +16,6 @@ package com.android.server.servicewatcher; import static android.content.Context.BIND_AUTO_CREATE; import static android.content.Context.BIND_NOT_FOREGROUND; import static android.content.Context.BIND_NOT_VISIBLE; import android.annotation.Nullable; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -214,7 +210,7 @@ class ServiceWatcherImpl<TBoundServiceInfo extends BoundServiceInfo> implements mBoundServiceInfo.getComponentName()); try { if (!mContext.bindServiceAsUser(bindIntent, this, BIND_AUTO_CREATE | BIND_NOT_FOREGROUND | BIND_NOT_VISIBLE, mBoundServiceInfo.getFlags(), mHandler, UserHandle.of(mBoundServiceInfo.getUserId()))) { Log.e(TAG, "[" + mTag + "] unexpected bind failure - retrying later"); mRebinder = this::bind; Loading