summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-11-14 19:59:57 (GMT)
committerDanesh M <daneshm90@gmail.com>2015-09-28 04:04:20 (GMT)
commit76c81b4a4c078a7096b3d643d3c0afc197229ee7 (patch)
tree5f3bb805e08408d488efadac41d7f76ddda458bb
parente05f05dd78ca156f9937814e5f6ca5ec85f5dcdd (diff)
downloadandroid_packages_apps_Trebuchet-76c81b4a4c078a7096b3d643d3c0afc197229ee7.zip
android_packages_apps_Trebuchet-76c81b4a4c078a7096b3d643d3c0afc197229ee7.tar.gz
android_packages_apps_Trebuchet-76c81b4a4c078a7096b3d643d3c0afc197229ee7.tar.bz2
Adding a few null checks.
1) During migration, if launcher2 has deleted user data, migration oes not happen 2) If Launcher3 does not has bind widget permission, QSB would be null. Bug: 18388507 Change-Id: Ief81f6f77ce154e7b3ecd4b77caf24239401e738
-rw-r--r--src/com/android/launcher3/Launcher.java6
-rw-r--r--src/com/android/launcher3/LauncherProvider.java6
-rw-r--r--src/com/android/launcher3/Workspace.java2
3 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c2ae5a1..7b88043 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -4595,11 +4595,11 @@ public class Launcher extends Activity
SharedPreferences sp = getSharedPreferences(
LauncherAppState.getSharedPreferencesKey(), MODE_PRIVATE);
int widgetId = sp.getInt(QSB_WIDGET_ID, -1);
+ AppWidgetProviderInfo widgetInfo = mAppWidgetManager.getAppWidgetInfo(widgetId);
if (!searchProvider.provider.flattenToString().equals(
sp.getString(QSB_WIDGET_PROVIDER, null))
- || (widgetId == -1)
- || !mAppWidgetManager.getAppWidgetInfo(widgetId).provider
- .equals(searchProvider.provider)) {
+ || (widgetInfo == null)
+ || !widgetInfo.provider.equals(searchProvider.provider)) {
// A valid widget is not already bound.
if (widgetId > -1) {
mAppWidgetHost.deleteAppWidgetId(widgetId);
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 6491268..dd2f48b 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -1512,6 +1512,12 @@ public class LauncherProvider extends ContentProvider {
userHandle = UserHandleCompat.myUserHandle();
userSerialNumber = userManager.getSerialNumberForUser(userHandle);
}
+
+ if (userHandle == null) {
+ Launcher.addDumpLog(TAG, "skipping deleted user", true);
+ continue;
+ }
+
Launcher.addDumpLog(TAG, "migrating \""
+ c.getString(titleIndex) + "\" ("
+ cellX + "," + cellY + "@"
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 96be502..3c6ab31 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2637,7 +2637,7 @@ public class Workspace extends SmoothPagedView
AlphaUpdateListener.updateVisibility(pageIndicator);
}
- if (mShowSearchBar && !mLauncher.getDragController().isDragging()) {
+ if (searchBar != null && mShowSearchBar && !mLauncher.getDragController().isDragging()) {
searchBar.setAlpha(finalSearchBarAlpha);
AlphaUpdateListener.updateVisibility(searchBar);
}