Loading api/current.xml +11 −4 Original line number Diff line number Diff line Loading @@ -36145,8 +36145,6 @@ > <parameter name="appWidgetIds" type="int[]"> </parameter> <parameter name="views" type="android.widget.RemoteViews"> </parameter> <parameter name="viewId" type="int"> </parameter> </method> Loading @@ -36162,8 +36160,6 @@ > <parameter name="appWidgetId" type="int"> </parameter> <parameter name="views" type="android.widget.RemoteViews"> </parameter> <parameter name="viewId" type="int"> </parameter> </method> Loading Loading @@ -228464,6 +228460,17 @@ visibility="public" > </method> <method name="onDataSetChanged" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="onDestroy" return="void" abstract="true" core/java/android/appwidget/AppWidgetHost.java +4 −5 Original line number Diff line number Diff line Loading @@ -62,11 +62,10 @@ public class AppWidgetHost { msg.sendToTarget(); } public void viewDataChanged(int appWidgetId, RemoteViews views, int viewId) { public void viewDataChanged(int appWidgetId, int viewId) { Message msg = mHandler.obtainMessage(HANDLE_VIEW_DATA_CHANGED); msg.arg1 = appWidgetId; msg.arg2 = viewId; msg.obj = views; msg.sendToTarget(); } } Loading @@ -87,7 +86,7 @@ public class AppWidgetHost { break; } case HANDLE_VIEW_DATA_CHANGED: { viewDataChanged(msg.arg1, (RemoteViews) msg.obj, msg.arg2); viewDataChanged(msg.arg1, msg.arg2); break; } } Loading Loading @@ -264,13 +263,13 @@ public class AppWidgetHost { } } void viewDataChanged(int appWidgetId, RemoteViews views, int viewId) { void viewDataChanged(int appWidgetId, int viewId) { AppWidgetHostView v; synchronized (mViews) { v = mViews.get(appWidgetId); } if (v != null) { v.viewDataChanged(views, viewId); v.viewDataChanged(viewId); } } } Loading core/java/android/appwidget/AppWidgetHostView.java +1 −1 Original line number Diff line number Diff line Loading @@ -264,7 +264,7 @@ public class AppWidgetHostView extends FrameLayout { * Process data-changed notifications for the specified view in the specified * set of {@link RemoteViews} views. */ void viewDataChanged(RemoteViews remoteViews, int viewId) { void viewDataChanged(int viewId) { View v = findViewById(viewId); if ((v != null) && (v instanceof AdapterView<?>)) { AdapterView<?> adapterView = (AdapterView<?>) v; Loading core/java/android/appwidget/AppWidgetManager.java +4 −6 Original line number Diff line number Diff line Loading @@ -353,12 +353,11 @@ public class AppWidgetManager { * to invalidate their currently data. * * @param appWidgetIds The AppWidget instances for which to notify of view data changes. * @param views The RemoteViews which contains the view referenced at viewId. * @param viewId The collection view id. */ public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, RemoteViews views, int viewId) { public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, int viewId) { try { sService.notifyAppWidgetViewDataChanged(appWidgetIds, views, viewId); sService.notifyAppWidgetViewDataChanged(appWidgetIds, viewId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); Loading @@ -370,11 +369,10 @@ public class AppWidgetManager { * to invalidate it's currently data. * * @param appWidgetId The AppWidget instance for which to notify of view data changes. * @param views The RemoteViews which contains the view referenced at viewId. * @param viewId The collection view id. */ public void notifyAppWidgetViewDataChanged(int appWidgetId, RemoteViews views, int viewId) { notifyAppWidgetViewDataChanged(new int[] { appWidgetId }, views, viewId); public void notifyAppWidgetViewDataChanged(int appWidgetId, int viewId) { notifyAppWidgetViewDataChanged(new int[] { appWidgetId }, viewId); } /** Loading core/java/android/widget/RemoteViewsAdapter.java +51 −0 Original line number Diff line number Diff line Loading @@ -202,6 +202,7 @@ public class RemoteViewsAdapter extends BaseAdapter { int count; int viewTypeCount; boolean hasStableIds; boolean isDataDirty; Map<Integer, Integer> mTypeIdIndexMap; RemoteViewsInfo() { Loading @@ -209,6 +210,7 @@ public class RemoteViewsAdapter extends BaseAdapter { // by default there is at least one dummy view type viewTypeCount = 1; hasStableIds = true; isDataDirty = false; mTypeIdIndexMap = new HashMap<Integer, Integer>(); } } Loading Loading @@ -282,6 +284,39 @@ public class RemoteViewsAdapter extends BaseAdapter { } } protected void onNotifyDataSetChanged() { // we mark the data as dirty so that the next call to fetch views will result in // an onDataSetDirty() call from the adapter synchronized (mViewCacheInfo) { mViewCacheInfo.isDataDirty = true; } } private void updateNotifyDataSetChanged() { // actually calls through to the factory to notify it to update if (mServiceConnection.isConnected()) { IRemoteViewsFactory factory = mServiceConnection.getRemoteViewsFactory(); try { factory.onDataSetChanged(); } catch (RemoteException e) { e.printStackTrace(); } } // re-request the new metadata (only after the notification to the factory) requestMetaData(); // post a new runnable on the main thread to propagate the notification back // to the base adapter mMainQueue.post(new Runnable() { @Override public void run() { completeNotifyDataSetChanged(); } }); } protected void updateRemoteViewsInfo(int position) { if (mServiceConnection.isConnected()) { IRemoteViewsFactory factory = mServiceConnection.getRemoteViewsFactory(); Loading Loading @@ -499,6 +534,16 @@ public class RemoteViewsAdapter extends BaseAdapter { @Override public void run() { while (mBackgroundLoaderEnabled) { // notify the RemoteViews factory if necessary boolean isDataDirty = false; synchronized (mViewCacheInfo) { isDataDirty = mViewCacheInfo.isDataDirty; mViewCacheInfo.isDataDirty = false; } if (isDataDirty) { updateNotifyDataSetChanged(); } int index = -1; synchronized (mViewCacheLoadIndices) { if (!mViewCacheLoadIndices.isEmpty()) { Loading Loading @@ -668,6 +713,12 @@ public class RemoteViewsAdapter extends BaseAdapter { public void notifyDataSetChanged() { // flush the cache so that we can reload new items from the service mViewCache.flushCache(); // notify the factory that it's data may no longer be valid mViewCache.onNotifyDataSetChanged(); } public void completeNotifyDataSetChanged() { super.notifyDataSetChanged(); } Loading Loading
api/current.xml +11 −4 Original line number Diff line number Diff line Loading @@ -36145,8 +36145,6 @@ > <parameter name="appWidgetIds" type="int[]"> </parameter> <parameter name="views" type="android.widget.RemoteViews"> </parameter> <parameter name="viewId" type="int"> </parameter> </method> Loading @@ -36162,8 +36160,6 @@ > <parameter name="appWidgetId" type="int"> </parameter> <parameter name="views" type="android.widget.RemoteViews"> </parameter> <parameter name="viewId" type="int"> </parameter> </method> Loading Loading @@ -228464,6 +228460,17 @@ visibility="public" > </method> <method name="onDataSetChanged" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="onDestroy" return="void" abstract="true"
core/java/android/appwidget/AppWidgetHost.java +4 −5 Original line number Diff line number Diff line Loading @@ -62,11 +62,10 @@ public class AppWidgetHost { msg.sendToTarget(); } public void viewDataChanged(int appWidgetId, RemoteViews views, int viewId) { public void viewDataChanged(int appWidgetId, int viewId) { Message msg = mHandler.obtainMessage(HANDLE_VIEW_DATA_CHANGED); msg.arg1 = appWidgetId; msg.arg2 = viewId; msg.obj = views; msg.sendToTarget(); } } Loading @@ -87,7 +86,7 @@ public class AppWidgetHost { break; } case HANDLE_VIEW_DATA_CHANGED: { viewDataChanged(msg.arg1, (RemoteViews) msg.obj, msg.arg2); viewDataChanged(msg.arg1, msg.arg2); break; } } Loading Loading @@ -264,13 +263,13 @@ public class AppWidgetHost { } } void viewDataChanged(int appWidgetId, RemoteViews views, int viewId) { void viewDataChanged(int appWidgetId, int viewId) { AppWidgetHostView v; synchronized (mViews) { v = mViews.get(appWidgetId); } if (v != null) { v.viewDataChanged(views, viewId); v.viewDataChanged(viewId); } } } Loading
core/java/android/appwidget/AppWidgetHostView.java +1 −1 Original line number Diff line number Diff line Loading @@ -264,7 +264,7 @@ public class AppWidgetHostView extends FrameLayout { * Process data-changed notifications for the specified view in the specified * set of {@link RemoteViews} views. */ void viewDataChanged(RemoteViews remoteViews, int viewId) { void viewDataChanged(int viewId) { View v = findViewById(viewId); if ((v != null) && (v instanceof AdapterView<?>)) { AdapterView<?> adapterView = (AdapterView<?>) v; Loading
core/java/android/appwidget/AppWidgetManager.java +4 −6 Original line number Diff line number Diff line Loading @@ -353,12 +353,11 @@ public class AppWidgetManager { * to invalidate their currently data. * * @param appWidgetIds The AppWidget instances for which to notify of view data changes. * @param views The RemoteViews which contains the view referenced at viewId. * @param viewId The collection view id. */ public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, RemoteViews views, int viewId) { public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, int viewId) { try { sService.notifyAppWidgetViewDataChanged(appWidgetIds, views, viewId); sService.notifyAppWidgetViewDataChanged(appWidgetIds, viewId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); Loading @@ -370,11 +369,10 @@ public class AppWidgetManager { * to invalidate it's currently data. * * @param appWidgetId The AppWidget instance for which to notify of view data changes. * @param views The RemoteViews which contains the view referenced at viewId. * @param viewId The collection view id. */ public void notifyAppWidgetViewDataChanged(int appWidgetId, RemoteViews views, int viewId) { notifyAppWidgetViewDataChanged(new int[] { appWidgetId }, views, viewId); public void notifyAppWidgetViewDataChanged(int appWidgetId, int viewId) { notifyAppWidgetViewDataChanged(new int[] { appWidgetId }, viewId); } /** Loading
core/java/android/widget/RemoteViewsAdapter.java +51 −0 Original line number Diff line number Diff line Loading @@ -202,6 +202,7 @@ public class RemoteViewsAdapter extends BaseAdapter { int count; int viewTypeCount; boolean hasStableIds; boolean isDataDirty; Map<Integer, Integer> mTypeIdIndexMap; RemoteViewsInfo() { Loading @@ -209,6 +210,7 @@ public class RemoteViewsAdapter extends BaseAdapter { // by default there is at least one dummy view type viewTypeCount = 1; hasStableIds = true; isDataDirty = false; mTypeIdIndexMap = new HashMap<Integer, Integer>(); } } Loading Loading @@ -282,6 +284,39 @@ public class RemoteViewsAdapter extends BaseAdapter { } } protected void onNotifyDataSetChanged() { // we mark the data as dirty so that the next call to fetch views will result in // an onDataSetDirty() call from the adapter synchronized (mViewCacheInfo) { mViewCacheInfo.isDataDirty = true; } } private void updateNotifyDataSetChanged() { // actually calls through to the factory to notify it to update if (mServiceConnection.isConnected()) { IRemoteViewsFactory factory = mServiceConnection.getRemoteViewsFactory(); try { factory.onDataSetChanged(); } catch (RemoteException e) { e.printStackTrace(); } } // re-request the new metadata (only after the notification to the factory) requestMetaData(); // post a new runnable on the main thread to propagate the notification back // to the base adapter mMainQueue.post(new Runnable() { @Override public void run() { completeNotifyDataSetChanged(); } }); } protected void updateRemoteViewsInfo(int position) { if (mServiceConnection.isConnected()) { IRemoteViewsFactory factory = mServiceConnection.getRemoteViewsFactory(); Loading Loading @@ -499,6 +534,16 @@ public class RemoteViewsAdapter extends BaseAdapter { @Override public void run() { while (mBackgroundLoaderEnabled) { // notify the RemoteViews factory if necessary boolean isDataDirty = false; synchronized (mViewCacheInfo) { isDataDirty = mViewCacheInfo.isDataDirty; mViewCacheInfo.isDataDirty = false; } if (isDataDirty) { updateNotifyDataSetChanged(); } int index = -1; synchronized (mViewCacheLoadIndices) { if (!mViewCacheLoadIndices.isEmpty()) { Loading Loading @@ -668,6 +713,12 @@ public class RemoteViewsAdapter extends BaseAdapter { public void notifyDataSetChanged() { // flush the cache so that we can reload new items from the service mViewCache.flushCache(); // notify the factory that it's data may no longer be valid mViewCache.onNotifyDataSetChanged(); } public void completeNotifyDataSetChanged() { super.notifyDataSetChanged(); } Loading