summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-04-13 14:52:04 -0700
committerEd Carrigan <cretin45@gmail.com>2016-04-27 10:32:59 -0700
commitc20815134a47bd7e2a5653ab6f42b597ff028907 (patch)
tree77690032884b658294f41d197227afe390e398ce
parentb2e0235cceec2fe892a9ccd8f26d17095c6799bf (diff)
downloadandroid_packages_apps_Trebuchet-c20815134a47bd7e2a5653ab6f42b597ff028907.tar.gz
android_packages_apps_Trebuchet-c20815134a47bd7e2a5653ab6f42b597ff028907.tar.bz2
android_packages_apps_Trebuchet-c20815134a47bd7e2a5653ab6f42b597ff028907.zip
Trebuchet: Don't crash when AppWidgetService is unavailable
Issue-id: CYNGNOS-2437 Change-Id: Ie83f26482539a821f498e07bec6d955c849b02c7 (cherry picked from commit 5e5f8259c31ce5c628922f0ce0760df6704856bb)
-rw-r--r--src/com/android/launcher3/Launcher.java3
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetHost.java7
2 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 739693361..bcff56064 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -523,7 +523,6 @@ public class Launcher extends Activity
mAppWidgetManager = AppWidgetManagerCompat.getInstance(this);
mAppWidgetHost = new LauncherAppWidgetHost(this, APPWIDGET_HOST_ID);
- mAppWidgetHost.startListening();
if (sRemoteFolderManager == null) {
sRemoteFolderManager = new RemoteFolderManager(this);
@@ -1099,6 +1098,8 @@ public class Launcher extends Activity
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onStart();
}
+ // If AppwidgetService failed to bind in onCreate, this will attempt binding again.
+ onAppWidgetHostReset();
}
@Override
diff --git a/src/com/android/launcher3/LauncherAppWidgetHost.java b/src/com/android/launcher3/LauncherAppWidgetHost.java
index 6c3a1e896..6105a0602 100644
--- a/src/com/android/launcher3/LauncherAppWidgetHost.java
+++ b/src/com/android/launcher3/LauncherAppWidgetHost.java
@@ -21,6 +21,7 @@ import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.os.TransactionTooLargeException;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -69,6 +70,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
try {
super.startListening();
} catch (Exception e) {
+ /*
if (e.getCause() instanceof TransactionTooLargeException) {
// We're willing to let this slide. The exception is being caused by the list of
// RemoteViews which is being passed back. The startListening relationship will
@@ -76,7 +78,10 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
// widgets upon bind anyway. See issue 14255011 for more context.
} else {
throw new RuntimeException(e);
- }
+ }*/
+ // If we can't bind to the app widget service, move on. We will retry at the next
+ // onStart().
+ Log.e("LauncherAppWidgetHost", "Error binding to IAppWidgetService", e);
}
}