diff --git a/api/system-current.txt b/api/system-current.txt index ad4c13506331c..1bacba2e9bfeb 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -4554,6 +4554,7 @@ package android.app { public abstract class EphemeralResolverService extends android.app.Service { ctor public EphemeralResolverService(); method public final void attachBaseContext(android.content.Context); + method public android.os.Looper getLooper(); method public final android.os.IBinder onBind(android.content.Intent); method public abstract deprecated java.util.List onEphemeralResolveInfoList(int[], int); method public android.content.pm.EphemeralResolveInfo onGetEphemeralIntentFilter(java.lang.String); diff --git a/core/java/android/app/EphemeralResolverService.java b/core/java/android/app/EphemeralResolverService.java index 7e3f626711bfe..45652ef7c37dc 100644 --- a/core/java/android/app/EphemeralResolverService.java +++ b/core/java/android/app/EphemeralResolverService.java @@ -74,10 +74,17 @@ public abstract class EphemeralResolverService extends Service { throw new IllegalStateException("Must define"); } + /** + * Returns a {@link Looper} to perform service operations on. + */ + public Looper getLooper() { + return getBaseContext().getMainLooper(); + } + @Override public final void attachBaseContext(Context base) { super.attachBaseContext(base); - mHandler = new ServiceHandler(base.getMainLooper()); + mHandler = new ServiceHandler(getLooper()); } @Override