diff options
Diffstat (limited to 'android/appwidget/AppWidgetManager.java')
-rw-r--r-- | android/appwidget/AppWidgetManager.java | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/android/appwidget/AppWidgetManager.java b/android/appwidget/AppWidgetManager.java index 969b19ee..37bb6b05 100644 --- a/android/appwidget/AppWidgetManager.java +++ b/android/appwidget/AppWidgetManager.java @@ -20,17 +20,19 @@ import android.annotation.BroadcastBehavior; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; -import android.annotation.SystemService; import android.annotation.SdkConstant.SdkConstantType; +import android.annotation.SystemService; +import android.app.IServiceConnection; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentSender; +import android.content.ServiceConnection; import android.content.pm.ParceledListSlice; import android.content.pm.ShortcutInfo; import android.os.Bundle; -import android.os.IBinder; +import android.os.Handler; import android.os.Process; import android.os.RemoteException; import android.os.UserHandle; @@ -1051,43 +1053,23 @@ public class AppWidgetManager { * The appWidgetId specified must already be bound to the calling AppWidgetHost via * {@link android.appwidget.AppWidgetManager#bindAppWidgetId AppWidgetManager.bindAppWidgetId()}. * - * @param packageName The package from which the binding is requested. * @param appWidgetId The AppWidget instance for which to bind the RemoteViewsService. * @param intent The intent of the service which will be providing the data to the * RemoteViewsAdapter. * @param connection The callback interface to be notified when a connection is made or lost. - * @hide - */ - public void bindRemoteViewsService(String packageName, int appWidgetId, Intent intent, - IBinder connection) { - if (mService == null) { - return; - } - try { - mService.bindRemoteViewsService(packageName, appWidgetId, intent, connection); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - - /** - * Unbinds the RemoteViewsService for a given appWidgetId and intent. - * - * The appWidgetId specified muse already be bound to the calling AppWidgetHost via - * {@link android.appwidget.AppWidgetManager#bindAppWidgetId AppWidgetManager.bindAppWidgetId()}. + * @param flags Flags used for binding to the service * - * @param packageName The package from which the binding is requested. - * @param appWidgetId The AppWidget instance for which to bind the RemoteViewsService. - * @param intent The intent of the service which will be providing the data to the - * RemoteViewsAdapter. + * @see Context#getServiceDispatcher(ServiceConnection, Handler, int) * @hide */ - public void unbindRemoteViewsService(String packageName, int appWidgetId, Intent intent) { + public boolean bindRemoteViewsService(Context context, int appWidgetId, Intent intent, + IServiceConnection connection, @Context.BindServiceFlags int flags) { if (mService == null) { - return; + return false; } try { - mService.unbindRemoteViewsService(packageName, appWidgetId, intent); + return mService.bindRemoteViewsService(context.getOpPackageName(), appWidgetId, intent, + context.getIApplicationThread(), context.getActivityToken(), connection, flags); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } |