am 77da7312: am f140be6c: Call into app widget hosts when the provider is updated.

Merge commit '77da7312215c4a433e3f53c2fe306307fc3bad52' into kraken

* commit '77da7312215c4a433e3f53c2fe306307fc3bad52':
  Call into app widget hosts when the provider is updated.
This commit is contained in:
Joe Onorato
2010-05-04 12:45:44 -07:00
committed by Android Git Automerger
2 changed files with 23 additions and 3 deletions

View File

@@ -231,8 +231,14 @@ public class AppWidgetHost {
/** /**
* Called when the AppWidget provider for a AppWidget has been upgraded to a new apk. * Called when the AppWidget provider for a AppWidget has been upgraded to a new apk.
*/ */
@SuppressWarnings({"UnusedDeclaration"})
protected void onProviderChanged(int appWidgetId, AppWidgetProviderInfo appWidget) { protected void onProviderChanged(int appWidgetId, AppWidgetProviderInfo appWidget) {
AppWidgetHostView v;
synchronized (mViews) {
v = mViews.get(appWidgetId);
}
if (v != null) {
v.updateAppWidget(null, AppWidgetHostView.UPDATE_FLAGS_RESET);
}
} }
void updateAppWidgetView(int appWidgetId, RemoteViews views) { void updateAppWidgetView(int appWidgetId, RemoteViews views) {
@@ -241,7 +247,7 @@ public class AppWidgetHost {
v = mViews.get(appWidgetId); v = mViews.get(appWidgetId);
} }
if (v != null) { if (v != null) {
v.updateAppWidget(views); v.updateAppWidget(views, 0);
} }
} }
} }

View File

@@ -46,6 +46,8 @@ public class AppWidgetHostView extends FrameLayout {
static final boolean LOGD = false; static final boolean LOGD = false;
static final boolean CROSSFADE = false; static final boolean CROSSFADE = false;
static final int UPDATE_FLAGS_RESET = 0x00000001;
static final int VIEW_MODE_NOINIT = 0; static final int VIEW_MODE_NOINIT = 0;
static final int VIEW_MODE_CONTENT = 1; static final int VIEW_MODE_CONTENT = 1;
static final int VIEW_MODE_ERROR = 2; static final int VIEW_MODE_ERROR = 2;
@@ -150,7 +152,16 @@ public class AppWidgetHostView extends FrameLayout {
* AppWidget provider. Will animate into these new views as needed * AppWidget provider. Will animate into these new views as needed
*/ */
public void updateAppWidget(RemoteViews remoteViews) { public void updateAppWidget(RemoteViews remoteViews) {
if (LOGD) Log.d(TAG, "updateAppWidget called mOld=" + mOld); updateAppWidget(remoteViews, 0);
}
void updateAppWidget(RemoteViews remoteViews, int flags) {
if (LOGD) Log.d(TAG, "updateAppWidget called mOld=" + mOld + " flags=0x"
+ Integer.toHexString(flags));
if ((flags & UPDATE_FLAGS_RESET) != 0) {
mViewMode = VIEW_MODE_NOINIT;
}
boolean recycled = false; boolean recycled = false;
View content = null; View content = null;
@@ -323,6 +334,9 @@ public class AppWidgetHostView extends FrameLayout {
* Inflate and return the default layout requested by AppWidget provider. * Inflate and return the default layout requested by AppWidget provider.
*/ */
protected View getDefaultView() { protected View getDefaultView() {
if (LOGD) {
Log.d(TAG, "getDefaultView");
}
View defaultView = null; View defaultView = null;
Exception exception = null; Exception exception = null;