Loading quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -144,7 +144,6 @@ public final class DigitalWellBeingToast { public void initialize(Task task) { public void initialize(Task task) { mTask = task; mTask = task; THREAD_POOL_EXECUTOR.execute(() -> { THREAD_POOL_EXECUTOR.execute(() -> { final AppUsageLimit usageLimit = mLauncherApps.getAppUsageLimit( final AppUsageLimit usageLimit = mLauncherApps.getAppUsageLimit( task.getTopComponent().getPackageName(), task.getTopComponent().getPackageName(), Loading Loading @@ -321,7 +320,7 @@ public final class DigitalWellBeingToast { mTaskView.getThumbnail().getLayoutParams()).bottomMargin; mTaskView.getThumbnail().getLayoutParams()).bottomMargin; PagedOrientationHandler orientationHandler = mTaskView.getPagedOrientationHandler(); PagedOrientationHandler orientationHandler = mTaskView.getPagedOrientationHandler(); Pair<Float, Float> translations = orientationHandler Pair<Float, Float> translations = orientationHandler .setDwbLayoutParamsAndGetTranslations(mTaskView.getMeasuredWidth(), .getDwbLayoutTranslations(mTaskView.getMeasuredWidth(), mTaskView.getMeasuredHeight(), mStagedSplitBounds, deviceProfile, mTaskView.getMeasuredHeight(), mStagedSplitBounds, deviceProfile, mTaskView.getThumbnails(), mTask.key.id, mBanner); mTaskView.getThumbnails(), mTask.key.id, mBanner); mSplitOffsetTranslationX = translations.first; mSplitOffsetTranslationX = translations.first; Loading quickstep/src/com/android/quickstep/views/GroupedTaskView.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -242,6 +242,7 @@ public class GroupedTaskView extends TaskView { mIconView2.setDrawableSize(iconDrawableSize, iconDrawableSize); mIconView2.setDrawableSize(iconDrawableSize, iconDrawableSize); mIconView2.setRotation(getPagedOrientationHandler().getDegreesRotated()); mIconView2.setRotation(getPagedOrientationHandler().getDegreesRotated()); updateIconPlacement(); updateIconPlacement(); updateSecondaryDwbPlacement(); } } private void updateIconPlacement() { private void updateIconPlacement() { Loading @@ -258,6 +259,13 @@ public class GroupedTaskView extends TaskView { isRtl, deviceProfile, mSplitBoundsConfig); isRtl, deviceProfile, mSplitBoundsConfig); } } private void updateSecondaryDwbPlacement() { if (mSecondaryTask == null) { return; } mDigitalWellBeingToast2.initialize(mSecondaryTask); } @Override @Override protected void updateSnapshotRadius() { protected void updateSnapshotRadius() { super.updateSnapshotRadius(); super.updateSnapshotRadius(); Loading quickstep/src/com/android/quickstep/views/TaskView.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -897,6 +897,7 @@ public class TaskView extends FrameLayout implements Reusable { LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams(); LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams(); orientationHandler.setIconAndSnapshotParams(mIconView, taskIconMargin, taskIconHeight, orientationHandler.setIconAndSnapshotParams(mIconView, taskIconMargin, taskIconHeight, snapshotParams, isRtl); snapshotParams, isRtl); updateDwbPlacement(); mSnapshotView.setLayoutParams(snapshotParams); mSnapshotView.setLayoutParams(snapshotParams); iconParams.width = iconParams.height = taskIconHeight; iconParams.width = iconParams.height = taskIconHeight; mIconView.setLayoutParams(iconParams); mIconView.setLayoutParams(iconParams); Loading @@ -909,6 +910,10 @@ public class TaskView extends FrameLayout implements Reusable { mSnapshotView.getTaskOverlay().updateOrientationState(orientationState); mSnapshotView.getTaskOverlay().updateOrientationState(orientationState); } } private void updateDwbPlacement() { mDigitalWellBeingToast.initialize(mTask); } /** /** * Returns whether the task is part of overview grid and not being focused. * Returns whether the task is part of overview grid and not being focused. */ */ Loading src/com/android/launcher3/touch/LandscapePagedViewHandler.java +11 −6 Original line number Original line Diff line number Diff line Loading @@ -310,9 +310,10 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { } } @Override @Override public Pair<Float, Float> setDwbLayoutParamsAndGetTranslations(int taskViewWidth, public Pair<Float, Float> getDwbLayoutTranslations(int taskViewWidth, int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile, int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile, View[] thumbnailViews, int desiredTaskId, View banner) { View[] thumbnailViews, int desiredTaskId, View banner) { boolean isRtl = banner.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; float translationX = 0; float translationX = 0; float translationY = 0; float translationY = 0; FrameLayout.LayoutParams bannerParams = (FrameLayout.LayoutParams) banner.getLayoutParams(); FrameLayout.LayoutParams bannerParams = (FrameLayout.LayoutParams) banner.getLayoutParams(); Loading @@ -323,7 +324,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { FrameLayout.LayoutParams snapshotParams = FrameLayout.LayoutParams snapshotParams = (FrameLayout.LayoutParams) thumbnailViews[0] (FrameLayout.LayoutParams) thumbnailViews[0] .getLayoutParams(); .getLayoutParams(); bannerParams.gravity = TOP | START; bannerParams.gravity = TOP | (isRtl ? END : START); if (splitBounds == null) { if (splitBounds == null) { // Single, fullscreen case // Single, fullscreen case bannerParams.width = taskViewHeight - snapshotParams.topMargin; bannerParams.width = taskViewHeight - snapshotParams.topMargin; Loading @@ -339,9 +340,11 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { // Set translations // Set translations if (desiredTaskId == splitBounds.rightBottomTaskId) { if (desiredTaskId == splitBounds.rightBottomTaskId) { translationY = (snapshotParams.topMargin + taskViewHeight) float topLeftTaskPlusDividerPercent = splitBounds.appsStackedVertically * (splitBounds.leftTaskPercent) + ? (splitBounds.topTaskPercent + splitBounds.dividerHeightPercent) (taskViewHeight * splitBounds.dividerWidthPercent); : (splitBounds.leftTaskPercent + splitBounds.dividerWidthPercent); translationY = snapshotParams.topMargin + ((taskViewHeight - snapshotParams.topMargin) * topLeftTaskPlusDividerPercent); } } if (desiredTaskId == splitBounds.leftTopTaskId) { if (desiredTaskId == splitBounds.leftTopTaskId) { translationY = snapshotParams.topMargin; translationY = snapshotParams.topMargin; Loading Loading @@ -440,7 +443,9 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { StagedSplitBounds splitBoundsConfig, DeviceProfile dp) { StagedSplitBounds splitBoundsConfig, DeviceProfile dp) { int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; int dividerBar = splitBoundsConfig.visualDividerBounds.width(); int dividerBar = splitBoundsConfig.appsStackedVertically ? splitBoundsConfig.visualDividerBounds.height() : splitBoundsConfig.visualDividerBounds.width(); int primarySnapshotHeight; int primarySnapshotHeight; int primarySnapshotWidth; int primarySnapshotWidth; int secondarySnapshotHeight; int secondarySnapshotHeight; Loading src/com/android/launcher3/touch/PagedOrientationHandler.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -191,7 +191,12 @@ public interface PagedOrientationHandler { */ */ PointF getAdditionalInsetForTaskMenu(float margin); PointF getAdditionalInsetForTaskMenu(float margin); Pair<Float, Float> setDwbLayoutParamsAndGetTranslations(int taskViewWidth, /** * Calculates the position where a Digital Wellbeing Banner should be placed on its parent * TaskView. * @return A Pair of Floats representing the proper x and y translations. */ Pair<Float, Float> getDwbLayoutTranslations(int taskViewWidth, int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile, int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile, View[] thumbnailViews, int desiredTaskId, View banner); View[] thumbnailViews, int desiredTaskId, View banner); Loading Loading
quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -144,7 +144,6 @@ public final class DigitalWellBeingToast { public void initialize(Task task) { public void initialize(Task task) { mTask = task; mTask = task; THREAD_POOL_EXECUTOR.execute(() -> { THREAD_POOL_EXECUTOR.execute(() -> { final AppUsageLimit usageLimit = mLauncherApps.getAppUsageLimit( final AppUsageLimit usageLimit = mLauncherApps.getAppUsageLimit( task.getTopComponent().getPackageName(), task.getTopComponent().getPackageName(), Loading Loading @@ -321,7 +320,7 @@ public final class DigitalWellBeingToast { mTaskView.getThumbnail().getLayoutParams()).bottomMargin; mTaskView.getThumbnail().getLayoutParams()).bottomMargin; PagedOrientationHandler orientationHandler = mTaskView.getPagedOrientationHandler(); PagedOrientationHandler orientationHandler = mTaskView.getPagedOrientationHandler(); Pair<Float, Float> translations = orientationHandler Pair<Float, Float> translations = orientationHandler .setDwbLayoutParamsAndGetTranslations(mTaskView.getMeasuredWidth(), .getDwbLayoutTranslations(mTaskView.getMeasuredWidth(), mTaskView.getMeasuredHeight(), mStagedSplitBounds, deviceProfile, mTaskView.getMeasuredHeight(), mStagedSplitBounds, deviceProfile, mTaskView.getThumbnails(), mTask.key.id, mBanner); mTaskView.getThumbnails(), mTask.key.id, mBanner); mSplitOffsetTranslationX = translations.first; mSplitOffsetTranslationX = translations.first; Loading
quickstep/src/com/android/quickstep/views/GroupedTaskView.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -242,6 +242,7 @@ public class GroupedTaskView extends TaskView { mIconView2.setDrawableSize(iconDrawableSize, iconDrawableSize); mIconView2.setDrawableSize(iconDrawableSize, iconDrawableSize); mIconView2.setRotation(getPagedOrientationHandler().getDegreesRotated()); mIconView2.setRotation(getPagedOrientationHandler().getDegreesRotated()); updateIconPlacement(); updateIconPlacement(); updateSecondaryDwbPlacement(); } } private void updateIconPlacement() { private void updateIconPlacement() { Loading @@ -258,6 +259,13 @@ public class GroupedTaskView extends TaskView { isRtl, deviceProfile, mSplitBoundsConfig); isRtl, deviceProfile, mSplitBoundsConfig); } } private void updateSecondaryDwbPlacement() { if (mSecondaryTask == null) { return; } mDigitalWellBeingToast2.initialize(mSecondaryTask); } @Override @Override protected void updateSnapshotRadius() { protected void updateSnapshotRadius() { super.updateSnapshotRadius(); super.updateSnapshotRadius(); Loading
quickstep/src/com/android/quickstep/views/TaskView.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -897,6 +897,7 @@ public class TaskView extends FrameLayout implements Reusable { LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams(); LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams(); orientationHandler.setIconAndSnapshotParams(mIconView, taskIconMargin, taskIconHeight, orientationHandler.setIconAndSnapshotParams(mIconView, taskIconMargin, taskIconHeight, snapshotParams, isRtl); snapshotParams, isRtl); updateDwbPlacement(); mSnapshotView.setLayoutParams(snapshotParams); mSnapshotView.setLayoutParams(snapshotParams); iconParams.width = iconParams.height = taskIconHeight; iconParams.width = iconParams.height = taskIconHeight; mIconView.setLayoutParams(iconParams); mIconView.setLayoutParams(iconParams); Loading @@ -909,6 +910,10 @@ public class TaskView extends FrameLayout implements Reusable { mSnapshotView.getTaskOverlay().updateOrientationState(orientationState); mSnapshotView.getTaskOverlay().updateOrientationState(orientationState); } } private void updateDwbPlacement() { mDigitalWellBeingToast.initialize(mTask); } /** /** * Returns whether the task is part of overview grid and not being focused. * Returns whether the task is part of overview grid and not being focused. */ */ Loading
src/com/android/launcher3/touch/LandscapePagedViewHandler.java +11 −6 Original line number Original line Diff line number Diff line Loading @@ -310,9 +310,10 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { } } @Override @Override public Pair<Float, Float> setDwbLayoutParamsAndGetTranslations(int taskViewWidth, public Pair<Float, Float> getDwbLayoutTranslations(int taskViewWidth, int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile, int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile, View[] thumbnailViews, int desiredTaskId, View banner) { View[] thumbnailViews, int desiredTaskId, View banner) { boolean isRtl = banner.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; float translationX = 0; float translationX = 0; float translationY = 0; float translationY = 0; FrameLayout.LayoutParams bannerParams = (FrameLayout.LayoutParams) banner.getLayoutParams(); FrameLayout.LayoutParams bannerParams = (FrameLayout.LayoutParams) banner.getLayoutParams(); Loading @@ -323,7 +324,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { FrameLayout.LayoutParams snapshotParams = FrameLayout.LayoutParams snapshotParams = (FrameLayout.LayoutParams) thumbnailViews[0] (FrameLayout.LayoutParams) thumbnailViews[0] .getLayoutParams(); .getLayoutParams(); bannerParams.gravity = TOP | START; bannerParams.gravity = TOP | (isRtl ? END : START); if (splitBounds == null) { if (splitBounds == null) { // Single, fullscreen case // Single, fullscreen case bannerParams.width = taskViewHeight - snapshotParams.topMargin; bannerParams.width = taskViewHeight - snapshotParams.topMargin; Loading @@ -339,9 +340,11 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { // Set translations // Set translations if (desiredTaskId == splitBounds.rightBottomTaskId) { if (desiredTaskId == splitBounds.rightBottomTaskId) { translationY = (snapshotParams.topMargin + taskViewHeight) float topLeftTaskPlusDividerPercent = splitBounds.appsStackedVertically * (splitBounds.leftTaskPercent) + ? (splitBounds.topTaskPercent + splitBounds.dividerHeightPercent) (taskViewHeight * splitBounds.dividerWidthPercent); : (splitBounds.leftTaskPercent + splitBounds.dividerWidthPercent); translationY = snapshotParams.topMargin + ((taskViewHeight - snapshotParams.topMargin) * topLeftTaskPlusDividerPercent); } } if (desiredTaskId == splitBounds.leftTopTaskId) { if (desiredTaskId == splitBounds.leftTopTaskId) { translationY = snapshotParams.topMargin; translationY = snapshotParams.topMargin; Loading Loading @@ -440,7 +443,9 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { StagedSplitBounds splitBoundsConfig, DeviceProfile dp) { StagedSplitBounds splitBoundsConfig, DeviceProfile dp) { int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; int dividerBar = splitBoundsConfig.visualDividerBounds.width(); int dividerBar = splitBoundsConfig.appsStackedVertically ? splitBoundsConfig.visualDividerBounds.height() : splitBoundsConfig.visualDividerBounds.width(); int primarySnapshotHeight; int primarySnapshotHeight; int primarySnapshotWidth; int primarySnapshotWidth; int secondarySnapshotHeight; int secondarySnapshotHeight; Loading
src/com/android/launcher3/touch/PagedOrientationHandler.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -191,7 +191,12 @@ public interface PagedOrientationHandler { */ */ PointF getAdditionalInsetForTaskMenu(float margin); PointF getAdditionalInsetForTaskMenu(float margin); Pair<Float, Float> setDwbLayoutParamsAndGetTranslations(int taskViewWidth, /** * Calculates the position where a Digital Wellbeing Banner should be placed on its parent * TaskView. * @return A Pair of Floats representing the proper x and y translations. */ Pair<Float, Float> getDwbLayoutTranslations(int taskViewWidth, int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile, int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile, View[] thumbnailViews, int desiredTaskId, View banner); View[] thumbnailViews, int desiredTaskId, View banner); Loading