Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9372ca07 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Binding to the RemoteViewsService directly from the host"

parents 2c3b41b7 e1273ebb
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -425,7 +425,6 @@ LOCAL_SRC_FILES += \
	core/java/com/android/internal/widget/ICheckCredentialProgressCallback.aidl \
	core/java/com/android/internal/widget/ILockSettings.aidl \
	core/java/com/android/internal/widget/IRemoteViewsFactory.aidl \
	core/java/com/android/internal/widget/IRemoteViewsAdapterConnection.aidl \
	keystore/java/android/security/IKeyChainAliasCallback.aidl \
	keystore/java/android/security/IKeyChainService.aidl \
	location/java/android/location/IBatchedLocationCallback.aidl \
+11 −29
Original line number Diff line number Diff line
@@ -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();
        }
+280 −367

File changed.

Preview size limit exceeded, changes collapsed.

+5 −3
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import com.android.internal.appwidget.IAppWidgetHost;
import android.os.Bundle;
import android.os.IBinder;
import android.widget.RemoteViews;
import android.app.IApplicationThread;
import android.app.IServiceConnection;

/** {@hide} */
interface IAppWidgetService {
@@ -62,9 +64,9 @@ interface IAppWidgetService {
    void setBindAppWidgetPermission(in String packageName, int userId, in boolean permission);
    boolean bindAppWidgetId(in String callingPackage, int appWidgetId,
            int providerProfileId, in ComponentName providerComponent, in Bundle options);
    void bindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent,
            in IBinder connection);
    void unbindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent);
    boolean bindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent,
            IApplicationThread caller, IBinder token, IServiceConnection connection, int flags);

    int[] getAppWidgetIds(in ComponentName providerComponent);
    boolean isBoundWidgetPackage(String packageName, int userId);
    boolean requestPinAppWidget(String packageName, in ComponentName providerComponent,
+0 −25
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.widget;

import android.os.IBinder;

/** {@hide} */
oneway interface IRemoteViewsAdapterConnection {
    void onServiceConnected(IBinder service);
    void onServiceDisconnected();
}
Loading