diff options
5 files changed, 29 insertions, 35 deletions
diff --git a/Android.mk b/Android.mk index 30dda139c..628b632cc 100644 --- a/Android.mk +++ b/Android.mk @@ -127,6 +127,7 @@ LOCAL_PACKAGE_NAME := Launcher3 LOCAL_PRIVILEGED_MODULE := true LOCAL_PRODUCT_MODULE := true LOCAL_OVERRIDES_PACKAGES := Home Launcher2 +LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3 LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest-common.xml @@ -157,6 +158,7 @@ LOCAL_PACKAGE_NAME := Launcher3Go LOCAL_PRIVILEGED_MODULE := true LOCAL_PRODUCT_MODULE := true LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 Launcher3QuickStep +LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3 LOCAL_FULL_LIBS_MANIFEST_FILES := \ $(LOCAL_PATH)/AndroidManifest.xml \ @@ -274,6 +276,7 @@ LOCAL_PACKAGE_NAME := Launcher3QuickStepGo LOCAL_PRIVILEGED_MODULE := true LOCAL_PRODUCT_MODULE := true LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 Launcher3QuickStep +LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3 LOCAL_FULL_LIBS_MANIFEST_FILES := \ $(LOCAL_PATH)/go/AndroidManifest.xml \ @@ -319,6 +322,7 @@ LOCAL_PROGUARD_ENABLED := full LOCAL_PACKAGE_NAME := Launcher3QuickStepGoIconRecents LOCAL_PRIVILEGED_MODULE := true LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 Launcher3QuickStep +LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3 LOCAL_FULL_LIBS_MANIFEST_FILES := \ $(LOCAL_PATH)/go/AndroidManifest.xml \ diff --git a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java index 57400bd43..720c1c420 100644 --- a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java +++ b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java @@ -390,7 +390,6 @@ public class ClipAnimationHelper { public TransformParams setCurrentRectAndTargetAlpha(RectF currentRect, float targetAlpha) { this.currentRect = currentRect; this.targetAlpha = targetAlpha; - this.progress = 1; return this; } diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java index bbcd4255c..4e8bbe64c 100644 --- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java +++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java @@ -23,6 +23,7 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.LauncherApps; +import android.content.pm.LauncherApps.AppUsageLimit; import android.content.res.Resources; import android.icu.text.MeasureFormat; import android.icu.text.MeasureFormat.FormatWidth; @@ -44,12 +45,12 @@ import com.android.launcher3.Utilities; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.systemui.shared.recents.model.Task; -import java.lang.reflect.Method; import java.time.Duration; import java.util.Locale; public final class DigitalWellBeingToast extends LinearLayout { static final Intent OPEN_APP_USAGE_SETTINGS_TEMPLATE = new Intent(ACTION_APP_USAGE_SETTINGS); + private final LauncherApps mLauncherApps; public interface InitializeCallback { void call(float saturation, String contentDescription); @@ -66,6 +67,7 @@ public final class DigitalWellBeingToast extends LinearLayout { setLayoutDirection(Utilities.isRtl(getResources()) ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR); setOnClickListener((view) -> openAppUsageSettings()); + mLauncherApps = context.getSystemService(LauncherApps.class); } @Override @@ -79,47 +81,29 @@ public final class DigitalWellBeingToast extends LinearLayout { public void initialize(Task task, InitializeCallback callback) { mTask = task; Utilities.THREAD_POOL_EXECUTOR.execute(() -> { - long appUsageLimitTimeMs = -1; - long appRemainingTimeMs = -1; - - try { - final Method getAppUsageLimit = LauncherApps.class.getMethod( - "getAppUsageLimit", - String.class, - UserHandle.class); - final Object usageLimit = getAppUsageLimit.invoke( - getContext().getSystemService(LauncherApps.class), - task.getTopComponent().getPackageName(), - UserHandle.of(task.key.userId)); - - if (usageLimit != null) { - final Class appUsageLimitClass = usageLimit.getClass(); - appUsageLimitTimeMs = (long) appUsageLimitClass.getMethod("getTotalUsageLimit"). - invoke(usageLimit); - appRemainingTimeMs = (long) appUsageLimitClass.getMethod("getUsageRemaining"). - invoke(usageLimit); - } - } catch (Exception e) { - // Do nothing - } + final AppUsageLimit usageLimit = mLauncherApps.getAppUsageLimit( + task.getTopComponent().getPackageName(), + UserHandle.of(task.key.userId)); - final long appUsageLimitTimeMsFinal = appUsageLimitTimeMs; - final long appRemainingTimeMsFinal = appRemainingTimeMs; + final long appUsageLimitTimeMs = + usageLimit != null ? usageLimit.getTotalUsageLimit() : -1; + final long appRemainingTimeMs = + usageLimit != null ? usageLimit.getUsageRemaining() : -1; post(() -> { - if (appUsageLimitTimeMsFinal < 0) { + if (appUsageLimitTimeMs < 0) { setVisibility(GONE); } else { setVisibility(VISIBLE); - mText.setText(getText(appRemainingTimeMsFinal)); - mImage.setImageResource(appRemainingTimeMsFinal > 0 ? + mText.setText(getText(appRemainingTimeMs)); + mImage.setImageResource(appRemainingTimeMs > 0 ? R.drawable.hourglass_top : R.drawable.hourglass_bottom); } callback.call( - appUsageLimitTimeMsFinal >= 0 && appRemainingTimeMsFinal <= 0 ? 0 : 1, + appUsageLimitTimeMs >= 0 && appRemainingTimeMs <= 0 ? 0 : 1, getContentDescriptionForTask( - task, appUsageLimitTimeMsFinal, appRemainingTimeMsFinal)); + task, appUsageLimitTimeMs, appRemainingTimeMs)); }); }); } diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java index ff85003ba..5c8f53c9f 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -222,7 +222,8 @@ public class LauncherRecentsView extends RecentsView<Launcher> { mTempRect.top -= offsetY; } mTempRectF.set(mTempRect); - mTransformParams.setCurrentRectAndTargetAlpha(mTempRectF, taskView.getAlpha()) + mTransformParams.setProgress(1f) + .setCurrentRectAndTargetAlpha(mTempRectF, taskView.getAlpha()) .setSyncTransactionApplier(mSyncTransactionApplier); if (mRecentsAnimationWrapper.targetSet != null) { mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet, diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java index d60dc87e4..70c8aaa4b 100644 --- a/src/com/android/launcher3/DeleteDropTarget.java +++ b/src/com/android/launcher3/DeleteDropTarget.java @@ -16,6 +16,8 @@ package com.android.launcher3; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; + import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; @@ -62,8 +64,12 @@ public class DeleteDropTarget extends ButtonDropTarget { */ @Override public boolean supportsAccessibilityDrop(ItemInfo info, View view) { - return (info instanceof ShortcutInfo) - || (info instanceof LauncherAppWidgetInfo) + if (info instanceof ShortcutInfo) { + // Support the action unless the item is in a context menu. + return info.screenId >= 0; + } + + return (info instanceof LauncherAppWidgetInfo) || (info instanceof FolderInfo); } |