Merge "All Apps header shadow is drawn incorrectly" into ub-launcher3-calgary
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java
index 84bd88d..45d0b52 100644
--- a/src/com/android/launcher3/BaseContainerView.java
+++ b/src/com/android/launcher3/BaseContainerView.java
@@ -53,7 +53,8 @@
Launcher launcher = Launcher.getLauncher(context);
int width = launcher.getDeviceProfile().availableWidthPx;
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
- this instanceof AllAppsContainerView && !launcher.getDeviceProfile().isLandscape) {
+ this instanceof AllAppsContainerView &&
+ !launcher.getDeviceProfile().isVerticalBarLayout()) {
mHorizontalPadding = 0;
} else {
mHorizontalPadding = DeviceProfile.getContainerPadding(context, width);
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index 5245509..b2f24be 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -227,4 +227,8 @@
setBackground(mBackground);
}
}
+
+ public int getBackgroundDrawableAlpha() {
+ return Color.alpha(mBackgroundColor);
+ }
}
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 1e597d3..3e66654 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1932,10 +1932,7 @@
List<ShortcutInfoCompat> fullDetails = mDeepShortcutManager
.queryForFullDetails(packageName,
Collections.singletonList(shortcutId), user);
- if (fullDetails == null || fullDetails.isEmpty()) {
- itemsToRemove.add(id);
- continue;
- } else {
+ if (fullDetails != null && !fullDetails.isEmpty()) {
pinnedShortcut = fullDetails.get(0);
shouldPin = true;
}
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 5ac3f0b..2d3e8dd 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -321,7 +321,7 @@
return (getMeasuredHeight() - getViewportHeight()) / 2;
}
- PageIndicator getPageIndicator() {
+ public PageIndicator getPageIndicator() {
return mPageIndicator;
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 3157c13..4e4e87c 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -137,7 +137,9 @@
return true;
}
} else {
- if (mLauncher.getDragLayer().isEventOverHotseat(ev) && !grid.isVerticalBarLayout()) {
+ if ((mLauncher.getDragLayer().isEventOverHotseat(ev)
+ || mLauncher.getDragLayer().isEventOverPageIndicator(ev))
+ && !grid.isVerticalBarLayout()) {
return true;
}
}
@@ -239,7 +241,7 @@
if (!mLauncher.isAllAppsVisible()) {
mLauncher.tryAndUpdatePredictedApps();
- mHotseatBackgroundAlpha = mHotseat.getBackground().getAlpha() / 255f;
+ mHotseatBackgroundAlpha = mHotseat.getBackgroundDrawableAlpha() / 255f;
mHotseat.setBackgroundTransparent(true /* transparent */);
mAppsView.setVisibility(View.VISIBLE);
mAppsView.getContentView().setVisibility(View.VISIBLE);
@@ -270,18 +272,26 @@
private void updateLightStatusBar(float progress) {
boolean enable = (progress < mStatusBarHeight / 2);
+ // Do not modify status bar on landscape as all apps is not full bleed.
+ if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
+ return;
+ }
// Already set correctly
if (mLightStatusBar == enable) {
return;
}
int systemUiFlags = mLauncher.getWindow().getDecorView().getSystemUiVisibility();
+ // SYSTEM_UI_FLAG_LIGHT_NAV_BAR == SYSTEM_UI_FLAG_LIGHT_STATUS_BAR << 1
+ // Use proper constant once API is submitted.
if (enable) {
mLauncher.getWindow().getDecorView().setSystemUiVisibility(systemUiFlags
- | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+ | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
+ | (View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR << 1));
} else {
mLauncher.getWindow().getDecorView().setSystemUiVisibility(systemUiFlags
- & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+ & ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
+ |(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR << 1)));
}
mLightStatusBar = enable;
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 4966938..8aed6d8 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -187,6 +187,11 @@
removeView(mOverlayView);
}
+ public boolean isEventOverPageIndicator(MotionEvent ev) {
+ getDescendantRectRelativeToSelf(mLauncher.getWorkspace().getPageIndicator(), mHitRect);
+ return mHitRect.contains((int) ev.getX(), (int) ev.getY());
+ }
+
public boolean isEventOverHotseat(MotionEvent ev) {
getDescendantRectRelativeToSelf(mLauncher.getHotseat(), mHitRect);
return mHitRect.contains((int) ev.getX(), (int) ev.getY());
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutManager.java b/src/com/android/launcher3/shortcuts/DeepShortcutManager.java
index 46ca931..97c384d 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutManager.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutManager.java
@@ -25,6 +25,7 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.util.Log;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.UserHandleCompat;
@@ -37,6 +38,7 @@
* Performs operations related to deep shortcuts, such as querying for them, pinning them, etc.
*/
public class DeepShortcutManager {
+ private static final String TAG = "DeepShortcutManager";
// TODO: Replace this with platform constants when the new sdk is available.
public static final int FLAG_MATCH_DYNAMIC = 1 << 0;
@@ -87,7 +89,11 @@
UserHandleCompat user = key.user;
List<String> pinnedIds = extractIds(queryForPinnedShortcuts(packageName, user));
pinnedIds.remove(id);
- mLauncherApps.pinShortcuts(packageName, pinnedIds, user.getUser());
+ try {
+ mLauncherApps.pinShortcuts(packageName, pinnedIds, user.getUser());
+ } catch (SecurityException e) {
+ Log.e(TAG, Log.getStackTraceString(e));
+ }
}
}
@@ -103,7 +109,11 @@
UserHandleCompat user = key.user;
List<String> pinnedIds = extractIds(queryForPinnedShortcuts(packageName, user));
pinnedIds.add(id);
- mLauncherApps.pinShortcuts(packageName, pinnedIds, user.getUser());
+ try {
+ mLauncherApps.pinShortcuts(packageName, pinnedIds, user.getUser());
+ } catch (SecurityException e) {
+ Log.e(TAG, Log.getStackTraceString(e));
+ }
}
}
@@ -111,16 +121,26 @@
public void startShortcut(String packageName, String id, Rect sourceBounds,
Bundle startActivityOptions, UserHandleCompat user) {
if (Utilities.isNycMR1OrAbove()) {
- mLauncherApps.startShortcut(packageName, id, sourceBounds,
- startActivityOptions, user.getUser());
+ try {
+ mLauncherApps.startShortcut(packageName, id, sourceBounds,
+ startActivityOptions, user.getUser());
+ } catch (SecurityException e) {
+ Log.e(TAG, Log.getStackTraceString(e));
+ }
}
}
@TargetApi(25)
public Drawable getShortcutIconDrawable(ShortcutInfoCompat shortcutInfo, int density) {
- return Utilities.isNycMR1OrAbove()
- ? mLauncherApps.getShortcutIconDrawable(shortcutInfo.getShortcutInfo(), density)
- : null;
+ if (Utilities.isNycMR1OrAbove()) {
+ try {
+ return mLauncherApps.getShortcutIconDrawable(shortcutInfo.getShortcutInfo(),
+ density);
+ } catch (SecurityException e) {
+ Log.e(TAG, Log.getStackTraceString(e));
+ }
+ }
+ return null;
}
/**
@@ -162,7 +182,12 @@
q.setActivity(activity);
q.setShortcutIds(shortcutIds);
}
- List<ShortcutInfo> shortcutInfos = mLauncherApps.getShortcuts(q, user.getUser());
+ List<ShortcutInfo> shortcutInfos = null;
+ try {
+ shortcutInfos = mLauncherApps.getShortcuts(q, user.getUser());
+ } catch (SecurityException e) {
+ Log.e(TAG, Log.getStackTraceString(e));
+ }
if (shortcutInfos == null) {
return Collections.EMPTY_LIST;
}