From d0f43ceba7eb4fb31d93fe949e2bafa945acac07 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 30 May 2018 17:35:24 -0700 Subject: [PATCH] Some launcher3 fixes so that it compiles with different configurations Bug: 79996542 Change-Id: I4267aeb8f5b0714415970c63453049ff41466644 --- proguard.flags | 5 +++++ quickstep/res/values/config.xml | 2 +- .../quickstep/QuickstepProcessInitializer.java | 1 + .../logging/UserEventDispatcherExtension.java | 9 ++++----- .../android/launcher3/provider/ImportDataTask.java | 2 ++ src/com/android/launcher3/qsb/QsbContainerView.java | 13 ++++++++++--- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/proguard.flags b/proguard.flags index 555d13e44c..e4011165e1 100644 --- a/proguard.flags +++ b/proguard.flags @@ -112,6 +112,11 @@ public (...); } +# UserEventDispatcherExtension +-keep class com.android.quickstep.logging.UserEventDispatcherExtension { + public (...); +} + -keep interface com.android.launcher3.userevent.nano.LauncherLogProto.** { *; } diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml index 7673f69940..c294376340 100644 --- a/quickstep/res/values/config.xml +++ b/quickstep/res/values/config.xml @@ -18,5 +18,5 @@ - com.google.quickstep.logging.UserEventDispatcherExtension + com.android.quickstep.logging.UserEventDispatcherExtension diff --git a/quickstep/src/com/android/quickstep/QuickstepProcessInitializer.java b/quickstep/src/com/android/quickstep/QuickstepProcessInitializer.java index aed9959576..2c3f77f213 100644 --- a/quickstep/src/com/android/quickstep/QuickstepProcessInitializer.java +++ b/quickstep/src/com/android/quickstep/QuickstepProcessInitializer.java @@ -20,6 +20,7 @@ import android.content.Context; import com.android.launcher3.MainProcessInitializer; import com.android.systemui.shared.system.ThreadedRendererCompat; +@SuppressWarnings("unused") public class QuickstepProcessInitializer extends MainProcessInitializer { public QuickstepProcessInitializer(Context context) { } diff --git a/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java b/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java index 04153cc99e..6dff187ea5 100644 --- a/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java +++ b/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java @@ -15,10 +15,9 @@ */ package com.android.quickstep.logging; +import android.content.Context; import android.util.Log; -import static com.android.launcher3.logging.LoggerUtils.newAction; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent; import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CANCEL_TARGET; import static com.android.systemui.shared.system.LauncherEventUtil.VISIBLE; @@ -27,20 +26,20 @@ import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_QUICK import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_SWIPE_UP_ONBOARDING_TIP; import com.android.launcher3.logging.UserEventDispatcher; -import com.android.launcher3.model.nano.LauncherDumpProto; -import com.android.launcher3.userevent.nano.LauncherLogExtensions; import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.systemui.shared.system.LauncherEventUtil; import com.android.systemui.shared.system.MetricsLoggerCompat; /** * This class handles AOSP MetricsLogger function calls and logging around * quickstep interactions. */ +@SuppressWarnings("unused") public class UserEventDispatcherExtension extends UserEventDispatcher { private static final String TAG = "UserEventDispatcher"; + public UserEventDispatcherExtension(Context context) { } + public void logStateChangeAction(int action, int dir, int srcChildTargetType, int srcParentContainerType, int dstContainerType, int pageIndex) { diff --git a/src/com/android/launcher3/provider/ImportDataTask.java b/src/com/android/launcher3/provider/ImportDataTask.java index b83d3c0cdf..b1dd003f81 100644 --- a/src/com/android/launcher3/provider/ImportDataTask.java +++ b/src/com/android/launcher3/provider/ImportDataTask.java @@ -142,6 +142,8 @@ public class ImportDataTask { // First row of first screen is not empty createEmptyRowOnFirstScreen = c.moveToNext(); } + } else { + createEmptyRowOnFirstScreen = false; } ArrayList insertOperations = new ArrayList<>(BATCH_INSERT_SIZE); diff --git a/src/com/android/launcher3/qsb/QsbContainerView.java b/src/com/android/launcher3/qsb/QsbContainerView.java index 65acaa9732..b26d39fda3 100644 --- a/src/com/android/launcher3/qsb/QsbContainerView.java +++ b/src/com/android/launcher3/qsb/QsbContainerView.java @@ -36,7 +36,6 @@ import android.widget.FrameLayout; import com.android.launcher3.AppWidgetResizeFrame; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.Utilities; @@ -68,6 +67,10 @@ public class QsbContainerView extends FrameLayout { super.setPadding(0, 0, 0, 0); } + protected void setPaddingUnchecked(int left, int top, int right, int bottom) { + super.setPadding(left, top, right, bottom); + } + /** * A fragment to display the QSB. */ @@ -100,7 +103,7 @@ public class QsbContainerView extends FrameLayout { mWrapper = new FrameLayout(getActivity()); // Only add the view when enabled - if (FeatureFlags.QSB_ON_FIRST_SCREEN) { + if (isQsbEnabled()) { mWrapper.addView(createQsb(mWrapper)); } return mWrapper; @@ -212,7 +215,7 @@ public class QsbContainerView extends FrameLayout { private void rebindFragment() { // Exit if the embedded qsb is disabled - if (!FeatureFlags.QSB_ON_FIRST_SCREEN) { + if (!isQsbEnabled()) { return; } @@ -221,6 +224,10 @@ public class QsbContainerView extends FrameLayout { mWrapper.addView(createQsb(mWrapper)); } } + + public boolean isQsbEnabled() { + return FeatureFlags.QSB_ON_FIRST_SCREEN; + } } /**