1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.internal.appwidget;
18
19import android.content.ComponentName;
20import android.content.Intent;
21import android.content.IntentSender;
22import android.content.pm.ApplicationInfo;
23import android.content.pm.ParceledListSlice;
24import android.appwidget.AppWidgetProviderInfo;
25import com.android.internal.appwidget.IAppWidgetHost;
26import android.os.Bundle;
27import android.os.IBinder;
28import android.widget.RemoteViews;
29
30/** {@hide} */
31interface IAppWidgetService {
32
33    //
34    // for AppWidgetHost
35    //
36    int[] startListening(IAppWidgetHost host, String callingPackage, int hostId,
37            out List<RemoteViews> updatedViews);
38    void stopListening(String callingPackage, int hostId);
39    int allocateAppWidgetId(String callingPackage, int hostId);
40    void deleteAppWidgetId(String callingPackage, int appWidgetId);
41    void deleteHost(String packageName, int hostId);
42    void deleteAllHosts();
43    RemoteViews getAppWidgetViews(String callingPackage, int appWidgetId);
44    int[] getAppWidgetIdsForHost(String callingPackage, int hostId);
45    IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId,
46            int intentFlags);
47
48    //
49    // for AppWidgetManager
50    //
51    void updateAppWidgetIds(String callingPackage, in int[] appWidgetIds, in RemoteViews views);
52    void updateAppWidgetOptions(String callingPackage, int appWidgetId, in Bundle extras);
53    Bundle getAppWidgetOptions(String callingPackage, int appWidgetId);
54    void partiallyUpdateAppWidgetIds(String callingPackage, in int[] appWidgetIds,
55            in RemoteViews views);
56    void updateAppWidgetProvider(in ComponentName provider, in RemoteViews views);
57    void notifyAppWidgetViewDataChanged(String packageName, in int[] appWidgetIds, int viewId);
58    ParceledListSlice getInstalledProvidersForProfile(int categoryFilter,
59            int profileId);
60    AppWidgetProviderInfo getAppWidgetInfo(String callingPackage, int appWidgetId);
61    boolean hasBindAppWidgetPermission(in String packageName, int userId);
62    void setBindAppWidgetPermission(in String packageName, int userId, in boolean permission);
63    boolean bindAppWidgetId(in String callingPackage, int appWidgetId,
64            int providerProfileId, in ComponentName providerComponent, in Bundle options);
65    void bindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent,
66            in IBinder connection);
67    void unbindRemoteViewsService(String callingPackage, int appWidgetId, in Intent intent);
68    int[] getAppWidgetIds(in ComponentName providerComponent);
69    boolean isBoundWidgetPackage(String packageName, int userId);
70}
71
72