Merge "Don't rely on intent to call back from activity tracker" into sc-dev
diff --git a/go/quickstep/res/values/config.xml b/go/quickstep/res/values/config.xml
index 402bf9a..796d14d 100644
--- a/go/quickstep/res/values/config.xml
+++ b/go/quickstep/res/values/config.xml
@@ -16,8 +16,6 @@
<resources>
<!-- The component to receive app sharing Intents -->
<string name="app_sharing_component" translatable="false"/>
- <!-- The package to receive Listen, Translate, and Search Intents -->
- <string name="niu_actions_package" translatable="false"/>
<!-- Feature Flags -->
<bool name="enable_niu_actions">true</bool>
diff --git a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
index 65cdcf0..3a6e9b5 100644
--- a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
+++ b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
@@ -21,6 +21,7 @@
import android.annotation.SuppressLint;
import android.app.assist.AssistContent;
+import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -29,10 +30,10 @@
import android.os.UserManager;
import android.provider.Settings;
import android.text.TextUtils;
+import android.util.Log;
import androidx.annotation.VisibleForTesting;
-import com.android.launcher3.R;
import com.android.quickstep.util.AssistContentRequester;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.TaskThumbnailView;
@@ -90,9 +91,7 @@
public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix,
boolean rotated) {
getActionsView().updateDisabledFlags(DISABLED_NO_THUMBNAIL, thumbnail == null);
- mNIUPackageName =
- mApplicationContext.getString(R.string.niu_actions_package);
-
+ checkSettings();
if (thumbnail == null || TextUtils.isEmpty(mNIUPackageName)) {
return;
}
@@ -105,7 +104,6 @@
getActionsView().setCallbacks(new OverlayUICallbacksGoImpl(isAllowedByPolicy, task));
mTaskPackageName = task.key.getPackageName();
- checkPermissions();
if (!mAssistPermissionsEnabled) {
return;
}
@@ -137,7 +135,11 @@
mImageApi.shareAsDataWithExplicitIntent(/* crop */ null, intent);
} else {
intent.putExtra(ACTIONS_ERROR_CODE, ERROR_PERMISSIONS);
- mApplicationContext.startActivity(intent);
+ try {
+ mApplicationContext.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Log.e(TAG, "No activity found to receive permission error intent");
+ }
}
}
@@ -160,13 +162,17 @@
* Checks whether the Assistant has screen context permissions
*/
@VisibleForTesting
- public void checkPermissions() {
+ public void checkSettings() {
ContentResolver contentResolver = mApplicationContext.getContentResolver();
boolean structureEnabled = Settings.Secure.getInt(contentResolver,
Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0;
boolean screenshotEnabled = Settings.Secure.getInt(contentResolver,
Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0;
mAssistPermissionsEnabled = structureEnabled && screenshotEnabled;
+
+ String assistantPackage =
+ Settings.Secure.getString(contentResolver, Settings.Secure.ASSISTANT);
+ mNIUPackageName = assistantPackage.split("/", 2)[0];
}
protected class OverlayUICallbacksGoImpl extends OverlayUICallbacksImpl
diff --git a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java
index be98157..1090099 100644
--- a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java
+++ b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java
@@ -152,16 +152,18 @@
@UiThread
public void setAnimation(AnimatorSet animation, Context context) {
- setAnimation(animation, context, null);
+ setAnimation(animation, context, null, true);
}
/**
* Sets the animation to play for this app launch
+ * @param skipFirstFrame Iff true, we skip the first frame of the animation.
+ * We set to false when skipping first frame causes jank.
*/
@UiThread
public void setAnimation(AnimatorSet animation, Context context,
- @Nullable Runnable onCompleteCallback) {
+ @Nullable Runnable onCompleteCallback, boolean skipFirstFrame) {
if (mInitialized) {
throw new IllegalStateException("Animation already initialized");
}
@@ -187,10 +189,12 @@
});
mAnimator.start();
- // Because t=0 has the app icon in its original spot, we can skip the
- // first frame and have the same movement one frame earlier.
- mAnimator.setCurrentPlayTime(
- Math.min(getSingleFrameMs(context), mAnimator.getTotalDuration()));
+ if (skipFirstFrame) {
+ // Because t=0 has the app icon in its original spot, we can skip the
+ // first frame and have the same movement one frame earlier.
+ mAnimator.setCurrentPlayTime(
+ Math.min(getSingleFrameMs(context), mAnimator.getTotalDuration()));
+ }
}
}
}
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index 26d407f..65df237 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -38,6 +38,7 @@
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS;
import static com.android.launcher3.statehandlers.DepthController.DEPTH;
+import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
@@ -340,12 +341,17 @@
final int rotationChange = getRotationChange(appTargets);
// Note: the targetBounds are relative to the launcher
+ int startDelay = getSingleFrameMs(mLauncher);
Rect windowTargetBounds = getWindowTargetBounds(appTargets, rotationChange);
- anim.play(getOpeningWindowAnimators(v, appTargets, wallpaperTargets, nonAppTargets,
- windowTargetBounds, areAllTargetsTranslucent(appTargets), rotationChange));
+ Animator windowAnimator = getOpeningWindowAnimators(v, appTargets, wallpaperTargets,
+ nonAppTargets, windowTargetBounds, areAllTargetsTranslucent(appTargets),
+ rotationChange);
+ windowAnimator.setStartDelay(startDelay);
+ anim.play(windowAnimator);
if (launcherClosing) {
+ // Delay animation by a frame to avoid jank.
Pair<AnimatorSet, Runnable> launcherContentAnimator =
- getLauncherContentAnimator(true /* isAppOpening */);
+ getLauncherContentAnimator(true /* isAppOpening */, startDelay);
anim.play(launcherContentAnimator.first);
anim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -436,8 +442,10 @@
*
* @param isAppOpening True when this is called when an app is opening.
* False when this is called when an app is closing.
+ * @param startDelay Start delay duration.
*/
- private Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean isAppOpening) {
+ private Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean isAppOpening,
+ int startDelay) {
AnimatorSet launcherAnimator = new AnimatorSet();
Runnable endListener;
@@ -528,6 +536,8 @@
mLauncher.getWorkspace().getPageIndicator().skipAnimationsToEnd();
};
}
+
+ launcherAnimator.setStartDelay(startDelay);
return new Pair<>(launcherAnimator, endListener);
}
@@ -633,7 +643,7 @@
? 0 : getWindowCornerRadius(mLauncher.getResources());
final float finalShadowRadius = appTargetsAreTranslucent ? 0 : mMaxShadowRadius;
- appAnimator.addUpdateListener(new MultiValueUpdateListener() {
+ MultiValueUpdateListener listener = new MultiValueUpdateListener() {
FloatProp mDx = new FloatProp(0, prop.dX, 0, prop.xDuration, AGGRESSIVE_EASE);
FloatProp mDy = new FloatProp(0, prop.dY, 0, prop.yDuration, AGGRESSIVE_EASE);
@@ -662,7 +672,7 @@
ANIMATION_NAV_FADE_IN_DURATION, NAV_FADE_IN_INTERPOLATOR);
@Override
- public void onUpdate(float percent) {
+ public void onUpdate(float percent, boolean initOnly) {
// Calculate the size of the scaled icon.
float iconWidth = launcherIconBounds.width() * mIconScaleToFitScreen.value;
float iconHeight = launcherIconBounds.height() * mIconScaleToFitScreen.value;
@@ -707,6 +717,12 @@
floatingIconBounds.right += offsetX;
floatingIconBounds.bottom += offsetY;
+ if (initOnly) {
+ floatingView.update(mIconAlpha.value, 255, floatingIconBounds, percent, 0f,
+ mWindowRadius.value * scale, true /* isOpening */);
+ return;
+ }
+
ArrayList<SurfaceParams> params = new ArrayList<>();
for (int i = appTargets.length - 1; i >= 0; i--) {
RemoteAnimationTargetCompat target = appTargets[i];
@@ -779,7 +795,10 @@
surfaceApplier.scheduleApply(params.toArray(new SurfaceParams[params.size()]));
}
- });
+ };
+ appAnimator.addUpdateListener(listener);
+ // Since we added a start delay, call update here to init the FloatingIconView properly.
+ listener.onUpdate(0, true /* initOnly */);
animatorSet.playTogether(appAnimator, getBackgroundAnimator(appTargets));
return animatorSet;
@@ -869,7 +888,7 @@
ANIMATION_NAV_FADE_IN_DURATION, NAV_FADE_IN_INTERPOLATOR);
@Override
- public void onUpdate(float percent) {
+ public void onUpdate(float percent, boolean initOnly) {
widgetBackgroundBounds.set(mDx.value - mWidth.value / 2f,
mDy.value - mHeight.value / 2f, mDx.value + mWidth.value / 2f,
mDy.value + mHeight.value / 2f);
@@ -1128,7 +1147,7 @@
DEACCEL_1_7);
@Override
- public void onUpdate(float percent) {
+ public void onUpdate(float percent, boolean initOnly) {
SurfaceParams[] params = new SurfaceParams[appTargets.length];
for (int i = appTargets.length - 1; i >= 0; i--) {
RemoteAnimationTargetCompat target = appTargets[i];
@@ -1278,8 +1297,7 @@
if (mLauncher.isInState(LauncherState.ALL_APPS)) {
Pair<AnimatorSet, Runnable> contentAnimator =
- getLauncherContentAnimator(false /* isAppOpening */);
- contentAnimator.first.setStartDelay(LAUNCHER_RESUME_START_DELAY);
+ getLauncherContentAnimator(false, LAUNCHER_RESUME_START_DELAY);
anim.play(contentAnimator.first);
anim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -1328,27 +1346,32 @@
final boolean launchingFromWidget = mV instanceof LauncherAppWidgetHostView;
final boolean launchingFromRecents = isLaunchingFromRecents(mV, appTargets);
+ final boolean skipFirstFrame;
if (launchingFromWidget) {
composeWidgetLaunchAnimator(anim, (LauncherAppWidgetHostView) mV, appTargets,
wallpaperTargets, nonAppTargets);
addCujInstrumentation(
anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_WIDGET);
+ skipFirstFrame = true;
} else if (launchingFromRecents) {
composeRecentsLaunchAnimator(anim, mV, appTargets, wallpaperTargets, nonAppTargets,
launcherClosing);
addCujInstrumentation(
anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_RECENTS);
+ skipFirstFrame = true;
} else {
composeIconLaunchAnimator(anim, mV, appTargets, wallpaperTargets, nonAppTargets,
launcherClosing);
addCujInstrumentation(anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_ICON);
+ skipFirstFrame = false;
}
if (launcherClosing) {
anim.addListener(mForceInvisibleListener);
}
- result.setAnimation(anim, mLauncher, mOnEndCallback::executeAllAndDestroy);
+ result.setAnimation(anim, mLauncher, mOnEndCallback::executeAllAndDestroy,
+ skipFirstFrame);
}
}
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 44ac4ae..a9dacee 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -117,6 +117,7 @@
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.TaskInfoCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.shared.system.TaskStackChangeListeners;
import java.util.ArrayList;
import java.util.function.Consumer;
@@ -1079,7 +1080,7 @@
protected abstract HomeAnimationFactory createHomeAnimationFactory(
ArrayList<IBinder> launchCookies, long duration, boolean isTargetTranslucent,
- RemoteAnimationTargetCompat runningTaskTarget);
+ boolean appCanEnterPip, RemoteAnimationTargetCompat runningTaskTarget);
private final TaskStackChangeListener mActivityRestartListener = new TaskStackChangeListener() {
@Override
@@ -1090,7 +1091,7 @@
// Since this is an edge case, just cancel and relaunch with default activity
// options (since we don't know if there's an associated app icon to launch from)
endRunningWindowAnim(true /* cancel */);
- ActivityManagerWrapper.getInstance().unregisterTaskStackListener(
+ TaskStackChangeListeners.getInstance().unregisterTaskStackListener(
mActivityRestartListener);
ActivityManagerWrapper.getInstance().startActivityFromRecents(task.taskId, null);
}
@@ -1105,7 +1106,7 @@
// If we are transitioning to launcher, then listen for the activity to be restarted while
// the transition is in progress
if (mGestureState.getEndTarget().isLauncher) {
- ActivityManagerWrapper.getInstance().registerTaskStackListener(
+ TaskStackChangeListeners.getInstance().registerTaskStackListener(
mActivityRestartListener);
mParallelRunningAnim = mActivityInterface.getParallelAnimationToLauncher(
@@ -1124,13 +1125,15 @@
? runningTaskTarget.taskInfo.launchCookies
: new ArrayList<>();
boolean isTranslucent = runningTaskTarget != null && runningTaskTarget.isTranslucent;
- HomeAnimationFactory homeAnimFactory =
- createHomeAnimationFactory(cookies, duration, isTranslucent, runningTaskTarget);
- mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome()
+ boolean appCanEnterPip = !mDeviceState.isPipActive()
&& runningTaskTarget != null
&& runningTaskTarget.taskInfo.pictureInPictureParams != null
&& TaskInfoCompat.isAutoEnterPipEnabled(
runningTaskTarget.taskInfo.pictureInPictureParams);
+ HomeAnimationFactory homeAnimFactory =
+ createHomeAnimationFactory(cookies, duration, isTranslucent, appCanEnterPip,
+ runningTaskTarget);
+ mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome() && appCanEnterPip;
if (mIsSwipingPipToHome) {
mSwipePipToHomeAnimator = getSwipePipToHomeAnimator(
homeAnimFactory, runningTaskTarget, start);
@@ -1406,7 +1409,8 @@
}
mActivityInitListener.unregister();
- ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mActivityRestartListener);
+ TaskStackChangeListeners.getInstance().unregisterTaskStackListener(
+ mActivityRestartListener);
mTaskSnapshot = null;
}
diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
index 7290ff6..fd44e02 100644
--- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
@@ -129,7 +129,7 @@
@Override
protected HomeAnimationFactory createHomeAnimationFactory(ArrayList<IBinder> launchCookies,
- long duration, boolean isTargetTranslucent,
+ long duration, boolean isTargetTranslucent, boolean appCanEnterPip,
RemoteAnimationTargetCompat runningTaskTarget) {
mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration);
ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0);
diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
index 40741e4..19cad53 100644
--- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
+++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
@@ -88,7 +88,7 @@
@Override
protected HomeAnimationFactory createHomeAnimationFactory(ArrayList<IBinder> launchCookies,
- long duration, boolean isTargetTranslucent,
+ long duration, boolean isTargetTranslucent, boolean appCanEnterPip,
RemoteAnimationTargetCompat runningTaskTarget) {
if (mActivity == null) {
mStateCallback.addChangeListener(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
@@ -108,7 +108,7 @@
mActivity.getRootView().setForceHideBackArrow(true);
mActivity.setHintUserWillBeActive();
- if (!canUseWorkspaceView) {
+ if (!canUseWorkspaceView || appCanEnterPip) {
return new LauncherHomeAnimationFactory();
}
if (workspaceView instanceof LauncherAppWidgetHostView) {
@@ -191,6 +191,12 @@
return new FloatingViewHomeAnimationFactory(floatingWidgetView) {
@Override
+ @Nullable
+ protected View getViewIgnoredInWorkspaceRevealAnimation() {
+ return hostView;
+ }
+
+ @Override
public RectF getWindowTargetRect() {
super.getWindowTargetRect();
return backgroundLocation;
@@ -387,6 +393,16 @@
}
private class LauncherHomeAnimationFactory extends HomeAnimationFactory {
+
+ /**
+ * Returns a view which should be excluded from the Workspace animation, or null if there
+ * is no view to exclude.
+ */
+ @Nullable
+ protected View getViewIgnoredInWorkspaceRevealAnimation() {
+ return null;
+ }
+
@NonNull
@Override
public AnimatorPlaybackController createActivityAnimationToHome() {
@@ -400,7 +416,8 @@
@Override
public void playAtomicAnimation(float velocity) {
if (!PROTOTYPE_APP_CLOSE.get()) {
- new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */)
+ new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */,
+ getViewIgnoredInWorkspaceRevealAnimation())
.start();
} else if (shouldPlayAtomicWorkspaceReveal()) {
new WorkspaceRevealAnim(mActivity, true).start();
diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java
index 3302da0..3080f04 100644
--- a/quickstep/src/com/android/quickstep/RecentTasksList.java
+++ b/quickstep/src/com/android/quickstep/RecentTasksList.java
@@ -33,6 +33,7 @@
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.KeyguardManagerCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.shared.system.TaskStackChangeListeners;
import java.util.ArrayList;
import java.util.Collections;
@@ -66,7 +67,7 @@
mKeyguardManager = keyguardManager;
mChangeId = 1;
mActivityManagerWrapper = activityManagerWrapper;
- mActivityManagerWrapper.registerTaskStackListener(this);
+ TaskStackChangeListeners.getInstance().registerTaskStackListener(this);
}
@VisibleForTesting
diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
index 80c6a97..3d66823 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -214,7 +214,8 @@
AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets,
wallpaperTargets, nonAppTargets);
anim.addListener(resetStateListener());
- result.setAnimation(anim, RecentsActivity.this, onEndCallback::executeAllAndDestroy);
+ result.setAnimation(anim, RecentsActivity.this, onEndCallback::executeAllAndDestroy,
+ true /* skipFirstFrame */);
};
final LauncherAnimationRunner wrapper = new WrappedLauncherAnimationRunner<>(
@@ -353,7 +354,8 @@
public void startHome() {
if (LIVE_TILE.get()) {
RecentsView recentsView = getOverviewPanel();
- recentsView.switchToScreenshotAndFinishAnimationToRecents(this::startHomeInternal);
+ recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true,
+ this::startHomeInternal));
} else {
startHomeInternal();
}
@@ -385,7 +387,8 @@
anim.play(controller.getAnimationPlayer());
anim.setDuration(HOME_APPEAR_DURATION);
result.setAnimation(anim, this,
- () -> getStateManager().goToState(RecentsState.HOME, false));
+ () -> getStateManager().goToState(RecentsState.HOME, false),
+ true /* skipFirstFrame */);
}
@Override
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index fa37901..444d77a 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -15,6 +15,8 @@
*/
package com.android.quickstep;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
+import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.content.Intent.ACTION_USER_UNLOCKED;
import static com.android.launcher3.util.DisplayController.CHANGE_ALL;
@@ -41,6 +43,7 @@
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
import android.app.ActivityManager;
+import android.app.ActivityTaskManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -50,6 +53,7 @@
import android.graphics.Region;
import android.net.Uri;
import android.os.Process;
+import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserManager;
import android.provider.Settings;
@@ -75,6 +79,8 @@
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
import com.android.systemui.shared.system.SystemGestureExclusionListenerCompat;
+import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.shared.system.TaskStackChangeListeners;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -96,6 +102,8 @@
private final DisplayController mDisplayController;
private final int mDisplayId;
private final RotationTouchHelper mRotationTouchHelper;
+ private final TaskStackChangeListener mPipListener;
+ private final List<ComponentName> mGestureBlockedActivities;
private final ArrayList<Runnable> mOnDestroyActions = new ArrayList<>();
@@ -106,9 +114,11 @@
private final Region mDeferredGestureRegion = new Region();
private boolean mAssistantAvailable;
private float mAssistantVisibility;
+ private boolean mIsUserSetupComplete;
private boolean mIsOneHandedModeEnabled;
private boolean mIsSwipeToNotificationEnabled;
private final boolean mIsOneHandedModeSupported;
+ private boolean mPipIsActive;
private boolean mIsUserUnlocked;
private final ArrayList<Runnable> mUserUnlockedActions = new ArrayList<>();
@@ -125,10 +135,6 @@
private Region mExclusionRegion;
private SystemGestureExclusionListenerCompat mExclusionListener;
- private final List<ComponentName> mGestureBlockedActivities;
-
- private boolean mIsUserSetupComplete;
-
public RecentsAnimationDeviceState(Context context) {
this(context, false);
}
@@ -204,7 +210,6 @@
mIsOneHandedModeEnabled = false;
}
-
Uri swipeBottomNotificationUri =
Settings.Secure.getUriFor(ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED);
SettingsCache.OnChangeListener onChangeListener =
@@ -220,6 +225,27 @@
settingsCache.register(setupCompleteUri, userSetupChangeListener);
runOnDestroy(() -> settingsCache.unregister(setupCompleteUri, userSetupChangeListener));
}
+
+ try {
+ mPipIsActive = ActivityTaskManager.getService().getRootTaskInfo(
+ WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED) != null;
+ } catch (RemoteException e) {
+ // Do nothing
+ }
+ mPipListener = new TaskStackChangeListener() {
+ @Override
+ public void onActivityPinned(String packageName, int userId, int taskId, int stackId) {
+ mPipIsActive = true;
+ }
+
+ @Override
+ public void onActivityUnpinned() {
+ mPipIsActive = false;
+ }
+ };
+ TaskStackChangeListeners.getInstance().registerTaskStackListener(mPipListener);
+ runOnDestroy(() ->
+ TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mPipListener));
}
private void runOnDestroy(Runnable action) {
@@ -579,6 +605,10 @@
return mIsSwipeToNotificationEnabled;
}
+ public boolean isPipActive() {
+ return mPipIsActive;
+ }
+
public RotationTouchHelper getRotationTouchHelper() {
return mRotationTouchHelper;
}
@@ -596,6 +626,7 @@
pw.println(" isOneHandedModeEnabled=" + mIsOneHandedModeEnabled);
pw.println(" isSwipeToNotificationEnabled=" + mIsSwipeToNotificationEnabled);
pw.println(" deferredGestureRegion=" + mDeferredGestureRegion);
+ pw.println(" pipIsActive=" + mPipIsActive);
mRotationTouchHelper.dump(pw);
}
}
diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java
index 2eb9dd8..1e82c8c 100644
--- a/quickstep/src/com/android/quickstep/RecentsModel.java
+++ b/quickstep/src/com/android/quickstep/RecentsModel.java
@@ -39,6 +39,7 @@
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.KeyguardManagerCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.shared.system.TaskStackChangeListeners;
import java.util.ArrayList;
import java.util.List;
@@ -75,7 +76,7 @@
mIconCache = new TaskIconCache(context, RECENTS_MODEL_EXECUTOR, iconProvider);
mThumbnailCache = new TaskThumbnailCache(context, RECENTS_MODEL_EXECUTOR);
- ActivityManagerWrapper.getInstance().registerTaskStackListener(this);
+ TaskStackChangeListeners.getInstance().registerTaskStackListener(this);
iconProvider.registerIconChangeListener(this, MAIN_EXECUTOR.getHandler());
}
diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
index fc7a3df..678b176 100644
--- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java
+++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
@@ -38,6 +38,7 @@
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.shared.system.TaskStackChangeListeners;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -178,14 +179,14 @@
}
private void setupOrientationSwipeHandler() {
- ActivityManagerWrapper.getInstance().registerTaskStackListener(mFrozenTaskListener);
- mOnDestroyFrozenTaskRunnable = () -> ActivityManagerWrapper.getInstance()
+ TaskStackChangeListeners.getInstance().registerTaskStackListener(mFrozenTaskListener);
+ mOnDestroyFrozenTaskRunnable = () -> TaskStackChangeListeners.getInstance()
.unregisterTaskStackListener(mFrozenTaskListener);
runOnDestroy(mOnDestroyFrozenTaskRunnable);
}
private void destroyOrientationSwipeHandlerCallback() {
- ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mFrozenTaskListener);
+ TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mFrozenTaskListener);
mOnDestroyActions.remove(mOnDestroyFrozenTaskRunnable);
}
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 29ddde0..9731bf1 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -39,6 +39,7 @@
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.RemoteTransitionCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.shared.system.TaskStackChangeListeners;
public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAnimationListener {
public static final boolean ENABLE_SHELL_TRANSITIONS =
@@ -58,7 +59,7 @@
public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
if (mLastGestureState == null) {
- ActivityManagerWrapper.getInstance().unregisterTaskStackListener(
+ TaskStackChangeListeners.getInstance().unregisterTaskStackListener(
mLiveTileRestartListener);
return;
}
@@ -68,7 +69,7 @@
RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel();
if (recentsView != null) {
recentsView.launchSideTaskInLiveTileModeForRestartedApp(task.taskId);
- ActivityManagerWrapper.getInstance().unregisterTaskStackListener(
+ TaskStackChangeListeners.getInstance().unregisterTaskStackListener(
mLiveTileRestartListener);
}
}
@@ -197,7 +198,7 @@
}
public void enableLiveTileRestartListener() {
- ActivityManagerWrapper.getInstance().registerTaskStackListener(mLiveTileRestartListener);
+ TaskStackChangeListeners.getInstance().registerTaskStackListener(mLiveTileRestartListener);
}
/**
@@ -241,7 +242,7 @@
mLiveTileCleanUpHandler.run();
mLiveTileCleanUpHandler = null;
}
- ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mLiveTileRestartListener);
+ TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mLiveTileRestartListener);
// Release all the target leashes
if (mTargets != null) {
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 59bd1ed..3293810 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -249,7 +249,7 @@
ANIMATION_NAV_FADE_IN_DURATION, NAV_FADE_IN_INTERPOLATOR);
@Override
- public void onUpdate(float percent) {
+ public void onUpdate(float percent, boolean initOnly) {
final SurfaceParams.Builder navBuilder =
new SurfaceParams.Builder(navBarTarget.leash);
if (mNavFadeIn.value > mNavFadeIn.getStartValue()) {
diff --git a/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java b/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
index c3b342b..cf523d0 100644
--- a/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
+++ b/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
@@ -29,8 +29,6 @@
import com.android.launcher3.R;
import com.android.quickstep.interaction.TutorialController.TutorialType;
-import java.util.ArrayDeque;
-import java.util.Deque;
import java.util.List;
/** Shows the gesture interactive sandbox in full screen mode. */
@@ -39,8 +37,9 @@
private static final String LOG_TAG = "GestureSandboxActivity";
private static final String KEY_TUTORIAL_STEPS = "tutorial_steps";
+ private static final String KEY_CURRENT_STEP = "current_step";
- private Deque<TutorialType> mTutorialSteps;
+ private TutorialType[] mTutorialSteps;
private TutorialType mCurrentTutorialStep;
private TutorialFragment mFragment;
@@ -55,9 +54,7 @@
Bundle args = savedInstanceState == null ? getIntent().getExtras() : savedInstanceState;
mTutorialSteps = getTutorialSteps(args);
- mCurrentStep = 1;
- mNumSteps = mTutorialSteps.size();
- mCurrentTutorialStep = mTutorialSteps.pop();
+ mCurrentTutorialStep = mTutorialSteps[mCurrentStep - 1];
mFragment = TutorialFragment.newInstance(mCurrentTutorialStep);
getSupportFragmentManager().beginTransaction()
.add(R.id.gesture_tutorial_fragment_container, mFragment)
@@ -88,12 +85,13 @@
@Override
protected void onSaveInstanceState(@NonNull Bundle savedInstanceState) {
savedInstanceState.putStringArray(KEY_TUTORIAL_STEPS, getTutorialStepNames());
+ savedInstanceState.putInt(KEY_CURRENT_STEP, mCurrentStep);
super.onSaveInstanceState(savedInstanceState);
}
/** Returns true iff there aren't anymore tutorial types to display to the user. */
public boolean isTutorialComplete() {
- return mTutorialSteps.isEmpty();
+ return mCurrentStep >= mNumSteps;
}
public int getCurrentStep() {
@@ -121,7 +119,7 @@
mFragment.closeTutorial();
return;
}
- mCurrentTutorialStep = mTutorialSteps.pop();
+ mCurrentTutorialStep = mTutorialSteps[mCurrentStep];
mFragment = TutorialFragment.newInstance(mCurrentTutorialStep);
getSupportFragmentManager().beginTransaction()
.replace(R.id.gesture_tutorial_fragment_container, mFragment)
@@ -131,10 +129,9 @@
}
private String[] getTutorialStepNames() {
- String[] tutorialStepNames = new String[mTutorialSteps.size() + 1];
+ String[] tutorialStepNames = new String[mTutorialSteps.length];
- int i = 1;
- tutorialStepNames[0] = mCurrentTutorialStep.name();
+ int i = 0;
for (TutorialType tutorialStep : mTutorialSteps) {
tutorialStepNames[i++] = tutorialStep.name();
}
@@ -142,25 +139,28 @@
return tutorialStepNames;
}
- private Deque<TutorialType> getTutorialSteps(Bundle extras) {
- Deque<TutorialType> defaultSteps = new ArrayDeque<>();
- defaultSteps.push(TutorialType.RIGHT_EDGE_BACK_NAVIGATION);
+ private TutorialType[] getTutorialSteps(Bundle extras) {
+ TutorialType[] defaultSteps = new TutorialType[] {TutorialType.LEFT_EDGE_BACK_NAVIGATION};
if (extras == null || !extras.containsKey(KEY_TUTORIAL_STEPS)) {
return defaultSteps;
}
String[] tutorialStepNames = extras.getStringArray(KEY_TUTORIAL_STEPS);
+ int currentStep = extras.getInt(KEY_CURRENT_STEP, -1);
if (tutorialStepNames == null) {
return defaultSteps;
}
- Deque<TutorialType> tutorialSteps = new ArrayDeque<>();
- for (String tutorialStepName : tutorialStepNames) {
- tutorialSteps.addLast(TutorialType.valueOf(tutorialStepName));
+ TutorialType[] tutorialSteps = new TutorialType[tutorialStepNames.length];
+ for (int i = 0; i < tutorialStepNames.length; i++) {
+ tutorialSteps[i] = TutorialType.valueOf(tutorialStepNames[i]);
}
+ mCurrentStep = Math.max(currentStep, 1);
+ mNumSteps = tutorialSteps.length;
+
return tutorialSteps;
}
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
index c9da609..dfe0c72 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
@@ -58,6 +58,7 @@
private static final int FEEDBACK_ANIMATION_MS = 250;
private static final int RIPPLE_VISIBLE_MS = 300;
+ private static final int GESTURE_ANIMATION_DELAY_MS = 1500;
final TutorialFragment mTutorialFragment;
TutorialType mTutorialType;
@@ -65,6 +66,7 @@
final TextView mCloseButton;
final ViewGroup mFeedbackView;
+ final TextView mFeedbackTitleView;
final ImageView mFeedbackVideoView;
final ImageView mGestureVideoView;
final RelativeLayout mFakeLauncherView;
@@ -80,6 +82,12 @@
protected boolean mGestureCompleted = false;
+ // These runnables should be used when posting callbacks to their views and cleared from their
+ // views before posting new callbacks.
+ private final Runnable mTitleViewCallback;
+ @Nullable private Runnable mFeedbackViewCallback;
+ @Nullable private Runnable mFeedbackVideoViewCallback;
+
TutorialController(TutorialFragment tutorialFragment, TutorialType tutorialType) {
mTutorialFragment = tutorialFragment;
mTutorialType = tutorialType;
@@ -89,6 +97,8 @@
mCloseButton = rootView.findViewById(R.id.gesture_tutorial_fragment_close_button);
mCloseButton.setOnClickListener(button -> showSkipTutorialDialog());
mFeedbackView = rootView.findViewById(R.id.gesture_tutorial_fragment_feedback_view);
+ mFeedbackTitleView = mFeedbackView.findViewById(
+ R.id.gesture_tutorial_fragment_feedback_title);
mFeedbackVideoView = rootView.findViewById(R.id.gesture_tutorial_feedback_video);
mGestureVideoView = rootView.findViewById(R.id.gesture_tutorial_gesture_video);
mFakeLauncherView = rootView.findViewById(R.id.gesture_tutorial_fake_launcher_view);
@@ -103,6 +113,9 @@
mTutorialStepView =
rootView.findViewById(R.id.gesture_tutorial_fragment_feedback_tutorial_step);
mSkipTutorialDialog = createSkipTutorialDialog();
+
+ mTitleViewCallback = () -> mFeedbackTitleView.sendAccessibilityEvent(
+ AccessibilityEvent.TYPE_VIEW_FOCUSED);
}
private void showSkipTutorialDialog() {
@@ -169,7 +182,7 @@
playFeedbackVideo(tutorialAnimation, gestureAnimation, () -> {
mFeedbackView.setTranslationY(0);
title.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
- });
+ }, true);
}
}
@@ -192,15 +205,17 @@
isGestureSuccessful
? R.string.gesture_tutorial_nice : R.string.gesture_tutorial_try_again,
subtitleResId,
- isGestureSuccessful);
+ isGestureSuccessful,
+ false);
}
void showFeedback(
int titleResId,
int subtitleResId,
- boolean isGestureSuccessful) {
- TextView title = mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_feedback_title);
- title.setText(titleResId);
+ boolean isGestureSuccessful,
+ boolean useGestureAnimationDelay) {
+ mFeedbackTitleView.setText(titleResId);
+ mFeedbackTitleView.removeCallbacks(mTitleViewCallback);
TextView subtitle =
mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_feedback_subtitle);
subtitle.setText(subtitleResId);
@@ -221,11 +236,8 @@
.setDuration(FEEDBACK_ANIMATION_MS)
.translationY(0)
.start();
- title.postDelayed(
- () -> title.sendAccessibilityEvent(
- AccessibilityEvent.TYPE_VIEW_FOCUSED),
- FEEDBACK_ANIMATION_MS);
- });
+ mFeedbackTitleView.postDelayed(mTitleViewCallback, FEEDBACK_ANIMATION_MS);
+ }, useGestureAnimationDelay);
return;
} else {
mTutorialFragment.releaseFeedbackVideoView();
@@ -237,10 +249,7 @@
.setDuration(FEEDBACK_ANIMATION_MS)
.translationY(0)
.start();
- title.postDelayed(
- () -> title.sendAccessibilityEvent(
- AccessibilityEvent.TYPE_VIEW_FOCUSED),
- FEEDBACK_ANIMATION_MS);
+ mFeedbackTitleView.postDelayed(mTitleViewCallback, FEEDBACK_ANIMATION_MS);
}
void hideFeedback(boolean releaseFeedbackVideo) {
@@ -254,7 +263,8 @@
private void playFeedbackVideo(
@NonNull AnimatedVectorDrawable tutorialAnimation,
@NonNull AnimatedVectorDrawable gestureAnimation,
- @NonNull Runnable onStartRunnable) {
+ @NonNull Runnable onStartRunnable,
+ boolean useGestureAnimationDelay) {
if (tutorialAnimation.isRunning()) {
tutorialAnimation.reset();
@@ -270,7 +280,9 @@
gestureAnimation.stop();
}
- onStartRunnable.run();
+ if (!useGestureAnimationDelay) {
+ onStartRunnable.run();
+ }
}
@Override
@@ -284,8 +296,28 @@
}
});
- tutorialAnimation.start();
- mFeedbackVideoView.setVisibility(View.VISIBLE);
+ if (mFeedbackViewCallback != null) {
+ mFeedbackVideoView.removeCallbacks(mFeedbackViewCallback);
+ mFeedbackViewCallback = null;
+ }
+ if (mFeedbackVideoViewCallback != null) {
+ mFeedbackVideoView.removeCallbacks(mFeedbackVideoViewCallback);
+ mFeedbackVideoViewCallback = null;
+ }
+ if (useGestureAnimationDelay) {
+ mFeedbackViewCallback = onStartRunnable;
+ mFeedbackVideoViewCallback = () -> {
+ mFeedbackVideoView.setVisibility(View.VISIBLE);
+ tutorialAnimation.start();
+ };
+
+ mFeedbackVideoView.setVisibility(View.GONE);
+ mFeedbackView.post(mFeedbackViewCallback);
+ mFeedbackVideoView.postDelayed(mFeedbackVideoViewCallback, GESTURE_ANIMATION_DELAY_MS);
+ } else {
+ mFeedbackVideoView.setVisibility(View.VISIBLE);
+ tutorialAnimation.start();
+ }
}
void setRippleHotspot(float x, float y) {
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
index ec26022..da0fc66 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
@@ -170,7 +170,8 @@
Integer introTileStringResId = mTutorialController.getIntroductionTitle();
Integer introSubtitleResId = mTutorialController.getIntroductionSubtitle();
if (introTileStringResId != null && introSubtitleResId != null) {
- mTutorialController.showFeedback(introTileStringResId, introSubtitleResId, false);
+ mTutorialController.showFeedback(
+ introTileStringResId, introSubtitleResId, false, true);
mIntroductionShown = true;
}
}
@@ -252,7 +253,7 @@
@Override
public void onResume() {
super.onResume();
- if (mFragmentStopped) {
+ if (mFragmentStopped && mTutorialController != null) {
mTutorialController.showFeedback();
mFragmentStopped = false;
} else {
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialStepIndicator.java b/quickstep/src/com/android/quickstep/interaction/TutorialStepIndicator.java
index eda6158..d880d74 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialStepIndicator.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialStepIndicator.java
@@ -23,6 +23,7 @@
import android.widget.LinearLayout;
import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.ColorUtils;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -86,6 +87,8 @@
for (int i = mTotalSteps; i < getChildCount(); i++) {
removeViewAt(i);
}
+ int stepIndicatorColor = GraphicsUtils.getAttrColor(
+ getContext(), android.R.attr.textColorPrimary);
for (int i = 0; i < mTotalSteps; i++) {
Drawable pageIndicatorPillDrawable = AppCompatResources.getDrawable(
getContext(), R.drawable.tutorial_step_indicator_pill);
@@ -104,13 +107,10 @@
}
if (pageIndicatorPillDrawable != null) {
if (i < mCurrentStep) {
- pageIndicatorPillDrawable.setTint(
- GraphicsUtils.getAttrColor(getContext(),
- android.R.attr.textColorPrimary));
+ pageIndicatorPillDrawable.setTint(stepIndicatorColor);
} else {
pageIndicatorPillDrawable.setTint(
- GraphicsUtils.getAttrColor(getContext(),
- android.R.attr.textColorPrimaryInverse));
+ ColorUtils.setAlphaComponent(stepIndicatorColor, 0x22));
}
}
}
diff --git a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java
index 2285d74..de7dbd6 100644
--- a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java
+++ b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java
@@ -26,6 +26,7 @@
import android.app.Activity;
import android.app.ActivityOptions;
import android.app.prediction.AppTarget;
+import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ComponentName;
@@ -68,6 +69,7 @@
private static final long FILE_LIFE = 1000L /*ms*/ * 60L /*s*/ * 60L /*m*/ * 24L /*h*/;
private static final String SUB_FOLDER = "Overview";
private static final String BASE_NAME = "overview_image_";
+ private static final String TAG = "ImageActionUtils";
/**
* Saves screenshot to location determine by SystemUiProxy
@@ -154,11 +156,15 @@
Intent intent, BiFunction<Uri, Intent, Intent[]> uriToIntentMap, String tag) {
Intent[] intents = uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent);
- // Work around b/159412574
- if (intents.length == 1) {
- context.startActivity(intents[0]);
- } else {
- context.startActivities(intents);
+ try {
+ // Work around b/159412574
+ if (intents.length == 1) {
+ context.startActivity(intents[0]);
+ } else {
+ context.startActivities(intents);
+ }
+ } catch (ActivityNotFoundException e) {
+ Log.e(TAG, "No activity found to receive image intent");
}
}
diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
index 8151d41..1ed2da3 100644
--- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
+++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java
@@ -121,7 +121,7 @@
mForcePauseTimeout.setAlarm(mMakePauseHarderToTrigger
? HARDER_TRIGGER_TIMEOUT
: FORCE_PAUSE_TIMEOUT);
- float newVelocity = mVelocityProvider.addMotionEvent(ev, pointerIndex);
+ float newVelocity = mVelocityProvider.addMotionEvent(ev, ev.getPointerId(pointerIndex));
if (mPreviousVelocity != null) {
checkMotionPaused(newVelocity, mPreviousVelocity, ev.getEventTime());
}
diff --git a/quickstep/src/com/android/quickstep/util/MultiValueUpdateListener.java b/quickstep/src/com/android/quickstep/util/MultiValueUpdateListener.java
index b4ae1ca..1c3c9c2 100644
--- a/quickstep/src/com/android/quickstep/util/MultiValueUpdateListener.java
+++ b/quickstep/src/com/android/quickstep/util/MultiValueUpdateListener.java
@@ -40,10 +40,14 @@
newPercent = prop.mInterpolator.getInterpolation(newPercent);
prop.value = prop.mEnd * newPercent + prop.mStart * (1 - newPercent);
}
- onUpdate(percent);
+ onUpdate(percent, false /* initOnly */);
}
- public abstract void onUpdate(float percent);
+ /**
+ * @param percent The total animation progress.
+ * @param initOnly When true, only does enough work to initialize the animation.
+ */
+ public abstract void onUpdate(float percent, boolean initOnly);
public final class FloatProp {
diff --git a/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java b/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java
index 93b3482..c331a13 100644
--- a/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java
+++ b/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java
@@ -280,7 +280,7 @@
}
@Override
- public void onUpdate(float percent) {}
+ public void onUpdate(float percent, boolean initOnly) {}
};
}
diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 49aec93..ccc587c 100644
--- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -32,6 +32,8 @@
import android.view.View;
import android.view.ViewGroup;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
@@ -68,15 +70,18 @@
private final float mSpringTransY;
private final AnimatorSet mAnimators = new AnimatorSet();
+ private final @Nullable View mIgnoredView;
- public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim) {
- this(launcher, velocity, animateOverviewScrim, true);
+ public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim,
+ @Nullable View ignoredView) {
+ this(launcher, velocity, animateOverviewScrim, ignoredView, true);
}
public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim,
- boolean staggerWorkspace) {
+ @Nullable View ignoredView, boolean staggerWorkspace) {
prepareToAnimate(launcher, animateOverviewScrim);
+ mIgnoredView = ignoredView;
mVelocity = velocity;
// Scale the translationY based on the initial velocity to better sync the workspace items
@@ -224,6 +229,7 @@
* @param totalRows Total number of rows.
*/
private void addStaggeredAnimationForView(View v, int row, int totalRows) {
+ if (mIgnoredView != null && mIgnoredView == v) return;
// Invert the rows, because we stagger starting from the bottom of the screen.
int invertedRow = totalRows - row;
// Add 1 to the inverted row so that the bottom most row has a start delay.
diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
index 3631130..61a2eaf 100644
--- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
+++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
@@ -121,6 +121,15 @@
mDestinationBoundsAnimation.set(mDestinationBounds);
mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius);
+ if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width()
+ || sourceRectHint.height() < destinationBounds.height())) {
+ // This is a situation in which the source hint rect on at least one axis is smaller
+ // than the destination bounds, which presents a problem because we would have to scale
+ // up that axis to fit the bounds. So instead, just fallback to the non-source hint
+ // animation in this case.
+ sourceRectHint = null;
+ }
+
if (sourceRectHint == null) {
mSourceHintRectInsets = null;
@@ -289,16 +298,16 @@
final float degree, positionX, positionY;
if (mFromRotation == Surface.ROTATION_90) {
degree = -90 * fraction;
- positionX = fraction * (mDestinationBoundsTransformed.left - mAppBounds.left)
- + mAppBounds.left;
- positionY = fraction * (mDestinationBoundsTransformed.bottom - mAppBounds.top)
- + mAppBounds.top;
+ positionX = fraction * (mDestinationBoundsTransformed.left - mStartBounds.left)
+ + mStartBounds.left;
+ positionY = fraction * (mDestinationBoundsTransformed.bottom - mStartBounds.top)
+ + mStartBounds.top;
} else {
degree = 90 * fraction;
- positionX = fraction * (mDestinationBoundsTransformed.right - mAppBounds.left)
- + mAppBounds.left;
- positionY = fraction * (mDestinationBoundsTransformed.top - mAppBounds.top)
- + mAppBounds.top;
+ positionX = fraction * (mDestinationBoundsTransformed.right - mStartBounds.left)
+ + mStartBounds.left;
+ positionY = fraction * (mDestinationBoundsTransformed.top - mStartBounds.top)
+ + mStartBounds.top;
}
return new RotatedPosition(degree, positionX, positionY);
}
diff --git a/quickstep/src/com/android/quickstep/views/AllAppsEduView.java b/quickstep/src/com/android/quickstep/views/AllAppsEduView.java
index 00993e3..f67940a 100644
--- a/quickstep/src/com/android/quickstep/views/AllAppsEduView.java
+++ b/quickstep/src/com/android/quickstep/views/AllAppsEduView.java
@@ -173,7 +173,7 @@
FloatProp mGradientAlpha = new FloatProp(0, 255, firstPart, secondPart * 0.3f, LINEAR);
@Override
- public void onUpdate(float progress) {
+ public void onUpdate(float progress, boolean initOnly) {
temp.set(circleBoundsOg);
temp.offset(0, (int) -mDeltaY.value);
Utilities.scaleRectAboutCenter(temp, mCircleScale.value);
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 7991614..df7f8b5 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -2357,7 +2357,8 @@
public void accept(Boolean success) {
if (LIVE_TILE.get() && mEnableDrawingLiveTile && taskView.isRunningTask()
&& success) {
- finishRecentsAnimation(true /* toHome */, () -> onEnd(success));
+ finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
+ () -> onEnd(success));
} else {
onEnd(success);
}
@@ -2368,7 +2369,8 @@
if (success) {
if (shouldRemoveTask) {
if (taskView.getTask() != null) {
- switchToScreenshotAndFinishAnimationToRecents(() -> {
+ finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
+ () -> {
UI_HELPER_EXECUTOR.getHandler().postDelayed(() ->
ActivityManagerWrapper.getInstance().removeTask(
taskView.getTask().key.id),
@@ -2478,7 +2480,7 @@
mPendingAnimation.addEndListener(isSuccess -> {
if (isSuccess) {
// Remove all the task views now
- switchToScreenshotAndFinishAnimationToRecents(() -> {
+ finishRecentsAnimation(true /* toRecents */, false /* shouldPip */, () -> {
UI_HELPER_EXECUTOR.getHandler().postDelayed(
ActivityManagerWrapper.getInstance()::removeAllRecentTasks,
REMOVE_TASK_WAIT_FOR_APP_STOP_MS);
@@ -2639,7 +2641,9 @@
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (LIVE_TILE.get() && mEnableDrawingLiveTile && newConfig.orientation != mOrientation) {
- switchToScreenshotAndFinishAnimationToRecents(this::updateRecentsRotation);
+ switchToScreenshot(
+ () -> finishRecentsAnimation(true /* toRecents */, false /* showPip */,
+ this::updateRecentsRotation));
mEnableDrawingLiveTile = false;
} else {
updateRecentsRotation();
@@ -3632,10 +3636,6 @@
}
}
- public void switchToScreenshotAndFinishAnimationToRecents(Runnable onFinishRunnable) {
- switchToScreenshot(() -> finishRecentsAnimation(true /* toRecents */, onFinishRunnable));
- }
-
/**
* Switch the current running task view to static snapshot mode,
* capturing the snapshot at the same time.
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-night-v31/all_apps_tab_background_selected.xml
similarity index 76%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-night-v31/all_apps_tab_background_selected.xml
index e59e8d2..b7c9ff6 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-night-v31/all_apps_tab_background_selected.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_accent2_100"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-night-v31/all_apps_tab_text.xml
similarity index 75%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-night-v31/all_apps_tab_text.xml
index e59e8d2..83237b4 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-night-v31/all_apps_tab_text.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_50" android:state_selected="true"/>
+ <item android:color="@android:color/system_neutral2_700"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-night-v31/all_apps_tabs_background.xml
similarity index 76%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-night-v31/all_apps_tabs_background.xml
index e59e8d2..b396f33 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-night-v31/all_apps_tabs_background.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral2_100"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-night/all_apps_tab_background_selected.xml
similarity index 76%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-night/all_apps_tab_background_selected.xml
index e59e8d2..b22bc8b 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-night/all_apps_tab_background_selected.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="#BFEBE3"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-night/all_apps_tab_text.xml
similarity index 76%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-night/all_apps_tab_text.xml
index e59e8d2..183af01 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-night/all_apps_tab_text.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="#F0F0F0" android:state_selected="true"/>
+ <item android:color="#464646"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-night/all_apps_tabs_background.xml
similarity index 76%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-night/all_apps_tabs_background.xml
index e59e8d2..c0c1621 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-night/all_apps_tabs_background.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="#E2E2E2"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-v31/all_apps_tab_background_selected.xml
similarity index 76%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-v31/all_apps_tab_background_selected.xml
index e59e8d2..dac8fa2 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-v31/all_apps_tab_background_selected.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_accent1_100"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-v31/all_apps_tab_text.xml
similarity index 75%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-v31/all_apps_tab_text.xml
index e59e8d2..c3520a7 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-v31/all_apps_tab_text.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_900" android:state_selected="true"/>
+ <item android:color="@android:color/system_neutral2_700"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color-v31/all_apps_tabs_background.xml
similarity index 76%
copy from res/color/all_apps_tab_bg.xml
copy to res/color-v31/all_apps_tabs_background.xml
index e59e8d2..30757b0 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color-v31/all_apps_tabs_background.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_500" android:lStar="97" />
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color/all_apps_tab_background_selected.xml
similarity index 83%
rename from res/color/all_apps_tab_bg.xml
rename to res/color/all_apps_tab_background_selected.xml
index e59e8d2..5cb9bd8 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color/all_apps_tab_background_selected.xml
@@ -13,7 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="#8DF5E3"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_text.xml b/res/color/all_apps_tab_text.xml
index 2db0fb5..dace380 100644
--- a/res/color/all_apps_tab_text.xml
+++ b/res/color/all_apps_tab_text.xml
@@ -14,6 +14,6 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@android:color/black" android:state_selected="true"/>
- <item android:color="?android:attr/textColorTertiary"/>
+ <item android:color="#1B1B1B" android:state_selected="true"/>
+ <item android:color="#464646"/>
</selector>
\ No newline at end of file
diff --git a/res/color/all_apps_tab_bg.xml b/res/color/all_apps_tabs_background.xml
similarity index 77%
copy from res/color/all_apps_tab_bg.xml
copy to res/color/all_apps_tabs_background.xml
index e59e8d2..a4b7d1f 100644
--- a/res/color/all_apps_tab_bg.xml
+++ b/res/color/all_apps_tabs_background.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="?androidprv:attr/colorAccentPrimary"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="#F6F6F6"/>
</selector>
\ No newline at end of file
diff --git a/res/drawable/all_apps_tabs_background.xml b/res/drawable/all_apps_tabs_background.xml
index a345dd3..4e95315 100644
--- a/res/drawable/all_apps_tabs_background.xml
+++ b/res/drawable/all_apps_tabs_background.xml
@@ -13,14 +13,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:top="@dimen/all_apps_tabs_vertical_padding"
- android:bottom="@dimen/all_apps_tabs_vertical_padding
-">
+ android:bottom="@dimen/all_apps_tabs_vertical_padding">
<shape android:shape="rectangle">
- <solid android:color="?androidprv:attr/colorSurface" />
+ <solid android:color="@color/all_apps_tabs_background" />
<corners android:radius="@dimen/all_apps_header_pill_corner_radius" />
</shape>
</item>
diff --git a/res/drawable/work_apps_toggle_background.xml b/res/drawable/work_apps_toggle_background.xml
new file mode 100644
index 0000000..b7115f8
--- /dev/null
+++ b/res/drawable/work_apps_toggle_background.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false">
+ <shape android:shape="rectangle">
+ <corners android:radius="@dimen/work_fab_radius" />
+ <solid android:color="?android:attr/colorControlHighlight" />
+ <padding android:left="@dimen/work_fab_radius" android:right="@dimen/work_fab_radius" />
+ </shape>
+ </item>
+ <item>
+ <shape android:shape="rectangle">
+ <corners android:radius="@dimen/work_fab_radius" />
+ <solid android:color="@color/all_apps_tab_background_selected" />
+ <padding android:left="@dimen/work_fab_radius" android:right="@dimen/work_fab_radius" />
+ </shape>
+ </item>
+</selector>
diff --git a/res/drawable/work_card.xml b/res/drawable/work_card.xml
new file mode 100644
index 0000000..0e4b054
--- /dev/null
+++ b/res/drawable/work_card.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle">
+ <solid android:color="?androidprv:attr/colorSurface" />
+ <corners android:radius="@dimen/work_edu_card_margin" />
+ <padding
+ android:left="@dimen/work_fab_radius"
+ android:right="@dimen/work_fab_radius" />
+</shape>
+
diff --git a/res/drawable/work_card_btn.xml b/res/drawable/work_card_btn.xml
new file mode 100644
index 0000000..3c93919
--- /dev/null
+++ b/res/drawable/work_card_btn.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle">
+ <corners android:radius="@dimen/work_edu_card_margin" />
+ <stroke android:width="1dp" android:color="?androidprv:attr/colorAccentPrimaryVariant" />
+ <padding
+ android:left="@dimen/work_fab_radius"
+ android:right="@dimen/work_fab_radius" />
+</shape>
+
diff --git a/res/layout/add_item_confirmation_activity.xml b/res/layout/add_item_confirmation_activity.xml
index 9439baf..1aeda50 100644
--- a/res/layout/add_item_confirmation_activity.xml
+++ b/res/layout/add_item_confirmation_activity.xml
@@ -26,79 +26,82 @@
android:importantForAccessibility="no">
<com.android.launcher3.widget.AddItemWidgetsBottomSheet
- xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/add_item_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/add_item_dialog_background"
- android:paddingTop="24dp"
android:theme="?attr/widgetsTheme"
android:layout_gravity="bottom"
android:orientation="vertical">
- <TextView
- style="@style/TextHeadline"
- android:id="@+id/widget_appName"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:paddingHorizontal="24dp"
- android:textColor="?android:attr/textColorPrimary"
- android:textSize="24sp"
- android:ellipsize="end"
- android:fadingEdge="horizontal"
- android:singleLine="true"
- android:maxLines="1" />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:paddingHorizontal="24dp"
- android:paddingTop="8dp"
- android:text="@string/add_item_request_drag_hint"
- android:textSize="14sp"
- android:textColor="?android:attr/textColorSecondary"
- android:alpha="0.7"
- android:importantForAccessibility="no"/>
-
- <include layout="@layout/widget_cell"
- android:id="@+id/widget_cell"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:layout_marginVertical="16dp" />
-
<LinearLayout
+ android:id="@+id/add_item_bottom_sheet_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:gravity="center_vertical|end"
- android:paddingHorizontal="24dp"
- android:paddingVertical="8dp"
- android:orientation="horizontal">
- <Button
- style="@style/Button.FullRounded.Colored"
- android:layout_width="wrap_content"
- android:layout_height="36dp"
- android:paddingHorizontal="16dp"
- android:textSize="14sp"
- android:textColor="@color/button_text"
- android:text="@android:string/cancel"
- android:onClick="onCancelClick"/>
+ android:padding="24dp"
+ android:background="@drawable/add_item_dialog_background"
+ android:orientation="vertical" >
- <Space
- android:layout_width="8dp"
- android:layout_height="wrap_content" />
+ <TextView
+ style="@style/TextHeadline"
+ android:id="@+id/widget_appName"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="24sp"
+ android:ellipsize="end"
+ android:fadingEdge="horizontal"
+ android:singleLine="true"
+ android:maxLines="1" />
- <Button
- style="@style/Button.FullRounded.Colored"
- android:layout_width="wrap_content"
- android:layout_height="36dp"
- android:paddingHorizontal="16dp"
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:paddingTop="8dp"
+ android:text="@string/add_item_request_drag_hint"
android:textSize="14sp"
- android:textColor="@color/button_text"
- android:text="@string/add_to_home_screen"
- android:onClick="onPlaceAutomaticallyClick"/>
+ android:textColor="?android:attr/textColorSecondary"
+ android:alpha="0.7"
+ android:importantForAccessibility="no"/>
+
+ <include layout="@layout/widget_cell"
+ android:id="@+id/widget_cell"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:layout_marginVertical="16dp" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical|end"
+ android:paddingVertical="8dp"
+ android:orientation="horizontal">
+ <Button
+ style="@style/Button.FullRounded.Colored"
+ android:layout_width="wrap_content"
+ android:layout_height="36dp"
+ android:paddingHorizontal="16dp"
+ android:textSize="14sp"
+ android:textColor="@color/button_text"
+ android:text="@android:string/cancel"
+ android:onClick="onCancelClick"/>
+
+ <Space
+ android:layout_width="8dp"
+ android:layout_height="wrap_content" />
+
+ <Button
+ style="@style/Button.FullRounded.Colored"
+ android:layout_width="wrap_content"
+ android:layout_height="36dp"
+ android:paddingHorizontal="16dp"
+ android:textSize="14sp"
+ android:textColor="@color/button_text"
+ android:text="@string/add_to_home_screen"
+ android:onClick="onPlaceAutomaticallyClick"/>
+ </LinearLayout>
</LinearLayout>
</com.android.launcher3.widget.AddItemWidgetsBottomSheet>
diff --git a/res/layout/widgets_bottom_sheet.xml b/res/layout/widgets_bottom_sheet.xml
index 1859bd8..bbb08fa 100644
--- a/res/layout/widgets_bottom_sheet.xml
+++ b/res/layout/widgets_bottom_sheet.xml
@@ -19,8 +19,6 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="16dp"
- android:background="@drawable/widgets_bottom_sheet_background"
android:layout_gravity="bottom"
android:theme="?attr/widgetsTheme">
diff --git a/res/layout/widgets_bottom_sheet_content.xml b/res/layout/widgets_bottom_sheet_content.xml
index 85c6488..3b3ff8b 100644
--- a/res/layout/widgets_bottom_sheet_content.xml
+++ b/res/layout/widgets_bottom_sheet_content.xml
@@ -14,32 +14,40 @@
limitations under the License.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <View
- android:id="@+id/collapse_handle"
- android:layout_width="48dp"
- android:layout_height="2dp"
- android:layout_gravity="center_horizontal"
- android:layout_marginBottom="16dp"
- android:visibility="gone"
- android:background="?android:attr/textColorSecondary"/>
- <TextView
- style="@style/TextHeadline"
- android:id="@+id/title"
+ <LinearLayout
+ android:id="@+id/widgets_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textColor="?android:attr/textColorPrimary"
- android:textSize="24sp"/>
-
- <ScrollView
- android:id="@+id/widgets_table_scroll_view"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:fadeScrollbars="false"
- android:layout_marginVertical="16dp">
- <include layout="@layout/widgets_table_container"
+ android:background="@drawable/widgets_bottom_sheet_background"
+ android:paddingTop="16dp"
+ android:orientation="vertical">
+ <View
+ android:id="@+id/collapse_handle"
+ android:layout_width="48dp"
+ android:layout_height="2dp"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginBottom="16dp"
+ android:visibility="gone"
+ android:background="?android:attr/textColorSecondary"/>
+ <TextView
+ style="@style/TextHeadline"
+ android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal" />
- </ScrollView>
+ android:gravity="center_horizontal"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="24sp"/>
+
+ <ScrollView
+ android:id="@+id/widgets_table_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fadeScrollbars="false"
+ android:layout_marginVertical="16dp">
+ <include layout="@layout/widgets_table_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal" />
+ </ScrollView>
+ </LinearLayout>
</merge>
diff --git a/res/layout/work_apps_edu.xml b/res/layout/work_apps_edu.xml
new file mode 100644
index 0000000..2c58907
--- /dev/null
+++ b/res/layout/work_apps_edu.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<com.android.launcher3.allapps.WorkEduCard xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="@dimen/work_edu_card_margin"
+ android:orientation="vertical"
+ android:background="@drawable/work_card"
+ android:gravity="center">
+
+ <TextView
+ style="@style/PrimaryHeadline"
+ android:textColor="?android:attr/textColorPrimary"
+ android:id="@+id/work_apps_paused_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="8dp"
+ android:text="@string/work_profile_edu_work_apps"
+ android:textAlignment="center"
+ android:textSize="20sp" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/action_btn"
+ android:textColor="?attr/workProfileOverlayTextColor"
+ android:text="@string/work_profile_edu_accept"
+ android:textAlignment="center"
+ android:background="@drawable/work_card_btn"
+ android:textSize="14sp" />
+</com.android.launcher3.allapps.WorkEduCard>
\ No newline at end of file
diff --git a/res/layout/work_mode_fab.xml b/res/layout/work_mode_fab.xml
new file mode 100644
index 0000000..4209192
--- /dev/null
+++ b/res/layout/work_mode_fab.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.android.launcher3.allapps.WorkModeSwitch xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/work_mode_toggle"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentEnd="true"
+ android:layout_height="@dimen/work_fab_height"
+ android:layout_width="wrap_content"
+ android:gravity="center"
+ android:includeFontPadding="false"
+ android:drawableTint="@color/all_apps_tab_text"
+ android:textColor="@color/all_apps_tab_text"
+ android:background="@drawable/work_apps_toggle_background"
+ android:drawablePadding="16dp"
+ android:drawableStart="@drawable/ic_corp_off"
+ android:elevation="10dp"
+ android:layout_marginBottom="@dimen/work_fab_margin"
+ android:layout_marginEnd="@dimen/work_fab_margin"
+ android:text="@string/work_apps_pause_btn_text" />
\ No newline at end of file
diff --git a/res/layout/work_mode_switch.xml b/res/layout/work_mode_switch.xml
deleted file mode 100644
index 31953c7..0000000
--- a/res/layout/work_mode_switch.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<com.android.launcher3.allapps.WorkModeSwitch
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- style="@style/PrimaryHeadline"
- android:id="@+id/work_mode_toggle"
- android:drawableStart="@drawable/ic_corp"
- android:drawablePadding="16dp"
- android:drawableTint="?attr/workProfileOverlayTextColor"
- android:textColor="?attr/workProfileOverlayTextColor"
- android:layout_alignParentBottom="true"
- android:ellipsize="end"
- android:elevation="10dp"
- android:gravity="start"
- android:lines="1"
- android:showText="false"
- android:textSize="@dimen/work_profile_footer_text_size"
- android:background="?attr/allAppsScrimColor"
- android:text="@string/work_profile_toggle_label"
- android:paddingBottom="@dimen/work_profile_footer_padding"
- android:paddingLeft="@dimen/work_profile_footer_padding"
- android:paddingRight="@dimen/work_profile_footer_padding"
- android:paddingTop="@dimen/work_profile_footer_padding"
-/>
diff --git a/res/layout/work_profile_edu.xml b/res/layout/work_profile_edu.xml
deleted file mode 100644
index c3c7010..0000000
--- a/res/layout/work_profile_edu.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2020 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<com.android.launcher3.views.WorkEduView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:gravity="bottom"
- android:orientation="vertical">
-
- <View
- android:layout_width="match_parent"
- android:layout_height="32dp"
- android:background="@drawable/bottom_sheet_top_border"
- android:backgroundTint="?attr/eduHalfSheetBGColor" />
-
- <LinearLayout
- android:id="@+id/view_wrapper"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="?attr/eduHalfSheetBGColor"
- android:orientation="vertical"
- android:paddingLeft="@dimen/bottom_sheet_edu_padding"
- android:paddingRight="@dimen/bottom_sheet_edu_padding">
-
- <TextView
- android:id="@+id/content_text"
- style="@style/TextHeadline"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="48dp"
- android:layout_marginBottom="48dp"
- android:gravity="center"
- android:text="@string/work_profile_edu_personal_apps"
- android:textAlignment="center"
- android:textColor="@android:color/white"
- android:textSize="20sp" />
-
- <Button
- android:id="@+id/proceed"
- android:layout_width="wrap_content"
- android:layout_height="48dp"
- android:layout_gravity="end"
- android:background="?android:attr/selectableItemBackground"
- android:gravity="center"
- android:text="@string/work_profile_edu_next"
- android:textAlignment="center"
- android:textColor="@android:color/white" />
- </LinearLayout>
-</com.android.launcher3.views.WorkEduView>
\ No newline at end of file
diff --git a/res/values-night/styles.xml b/res/values-night/styles.xml
index 427525b..d41eb7e 100644
--- a/res/values-night/styles.xml
+++ b/res/values-night/styles.xml
@@ -20,5 +20,6 @@
<resources>
<style name="AddItemActivityTheme" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="widgetsTheme">@style/WidgetContainerTheme.Dark</item>
+ <item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index 1434430..38a0894 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -16,7 +16,7 @@
** limitations under the License.
*/
-->
-<resources>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
<color name="popup_color_primary_light">@android:color/system_accent2_50</color>
<color name="popup_color_secondary_light">@android:color/system_neutral2_100</color>
<color name="popup_color_tertiary_light">@android:color/system_neutral2_300</color>
@@ -36,7 +36,8 @@
<color name="text_color_tertiary_dark">@android:color/system_neutral2_400</color>
<color name="wallpaper_popup_scrim">@android:color/system_neutral1_900</color>
-
+ <color name="folder_background_light" android:lstar="98">@android:color/system_neutral1_50</color>
+ <color name="folder_background_dark" android:lstar="30">@android:color/system_neutral2_800</color>
+
<color name="folder_dot_color">@android:color/system_accent2_50</color>
-
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 7aab4fa..dac12ed 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -59,6 +59,9 @@
<color name="folder_hint_text_color_light">#FFF</color>
<color name="folder_hint_text_color_dark">#FF000000</color>
+ <color name="folder_background_light">#FFFFFF</color>
+ <color name="folder_background_dark">#FF3C4043</color>
+
<color name="folder_dot_color">?attr/colorPrimary</color>
<color name="text_color_primary_dark">#FFFFFFFF</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 29a8016..430a1ab 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -116,10 +116,16 @@
<dimen name="all_apps_divider_margin_vertical">8dp</dimen>
+<!-- Floating action button inside work tab to toggle work profile -->
+ <dimen name="work_fab_height">48dp</dimen>
+ <dimen name="work_fab_radius">24dp</dimen>
+ <dimen name="work_fab_margin">18dp</dimen>
<dimen name="work_profile_footer_padding">20dp</dimen>
<dimen name="work_profile_footer_text_size">16sp</dimen>
+ <dimen name="work_edu_card_margin">16dp</dimen>
-<!-- Widget tray -->
+
+ <!-- Widget tray -->
<dimen name="widget_cell_vertical_padding">8dp</dimen>
<dimen name="widget_cell_horizontal_padding">16dp</dimen>
<dimen name="widget_cell_font_size">14sp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ee0b64a..9823df3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -388,37 +388,30 @@
<!-- This string is in the work profile tab when a user has All Apps open on their phone. This is a label for a toggle to turn the work profile on and off. "Work profile" means a separate profile on a user's phone that's specifically for their work apps and managed by their company. "Work" is used as an adjective.-->
<string name="work_profile_toggle_label">Work profile</string>
- <!--- User onboarding title for personal apps -->
- <string name="work_profile_edu_personal_apps">Personal data is separate & hidden from work apps</string>
<!--- User onboarding title for work profile apps -->
- <string name="work_profile_edu_work_apps">Work apps & data are visible to your IT admin</string>
- <!-- Action label to proceed to the next work profile edu section-->
- <string name="work_profile_edu_next">Next</string>
+ <string name="work_profile_edu_work_apps">Work apps are badged and visible to your IT admin</string>
<!-- Action label to finish work profile edu-->
<string name="work_profile_edu_accept">Got it</string>
<!--- heading shown when user opens work apps tab while work apps are paused -->
- <string name="work_apps_paused_title">Work profile is paused</string>
+ <string name="work_apps_paused_title">Work apps are off</string>
<!--- body shown when user opens work apps tab while work apps are paused -->
- <string name="work_apps_paused_body">Work apps can’t send you notifications, use your battery, or access your location</string>
+ <string name="work_apps_paused_body">Your work apps can’t send you notifications, use your battery, or access your location</string>
<!-- content description for paused work apps list -->
- <string name="work_apps_paused_content_description">Work profile is paused. Work apps can’t send you notifications, use your battery, or access your location</string>
+ <string name="work_apps_paused_content_description">Work apps are off. Your work apps can’t send you notifications, use your battery, or access your location</string>
<!-- string shown in educational banner about work profile -->
<string name="work_apps_paused_edu_banner">Work apps are badged and visible to your IT admin</string>
<!-- button string shown to dismiss work tab education -->
<string name="work_apps_paused_edu_accept">Got it</string>
<!-- button string shown pause work profile -->
- <string name="work_apps_pause_btn_text">Pause work apps</string>
+ <string name="work_apps_pause_btn_text">Turn off work apps</string>
<!-- button string shown enable work profile -->
- <string name="work_apps_enable_btn_text">Turn on</string>
+ <string name="work_apps_enable_btn_text">Turn on work apps</string>
<!-- A hint shown in launcher settings develop options filter box -->
<string name="developer_options_filter_hint">Filter</string>
- <!-- A tip shown pointing at work toggle -->
- <string name="work_switch_tip">Pause work apps and notifications</string>
-
<!-- Failed action error message: e.g. Failed: Pause -->
<string name="remote_action_failed">Failed: <xliff:g id="what" example="Pause">%1$s</xliff:g></string>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 571377c..6f7d727 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -48,9 +48,9 @@
<item name="workspaceStatusBarScrim">@drawable/workspace_bg</item>
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
<item name="folderDotColor">@color/folder_dot_color</item>
- <item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
+ <item name="folderFillColor">@color/folder_background_light</item>
<item name="folderIconBorderColor">?android:attr/colorPrimary</item>
- <item name="folderTextColor">?android:attr/textColorPrimary</item>
+ <item name="folderTextColor">@color/workspace_text_color_dark</item>
<item name="isFolderDarkText">true</item>
<item name="folderHintColor">@color/folder_hint_text_color_dark</item>
<item name="loadingIconColor">#CCFFFFFF</item>
@@ -71,10 +71,10 @@
</style>
<style name="LauncherTheme.DarkMainColor" parent="@style/LauncherTheme">
- <item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
- <item name="folderTextColor">?attr/workspaceTextColor</item>
- <item name="isFolderDarkText">?attr/isWorkspaceDarkText</item>
- <item name="folderHintColor">@color/folder_hint_text_color_dark</item>
+ <item name="folderFillColor">@color/folder_background_dark</item>
+ <item name="folderTextColor">@color/workspace_text_color_light</item>
+ <item name="isFolderDarkText">false</item>
+ <item name="folderHintColor">@color/folder_hint_text_color_light</item>
<item name="disabledIconAlpha">.254</item>
</style>
@@ -87,9 +87,9 @@
<item name="isWorkspaceDarkText">true</item>
<item name="workspaceStatusBarScrim">@null</item>
<item name="folderDotColor">@color/folder_dot_color</item>
- <item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
+ <item name="folderFillColor">@color/folder_background_light</item>
<item name="folderIconBorderColor">#FF80868B</item>
- <item name="folderTextColor">?attr/workspaceTextColor</item>
+ <item name="folderTextColor">@color/workspace_text_color_dark</item>
<item name="isFolderDarkText">true</item>
<item name="folderHintColor">@color/folder_hint_text_color_dark</item>
</style>
@@ -109,9 +109,9 @@
<item name="popupColorTertiary">@color/popup_color_tertiary_dark</item>
<item name="widgetsTheme">@style/WidgetContainerTheme.Dark</item>
<item name="folderDotColor">@color/folder_dot_color</item>
- <item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
+ <item name="folderFillColor">@color/folder_background_dark</item>
<item name="folderIconBorderColor">?android:attr/colorPrimary</item>
- <item name="folderTextColor">?android:attr/textColorPrimary</item>
+ <item name="folderTextColor">@color/workspace_text_color_light</item>
<item name="isFolderDarkText">false</item>
<item name="folderHintColor">@color/folder_hint_text_color_light</item>
<item name="isMainColorDark">true</item>
@@ -123,8 +123,8 @@
</style>
<style name="LauncherTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark">
- <item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
- <item name="folderTextColor">@android:color/white</item>
+ <item name="folderFillColor">@color/folder_background_dark</item>
+ <item name="folderTextColor">@color/workspace_text_color_light</item>
<item name="isFolderDarkText">false</item>
<item name="folderHintColor">@color/folder_hint_text_color_light</item>
<item name="disabledIconAlpha">.54</item>
@@ -132,16 +132,16 @@
<style name="LauncherTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark">
<item name="android:colorControlHighlight">#19212121</item>
- <item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
- <item name="folderTextColor">?attr/workspaceTextColor</item>
- <item name="isFolderDarkText">?attr/isWorkspaceDarkText</item>
- <item name="folderHintColor">@color/folder_hint_text_color_dark</item>
+ <item name="folderFillColor">@color/folder_background_light</item>
<item name="workspaceTextColor">@color/workspace_text_color_dark</item>
<item name="workspaceShadowColor">@android:color/transparent</item>
<item name="workspaceAmbientShadowColor">@android:color/transparent</item>
<item name="workspaceKeyShadowColor">@android:color/transparent</item>
<item name="isWorkspaceDarkText">true</item>
<item name="workspaceStatusBarScrim">@null</item>
+ <item name="folderTextColor">@color/workspace_text_color_dark</item>
+ <item name="isFolderDarkText">true</item>
+ <item name="folderHintColor">@color/folder_hint_text_color_dark</item>
</style>
<!-- A derivative project can extend these themes to customize the application theme without
@@ -316,5 +316,6 @@
<style name="AddItemActivityTheme" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
<item name="android:windowLightStatusBar">true</item>
+ <item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c91fb27..c5d280d 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1080,7 +1080,13 @@
// Making sure mAllAppsSessionLogId is not null to avoid double logging.
&& mAllAppsSessionLogId != null) {
getAppsView().getSearchUiManager().resetSearch();
- getStatsLogManager().logger().log(LAUNCHER_ALLAPPS_EXIT);
+ getStatsLogManager().logger()
+ .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
+ .setWorkspace(
+ LauncherAtom.WorkspaceContainer.newBuilder()
+ .setPageIndex(getWorkspace().getCurrentPage()))
+ .build())
+ .log(LAUNCHER_ALLAPPS_EXIT);
mAllAppsSessionLogId = null;
}
}
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 2c24c3a..4579705 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -18,6 +18,9 @@
import static android.view.MotionEvent.ACTION_DOWN;
+import static com.android.launcher3.CellLayout.FOLDER;
+import static com.android.launcher3.CellLayout.WORKSPACE;
+
import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Rect;
@@ -124,21 +127,27 @@
public void measureChild(View child) {
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
- final DeviceProfile profile = mActivity.getDeviceProfile();
+ final DeviceProfile dp = mActivity.getDeviceProfile();
if (child instanceof LauncherAppWidgetHostView) {
- ((LauncherAppWidgetHostView) child).getWidgetInset(profile, mTempRect);
+ ((LauncherAppWidgetHostView) child).getWidgetInset(dp, mTempRect);
lp.setup(mCellWidth, mCellHeight, invertLayoutHorizontally(), mCountX, mCountY,
- profile.appWidgetScale.x, profile.appWidgetScale.y, mBorderSpacing, mTempRect);
+ dp.appWidgetScale.x, dp.appWidgetScale.y, mBorderSpacing, mTempRect);
} else {
lp.setup(mCellWidth, mCellHeight, invertLayoutHorizontally(), mCountX, mCountY,
mBorderSpacing, null);
// Center the icon/folder
int cHeight = getCellContentHeight();
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
- int cellPaddingX = mContainerType == CellLayout.WORKSPACE
- ? profile.workspaceCellPaddingXPx
- : (int) (profile.edgeMarginPx / 2f);
+
+ // No need to add padding when cell layout border spacing is present.
+ boolean noPadding = (dp.cellLayoutBorderSpacingPx > 0 && mContainerType == WORKSPACE)
+ || (dp.folderCellLayoutBorderSpacingPx > 0 && mContainerType == FOLDER);
+ int cellPaddingX = noPadding
+ ? 0
+ : mContainerType == WORKSPACE
+ ? dp.workspaceCellPaddingXPx
+ : (int) (dp.edgeMarginPx / 2f);
child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
}
int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 681f5e7..d749e02 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -50,7 +50,6 @@
import androidx.annotation.VisibleForTesting;
import androidx.core.graphics.ColorUtils;
import androidx.core.os.BuildCompat;
-import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -127,6 +126,7 @@
private Rect mInsets = new Rect();
private SearchAdapterProvider mSearchAdapterProvider;
+ private WorkAdapterProvider mWorkAdapterProvider;
private final int mScrimColor;
private final int mHeaderProtectionColor;
private final float mHeaderThreshold;
@@ -159,6 +159,11 @@
Selection.setSelection(mSearchQueryBuilder, 0);
mAH = new AdapterHolder[2];
+ mWorkAdapterProvider = new WorkAdapterProvider(mLauncher, () -> {
+ if (mAH[AdapterHolder.WORK] != null) {
+ mAH[AdapterHolder.WORK].appsList.updateAdapterItems();
+ }
+ });
mAH[AdapterHolder.MAIN] = new AdapterHolder(false /* isWork */);
mAH[AdapterHolder.WORK] = new AdapterHolder(true /* isWork */);
@@ -228,8 +233,9 @@
}
private void resetWorkProfile() {
- mWorkModeSwitch.update(!mAllAppsStore.hasModelFlag(FLAG_QUIET_MODE_ENABLED));
- mAH[AdapterHolder.WORK].setupOverlay();
+ boolean isEnabled = !mAllAppsStore.hasModelFlag(FLAG_QUIET_MODE_ENABLED);
+ mWorkModeSwitch.updateCurrentState(isEnabled);
+ mWorkAdapterProvider.updateCurrentState(isEnabled);
mAH[AdapterHolder.WORK].applyPadding();
}
@@ -392,7 +398,6 @@
mAH[i].padding.bottom = insets.bottom;
mAH[i].padding.left = mAH[i].padding.right = leftRightPadding;
mAH[i].applyPadding();
- mAH[i].setupOverlay();
}
ViewGroup.MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams();
@@ -482,7 +487,7 @@
private void setupWorkToggle() {
if (Utilities.ATLEAST_P) {
mWorkModeSwitch = (WorkModeSwitch) mLauncher.getLayoutInflater().inflate(
- R.layout.work_mode_switch, this, false);
+ R.layout.work_mode_fab, this, false);
this.addView(mWorkModeSwitch);
mWorkModeSwitch.setInsets(mInsets);
mWorkModeSwitch.post(this::resetWorkProfile);
@@ -539,6 +544,9 @@
&& mAllAppsStore.hasModelFlag(
FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION));
}
+ if (mSearchUiManager != null && mSearchUiManager.getEditText() != null) {
+ mSearchUiManager.getEditText().hideKeyboard();
+ }
}
// Used by tests only
@@ -719,9 +727,15 @@
AdapterHolder(boolean isWork) {
mIsWork = isWork;
- appsList = new AlphabeticalAppsList(mLauncher, mAllAppsStore, isWork);
+ appsList = new AlphabeticalAppsList(mLauncher, mAllAppsStore,
+ isWork ? mWorkAdapterProvider : null);
+
+ BaseAdapterProvider[] adapterProviders =
+ isWork ? new BaseAdapterProvider[]{mSearchAdapterProvider, mWorkAdapterProvider}
+ : new BaseAdapterProvider[]{mSearchAdapterProvider};
+
adapter = new AllAppsGridAdapter(mLauncher, getLayoutInflater(), appsList,
- mSearchAdapterProvider);
+ adapterProviders);
appsList.setAdapter(adapter);
layoutManager = adapter.getLayoutManager();
}
@@ -743,38 +757,11 @@
adapter.setIconFocusListener(focusedItemDecorator.getFocusListener());
applyVerticalFadingEdgeEnabled(verticalFadingEdge);
applyPadding();
- setupOverlay();
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
recyclerView.addItemDecoration(mSearchAdapterProvider.getDecorator());
}
}
- void setupOverlay() {
- if (!mIsWork || recyclerView == null) return;
- boolean workDisabled = mAllAppsStore.hasModelFlag(FLAG_QUIET_MODE_ENABLED);
- if (mWorkDisabled == workDisabled) return;
- recyclerView.setContentDescription(workDisabled ? mLauncher.getString(
- R.string.work_apps_paused_content_description) : null);
- View overlayView = getOverlayView();
- recyclerView.setItemAnimator(new DefaultItemAnimator());
- if (workDisabled) {
- overlayView.setAlpha(0);
- recyclerView.addAutoSizedOverlay(overlayView);
- overlayView.animate().alpha(1).withEndAction(
- () -> {
- appsList.updateItemFilter((info, cn) -> false);
- recyclerView.setItemAnimator(null);
- }).start();
- } else if (mInfoMatcher != null) {
- appsList.updateItemFilter(mInfoMatcher);
- overlayView.animate().alpha(0).withEndAction(() -> {
- recyclerView.setItemAnimator(null);
- recyclerView.clearAutoSizedOverlays();
- }).start();
- }
- mWorkDisabled = workDisabled;
- }
-
void applyPadding() {
if (recyclerView != null) {
Resources res = getResources();
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
index 70588ea..874fe80 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -41,10 +41,10 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.R;
-import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.util.PackageManagerHelper;
+import java.util.Arrays;
import java.util.List;
/**
@@ -72,7 +72,8 @@
public static final int VIEW_TYPE_MASK_DIVIDER = VIEW_TYPE_ALL_APPS_DIVIDER;
public static final int VIEW_TYPE_MASK_ICON = VIEW_TYPE_ICON;
- private final SearchAdapterProvider mSearchAdapterProvider;
+
+ private final BaseAdapterProvider[] mAdapterProviders;
/**
* ViewHolder for each icon.
@@ -242,9 +243,12 @@
int totalSpans = mGridLayoutMgr.getSpanCount();
if (isIconViewType(viewType)) {
return totalSpans / mAppsPerRow;
- } else if (mSearchAdapterProvider.isSearchView(viewType)) {
- return totalSpans / mSearchAdapterProvider.getItemsPerRow(viewType, mAppsPerRow);
} else {
+ BaseAdapterProvider adapterProvider = getAdapterProvider(viewType);
+ if (adapterProvider != null) {
+ return totalSpans / adapterProvider.getItemsPerRow(viewType, mAppsPerRow);
+ }
+
// Section breaks span the full width
return totalSpans;
}
@@ -270,7 +274,7 @@
private Intent mMarketSearchIntent;
public AllAppsGridAdapter(BaseDraggingActivity launcher, LayoutInflater inflater,
- AlphabeticalAppsList apps, SearchAdapterProvider searchAdapterProvider) {
+ AlphabeticalAppsList apps, BaseAdapterProvider[] adapterProviders) {
Resources res = launcher.getResources();
mLauncher = launcher;
mApps = apps;
@@ -282,16 +286,18 @@
mOnIconClickListener = launcher.getItemOnClickListener();
- mSearchAdapterProvider = searchAdapterProvider;
+ mAdapterProviders = adapterProviders;
setAppsPerRow(mLauncher.getDeviceProfile().numShownAllAppsColumns);
}
public void setAppsPerRow(int appsPerRow) {
mAppsPerRow = appsPerRow;
int totalSpans = mAppsPerRow;
- for (int itemPerRow : mSearchAdapterProvider.getSupportedItemsPerRowArray()) {
- if (totalSpans % itemPerRow != 0) {
- totalSpans *= itemPerRow;
+ for (BaseAdapterProvider adapterProvider : mAdapterProviders) {
+ for (int itemPerRow : adapterProvider.getSupportedItemsPerRowArray()) {
+ if (totalSpans % itemPerRow != 0) {
+ totalSpans *= itemPerRow;
+ }
}
}
mGridLayoutMgr.setSpanCount(totalSpans);
@@ -363,9 +369,9 @@
return new ViewHolder(mLayoutInflater.inflate(
R.layout.all_apps_divider, parent, false));
default:
- if (mSearchAdapterProvider.isSearchView(viewType)) {
- return mSearchAdapterProvider.onCreateViewHolder(mLayoutInflater, parent,
- viewType);
+ BaseAdapterProvider adapterProvider = getAdapterProvider(viewType);
+ if (adapterProvider != null) {
+ return adapterProvider.onCreateViewHolder(mLayoutInflater, parent, viewType);
}
throw new RuntimeException("Unexpected view type");
}
@@ -399,7 +405,10 @@
// nothing to do
break;
default:
- mSearchAdapterProvider.onBindView(holder, position);
+ BaseAdapterProvider adapterProvider = getAdapterProvider(holder.getItemViewType());
+ if (adapterProvider != null) {
+ adapterProvider.onBindView(holder, position);
+ }
}
}
@@ -424,4 +433,11 @@
AdapterItem item = mApps.getAdapterItems().get(position);
return item.viewType;
}
+
+ @Nullable
+ private BaseAdapterProvider getAdapterProvider(int viewType) {
+ return Arrays.stream(mAdapterProviders).filter(
+ adapterProvider -> adapterProvider.isViewSupported(viewType)).findFirst().orElse(
+ null);
+ }
}
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 88d95fa..ce5c589 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -44,6 +44,7 @@
private static final int FAST_SCROLL_FRACTION_DISTRIBUTE_BY_NUM_SECTIONS = 1;
private final int mFastScrollDistributionMode = FAST_SCROLL_FRACTION_DISTRIBUTE_BY_NUM_SECTIONS;
+ private final WorkAdapterProvider mWorkAdapterProvider;
/**
* Info about a fast scroller section, depending if sections are merged, the fast scroller
@@ -75,8 +76,6 @@
private final ArrayList<AdapterItem> mAdapterItems = new ArrayList<>();
// The set of sections that we allow fast-scrolling to (includes non-merged sections)
private final List<FastScrollSectionInfo> mFastScrollerSections = new ArrayList<>();
- // Is it the work profile app list.
- private final boolean mIsWork;
// The of ordered component names as a result of a search query
private ArrayList<AdapterItem> mSearchResults;
@@ -86,11 +85,12 @@
private int mNumAppRowsInAdapter;
private ItemInfoMatcher mItemFilter;
- public AlphabeticalAppsList(Context context, AllAppsStore appsStore, boolean isWork) {
+ public AlphabeticalAppsList(Context context, AllAppsStore appsStore,
+ WorkAdapterProvider adapterProvider) {
mAllAppsStore = appsStore;
mLauncher = BaseDraggingActivity.fromContext(context);
mAppNameComparator = new AppInfoComparator(context);
- mIsWork = isWork;
+ mWorkAdapterProvider = adapterProvider;
mNumAppsPerRow = mLauncher.getDeviceProfile().inv.numColumns;
mAllAppsStore.addUpdateListener(this);
}
@@ -265,7 +265,7 @@
* Updates the set of filtered apps with the current filter. At this point, we expect
* mCachedSectionNames to have been calculated for the set of all apps in mApps.
*/
- private void updateAdapterItems() {
+ public void updateAdapterItems() {
refillAdapterItems();
refreshRecyclerView();
}
@@ -292,6 +292,12 @@
if (!hasFilter()) {
mAccessibilityResultsCount = mApps.size();
+ if (mWorkAdapterProvider != null) {
+ position += mWorkAdapterProvider.addWorkItems(mAdapterItems);
+ if (!mWorkAdapterProvider.shouldShowWorkApps()) {
+ return;
+ }
+ }
for (AppInfo info : mApps) {
String sectionName = info.sectionName;
@@ -303,7 +309,8 @@
}
// Create an app item
- AdapterItem appItem = AdapterItem.asApp(position++, sectionName, info, appIndex++);
+ AdapterItem appItem = AdapterItem.asApp(position++, sectionName, info,
+ appIndex++);
if (lastFastScrollerSectionInfo.fastScrollToItem == null) {
lastFastScrollerSectionInfo.fastScrollToItem = appItem;
}
diff --git a/src/com/android/launcher3/allapps/BaseAdapterProvider.java b/src/com/android/launcher3/allapps/BaseAdapterProvider.java
new file mode 100644
index 0000000..308294c
--- /dev/null
+++ b/src/com/android/launcher3/allapps/BaseAdapterProvider.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.allapps;
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+/**
+ * A UI expansion wrapper providing for providing dynamic recyclerview items
+ */
+public abstract class BaseAdapterProvider {
+
+ /**
+ * Returns whether or not viewType can be handled by searchProvider
+ */
+ public abstract boolean isViewSupported(int viewType);
+
+ /**
+ * Called from RecyclerView.Adapter#onBindViewHolder
+ */
+ public abstract void onBindView(AllAppsGridAdapter.ViewHolder holder, int position);
+
+ /**
+ * Called from RecyclerView.Adapter#onCreateViewHolder
+ */
+ public abstract AllAppsGridAdapter.ViewHolder onCreateViewHolder(LayoutInflater layoutInflater,
+ ViewGroup parent, int viewType);
+
+ /**
+ * Returns supported item per row combinations supported
+ */
+ public int[] getSupportedItemsPerRowArray() {
+ return new int[]{};
+ }
+
+ /**
+ * Returns how many cells a view should span
+ */
+ public int getItemsPerRow(int viewType, int appsPerRow) {
+ return appsPerRow;
+ }
+
+}
diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
index 16ae250..1eb726c 100644
--- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
@@ -25,7 +25,6 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.statemanager.StateManager.StateListener;
-import com.android.launcher3.views.WorkEduView;
/**
* AllAppsContainerView with launcher specific callbacks
@@ -88,13 +87,6 @@
@Override
public void onActivePageChanged(int currentActivePage) {
super.onActivePageChanged(currentActivePage);
- if (mUsingTabs) {
- if (currentActivePage == AdapterHolder.WORK) {
- WorkEduView.showWorkEduIfNeeded(mLauncher);
- } else {
- mWorkTabListener = WorkEduView.showEduFlowIfNeeded(mLauncher, mWorkTabListener);
- }
- }
}
@Override
diff --git a/src/com/android/launcher3/allapps/WorkAdapterProvider.java b/src/com/android/launcher3/allapps/WorkAdapterProvider.java
new file mode 100644
index 0000000..13444dd
--- /dev/null
+++ b/src/com/android/launcher3/allapps/WorkAdapterProvider.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.allapps;
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import com.android.launcher3.BaseDraggingActivity;
+import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
+
+import java.util.ArrayList;
+
+/**
+ * A UI expansion wrapper providing for providing work profile specific views
+ */
+public class WorkAdapterProvider extends BaseAdapterProvider {
+
+ public static final String KEY_WORK_EDU_STEP = "showed_work_profile_edu";
+
+ private static final int VIEW_TYPE_WORK_EDU_CARD = 1 << 20;
+ private static final int VIEW_TYPE_WORK_DISABLED_CARD = 1 << 21;
+ private final Runnable mRefreshCB;
+ private final BaseDraggingActivity mLauncher;
+ private boolean mEnabled;
+
+ WorkAdapterProvider(BaseDraggingActivity launcher, Runnable refreshCallback) {
+ mLauncher = launcher;
+ mRefreshCB = refreshCallback;
+ }
+
+ @Override
+ public void onBindView(AllAppsGridAdapter.ViewHolder holder, int position) {
+ if (holder.itemView instanceof WorkEduCard) {
+ ((WorkEduCard) holder.itemView).setPosition(position);
+ }
+ }
+
+ @Override
+ public AllAppsGridAdapter.ViewHolder onCreateViewHolder(LayoutInflater layoutInflater,
+ ViewGroup parent, int viewType) {
+ int viewId = viewType == VIEW_TYPE_WORK_DISABLED_CARD ? R.layout.work_apps_paused
+ : R.layout.work_apps_edu;
+ return new AllAppsGridAdapter.ViewHolder(layoutInflater.inflate(viewId, parent, false));
+ }
+
+ /**
+ * returns whether or not work apps should be visible in work tab.
+ */
+ public boolean shouldShowWorkApps() {
+ return mEnabled;
+ }
+
+ /**
+ * Adds work profile specific adapter items to adapterItems and returns number of items added
+ */
+ public int addWorkItems(ArrayList<AllAppsGridAdapter.AdapterItem> adapterItems) {
+ if (!mEnabled) {
+ //add disabled card here.
+ AllAppsGridAdapter.AdapterItem disabledCard = new AllAppsGridAdapter.AdapterItem();
+ disabledCard.viewType = VIEW_TYPE_WORK_DISABLED_CARD;
+ adapterItems.add(disabledCard);
+ } else if (!isEduSeen()) {
+ AllAppsGridAdapter.AdapterItem eduCard = new AllAppsGridAdapter.AdapterItem();
+ eduCard.viewType = VIEW_TYPE_WORK_EDU_CARD;
+ adapterItems.add(eduCard);
+ }
+
+ return adapterItems.size();
+ }
+
+ /**
+ * Sets the current state of work profile
+ */
+ public void updateCurrentState(boolean isEnabled) {
+ mEnabled = isEnabled;
+ mRefreshCB.run();
+ }
+
+ @Override
+ public boolean isViewSupported(int viewType) {
+ return viewType == VIEW_TYPE_WORK_DISABLED_CARD || viewType == VIEW_TYPE_WORK_EDU_CARD;
+ }
+
+ @Override
+ public int getItemsPerRow(int viewType, int appsPerRow) {
+ return 1;
+ }
+
+ private boolean isEduSeen() {
+ return Utilities.getPrefs(mLauncher).getInt(KEY_WORK_EDU_STEP, 0) != 0;
+ }
+}
diff --git a/src/com/android/launcher3/allapps/WorkEduCard.java b/src/com/android/launcher3/allapps/WorkEduCard.java
new file mode 100644
index 0000000..29a42f8
--- /dev/null
+++ b/src/com/android/launcher3/allapps/WorkEduCard.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.allapps;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.LinearLayout;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
+
+/**
+ * Work profile toggle switch shown at the bottom of AllApps work tab
+ */
+public class WorkEduCard extends LinearLayout implements View.OnClickListener,
+ Animation.AnimationListener {
+
+ private final Launcher mLauncher;
+ Animation mDismissAnim;
+ private int mPosition = -1;
+
+ public WorkEduCard(Context context) {
+ this(context, null, 0);
+ }
+
+ public WorkEduCard(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public WorkEduCard(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ mLauncher = Launcher.getLauncher(getContext());
+ mDismissAnim = AnimationUtils.loadAnimation(context, android.R.anim.fade_out);
+ mDismissAnim.setDuration(500);
+ mDismissAnim.setAnimationListener(this);
+ }
+
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ findViewById(R.id.action_btn).setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View view) {
+ startAnimation(mDismissAnim);
+ mLauncher.getSharedPrefs().edit().putInt(WorkAdapterProvider.KEY_WORK_EDU_STEP, 1).apply();
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ removeCard();
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+
+ @Override
+ public void onAnimationStart(Animation animation) {
+
+ }
+
+ private void removeCard() {
+ if (mPosition == -1) {
+ if (getParent() != null) ((ViewGroup) getParent()).removeView(WorkEduCard.this);
+ } else {
+ AllAppsRecyclerView rv = mLauncher.getAppsView()
+ .mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView;
+ rv.getApps().getAdapterItems().remove(mPosition);
+ rv.getAdapter().notifyItemRemoved(mPosition);
+ }
+ }
+
+ public void setPosition(int position) {
+ mPosition = position;
+ }
+
+}
diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java
index 4567ee6..c22cd63 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -15,108 +15,61 @@
*/
package com.android.launcher3.allapps;
+import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
+
import android.content.Context;
-import android.content.SharedPreferences;
import android.graphics.Rect;
-import android.os.AsyncTask;
+import android.os.Build;
import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.ViewConfiguration;
-import android.widget.Switch;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+
+import androidx.annotation.RequiresApi;
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.pm.UserCache;
-import com.android.launcher3.views.ArrowTipView;
-
-import java.lang.ref.WeakReference;
/**
* Work profile toggle switch shown at the bottom of AllApps work tab
*/
-public class WorkModeSwitch extends Switch implements Insettable {
-
- private static final int WORK_TIP_THRESHOLD = 2;
- public static final String KEY_WORK_TIP_COUNTER = "worked_tip_counter";
+public class WorkModeSwitch extends Button implements Insettable, View.OnClickListener {
private Rect mInsets = new Rect();
-
- private final float[] mTouch = new float[2];
- private int mTouchSlop;
+ private boolean mWorkEnabled;
public WorkModeSwitch(Context context) {
- super(context);
- init();
+ this(context, null, 0);
}
public WorkModeSwitch(Context context, AttributeSet attrs) {
- super(context, attrs);
- init();
+ this(context, attrs, 0);
}
public WorkModeSwitch(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- init();
- }
-
- private void init() {
- ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
- mTouchSlop = viewConfiguration.getScaledTouchSlop();
}
@Override
- public void setChecked(boolean checked) { }
-
- @Override
- public void toggle() {
- // don't show tip if user uses toggle
- Utilities.getPrefs(getContext()).edit().putInt(KEY_WORK_TIP_COUNTER, -1).apply();
- trySetQuietModeEnabledToAllProfilesAsync(isChecked());
- }
-
- /**
- * Sets the enabled or disabled state of the button
- * @param isChecked
- */
- public void update(boolean isChecked) {
- super.setChecked(isChecked);
- setCompoundDrawablesRelativeWithIntrinsicBounds(
- isChecked ? R.drawable.ic_corp : R.drawable.ic_corp_off, 0, 0, 0);
- setEnabled(true);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
- mTouch[0] = ev.getX();
- mTouch[1] = ev.getY();
- } else if (ev.getActionMasked() == MotionEvent.ACTION_MOVE) {
- if (Math.abs(mTouch[0] - ev.getX()) > mTouchSlop
- || Math.abs(mTouch[1] - ev.getY()) > mTouchSlop) {
- int action = ev.getAction();
- ev.setAction(MotionEvent.ACTION_CANCEL);
- super.onTouchEvent(ev);
- ev.setAction(action);
- return false;
- }
- }
- return super.onTouchEvent(ev);
- }
-
- private void trySetQuietModeEnabledToAllProfilesAsync(boolean enabled) {
- new SetQuietModeEnabledAsyncTask(enabled, new WeakReference<>(this)).execute();
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ setOnClickListener(this);
}
@Override
public void setInsets(Rect insets) {
int bottomInset = insets.bottom - mInsets.bottom;
mInsets.set(insets);
- setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
- getPaddingBottom() + bottomInset);
+ ViewGroup.MarginLayoutParams marginLayoutParams =
+ (ViewGroup.MarginLayoutParams) getLayoutParams();
+ if (marginLayoutParams != null) {
+ marginLayoutParams.bottomMargin = bottomInset + marginLayoutParams.bottomMargin;
+ }
}
/**
@@ -125,78 +78,44 @@
public void setWorkTabVisible(boolean workTabVisible) {
clearAnimation();
if (workTabVisible) {
+ setEnabled(true);
setVisibility(VISIBLE);
setAlpha(0);
animate().alpha(1).start();
- showTipIfNeeded();
} else {
animate().alpha(0).withEndAction(() -> this.setVisibility(GONE)).start();
}
}
- private static final class SetQuietModeEnabledAsyncTask
- extends AsyncTask<Void, Void, Boolean> {
-
- private final boolean enabled;
- private final WeakReference<WorkModeSwitch> switchWeakReference;
-
- SetQuietModeEnabledAsyncTask(boolean enabled,
- WeakReference<WorkModeSwitch> switchWeakReference) {
- this.enabled = enabled;
- this.switchWeakReference = switchWeakReference;
- }
-
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- WorkModeSwitch workModeSwitch = switchWeakReference.get();
- if (workModeSwitch != null) {
- workModeSwitch.setEnabled(false);
- }
- }
-
- @Override
- protected Boolean doInBackground(Void... voids) {
- WorkModeSwitch workModeSwitch = switchWeakReference.get();
- if (workModeSwitch == null || !Utilities.ATLEAST_P) {
- return false;
- }
-
- Context context = workModeSwitch.getContext();
- UserManager userManager = context.getSystemService(UserManager.class);
- boolean showConfirm = false;
- for (UserHandle userProfile : UserCache.INSTANCE.get(context).getUserProfiles()) {
- if (Process.myUserHandle().equals(userProfile)) {
- continue;
- }
- showConfirm |= !userManager.requestQuietModeEnabled(enabled, userProfile);
- }
- return showConfirm;
- }
-
- @Override
- protected void onPostExecute(Boolean showConfirm) {
- if (showConfirm) {
- WorkModeSwitch workModeSwitch = switchWeakReference.get();
- if (workModeSwitch != null) {
- workModeSwitch.setEnabled(true);
- }
- }
+ @Override
+ public void onClick(View view) {
+ if (Utilities.ATLEAST_P) {
+ setEnabled(false);
+ UI_HELPER_EXECUTOR.post(() -> setToState(!mWorkEnabled));
}
}
/**
- * Shows a work tip on the Nth work tab open
+ * Sets the enabled or disabled state of the button
*/
- public void showTipIfNeeded() {
- Context context = getContext();
- SharedPreferences prefs = Utilities.getPrefs(context);
- int tipCounter = prefs.getInt(KEY_WORK_TIP_COUNTER, WORK_TIP_THRESHOLD);
- if (tipCounter < 0) return;
- if (tipCounter == 0) {
- new ArrowTipView(context)
- .show(context.getString(R.string.work_switch_tip), getTop());
+ public void updateCurrentState(boolean active) {
+ mWorkEnabled = active;
+ setEnabled(true);
+ setCompoundDrawablesRelativeWithIntrinsicBounds(
+ active ? R.drawable.ic_corp_off : R.drawable.ic_corp, 0, 0, 0);
+ setText(active ? R.string.work_apps_pause_btn_text : R.string.work_apps_enable_btn_text);
+ }
+
+ @RequiresApi(Build.VERSION_CODES.P)
+ protected Boolean setToState(boolean toState) {
+ UserManager userManager = getContext().getSystemService(UserManager.class);
+ boolean showConfirm = false;
+ for (UserHandle userProfile : UserCache.INSTANCE.get(getContext()).getUserProfiles()) {
+ if (Process.myUserHandle().equals(userProfile)) {
+ continue;
+ }
+ showConfirm |= !userManager.requestQuietModeEnabled(!toState, userProfile);
}
- prefs.edit().putInt(KEY_WORK_TIP_COUNTER, tipCounter - 1).apply();
+ return showConfirm;
}
}
diff --git a/src/com/android/launcher3/allapps/search/DefaultSearchAdapterProvider.java b/src/com/android/launcher3/allapps/search/DefaultSearchAdapterProvider.java
index ef62da4..7abd555 100644
--- a/src/com/android/launcher3/allapps/search/DefaultSearchAdapterProvider.java
+++ b/src/com/android/launcher3/allapps/search/DefaultSearchAdapterProvider.java
@@ -57,7 +57,7 @@
}
@Override
- public boolean isSearchView(int viewType) {
+ public boolean isViewSupported(int viewType) {
return false;
}
diff --git a/src/com/android/launcher3/allapps/search/SearchAdapterProvider.java b/src/com/android/launcher3/allapps/search/SearchAdapterProvider.java
index cefb8cb..7af0406 100644
--- a/src/com/android/launcher3/allapps/search/SearchAdapterProvider.java
+++ b/src/com/android/launcher3/allapps/search/SearchAdapterProvider.java
@@ -17,20 +17,18 @@
package com.android.launcher3.allapps.search;
import android.net.Uri;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.allapps.AllAppsContainerView;
-import com.android.launcher3.allapps.AllAppsGridAdapter;
+import com.android.launcher3.allapps.BaseAdapterProvider;
/**
* A UI expansion wrapper providing for search results
*/
-public abstract class SearchAdapterProvider {
+public abstract class SearchAdapterProvider extends BaseAdapterProvider {
protected final BaseDraggingActivity mLauncher;
@@ -39,42 +37,12 @@
}
/**
- * Called from RecyclerView.Adapter#onBindViewHolder
- */
- public abstract void onBindView(AllAppsGridAdapter.ViewHolder holder, int position);
-
- /**
* Called from LiveSearchManager to notify slice status updates.
*/
public void onSliceStatusUpdate(Uri sliceUri) {
}
/**
- * Returns whether or not viewType can be handled by searchProvider
- */
- public abstract boolean isSearchView(int viewType);
-
- /**
- * Called from RecyclerView.Adapter#onCreateViewHolder
- */
- public abstract AllAppsGridAdapter.ViewHolder onCreateViewHolder(LayoutInflater layoutInflater,
- ViewGroup parent, int viewType);
-
- /**
- * Returns supported item per row combinations supported
- */
- public int[] getSupportedItemsPerRowArray() {
- return new int[]{};
- }
-
- /**
- * Returns how many cells a view should span
- */
- public int getItemsPerRow(int viewType, int appsPerRow) {
- return appsPerRow;
- }
-
- /**
* Handles selection event on search adapter item. Returns false if provider can not handle
* event
*/
diff --git a/src/com/android/launcher3/anim/AnimatorPlaybackController.java b/src/com/android/launcher3/anim/AnimatorPlaybackController.java
index f6d1651..7d8b82a 100644
--- a/src/com/android/launcher3/anim/AnimatorPlaybackController.java
+++ b/src/com/android/launcher3/anim/AnimatorPlaybackController.java
@@ -290,7 +290,10 @@
callAnimatorCommandRecursively(mAnim, a -> a.setInterpolator(interpolator));
}
- private static void callListenerCommandRecursively(
+ /**
+ * Recursively calls a command on all the listeners of the provided animation
+ */
+ public static void callListenerCommandRecursively(
Animator anim, BiConsumer<AnimatorListener, Animator> command) {
callAnimatorCommandRecursively(anim, a-> {
for (AnimatorListener l : nonNullList(a.getListeners())) {
diff --git a/src/com/android/launcher3/dragndrop/AddItemActivity.java b/src/com/android/launcher3/dragndrop/AddItemActivity.java
index 2844fb2..1503167 100644
--- a/src/com/android/launcher3/dragndrop/AddItemActivity.java
+++ b/src/com/android/launcher3/dragndrop/AddItemActivity.java
@@ -125,7 +125,6 @@
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
mDragLayer = findViewById(R.id.add_item_drag_layer);
mDragLayer.recreateControllers();
- mDragLayer.setInsets(mDeviceProfile.getInsets());
mWidgetCell = findViewById(R.id.widget_cell);
if (mRequest.getRequestType() == PinItemRequest.REQUEST_TYPE_SHORTCUT) {
@@ -322,7 +321,7 @@
@Override
public void onBackPressed() {
logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_BACK);
- super.onBackPressed();
+ mSlideInView.close(/* animate= */ true);
}
@Override
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index dc188f2..5dcd75a 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -30,17 +30,13 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
import android.appwidget.AppWidgetHostView;
import android.content.Context;
-import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Insets;
import android.graphics.Path;
import android.graphics.Rect;
-import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
@@ -50,7 +46,6 @@
import android.util.AttributeSet;
import android.util.Log;
import android.util.Pair;
-import android.util.SparseIntArray;
import android.util.TypedValue;
import android.view.FocusFinder;
import android.view.KeyEvent;
@@ -69,7 +64,6 @@
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.content.res.ResourcesCompat;
-import androidx.core.graphics.ColorUtils;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Alarm;
@@ -104,12 +98,10 @@
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pageindicators.PageIndicatorDots;
import com.android.launcher3.util.Executors;
-import com.android.launcher3.util.Themes;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BaseDragLayer;
import com.android.launcher3.views.ClipPathView;
-import com.android.launcher3.widget.LocalColorExtractor;
import com.android.launcher3.widget.PendingAddShortcutInfo;
import java.util.ArrayList;
@@ -169,11 +161,6 @@
private static final Rect sTempRect = new Rect();
private static final int MIN_FOLDERS_FOR_HARDWARE_OPTIMIZATION = 10;
- // Index used to get background color when using local wallpaper color extraction,
- private static final int DARK_COLOR_EXTRACTION_INDEX = android.R.color.system_neutral1_900;
- private static final int LIGHT_COLOR_EXTRACTION_INDEX = android.R.color.system_neutral2_500;
- private static final int LIGHT_COLOR_L_STAR = 98;
-
private final Alarm mReorderAlarm = new Alarm();
private final Alarm mOnExitAlarm = new Alarm();
private final Alarm mOnScrollHintAlarm = new Alarm();
@@ -241,17 +228,6 @@
@Nullable private FolderWindowInsetsAnimationCallback mFolderWindowInsetsAnimationCallback;
- // Wallpaper local color extraction
- @Nullable private LocalColorExtractor mColorExtractor;
- @Nullable private LocalColorExtractor.Listener mColorListener;
-
- // For simplicity, we start the color change only after the open animation has started.
- private Runnable mColorChangeRunnable;
- private Animator mColorChangeAnimator;
- // The background color animator used in the folder open animation. We keep a reference to this,
- // so that we can cancel it when starting mColorChangeAnimator.
- private ObjectAnimator mOpenAnimationColorChangeAnimator;
-
private GradientDrawable mBackground;
/**
@@ -315,64 +291,6 @@
setWindowInsetsAnimationCallback(mFolderWindowInsetsAnimationCallback);
}
-
- if (Utilities.ATLEAST_S) {
- boolean isFolderDarkText = Themes.getAttrBoolean(getContext(), R.attr.isFolderDarkText);
- mColorExtractor = LocalColorExtractor.newInstance(getContext());
- mColorListener = (RectF rect, SparseIntArray extractedColors) -> {
- mColorChangeRunnable = () -> {
- mColorChangeRunnable = null;
- int duration = FOLDER_COLOR_ANIMATION_DURATION;
-
- // Cancel the open animation color change animator.
- ObjectAnimator existingAnim = mOpenAnimationColorChangeAnimator;
- if (existingAnim != null && existingAnim.isRunning()) {
- duration = (int) Math.max(FOLDER_COLOR_ANIMATION_DURATION,
- existingAnim.getDuration() * (1f - existingAnim.getDuration()));
- existingAnim.cancel();
- mOpenAnimationColorChangeAnimator = null;
- }
-
- // Start a new animator to the extracted color. Clamp down on the alpha
- // to prevent folder from being transparent for too long.
- GradientDrawable bg = (GradientDrawable) getBackground();
- int currentColor = ColorUtils.setAlphaComponent(bg.getColor().getDefaultColor(),
- 255);
- int newColor = getExtractedColor(extractedColors, isFolderDarkText);
- mColorChangeAnimator = ObjectAnimator.ofArgb(bg, "color", currentColor,
- newColor).setDuration(duration);
- mColorChangeAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mColorChangeAnimator = null;
- }
- });
- mColorChangeAnimator.start();
- };
-
- // If the folder open animation has started, we can start the color change now.
- // Otherwise we wait for it to start.
- if (mOpenAnimationColorChangeAnimator != null
- && mOpenAnimationColorChangeAnimator.isStarted()) {
- post(mColorChangeRunnable);
- }
- };
- }
- }
-
- /**
- * Returns an index used to query the color of interest from the list of extracted colors.
- * @param hasDarkText True when dark index is wanted, False when light index is wanted.
- */
- @TargetApi(Build.VERSION_CODES.S)
- private int getExtractedColor(SparseIntArray colors, boolean hasDarkText) {
- int color = colors.get(hasDarkText
- ? LIGHT_COLOR_EXTRACTION_INDEX
- : DARK_COLOR_EXTRACTION_INDEX);
- if (hasDarkText) {
- color = ColorStateList.valueOf(color).withLStar(LIGHT_COLOR_L_STAR).getDefaultColor();
- }
- return color;
}
public boolean onLongClick(View v) {
@@ -753,15 +671,11 @@
cancelRunningAnimations();
FolderAnimationManager fam = new FolderAnimationManager(this, true /* isOpening */);
AnimatorSet anim = fam.getAnimator();
- mOpenAnimationColorChangeAnimator = fam.getBgColorAnimator();
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mFolderIcon.setIconVisible(false);
mFolderIcon.drawLeaveBehindIfExists();
- if (mColorChangeRunnable != null) {
- mColorChangeRunnable.run();
- }
}
@Override
public void onAnimationEnd(Animator animation) {
@@ -857,9 +771,6 @@
if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) {
mCurrentAnimator.cancel();
}
- if (mColorChangeAnimator != null && mColorChangeAnimator.isRunning()) {
- mColorChangeAnimator.cancel();
- }
}
private void animateClosed() {
@@ -945,19 +856,6 @@
clearDragInfo();
mState = STATE_SMALL;
mContent.setCurrentPage(0);
-
- mOpenAnimationColorChangeAnimator = null;
- mColorChangeRunnable = null;
- if (mColorChangeAnimator != null) {
- mColorChangeAnimator.cancel();
- mColorChangeAnimator = null;
- }
- if (mColorExtractor != null) {
- mColorExtractor.removeLocations();
- mColorExtractor.setListener(null);
- }
- GradientDrawable bg = (GradientDrawable) getBackground();
- bg.setColor(Themes.getAttrColor(getContext(), R.attr.folderFillColor));
}
@Override
@@ -1227,12 +1125,6 @@
lp.y = top;
mBackground.setBounds(0, 0, width, height);
-
- if (mColorExtractor != null) {
- mColorExtractor.removeLocations();
- mColorExtractor.setListener(mColorListener);
- mLauncherDelegate.addRectForColorExtraction(lp, mColorExtractor);
- }
}
protected int getContentAreaHeight() {
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index e66e2f6..57b289e 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -239,13 +239,13 @@
mFolder, startRect, endRect, finalRadius, !mIsOpening));
// Create reveal animator for the folder content (capture the top 4 icons 2x2)
- int width = mContent.getPaddingLeft() + mDeviceProfile.folderCellLayoutBorderSpacingPx
+ int width = mDeviceProfile.folderCellLayoutBorderSpacingPx
+ mDeviceProfile.folderCellWidthPx * 2;
- int height = mContent.getPaddingTop() + mDeviceProfile.folderCellLayoutBorderSpacingPx
+ int height = mDeviceProfile.folderCellLayoutBorderSpacingPx
+ mDeviceProfile.folderCellHeightPx * 2;
int page = mIsOpening ? mContent.getCurrentPage() : mContent.getDestinationPage();
- int left = mContent.getPaddingLeft() + page * mContent.getWidth();
- Rect contentStart = new Rect(left, 0, left + width, height);
+ int left = mContent.getPaddingLeft() + page * lp.width;
+ Rect contentStart = new Rect(0, 0, width, height);
Rect contentEnd = new Rect(endRect.left + left, endRect.top, endRect.right + left,
endRect.bottom);
play(a, getShape().createRevealAnimator(
diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java
index 03b6853..13d6568 100644
--- a/src/com/android/launcher3/statemanager/StateManager.java
+++ b/src/com/android/launcher3/statemanager/StateManager.java
@@ -18,6 +18,7 @@
import static android.animation.ValueAnimator.areAnimatorsEnabled;
+import static com.android.launcher3.anim.AnimatorPlaybackController.callListenerCommandRecursively;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_ALL_ANIMATIONS;
import android.animation.Animator;
@@ -514,8 +515,15 @@
playbackController.getAnimationPlayer().cancel();
playbackController.dispatchOnCancel();
} else if (currentAnimation != null) {
- currentAnimation.setDuration(0);
- currentAnimation.cancel();
+ AnimatorSet anim = currentAnimation;
+ anim.setDuration(0);
+ if (!anim.isStarted()) {
+ // If the animation is not started the listeners do not get notified,
+ // notify manually.
+ callListenerCommandRecursively(anim, AnimatorListener::onAnimationCancel);
+ callListenerCommandRecursively(anim, AnimatorListener::onAnimationEnd);
+ }
+ anim.cancel();
}
currentAnimation = null;
diff --git a/src/com/android/launcher3/util/UiThreadHelper.java b/src/com/android/launcher3/util/UiThreadHelper.java
index b9387a8..cb721e6 100644
--- a/src/com/android/launcher3/util/UiThreadHelper.java
+++ b/src/com/android/launcher3/util/UiThreadHelper.java
@@ -25,11 +25,9 @@
import android.os.IBinder;
import android.os.Message;
import android.view.View;
-import android.view.WindowInsets;
import android.view.inputmethod.InputMethodManager;
import com.android.launcher3.Launcher;
-import com.android.launcher3.Utilities;
import com.android.launcher3.views.ActivityContext;
/**
@@ -48,14 +46,6 @@
@SuppressLint("NewApi")
public static void hideKeyboardAsync(ActivityContext activityContext, IBinder token) {
View root = activityContext.getDragLayer();
- if (Utilities.ATLEAST_R) {
- WindowInsets rootInsets = root.getRootWindowInsets();
- boolean isImeShown = rootInsets != null && rootInsets.isVisible(
- WindowInsets.Type.ime());
- if (!isImeShown) {
- return;
- }
- }
Message.obtain(HANDLER.get(root.getContext()),
MSG_HIDE_KEYBOARD, token).sendToTarget();
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 25cce69..3027db6 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -376,6 +376,7 @@
if (mIconLoadResult.isIconLoaded) {
setIcon(mIconLoadResult.drawable, mIconLoadResult.badge,
mIconLoadResult.btvDrawable, mIconLoadResult.iconOffset);
+ setVisibility(VISIBLE);
setIconAndDotVisible(originalView, false);
} else {
mIconLoadResult.onIconLoaded = () -> {
diff --git a/src/com/android/launcher3/views/RecyclerViewFastScroller.java b/src/com/android/launcher3/views/RecyclerViewFastScroller.java
index e607ab3..78916ac 100644
--- a/src/com/android/launcher3/views/RecyclerViewFastScroller.java
+++ b/src/com/android/launcher3/views/RecyclerViewFastScroller.java
@@ -28,6 +28,7 @@
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.os.Build;
import android.util.AttributeSet;
import android.util.Property;
import android.view.MotionEvent;
@@ -37,6 +38,7 @@
import android.widget.TextView;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.BaseRecyclerView;
@@ -342,16 +344,21 @@
// swiping very close to the thumb area (not just within it's bound)
// will also prevent back gesture
SYSTEM_GESTURE_EXCLUSION_RECT.get(0).offset(mThumbDrawOffset.x, mThumbDrawOffset.y);
- SYSTEM_GESTURE_EXCLUSION_RECT.get(0).left = SYSTEM_GESTURE_EXCLUSION_RECT.get(0).right
- - mSystemGestureInsets.right;
+ if (Utilities.ATLEAST_Q && mSystemGestureInsets != null) {
+ SYSTEM_GESTURE_EXCLUSION_RECT.get(0).left =
+ SYSTEM_GESTURE_EXCLUSION_RECT.get(0).right - mSystemGestureInsets.right;
+ }
setSystemGestureExclusionRects(SYSTEM_GESTURE_EXCLUSION_RECT);
}
canvas.restoreToCount(saveCount);
}
@Override
+ @RequiresApi(Build.VERSION_CODES.Q)
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
- mSystemGestureInsets = insets.getSystemGestureInsets();
+ if (Utilities.ATLEAST_Q) {
+ mSystemGestureInsets = insets.getSystemGestureInsets();
+ }
return super.onApplyWindowInsets(insets);
}
diff --git a/src/com/android/launcher3/views/WorkEduView.java b/src/com/android/launcher3/views/WorkEduView.java
deleted file mode 100644
index 6be0c23..0000000
--- a/src/com/android/launcher3/views/WorkEduView.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.launcher3.views;
-
-
-import android.animation.Animator;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.content.Context;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.Button;
-import android.widget.TextView;
-
-import androidx.annotation.Nullable;
-
-import com.android.launcher3.Insettable;
-import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherState;
-import com.android.launcher3.R;
-import com.android.launcher3.allapps.AllAppsContainerView;
-import com.android.launcher3.allapps.AllAppsPagedView;
-import com.android.launcher3.anim.AnimationSuccessListener;
-import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.statemanager.StateManager.StateListener;
-
-/**
- * On boarding flow for users right after setting up work profile
- */
-public class WorkEduView extends AbstractSlideInView<Launcher>
- implements Insettable, StateListener<LauncherState> {
-
- private static final int DEFAULT_CLOSE_DURATION = 200;
- public static final String KEY_WORK_EDU_STEP = "showed_work_profile_edu";
- public static final String KEY_LEGACY_WORK_EDU_SEEN = "showed_bottom_user_education";
-
- private static final int WORK_EDU_NOT_STARTED = 0;
- private static final int WORK_EDU_PERSONAL_APPS = 1;
- private static final int WORK_EDU_WORK_APPS = 2;
-
- protected static final int FINAL_SCRIM_BG_COLOR = 0x88000000;
-
-
- private Rect mInsets = new Rect();
- private View mViewWrapper;
- private Button mProceedButton;
- private TextView mContentText;
-
- private int mNextWorkEduStep = WORK_EDU_PERSONAL_APPS;
-
-
- public WorkEduView(Context context, AttributeSet attr) {
- this(context, attr, 0);
- }
-
- public WorkEduView(Context context, AttributeSet attrs,
- int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- mContent = this;
- }
-
- @Override
- protected void handleClose(boolean animate) {
- mActivityContext.getSharedPrefs().edit()
- .putInt(KEY_WORK_EDU_STEP, mNextWorkEduStep).apply();
- handleClose(true, DEFAULT_CLOSE_DURATION);
- }
-
- @Override
- protected void onCloseComplete() {
- super.onCloseComplete();
- mActivityContext.getStateManager().removeStateListener(this);
- }
-
- @Override
- protected boolean isOfType(int type) {
- return (type & TYPE_ON_BOARD_POPUP) != 0;
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mViewWrapper = findViewById(R.id.view_wrapper);
- mProceedButton = findViewById(R.id.proceed);
- mContentText = findViewById(R.id.content_text);
-
- // make sure layout does not shrink when we change the text
- mContentText.post(() -> mContentText.setMinLines(mContentText.getLineCount()));
-
- mProceedButton.setOnClickListener(view -> {
- if (getAllAppsPagedView() != null) {
- getAllAppsPagedView().snapToPage(AllAppsContainerView.AdapterHolder.WORK);
- }
- goToWorkTab(true);
- });
- }
-
- private void goToWorkTab(boolean animate) {
- mProceedButton.setText(R.string.work_profile_edu_accept);
- if (animate) {
- ObjectAnimator animator = ObjectAnimator.ofFloat(mContentText, ALPHA, 0);
- animator.addListener(new AnimationSuccessListener() {
- @Override
- public void onAnimationSuccess(Animator animator) {
- mContentText.setText(
- mActivityContext.getString(R.string.work_profile_edu_work_apps));
- ObjectAnimator.ofFloat(mContentText, ALPHA, 1).start();
- }
- });
- animator.start();
- } else {
- mContentText.setText(mActivityContext.getString(R.string.work_profile_edu_work_apps));
- }
- mNextWorkEduStep = WORK_EDU_WORK_APPS;
- mProceedButton.setOnClickListener(v -> handleClose(true));
- }
-
- @Override
- public void setInsets(Rect insets) {
- int leftInset = insets.left - mInsets.left;
- int rightInset = insets.right - mInsets.right;
- int bottomInset = insets.bottom - mInsets.bottom;
- mInsets.set(insets);
- setPadding(leftInset, getPaddingTop(), rightInset, 0);
- mViewWrapper.setPaddingRelative(mViewWrapper.getPaddingStart(),
- mViewWrapper.getPaddingTop(), mViewWrapper.getPaddingEnd(), bottomInset);
- }
-
- private void show() {
- attachToContainer();
- animateOpen();
- mActivityContext.getStateManager().addStateListener(this);
- }
-
- @Override
- protected int getScrimColor(Context context) {
- return FINAL_SCRIM_BG_COLOR;
- }
-
- private void goToFirstPage() {
- if (getAllAppsPagedView() != null) {
- getAllAppsPagedView().snapToPageImmediately(AllAppsContainerView.AdapterHolder.MAIN);
- }
- }
-
- private void animateOpen() {
- if (mIsOpen || mOpenCloseAnimator.isRunning()) {
- return;
- }
- mIsOpen = true;
- mOpenCloseAnimator.setValues(
- PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
- mOpenCloseAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
- mOpenCloseAnimator.start();
- }
-
- private AllAppsPagedView getAllAppsPagedView() {
- View v = mActivityContext.getAppsView().getContentView();
- return (v instanceof AllAppsPagedView) ? (AllAppsPagedView) v : null;
- }
-
- /**
- * Checks if user has not seen onboarding UI yet and shows it when user navigates to all apps
- */
- public static StateListener<LauncherState> showEduFlowIfNeeded(Launcher launcher,
- @Nullable StateListener<LauncherState> oldListener) {
- if (oldListener != null) {
- launcher.getStateManager().removeStateListener(oldListener);
- }
- if (hasSeenLegacyEdu(launcher) || launcher.getSharedPrefs().getInt(KEY_WORK_EDU_STEP,
- WORK_EDU_NOT_STARTED) != WORK_EDU_NOT_STARTED) {
- return null;
- }
-
- StateListener<LauncherState> listener = new StateListener<LauncherState>() {
- @Override
- public void onStateTransitionComplete(LauncherState finalState) {
- if (finalState != LauncherState.ALL_APPS) return;
- LayoutInflater layoutInflater = LayoutInflater.from(launcher);
- WorkEduView v = (WorkEduView) layoutInflater.inflate(
- R.layout.work_profile_edu, launcher.getDragLayer(),
- false);
- v.show();
- v.goToFirstPage();
- launcher.getStateManager().removeStateListener(this);
- }
- };
- launcher.getStateManager().addStateListener(listener);
- return listener;
- }
-
- /**
- * Shows work apps edu if user had dismissed full edu flow
- */
- public static void showWorkEduIfNeeded(Launcher launcher) {
- if (hasSeenLegacyEdu(launcher) || launcher.getSharedPrefs().getInt(KEY_WORK_EDU_STEP,
- WORK_EDU_NOT_STARTED) != WORK_EDU_PERSONAL_APPS) {
- return;
- }
- LayoutInflater layoutInflater = LayoutInflater.from(launcher);
- WorkEduView v = (WorkEduView) layoutInflater.inflate(
- R.layout.work_profile_edu, launcher.getDragLayer(), false);
- v.show();
- v.goToWorkTab(false);
- }
-
- private static boolean hasSeenLegacyEdu(Launcher launcher) {
- return launcher.getSharedPrefs().getBoolean(KEY_LEGACY_WORK_EDU_SEEN, false);
- }
-
- @Override
- public void onStateTransitionComplete(LauncherState finalState) {
- close(false);
- }
-}
diff --git a/src/com/android/launcher3/widget/AddItemWidgetsBottomSheet.java b/src/com/android/launcher3/widget/AddItemWidgetsBottomSheet.java
index 804973f..1cc7f53 100644
--- a/src/com/android/launcher3/widget/AddItemWidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/AddItemWidgetsBottomSheet.java
@@ -16,17 +16,21 @@
package com.android.launcher3.widget;
+import static com.android.launcher3.Utilities.ATLEAST_R;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import android.animation.PropertyValuesHolder;
+import android.annotation.SuppressLint;
import android.content.Context;
-import android.content.res.Configuration;
+import android.graphics.Insets;
import android.graphics.Rect;
import android.util.AttributeSet;
+import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
+import android.view.WindowInsets;
-import com.android.launcher3.Insettable;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.dragndrop.AddItemActivity;
import com.android.launcher3.views.AbstractSlideInView;
@@ -34,13 +38,12 @@
/**
* Bottom sheet for the pin widget.
*/
-public class AddItemWidgetsBottomSheet extends AbstractSlideInView<AddItemActivity>
- implements Insettable {
+public class AddItemWidgetsBottomSheet extends AbstractSlideInView<AddItemActivity> implements
+ View.OnApplyWindowInsetsListener {
private static final int DEFAULT_CLOSE_DURATION = 200;
- private Rect mInsets;
- private Configuration mCurrentConfiguration;
+ private final Rect mInsets;
public AddItemWidgetsBottomSheet(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -48,9 +51,7 @@
public AddItemWidgetsBottomSheet(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- mContent = this;
mInsets = new Rect();
- mCurrentConfiguration = new Configuration(getResources().getConfiguration());
}
/**
@@ -62,15 +63,49 @@
((ViewGroup) parent).removeView(this);
}
attachToContainer();
+ setOnApplyWindowInsetsListener(this);
animateOpen();
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
+ int width = r - l;
+ int height = b - t;
+
+ // Lay out content as center bottom aligned.
+ int contentWidth = mContent.getMeasuredWidth();
+ int contentLeft = (width - contentWidth - mInsets.left - mInsets.right) / 2 + mInsets.left;
+ mContent.layout(contentLeft, height - mContent.getMeasuredHeight(),
+ contentLeft + contentWidth, height);
+
setTranslationShift(mTranslationShift);
}
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
+ int widthUsed;
+ if (mInsets.bottom > 0) {
+ widthUsed = mInsets.left + mInsets.right;
+ } else {
+ Rect padding = deviceProfile.workspacePadding;
+ widthUsed = Math.max(padding.left + padding.right,
+ 2 * (mInsets.left + mInsets.right));
+ }
+
+ int heightUsed = mInsets.top + deviceProfile.edgeMarginPx;
+ measureChildWithMargins(mContent, widthMeasureSpec,
+ widthUsed, heightMeasureSpec, heightUsed);
+ setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),
+ MeasureSpec.getSize(heightMeasureSpec));
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mContent = findViewById(R.id.add_item_bottom_sheet_content);
+ }
+
private void animateOpen() {
if (mIsOpen || mOpenCloseAnimator.isRunning()) {
return;
@@ -93,25 +128,24 @@
}
@Override
- public void setInsets(Rect insets) {
- // Extend behind left, right, and bottom insets.
- int leftInset = insets.left - mInsets.left;
- int rightInset = insets.right - mInsets.right;
- int bottomInset = insets.bottom - mInsets.bottom;
- mInsets.set(insets);
- setPadding(leftInset, getPaddingTop(), rightInset, bottomInset);
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- if (mCurrentConfiguration.orientation != newConfig.orientation) {
- mInsets.setEmpty();
- }
- mCurrentConfiguration.updateFrom(newConfig);
- }
-
- @Override
protected int getScrimColor(Context context) {
return context.getResources().getColor(R.color.widgets_picker_scrim);
}
+
+ @SuppressLint("NewApi") // Already added API check.
+ @Override
+ public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
+ if (ATLEAST_R) {
+ Insets insets = windowInsets.getInsets(WindowInsets.Type.systemBars());
+ mInsets.set(insets.left, insets.top, insets.right, insets.bottom);
+ } else {
+ mInsets.set(windowInsets.getSystemWindowInsetLeft(),
+ windowInsets.getSystemWindowInsetTop(),
+ windowInsets.getSystemWindowInsetRight(),
+ windowInsets.getSystemWindowInsetBottom());
+ }
+ mContent.setPadding(mContent.getPaddingStart(),
+ mContent.getPaddingTop(), mContent.getPaddingEnd(), mInsets.bottom);
+ return windowInsets;
+ }
}
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index 81df100..d0e69fa 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -20,7 +20,6 @@
import android.animation.PropertyValuesHolder;
import android.content.Context;
-import android.content.res.Configuration;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.IntProperty;
@@ -71,10 +70,9 @@
private static final long EDUCATION_TIP_DELAY_MS = 300;
private ItemInfo mOriginalItemInfo;
- private Rect mInsets;
+ private final Rect mInsets;
private final int mMaxTableHeight;
private int mMaxHorizontalSpan = 4;
- private Configuration mCurrentConfiguration;
private final OnLayoutChangeListener mLayoutChangeListenerToShowTips =
new OnLayoutChangeListener() {
@@ -113,20 +111,38 @@
super(context, attrs, defStyleAttr);
setWillNotDraw(false);
mInsets = new Rect();
- mContent = this;
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
// Set the max table height to 2 / 3 of the grid height so that the bottom picker won't
// take over the entire view vertically.
mMaxTableHeight = deviceProfile.inv.numRows * 2 / 3 * deviceProfile.cellHeightPx;
- mCurrentConfiguration = new Configuration(getResources().getConfiguration());
if (!hasSeenEducationTip()) {
addOnLayoutChangeListener(mLayoutChangeListenerToShowTips);
}
}
@Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mContent = findViewById(R.id.widgets_bottom_sheet);
+ }
+
+ @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
+ int widthUsed;
+ if (mInsets.bottom > 0) {
+ widthUsed = mInsets.left + mInsets.right;
+ } else {
+ Rect padding = deviceProfile.workspacePadding;
+ widthUsed = Math.max(padding.left + padding.right,
+ 2 * (mInsets.left + mInsets.right));
+ }
+
+ int heightUsed = mInsets.top + deviceProfile.edgeMarginPx;
+ measureChildWithMargins(mContent, widthMeasureSpec,
+ widthUsed, heightMeasureSpec, heightUsed);
+ setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),
+ MeasureSpec.getSize(heightMeasureSpec));
int paddingPx = 2 * getResources().getDimensionPixelOffset(
R.dimen.widget_cell_horizontal_padding);
@@ -142,7 +158,15 @@
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
+ int width = r - l;
+ int height = b - t;
+
+ // Content is laid out as center bottom aligned.
+ int contentWidth = mContent.getMeasuredWidth();
+ int contentLeft = (width - contentWidth - mInsets.left - mInsets.right) / 2 + mInsets.left;
+ mContent.layout(contentLeft, height - mContent.getMeasuredHeight(),
+ contentLeft + contentWidth, height);
+
setTranslationShift(mTranslationShift);
// Ensure the scroll view height is not larger than mMaxTableHeight, which is a value
@@ -241,20 +265,14 @@
@Override
public void setInsets(Rect insets) {
- // Extend behind left, right, and bottom insets.
- int leftInset = insets.left - mInsets.left;
- int rightInset = insets.right - mInsets.right;
- int bottomInset = insets.bottom - mInsets.bottom;
mInsets.set(insets);
- setPadding(leftInset, getPaddingTop(), rightInset, bottomInset);
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- if (mCurrentConfiguration.orientation != newConfig.orientation) {
- mInsets.setEmpty();
+ mContent.setPadding(mContent.getPaddingStart(),
+ mContent.getPaddingTop(), mContent.getPaddingEnd(), insets.bottom);
+ if (insets.bottom > 0) {
+ setupNavBarColor();
+ } else {
+ clearNavBarColor();
}
- mCurrentConfiguration.updateFrom(newConfig);
}
@Override
diff --git a/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java b/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
index 150bd99..e89aea7 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
@@ -298,6 +298,12 @@
scrollToPositionAndMaintainOffset(positionForPackageUserKey, topForPackageUserKey);
}
+ /** Returns the position of the currently expanded header, or empty if it's not present. */
+ public OptionalInt getSelectedHeaderPosition() {
+ if (mWidgetsContentVisiblePackageUserKey == null) return OptionalInt.empty();
+ return getPositionForPackageUserKey(mWidgetsContentVisiblePackageUserKey);
+ }
+
/**
* Returns the position of {@code key} in {@link #mVisibleEntries}, or empty if it's not
* present.
diff --git a/src/com/android/launcher3/widget/picker/WidgetsListLayoutManager.java b/src/com/android/launcher3/widget/picker/WidgetsListLayoutManager.java
new file mode 100644
index 0000000..2b7f544
--- /dev/null
+++ b/src/com/android/launcher3/widget/picker/WidgetsListLayoutManager.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.widget.picker;
+
+import android.content.Context;
+
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.launcher3.widget.picker.SearchAndRecommendationsScrollController.OnContentChangeListener;
+
+/**
+ * A layout manager for the {@link WidgetsRecyclerView}.
+ *
+ * {@link #setOnContentChangeListener(OnContentChangeListener)} can be used to register a callback
+ * for when the content of the layout manager has changed, following measurement and animation.
+ */
+public final class WidgetsListLayoutManager extends LinearLayoutManager {
+ @Nullable
+ private OnContentChangeListener mOnContentChangeListener;
+
+ public WidgetsListLayoutManager(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void onLayoutCompleted(RecyclerView.State state) {
+ super.onLayoutCompleted(state);
+ if (mOnContentChangeListener != null) {
+ mOnContentChangeListener.onContentChanged();
+ }
+ }
+
+ public void setOnContentChangeListener(@Nullable OnContentChangeListener listener) {
+ mOnContentChangeListener = listener;
+ }
+}
diff --git a/src/com/android/launcher3/widget/picker/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/picker/WidgetsRecyclerView.java
index 090362b..3ee8b33 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsRecyclerView.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsRecyclerView.java
@@ -23,7 +23,6 @@
import android.view.View;
import android.widget.TableLayout;
-import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -53,6 +52,7 @@
private HeaderViewDimensionsProvider mHeaderViewDimensionsProvider;
private int mLastVisibleWidgetContentTableHeight = 0;
private int mWidgetHeaderHeight = 0;
+ private final int mCollapsedHeaderBottomMarginSize;
@Nullable private OnContentChangeListener mOnContentChangeListener;
public WidgetsRecyclerView(Context context) {
@@ -71,6 +71,10 @@
ActivityContext activity = ActivityContext.lookupContext(getContext());
DeviceProfile grid = activity.getDeviceProfile();
+
+ // The bottom margin used when the header is not expanded.
+ mCollapsedHeaderBottomMarginSize =
+ getResources().getDimensionPixelSize(R.dimen.widget_list_entry_bottom_margin);
}
@Override
@@ -78,7 +82,9 @@
super.onFinishInflate();
// create a layout manager with Launcher's context so that scroll position
// can be preserved during screen rotation.
- setLayoutManager(new LinearLayoutManager(getContext()));
+ WidgetsListLayoutManager layoutManager = new WidgetsListLayoutManager(getContext());
+ layoutManager.setOnContentChangeListener(mOnContentChangeListener);
+ setLayoutManager(layoutManager);
}
@Override
@@ -87,22 +93,6 @@
mAdapter = (WidgetsListAdapter) adapter;
}
- @Override
- public void onChildAttachedToWindow(@NonNull View child) {
- super.onChildAttachedToWindow(child);
- if (mOnContentChangeListener != null) {
- mOnContentChangeListener.onContentChanged();
- }
- }
-
- @Override
- public void onChildDetachedFromWindow(@NonNull View child) {
- super.onChildDetachedFromWindow(child);
- if (mOnContentChangeListener != null) {
- mOnContentChangeListener.onContentChanged();
- }
- }
-
/**
* Maps the touch (from 0..1) to the adapter position that should be visible.
*/
@@ -182,10 +172,7 @@
&& mLastVisibleWidgetContentTableHeight == 0
&& view.getMeasuredHeight() > 0) {
// This assumes all header views are of the same height.
- RecyclerView.LayoutParams layoutParams =
- (RecyclerView.LayoutParams) view.getLayoutParams();
- mWidgetHeaderHeight = view.getMeasuredHeight() + layoutParams.topMargin
- + layoutParams.bottomMargin;
+ mWidgetHeaderHeight = view.getMeasuredHeight();
}
}
@@ -266,6 +253,10 @@
public void setOnContentChangeListener(@Nullable OnContentChangeListener listener) {
mOnContentChangeListener = listener;
+ WidgetsListLayoutManager layoutManager = (WidgetsListLayoutManager) getLayoutManager();
+ if (layoutManager != null) {
+ layoutManager.setOnContentChangeListener(listener);
+ }
}
/**
@@ -279,12 +270,17 @@
if (untilIndex > mAdapter.getItems().size()) {
untilIndex = mAdapter.getItems().size();
}
+ int expandedHeaderPosition = mAdapter.getSelectedHeaderPosition().orElse(-1);
int totalItemsHeight = 0;
for (int i = 0; i < untilIndex; i++) {
WidgetsListBaseEntry entry = mAdapter.getItems().get(i);
if (entry instanceof WidgetsListHeaderEntry
|| entry instanceof WidgetsListSearchHeaderEntry) {
totalItemsHeight += mWidgetHeaderHeight;
+ if (expandedHeaderPosition != i) {
+ // If the header is collapsed, include the bottom margin it will use.
+ totalItemsHeight += mCollapsedHeaderBottomMarginSize;
+ }
} else if (entry instanceof WidgetsListContentEntry) {
totalItemsHeight += mLastVisibleWidgetContentTableHeight;
} else {
diff --git a/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java b/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java
index 59ada7b..b35c75b 100644
--- a/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java
+++ b/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java
@@ -59,7 +59,8 @@
R.dimen.all_apps_header_pill_corner_radius);
mSelectedIndicatorPaint = new Paint();
- mSelectedIndicatorPaint.setColor(context.getColor(R.color.all_apps_tab_bg));
+ mSelectedIndicatorPaint.setColor(
+ context.getColor(R.color.all_apps_tab_background_selected));
mIsRtl = Utilities.isRtl(getResources());
}
diff --git a/tests/Android.mk b/tests/Android.mk
index 19b9656..6adc685 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -16,34 +16,6 @@
LOCAL_PATH := $(call my-dir)
#
-# Build rule for Tapl library.
-#
-include $(CLEAR_VARS)
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.annotation_annotation \
- androidx.test.runner \
- androidx.test.rules \
- androidx.preference_preference \
- androidx.test.uiautomator_uiautomator
-
-ifneq (,$(wildcard frameworks/base))
-else
- LOCAL_STATIC_JAVA_LIBRARIES += SystemUISharedLib
-
- LOCAL_SRC_FILES := $(call all-java-files-under, tapl) \
- ../src/com/android/launcher3/ResourceUtils.java \
- ../src/com/android/launcher3/testing/TestProtocol.java
-endif
-
-LOCAL_MODULE := ub-launcher-aosp-tapl
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-#
# Build rule for Launcher3Tests
#
include $(CLEAR_VARS)
@@ -56,14 +28,8 @@
mockito-target-minus-junit4 \
launcher_log_protos_lite
-ifneq (,$(wildcard frameworks/base))
- LOCAL_PRIVATE_PLATFORM_APIS := true
- LOCAL_STATIC_JAVA_LIBRARIES += launcher-aosp-tapl
-else
- LOCAL_SDK_VERSION := system_28
- LOCAL_MIN_SDK_VERSION := 21
- LOCAL_STATIC_JAVA_LIBRARIES += ub-launcher-aosp-tapl
-endif
+LOCAL_PRIVATE_PLATFORM_APIS := true
+LOCAL_STATIC_JAVA_LIBRARIES += launcher-aosp-tapl
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 4a666b1..e86be2a 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -163,8 +163,8 @@
@NonNull
private void quickSwitch(boolean toRight) {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
- LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
- "want to quick switch to the previous app")) {
+ LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
+ "want to quick switch to the previous app")) {
verifyActiveContainer();
final boolean launcherWasVisible = mLauncher.isLauncherVisible();
boolean transposeInLandscape = false;
@@ -177,33 +177,34 @@
final int startY;
final int endX;
final int endY;
+ final int cornerRadius = (int) Math.ceil(mLauncher.getWindowCornerRadius());
if (toRight) {
if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
// Swipe from the bottom left to the bottom right of the screen.
- startX = 0;
+ startX = cornerRadius;
startY = getSwipeStartY();
- endX = mLauncher.getDevice().getDisplayWidth();
+ endX = mLauncher.getDevice().getDisplayWidth() - cornerRadius;
endY = startY;
} else {
// Swipe from the bottom right to the top right of the screen.
startX = getSwipeStartX();
- startY = mLauncher.getRealDisplaySize().y - 1;
+ startY = mLauncher.getRealDisplaySize().y - 1 - cornerRadius;
endX = startX;
- endY = 0;
+ endY = cornerRadius;
}
} else {
if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
// Swipe from the bottom right to the bottom left of the screen.
- startX = mLauncher.getDevice().getDisplayWidth();
+ startX = mLauncher.getDevice().getDisplayWidth() - cornerRadius;
startY = getSwipeStartY();
- endX = 0;
+ endX = cornerRadius;
endY = startY;
} else {
// Swipe from the bottom left to the top left of the screen.
startX = getSwipeStartX();
- startY = 0;
+ startY = cornerRadius;
endX = startX;
- endY = mLauncher.getRealDisplaySize().y - 1;
+ endY = mLauncher.getRealDisplaySize().y - 1 - cornerRadius;
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index bf7984e..f5c1efa 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -1248,6 +1248,13 @@
}
final MotionEvent event = getMotionEvent(downTime, currentTime, action, point.x, point.y);
+ // b/190748682
+ switch (action) {
+ case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_UP:
+ log("b/190748682: injecting " + event);
+ break;
+ }
assertTrue("injectInputEvent failed",
mInstrumentation.getUiAutomation().injectInputEvent(event, true, false));
event.recycle();
@@ -1443,4 +1450,33 @@
return null;
}
}
+
+ float getWindowCornerRadius() {
+ final Resources resources = getResources();
+ if (!supportsRoundedCornersOnWindows(resources)) {
+ return 0f;
+ }
+
+ // Radius that should be used in case top or bottom aren't defined.
+ float defaultRadius = ResourceUtils.getDimenByName("rounded_corner_radius", resources, 0);
+
+ float topRadius = ResourceUtils.getDimenByName("rounded_corner_radius_top", resources, 0);
+ if (topRadius == 0f) {
+ topRadius = defaultRadius;
+ }
+ float bottomRadius = ResourceUtils.getDimenByName(
+ "rounded_corner_radius_bottom", resources, 0);
+ if (bottomRadius == 0f) {
+ bottomRadius = defaultRadius;
+ }
+
+ // Always use the smallest radius to make sure the rounded corners will
+ // completely cover the display.
+ return Math.min(topRadius, bottomRadius);
+ }
+
+ private static boolean supportsRoundedCornersOnWindows(Resources resources) {
+ return ResourceUtils.getBoolByName(
+ "config_supportsRoundedCornersOnWindows", resources, false);
+ }
}
\ No newline at end of file
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 3624624..1ea0922 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -22,7 +22,6 @@
import static junit.framework.TestCase.assertTrue;
-import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.SystemClock;
@@ -61,34 +60,6 @@
mHotseat = launcher.waitForLauncherObject("hotseat");
}
- private static boolean supportsRoundedCornersOnWindows(Resources resources) {
- return ResourceUtils.getBoolByName(
- "config_supportsRoundedCornersOnWindows", resources, false);
- }
-
- private static float getWindowCornerRadius(Resources resources) {
- if (!supportsRoundedCornersOnWindows(resources)) {
- return 0f;
- }
-
- // Radius that should be used in case top or bottom aren't defined.
- float defaultRadius = ResourceUtils.getDimenByName("rounded_corner_radius", resources, 0);
-
- float topRadius = ResourceUtils.getDimenByName("rounded_corner_radius_top", resources, 0);
- if (topRadius == 0f) {
- topRadius = defaultRadius;
- }
- float bottomRadius = ResourceUtils.getDimenByName(
- "rounded_corner_radius_bottom", resources, 0);
- if (bottomRadius == 0f) {
- bottomRadius = defaultRadius;
- }
-
- // Always use the smallest radius to make sure the rounded corners will
- // completely cover the display.
- return Math.min(topRadius, bottomRadius);
- }
-
/**
* Swipes up to All Apps.
*
@@ -103,8 +74,7 @@
final int deviceHeight = mLauncher.getDevice().getDisplayHeight();
final int bottomGestureMargin = ResourceUtils.getNavbarSize(
ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mLauncher.getResources());
- final int windowCornerRadius = (int) Math.ceil(getWindowCornerRadius(
- mLauncher.getResources()));
+ final int windowCornerRadius = (int) Math.ceil(mLauncher.getWindowCornerRadius());
final int startY = deviceHeight - Math.max(bottomGestureMargin, windowCornerRadius) - 1;
final int swipeHeight = mLauncher.getTestInfo(
TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT).