Merge "Show side pages when exiting spring-loaded mode"
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index af0f205..0199d01 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -255,8 +255,8 @@
PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(true);
mAnimationBuffer.setAlpha(1f);
mAnimationBuffer.setVisibility(View.VISIBLE);
- LayoutParams p = new FrameLayout.LayoutParams(child.getWidth(),
- child.getHeight());
+ LayoutParams p = new FrameLayout.LayoutParams(child.getMeasuredWidth(),
+ child.getMeasuredHeight());
p.setMargins((int) child.getLeft(), (int) child.getTop(), 0, 0);
mAnimationBuffer.addView(child, p);
}
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index eba89e5..2a1d65a 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -377,7 +377,11 @@
if (rawDragInfo instanceof ShortcutInfo) {
ShortcutInfo dragInfo = (ShortcutInfo) rawDragInfo;
for (ApplicationInfo info : apps) {
- if (dragInfo.intent.getComponent().equals(info.intent.getComponent())) {
+ // Added null checks to prevent NPE we've seen in the wild
+ if (dragInfo != null &&
+ dragInfo.intent != null &&
+ info.intent != null &&
+ dragInfo.intent.getComponent().equals(info.intent.getComponent())) {
cancelDrag();
return;
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index ee540f8..b3ce968 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -524,6 +524,10 @@
// We just wanted the activity result here so we can clear mWaitingForResult
break;
}
+ // Before adding this resetAddInfo(), after a shortcut was added to a workspace screen,
+ // if you turned the screen off and then back while in All Apps, Launcher would not
+ // return to the workspace. Clearing mAddInfo.container here fixes this issue
+ resetAddInfo();
return result;
}
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 30eb86c..32c77c7 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -1354,6 +1354,7 @@
}
// shallow copy
+ @SuppressWarnings("unchecked")
final ArrayList<ApplicationInfo> list
= (ArrayList<ApplicationInfo>) mAllAppsList.data.clone();
mHandler.post(new Runnable() {
@@ -1657,7 +1658,26 @@
// but don't worry about that. All we're doing with usingFallbackIcon is
// to avoid saving lots of copies of that in the database, and most apps
// have icons anyway.
- final ResolveInfo resolveInfo = manager.resolveActivity(intent, 0);
+
+ // Attempt to use queryIntentActivities to get the ResolveInfo (with IntentFilter info) and
+ // if that fails, or is ambiguious, fallback to the standard way of getting the resolve info
+ // via resolveActivity().
+ ResolveInfo resolveInfo = null;
+ ComponentName oldComponent = intent.getComponent();
+ Intent newIntent = new Intent(intent.getAction(), null);
+ newIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+ newIntent.setPackage(oldComponent.getPackageName());
+ List<ResolveInfo> infos = manager.queryIntentActivities(newIntent, 0);
+ for (ResolveInfo i : infos) {
+ ComponentName cn = new ComponentName(i.activityInfo.packageName,
+ i.activityInfo.name);
+ if (cn.equals(oldComponent)) {
+ resolveInfo = i;
+ }
+ }
+ if (resolveInfo == null) {
+ resolveInfo = manager.resolveActivity(intent, 0);
+ }
if (resolveInfo != null) {
icon = mIconCache.getIcon(componentName, resolveInfo, labelCache);
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index fc49161..ba8b56f 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -2297,7 +2297,8 @@
final LauncherAppWidgetHostView hostView = (LauncherAppWidgetHostView) cell;
AppWidgetProviderInfo pinfo = hostView.getAppWidgetInfo();
- if (pinfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) {
+ if (pinfo != null &&
+ pinfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) {
final Runnable addResizeFrame = new Runnable() {
public void run() {
DragLayer dragLayer = mLauncher.getDragLayer();