diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-11-04 10:19:58 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2016-11-09 12:43:11 -0800 |
commit | 712ee53c67bbfb5ad4735217f3a9b063d9c60ad9 (patch) | |
tree | a789880aa362c34e0431069efcd210b0628da701 /src/com/android/launcher3/LauncherAppWidgetHostView.java | |
parent | 724943dcbd8958ef220a7a45ebc0cdb10e74f7fd (diff) | |
download | android_packages_apps_Trebuchet-712ee53c67bbfb5ad4735217f3a9b063d9c60ad9.tar.gz android_packages_apps_Trebuchet-712ee53c67bbfb5ad4735217f3a9b063d9c60ad9.tar.bz2 android_packages_apps_Trebuchet-712ee53c67bbfb5ad4735217f3a9b063d9c60ad9.zip |
Catching TransactionTooLargeException when binding widget.
A widget can potentially bypass binder size limit with remote views when
using partual updates (as the merging happens on the system service). In
such a case, show the widget in error state.
Bug: 32365088
Change-Id: Id1c4425958a06463273731464e31f05908c35ec7
Diffstat (limited to 'src/com/android/launcher3/LauncherAppWidgetHostView.java')
-rw-r--r-- | src/com/android/launcher3/LauncherAppWidgetHostView.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java index b3db092da..c18408607 100644 --- a/src/com/android/launcher3/LauncherAppWidgetHostView.java +++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java @@ -72,7 +72,7 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc mContext = context; mLongPressHelper = new CheckLongPressHelper(this); mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this); - mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + mInflater = LayoutInflater.from(context); setAccessibilityDelegate(Launcher.getLauncher(context).getAccessibilityDelegate()); setBackgroundResource(R.drawable.widget_internal_focus_bg); } @@ -301,6 +301,11 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc setSelected(childIsFocused); } + public void switchToErrorView() { + // Update the widget with 0 Layout id, to reset the view to error view. + updateAppWidget(new RemoteViews(getAppWidgetInfo().provider.getPackageName(), 0)); + } + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { try { @@ -309,8 +314,7 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc post(new Runnable() { @Override public void run() { - // Update the widget with 0 Layout id, to reset the view to error view. - updateAppWidget(new RemoteViews(getAppWidgetInfo().provider.getPackageName(), 0)); + switchToErrorView(); } }); } |