diff --git a/quickstep/src/com/android/launcher3/model/AppEventProducer.java b/quickstep/src/com/android/launcher3/model/AppEventProducer.java index 9c4d4b7cae..8ca1cd9e3d 100644 --- a/quickstep/src/com/android/launcher3/model/AppEventProducer.java +++ b/quickstep/src/com/android/launcher3/model/AppEventProducer.java @@ -253,12 +253,12 @@ public class AppEventProducer implements StatsLogConsumer { return createTempFolderTarget(); } if (id != null && cn != null) { - if (shortcutInfo != null) { - return new AppTarget.Builder(new AppTargetId(id), shortcutInfo).build(); - } if (!Utilities.ATLEAST_Q) { return null; } + if (shortcutInfo != null) { + return new AppTarget.Builder(new AppTargetId(id), shortcutInfo).build(); + } return new AppTarget.Builder(new AppTargetId(id), cn.getPackageName(), userHandle) .setClassName(cn.getClassName()) .build(); diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java index 5f786a4a68..fa73c475f4 100644 --- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java +++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java @@ -16,6 +16,8 @@ package com.android.launcher3.compat; +import static com.android.launcher3.Utilities.ATLEAST_Q; + import android.content.Context; import android.os.Bundle; import android.text.TextUtils; @@ -110,6 +112,6 @@ public class AccessibilityManagerCompat { } public static int getRecommendedTimeoutMillis(Context context, int originalTimeout, int flags) { - return getManager(context).getRecommendedTimeoutMillis(originalTimeout, flags); + return ATLEAST_Q ? getManager(context).getRecommendedTimeoutMillis(originalTimeout, flags) : originalTimeout; } } diff --git a/src/com/android/launcher3/pm/InstallSessionHelper.java b/src/com/android/launcher3/pm/InstallSessionHelper.java index b9572167af..ac236d57e5 100644 --- a/src/com/android/launcher3/pm/InstallSessionHelper.java +++ b/src/com/android/launcher3/pm/InstallSessionHelper.java @@ -22,6 +22,7 @@ import android.content.pm.LauncherApps; import android.content.pm.PackageInstaller; import android.content.pm.PackageInstaller.SessionInfo; import android.content.pm.PackageManager; +import android.os.Process; import android.os.UserHandle; import android.text.TextUtils; @@ -262,6 +263,6 @@ public class InstallSessionHelper implements SafeCloseable { } public static UserHandle getUserHandle(@NonNull final SessionInfo info) { - return info.getUser(); + return Utilities.ATLEAST_Q ? info.getUser() : Process.myUserHandle(); } } diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java index 10c9fc6525..1f4419bb7e 100644 --- a/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java +++ b/src/com/android/launcher3/widget/LauncherAppWidgetHostView.java @@ -136,8 +136,10 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView public void updateAppWidget(RemoteViews remoteViews) { if (mTrackingWidgetUpdate && remoteViews != null) { Log.i(TAG, "App widget with id: " + getAppWidgetId() + " loaded"); - Trace.endAsyncSection( + if (ATLEAST_Q) { + Trace.endAsyncSection( TRACE_METHOD_NAME + getAppWidgetInfo().provider, getAppWidgetId()); + } mTrackingWidgetUpdate = false; } if (isDeferringUpdates()) { diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java index c404ed3f8b..9fca894574 100644 --- a/src/com/android/launcher3/widget/WidgetCell.java +++ b/src/com/android/launcher3/widget/WidgetCell.java @@ -162,6 +162,8 @@ public class WidgetCell extends LinearLayout { mWidgetName = findViewById(R.id.widget_name); mWidgetDims = findViewById(R.id.widget_dims); mWidgetDescription = findViewById(R.id.widget_description); + mWidgetAddButton = findViewById(R.id.widget_add_button); + mWidgetTextContainer = findViewById(R.id.widget_text_container); FontManager fontManager = FontManager.INSTANCE.get(getContext()); fontManager.setCustomFont(mWidgetName, R.id.font_body_medium);