summaryrefslogtreecommitdiffstats
path: root/core/java/android/appwidget/AppWidgetManager.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-01-11 18:05:01 -0800
committerWinson Chung <winsonc@google.com>2011-01-18 22:57:09 -0800
commit81f39eb6e76d0be1dd341af835e8002a0f80524e (patch)
treec4e0d4f4e531b779ae0ea16b1eb3cd783c633564 /core/java/android/appwidget/AppWidgetManager.java
parent5fb60c7af2cbf59a99ae324c4284c7860b37c723 (diff)
downloadframeworks_base-81f39eb6e76d0be1dd341af835e8002a0f80524e.zip
frameworks_base-81f39eb6e76d0be1dd341af835e8002a0f80524e.tar.gz
frameworks_base-81f39eb6e76d0be1dd341af835e8002a0f80524e.tar.bz2
Refactoring app widgets to address security/performance issues.
- Moving the service binding to AppWidgetService to prevent arbitrary apps from binding to widget services - Requiring RemoteViewsServices to require android.permission.BIND_REMOTEVIEWS permission Change-Id: Id135bafba998299eb278067712b8a5d8487cfd04
Diffstat (limited to 'core/java/android/appwidget/AppWidgetManager.java')
-rw-r--r--core/java/android/appwidget/AppWidgetManager.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java
index 2a583c1..019652c 100644
--- a/core/java/android/appwidget/AppWidgetManager.java
+++ b/core/java/android/appwidget/AppWidgetManager.java
@@ -18,6 +18,7 @@ package android.appwidget;
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -438,6 +439,47 @@ public class AppWidgetManager {
}
/**
+ * Binds the RemoteViewsService for a given appWidgetId and intent.
+ *
+ * The appWidgetId specified must already be bound to the calling AppWidgetHost via
+ * {@link android.appwidget.AppWidgetManager#bindAppWidgetId AppWidgetManager.bindAppWidgetId()}.
+ *
+ * @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(int appWidgetId, Intent intent, IBinder connection) {
+ try {
+ sService.bindRemoteViewsService(appWidgetId, intent, connection);
+ }
+ catch (RemoteException e) {
+ throw new RuntimeException("system server dead?", e);
+ }
+ }
+
+ /**
+ * 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 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.
+ * @hide
+ */
+ public void unbindRemoteViewsService(int appWidgetId, Intent intent) {
+ try {
+ sService.unbindRemoteViewsService(appWidgetId, intent);
+ }
+ catch (RemoteException e) {
+ throw new RuntimeException("system server dead?", e);
+ }
+ }
+
+ /**
* Get the list of appWidgetIds that have been bound to the given AppWidget
* provider.
*