summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorStevie Kideckel <kideckel@google.com>2021-11-23 17:26:26 +0000
committerStevie Kideckel <kideckel@google.com>2021-11-24 13:16:30 +0000
commit8ae95aef56aea58e079c4eb5b372eb49c2895db0 (patch)
treecf4dda94f43f3b37e181d455b8bfe7e8e1212271 /core/java
parent532ff811dbc098c8403735f5d112c10b7d62c94d (diff)
Deprecate RemoteViews showNext/showPrevious
Only idempotent actions should be used as RemoteViews can be reapplied frequently. Also, these actions don't work with partiallyUpdateAppWidget, which causes developer confusion and pain. Developers should use setDisplayedChild instead and maintain their own record of the current index. Test: annotation only, validated that things still built ok Fix: 197745933 Change-Id: I67a2615567a38dae90d693c89001adcaafba2a8e
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/RemoteViews.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 3d4d9eca6b16..d8e7d118bd24 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -1510,6 +1510,12 @@ public class RemoteViews implements Parcelable, Filter {
}
}
+ /**
+ * @deprecated As RemoteViews may be reapplied frequently, it is preferable to call
+ * {@link #setDisplayedChild(int, int)} to ensure that the adapter index does not change
+ * unexpectedly.
+ */
+ @Deprecated
private final class ViewContentNavigation extends Action {
final boolean mNext;
@@ -4100,7 +4106,11 @@ public class RemoteViews implements Parcelable, Filter {
* Equivalent to calling {@link AdapterViewAnimator#showNext()}
*
* @param viewId The id of the view on which to call {@link AdapterViewAnimator#showNext()}
+ * @deprecated As RemoteViews may be reapplied frequently, it is preferable to call
+ * {@link #setDisplayedChild(int, int)} to ensure that the adapter index does not change
+ * unexpectedly.
*/
+ @Deprecated
public void showNext(@IdRes int viewId) {
addAction(new ViewContentNavigation(viewId, true /* next */));
}
@@ -4109,7 +4119,11 @@ public class RemoteViews implements Parcelable, Filter {
* Equivalent to calling {@link AdapterViewAnimator#showPrevious()}
*
* @param viewId The id of the view on which to call {@link AdapterViewAnimator#showPrevious()}
+ * @deprecated As RemoteViews may be reapplied frequently, it is preferable to call
+ * {@link #setDisplayedChild(int, int)} to ensure that the adapter index does not change
+ * unexpectedly.
*/
+ @Deprecated
public void showPrevious(@IdRes int viewId) {
addAction(new ViewContentNavigation(viewId, false /* next */));
}