-> Enabled partial updates to app widgets through AppWidgetManager.
Partial updates are not cached by the AppWidgetService. -> Added the ability to insert commands with no parameters into RemoteViews objects. -> Added showNext() and showPrevious() methods to RemoteViews. -> Made showNext() / showPrevious() of AdapterViewFlipper remotable. Change-Id: Ic5491bb374424a54728c4ca92b94b1f00dfb87ff
This commit is contained in:
@@ -425,6 +425,23 @@ class AppWidgetService extends IAppWidgetService.Stub
|
||||
}
|
||||
}
|
||||
|
||||
public void partiallyUpdateAppWidgetIds(int[] appWidgetIds, RemoteViews views) {
|
||||
if (appWidgetIds == null) {
|
||||
return;
|
||||
}
|
||||
if (appWidgetIds.length == 0) {
|
||||
return;
|
||||
}
|
||||
final int N = appWidgetIds.length;
|
||||
|
||||
synchronized (mAppWidgetIds) {
|
||||
for (int i=0; i<N; i++) {
|
||||
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetIds[i]);
|
||||
updateAppWidgetInstanceLocked(id, views, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, RemoteViews views, int viewId) {
|
||||
if (appWidgetIds == null) {
|
||||
return;
|
||||
@@ -459,11 +476,17 @@ class AppWidgetService extends IAppWidgetService.Stub
|
||||
}
|
||||
|
||||
void updateAppWidgetInstanceLocked(AppWidgetId id, RemoteViews views) {
|
||||
updateAppWidgetInstanceLocked(id, views, false);
|
||||
}
|
||||
|
||||
void updateAppWidgetInstanceLocked(AppWidgetId id, RemoteViews views, boolean isPartialUpdate) {
|
||||
// allow for stale appWidgetIds and other badness
|
||||
// lookup also checks that the calling process can access the appWidgetId
|
||||
// drop unbound appWidgetIds (shouldn't be possible under normal circumstances)
|
||||
if (id != null && id.provider != null && !id.provider.zombie && !id.host.zombie) {
|
||||
id.views = views;
|
||||
|
||||
// We do not want to save this RemoteViews
|
||||
if (!isPartialUpdate) id.views = views;
|
||||
|
||||
// is anyone listening?
|
||||
if (id.host.callbacks != null) {
|
||||
|
||||
Reference in New Issue
Block a user