Snap for 9414774 from 40ac71e8b3 to udc-release

Change-Id: Iee84e197721e22b71de5afaa2ca6c18b6d2e2b76
This commit is contained in:
Android Build Coastguard Worker
2022-12-17 04:27:07 +00:00
53 changed files with 440 additions and 623 deletions
@@ -210,12 +210,19 @@ public class DebugTestInformationHandler extends TestInformationHandler {
}
case TestProtocol.REQUEST_USE_TEST_WORKSPACE_LAYOUT: {
useTestWorkspaceLayout(true);
useTestWorkspaceLayout(
LauncherSettings.Settings.ARG_DEFAULT_WORKSPACE_LAYOUT_TEST);
return response;
}
case TestProtocol.REQUEST_USE_TEST2_WORKSPACE_LAYOUT: {
useTestWorkspaceLayout(
LauncherSettings.Settings.ARG_DEFAULT_WORKSPACE_LAYOUT_TEST2);
return response;
}
case TestProtocol.REQUEST_USE_DEFAULT_WORKSPACE_LAYOUT: {
useTestWorkspaceLayout(false);
useTestWorkspaceLayout(null);
return response;
}
@@ -257,12 +264,17 @@ public class DebugTestInformationHandler extends TestInformationHandler {
}
}
private void useTestWorkspaceLayout(boolean useTestWorkspaceLayout) {
private void useTestWorkspaceLayout(String layout) {
final long identity = Binder.clearCallingIdentity();
try {
LauncherSettings.Settings.call(mContext.getContentResolver(), useTestWorkspaceLayout
? LauncherSettings.Settings.METHOD_SET_USE_TEST_WORKSPACE_LAYOUT_FLAG
: LauncherSettings.Settings.METHOD_CLEAR_USE_TEST_WORKSPACE_LAYOUT_FLAG);
if (layout != null) {
LauncherSettings.Settings.call(mContext.getContentResolver(),
LauncherSettings.Settings.METHOD_SET_USE_TEST_WORKSPACE_LAYOUT_FLAG,
layout);
} else {
LauncherSettings.Settings.call(mContext.getContentResolver(),
LauncherSettings.Settings.METHOD_CLEAR_USE_TEST_WORKSPACE_LAYOUT_FLAG);
}
} finally {
Binder.restoreCallingIdentity(identity);
}
+2 -1
View File
@@ -130,7 +130,7 @@ message TaskBarContainer {
optional int32 cardinality = 2;
}
// Next value 40
// Next value 41
enum Attribute {
UNKNOWN = 0;
DEFAULT_LAYOUT = 1; // icon automatically placed in workspace, folder, hotseat
@@ -186,6 +186,7 @@ enum Attribute {
WEB_SEARCH_RESULT_PERSONAL = 36;
WEB_SEARCH_RESULT_CALCULATOR = 37;
WEB_SEARCH_RESULT_URL = 38;
WEB_SEARCH_RESULT_RICH_ANSWER = 40;
WIDGETS_BOTTOM_TRAY = 28;
WIDGETS_TRAY_PREDICTION = 29;
+1 -36
View File
@@ -27,40 +27,5 @@
android:clipChildren="true"
android:clipToPadding="false"
android:focusable="false"
android:saveEnabled="false"
android:theme="?attr/allAppsTheme">
<include
layout="@layout/all_apps_bottom_sheet_background"
android:visibility="gone" />
<include
layout="@layout/search_results_rv_layout"
android:visibility="gone" />
<include
layout="@layout/all_apps_rv_layout"
android:visibility="gone" />
<com.android.launcher3.allapps.FloatingHeaderView
android:id="@+id/all_apps_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/search_container_all_apps"
android:clipToPadding="false"
android:orientation="vertical">
<include layout="@layout/floating_header_content" />
<include layout="@layout/all_apps_personal_work_tabs" />
</com.android.launcher3.allapps.FloatingHeaderView>
<com.android.launcher3.taskbar.allapps.TaskbarAllAppsFallbackSearchContainer
android:id="@+id/search_container_all_apps"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone" />
<include layout="@layout/all_apps_fast_scroller" />
</com.android.launcher3.taskbar.allapps.TaskbarAllAppsContainerView>
android:saveEnabled="false" />
</com.android.launcher3.taskbar.allapps.TaskbarAllAppsSlideInView>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Tapşırıq panelində təhsil"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Tapşırıq panelindəki təlim bölməsi görünür"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Tapşırıq panelindəki təlim bölməsi bağlanıb"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Eyni anda 2 tətbiqi istifadə etmək üçün yan tərəfə çəkin"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Tapşırıq panelini göstərmək üçün azca yuxarı sürüşdürün"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"Tapşırıq paneli rejiminizə əsasən tətbiqlər təklif edir"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Sonra"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Geri"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Bağlayın"</string>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Edukacija o traci zadataka"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Edukacija o programskoj traci je prikazana"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Edukacija o programskoj traci je zatvorena"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Povucite u stranu za istovremeno korištenje 2 aplikacije"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Kratki pokret prema gore za prikaz trake sa zadacima"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"Traka sa zadacima predlaže aplikacije na temelju vaše rutine"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Naprijed"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Nazad"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Zatvori"</string>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Πληροφορίες χρήσης της Γραμμής εργαλείων"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Η εκπαίδευση για τη γραμμή εργασιών εμφανίστηκε"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Η εκπαίδευση για τη γραμμή εργασιών έκλεισε"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Σύρετε στο πλάι για ταυτόχρονη χρήση δύο εφαρμογών"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Σύρετε σύντομα προς τα πάνω για εμφάνιση γραμμής εργαλείων"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"Η γραμμή εργαλείων συνιστά εφαρμογές βάσει της ρουτίνας σας"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Επόμενο"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Πίσω"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Κλείσιμο"</string>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Taskbar education"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Taskbar education appeared"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Taskbar education closed"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Drag to the side to use two apps at once"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Short swipe up to show the taskbar"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"The taskbar suggests apps based on your routine"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Next"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Back"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Close"</string>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Taskbar education"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Taskbar education appeared"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Taskbar education closed"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Drag to the side to use 2 apps at once"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Short swipe up to show the taskbar"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"The taskbar suggests apps based on your routine"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Next"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Back"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Close"</string>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Taskbar education"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Taskbar education appeared"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Taskbar education closed"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Drag to the side to use two apps at once"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Short swipe up to show the taskbar"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"The taskbar suggests apps based on your routine"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Next"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Back"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Close"</string>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Taskbar education"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Taskbar education appeared"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Taskbar education closed"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Drag to the side to use two apps at once"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Short swipe up to show the taskbar"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"The taskbar suggests apps based on your routine"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Next"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Back"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Close"</string>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Taskbar education"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Taskbar education appeared"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Taskbar education closed"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Drag to the side to use 2 apps at once"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Short swipe up to show the taskbar"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"The taskbar suggests apps based on your routine"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Next"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Back"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Close"</string>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Upute za traku sa zadacima"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"Upute za programsku traku su se pojavile"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"Upute za programsku traku su zatvorene"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Povucite u stranu za istovremeno korištenje 2 aplikacije"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Kratki pokret prema gore za prikaz trake sa zadacima"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"Traka sa zadacima predlaže aplikacije na temelju vaše rutine"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Dalje"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Natrag"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Zatvori"</string>
+5 -10
View File
@@ -78,10 +78,8 @@
<string name="allset_title" msgid="5021126669778966707">"सबै तयार भयो!"</string>
<string name="allset_hint" msgid="2384632994739392447">"होममा जान माथितिर स्वाइप गर्नुहोस्"</string>
<string name="allset_button_hint" msgid="2395219947744706291">"आफ्नो होम स्क्रिनमा जान होम बटनमा ट्याप गर्नुहोस्"</string>
<!-- no translation found for allset_description_generic (5385500062202019855) -->
<skip />
<!-- no translation found for default_device_name (6660656727127422487) -->
<skip />
<string name="allset_description_generic" msgid="5385500062202019855">"तपाईं अब आफ्नो <xliff:g id="DEVICE">%1$s</xliff:g> चलाउन थाल्न सक्नुहुन्छ"</string>
<string name="default_device_name" msgid="6660656727127422487">"डिभाइस"</string>
<string name="allset_navigation_settings" msgid="4713404605961476027"><annotation id="link">"सिस्टम नेभिगेसनसम्बन्धी सेटिङ"</annotation></string>
<string name="action_share" msgid="2648470652637092375">"सेयर गर्नुहोस्"</string>
<string name="action_screenshot" msgid="8171125848358142917">"स्क्रिनसट"</string>
@@ -94,8 +92,7 @@
<string name="gesture_tutorial_action_button_label_cancel" msgid="3809842569351264108">"रद्द गर्नुहोस्"</string>
<string name="gesture_tutorial_action_button_label_skip" msgid="394452764989751960">"स्किप गर्नु…"</string>
<string name="accessibility_rotate_button" msgid="4771825231336502943">"स्क्रिन घुमाउनुहोस्"</string>
<!-- no translation found for taskbar_edu_a11y_title (5417986057866415355) -->
<skip />
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"टास्कबार एजुकेसन"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"टास्कबार एजुकेसन देखिएको छ"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"टास्कबार एजुकेसन बन्द गरिएको छ"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
@@ -115,10 +112,8 @@
<string name="taskbar_button_recents" msgid="7273376136216613134">"हालसालैका बटनहरू"</string>
<string name="taskbar_button_notifications" msgid="7471740351507357318">"सूचनाहरू"</string>
<string name="taskbar_button_quick_settings" msgid="227662894293189391">"द्रुत सेटिङ"</string>
<!-- no translation found for taskbar_a11y_title (6432169809852243110) -->
<skip />
<!-- no translation found for taskbar_phone_a11y_title (4933360237131229395) -->
<skip />
<string name="taskbar_a11y_title" msgid="6432169809852243110">"टास्कबार"</string>
<string name="taskbar_phone_a11y_title" msgid="4933360237131229395">"नेभिगेसन बार"</string>
<string name="move_drop_target_top_or_left" msgid="2988702185049595807">"सिरान/बायाँतिर सार्नुहोस्"</string>
<string name="move_drop_target_bottom_or_right" msgid="5431393418797620162">"फेद/दायाँतिर सार्नुहोस्"</string>
</resources>
+3 -6
View File
@@ -95,12 +95,9 @@
<string name="taskbar_edu_a11y_title" msgid="5417986057866415355">"Informações sobre a barra de tarefas"</string>
<string name="taskbar_edu_opened" msgid="3950252793551919129">"As dicas sobre a barra de tarefas foram abertas"</string>
<string name="taskbar_edu_closed" msgid="126643734478892862">"As dicas sobre a barra de tarefas foram fechadas"</string>
<!-- no translation found for taskbar_edu_splitscreen (5563823414110661454) -->
<skip />
<!-- no translation found for taskbar_edu_stashing (2805035263048176462) -->
<skip />
<!-- no translation found for taskbar_edu_suggestions (1416699696825090402) -->
<skip />
<string name="taskbar_edu_splitscreen" msgid="5563823414110661454">"Arraste para o lado para usar dois apps ao mesmo tempo"</string>
<string name="taskbar_edu_stashing" msgid="2805035263048176462">"Deslize para cima para mostrar a barra de tarefas"</string>
<string name="taskbar_edu_suggestions" msgid="1416699696825090402">"A barra de tarefas sugere apps com base na sua rotina"</string>
<string name="taskbar_edu_next" msgid="4007618274426775841">"Próxima"</string>
<string name="taskbar_edu_previous" msgid="459202320127201702">"Voltar"</string>
<string name="taskbar_edu_close" msgid="887022990168191073">"Fechar"</string>
@@ -271,14 +271,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
}
private void updateIconSize(Resources resources) {
float taskbarIconSize = resources.getDimension(DisplayController.isTransientTaskbar(this)
? mDeviceProfile.isTwoPanels
? R.dimen.transient_taskbar_two_panels_icon_size
: R.dimen.transient_taskbar_icon_size
: R.dimen.taskbar_icon_size);
mDeviceProfile.updateIconSize(1, resources);
float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx;
mDeviceProfile.updateIconSize(iconScale, resources);
mDeviceProfile.iconSizePx = resources.getDimensionPixelSize(
DisplayController.isTransientTaskbar(this)
? mDeviceProfile.isTwoPanels
? R.dimen.transient_taskbar_two_panels_icon_size
: R.dimen.transient_taskbar_icon_size
: R.dimen.taskbar_icon_size);
mDeviceProfile.updateIconSize(1f, resources);
}
/**
@@ -428,8 +428,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
}
public void onRotationChanged(DeviceProfile deviceProfile) {
if (mControllers.taskbarStashController.isInApp()) {
// We only translate on rotation when on home
if (!mControllers.uiController.isIconAlignedWithHotseat()) {
// We only translate on rotation when icon is aligned with hotseat
return;
}
mActivity.setTaskbarWindowHeight(
@@ -17,6 +17,7 @@ package com.android.launcher3.taskbar.allapps;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.WindowInsets;
import com.android.launcher3.DeviceProfile;
@@ -42,6 +43,19 @@ public class TaskbarAllAppsContainerView extends
return super.onApplyWindowInsets(insets);
}
@Override
protected View inflateSearchBox() {
// Remove top padding of header, since we do not have any search
mHeader.setPadding(mHeader.getPaddingLeft(), 0,
mHeader.getPaddingRight(), mHeader.getPaddingBottom());
TaskbarAllAppsFallbackSearchContainer searchView =
new TaskbarAllAppsFallbackSearchContainer(getContext(), null);
searchView.setId(R.id.search_container_all_apps);
searchView.setVisibility(GONE);
return searchView;
}
@Override
protected boolean isSearchSupported() {
return false;
@@ -53,4 +67,10 @@ public class TaskbarAllAppsContainerView extends
// TODO(b/240670050): Remove this and add header protection for the taskbar entrypoint.
mBottomSheetBackground.setBackgroundResource(R.drawable.bg_rounded_corner_bottom_sheet);
}
@Override
public boolean isInAllApps() {
// All apps is always open
return true;
}
}
@@ -21,9 +21,6 @@ import android.view.View;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
import com.android.launcher3.allapps.search.DefaultSearchAdapterProvider;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.dot.DotInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.popup.PopupDataProvider;
@@ -137,10 +134,4 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
@Override
public void onPopupVisibilityChanged(boolean isVisible) {}
@Override
public SearchAdapterProvider<?> createSearchAdapterProvider(
ActivityAllAppsContainerView<?> appsView) {
return new DefaultSearchAdapterProvider(this);
}
}
@@ -28,6 +28,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.taskbar.TaskbarActivityContext;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.views.BaseDragLayer;
@@ -85,6 +86,7 @@ public class FloatingTaskView extends FrameLayout {
private PagedOrientationHandler mOrientationHandler;
@SplitConfigurationOptions.StagePosition
private int mStagePosition;
private final Rect mTmpRect = new Rect();
public FloatingTaskView(Context context) {
this(context, null);
@@ -158,10 +160,24 @@ public class FloatingTaskView extends FrameLayout {
}
public void updateInitialPositionForView(View originalView) {
Rect viewBounds = new Rect(0, 0, originalView.getWidth(), originalView.getHeight());
Utilities.getBoundsForViewInDragLayer(mActivity.getDragLayer(), originalView, viewBounds,
false /* ignoreTransform */, null /* recycle */,
mStartingPosition);
if (originalView.getContext() instanceof TaskbarActivityContext) {
// If original View is a button on the Taskbar, find the on-screen bounds and calculate
// the equivalent bounds in the DragLayer, so we can set the initial position of
// this FloatingTaskView and start the split animation at the correct spot.
originalView.getBoundsOnScreen(mTmpRect);
mStartingPosition.set(mTmpRect);
int[] dragLayerPositionRelativeToScreen =
mActivity.getDragLayer().getLocationOnScreen();
mStartingPosition.offset(
-dragLayerPositionRelativeToScreen[0],
-dragLayerPositionRelativeToScreen[1]);
} else {
Rect viewBounds = new Rect(0, 0, originalView.getWidth(), originalView.getHeight());
Utilities.getBoundsForViewInDragLayer(mActivity.getDragLayer(), originalView,
viewBounds, false /* ignoreTransform */, null /* recycle */,
mStartingPosition);
}
final BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams(
Math.round(mStartingPosition.width()),
Math.round(mStartingPosition.height()));
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 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:color="@android:color/system_neutral1_900" android:alpha="0.8" />
</selector>
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 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:color="@android:color/system_neutral1_200" android:alpha="0.8" />
</selector>
+1 -1
View File
@@ -18,5 +18,5 @@
*/
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#000000" android:alpha="0.32" />
<item android:color="#000000" android:alpha="0.65" />
</selector>
+2 -1
View File
@@ -15,5 +15,6 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?attr/popupColorPrimary" />
<corners android:radius="2dp" />
<corners android:radius="@dimen/rounded_button_radius" />
<stroke android:color="?attr/allappsHeaderProtectionColor" android:width=".5dp" />
</shape>
+1 -5
View File
@@ -17,13 +17,9 @@
will bake the left/right padding into that view's background itself. -->
<com.android.launcher3.allapps.LauncherAllAppsContainerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/apps_view"
android:theme="?attr/allAppsTheme"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="true"
android:clipToPadding="false"
android:focusable="false"
android:saveEnabled="false">
<include layout="@layout/all_apps_content" />
</com.android.launcher3.allapps.LauncherAllAppsContainerView>
android:saveEnabled="false" />
+1 -10
View File
@@ -34,6 +34,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:layout_below="@id/search_container_all_apps"
android:paddingTop="@dimen/all_apps_header_top_padding"
android:paddingBottom="@dimen/all_apps_header_bottom_padding"
android:orientation="vertical" >
@@ -44,15 +45,5 @@
</com.android.launcher3.allapps.FloatingHeaderView>
<View
android:id="@+id/search_protection"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:forceHasOverlappingRendering="false" />
<include layout="@layout/search_container_all_apps" />
<include layout="@layout/all_apps_fast_scroller" />
</merge>
-1
View File
@@ -21,7 +21,6 @@
android:layout_centerHorizontal="true"
android:layout_gravity="top|center_horizontal"
android:background="@drawable/bg_all_apps_searchbox"
android:elevation="1dp"
android:focusableInTouchMode="true"
android:gravity="center"
android:hint="@string/all_apps_search_bar_hint"
+2 -55
View File
@@ -42,8 +42,7 @@
android:contentDescription="@string/all_apps_button_label"
android:onClick="onAppsButtonClicked" />
<view
class="com.android.launcher3.allapps.SecondaryLauncherAllAppsContainerView"
<com.android.launcher3.allapps.SecondaryLauncherAllAppsContainerView
android:id="@+id/apps_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -53,57 +52,5 @@
android:saveEnabled="false"
android:layout_gravity="bottom|end"
android:background="@drawable/round_rect_primary"
android:visibility="invisible" >
<include
layout="@layout/all_apps_bottom_sheet_background"
android:visibility="gone" />
<include
layout="@layout/search_results_rv_layout"
android:visibility="gone" />
<include
layout="@layout/all_apps_rv_layout"
android:visibility="gone" />
<com.android.launcher3.allapps.FloatingHeaderView
android:id="@+id/all_apps_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/search_container_all_apps"
android:clipToPadding="false"
android:paddingTop="@dimen/all_apps_header_top_padding"
android:orientation="vertical" >
<include layout="@layout/floating_header_content" />
<include layout="@layout/all_apps_personal_work_tabs" />
</com.android.launcher3.allapps.FloatingHeaderView>
<com.android.launcher3.allapps.search.AppsSearchContainerLayout
android:id="@id/search_container_all_apps"
android:layout_width="match_parent"
android:layout_height="@dimen/all_apps_search_bar_field_height"
android:layout_centerHorizontal="true"
android:layout_gravity="top|center_horizontal"
android:layout_marginTop="24dp"
android:background="@drawable/bg_all_apps_searchbox"
android:elevation="1dp"
android:focusableInTouchMode="true"
android:gravity="center"
android:hint="@string/all_apps_search_bar_hint"
android:imeOptions="actionSearch|flagNoExtractUi"
android:importantForAutofill="no"
android:inputType="text|textNoSuggestions|textCapWords"
android:maxLines="1"
android:padding="8dp"
android:saveEnabled="false"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textColorHint="@drawable/all_apps_search_hint"
android:textSize="16sp" />
<include layout="@layout/all_apps_fast_scroller" />
</view>
android:visibility="invisible" />
</com.android.launcher3.secondarydisplay.SecondaryDragLayer>
+1 -1
View File
@@ -72,7 +72,7 @@
<string name="all_apps_button_work_label" msgid="7270707118948892488">"Спіс працоўных праграм"</string>
<string name="remove_drop_target_label" msgid="7812859488053230776">"Выдаліць"</string>
<string name="uninstall_drop_target_label" msgid="4722034217958379417">"Дэінсталяваць"</string>
<string name="app_info_drop_target_label" msgid="692894985365717661">"Пра праграму"</string>
<string name="app_info_drop_target_label" msgid="692894985365717661">"Звесткі аб праграме"</string>
<string name="install_drop_target_label" msgid="2539096853673231757">"Усталяваць"</string>
<string name="dismiss_prediction_label" msgid="3357562989568808658">"Не прапаноўваць праграму"</string>
<string name="pin_prediction" msgid="4196423321649756498">"Замацаваць прапанаваную праграму"</string>
+1 -1
View File
@@ -141,7 +141,7 @@
<string name="move_to_hotseat_position" msgid="6295412897075147808">"ఇష్టమైనవిలో <xliff:g id="NUMBER">%1$s</xliff:g>వ స్థానానికి తరలించు"</string>
<string name="item_moved" msgid="4606538322571412879">"అంశం తరలించబడింది"</string>
<string name="add_to_folder" msgid="9040534766770853243">"ఈ ఫోల్డర్‌కి జోడించండి: <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="add_to_folder_with_app" msgid="4534929978967147231">"<xliff:g id="NAME">%1$s</xliff:g> గల ఫోల్డర్‌కు జోడించ"</string>
<string name="add_to_folder_with_app" msgid="4534929978967147231">"<xliff:g id="NAME">%1$s</xliff:g> గల ఫోల్డర్‌కు జోడించండి"</string>
<string name="added_to_folder" msgid="4793259502305558003">"అంశం ఫోల్డర్‌కు జోడించబడింది"</string>
<string name="create_folder_with" msgid="4050141361160214248">"ఈ పేరుతో ఫోల్డర్‌ను క్రియేట్ చేయండి: <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="folder_created" msgid="6409794597405184510">"ఫోల్డర్ క్రియేట్ చేయబడింది"</string>
-3
View File
@@ -49,9 +49,6 @@
<!-- View tag key used to determine if we should fade in the child views.. -->
<string name="popup_container_iterate_children" translatable="false">popup_container_iterate_children</string>
<!-- config used to determine if header protection is supported in AllApps -->
<bool name="config_header_protection_supported">false</bool>
<!-- Workspace -->
<!-- The duration (in ms) of the fade animation on the object outlines, used when
we are dragging objects around on the home screen. -->
+3 -20
View File
@@ -20,6 +20,7 @@
<resources>
<!-- Launcher theme -->
<style name="BaseLauncherTheme" parent="@android:style/Theme.DeviceDefault.Light">
<item name="disabledIconAlpha">.54</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:colorEdgeEffect">#FF757575</item>
<item name="android:windowActionBar">false</item>
@@ -33,7 +34,6 @@
<item name="allAppsScrimColor">?android:attr/colorBackgroundFloating</item>
<item name="allappsHeaderProtectionColor">@color/popup_color_tertiary_light</item>
<item name="allAppsNavBarScrimColor">#66FFFFFF</item>
<item name="allAppsTheme">@style/AllAppsTheme</item>
<item name="popupColorPrimary">@color/popup_color_primary_light</item>
<item name="popupColorSecondary">@color/popup_color_secondary_light</item>
<item name="popupColorTertiary">@color/popup_color_tertiary_light</item>
@@ -61,7 +61,6 @@
<item name="iconOnlyShortcutColor">?android:attr/textColorSecondary</item>
<item name="workProfileOverlayTextColor">#FF212121</item>
<item name="eduHalfSheetBGColor">?android:attr/colorAccent</item>
<item name="disabledIconAlpha">.54</item>
<item name="workspaceAccentColor">@color/workspace_accent_color_light</item>
<item name="dropTargetHoverTextColor">@color/workspace_text_color_dark</item>
<item name="overviewScrimColor">@color/overview_scrim</item>
@@ -73,14 +72,9 @@
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#00000000</item>
<item name="android:navigationBarColor">#00000000</item>
</style>
<style name="LauncherTheme.DarkMainColor" parent="@style/LauncherTheme">
<item name="disabledIconAlpha">.54</item>
</style>
<style name="LauncherTheme.DarkMainColor" parent="@style/LauncherTheme" />
<style name="LauncherTheme.DarkText" parent="@style/LauncherTheme">
<item name="workspaceTextColor">@color/workspace_text_color_dark</item>
@@ -102,7 +96,6 @@
<item name="android:colorPrimary">#FF212121</item>
<item name="allAppsScrimColor">?android:attr/colorBackgroundFloating</item>
<item name="allAppsNavBarScrimColor">#80000000</item>
<item name="allAppsTheme">@style/AllAppsTheme.Dark</item>
<item name="popupColorPrimary">@color/popup_color_primary_dark</item>
<item name="popupColorSecondary">@color/popup_color_secondary_dark</item>
<item name="popupColorTertiary">@color/popup_color_tertiary_dark</item>
@@ -129,9 +122,7 @@
<item name="preloadIconBackgroundColor">@color/preload_icon_background_color_dark</item>
</style>
<style name="LauncherTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark">
<item name="disabledIconAlpha">.54</item>
</style>
<style name="LauncherTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark"/>
<style name="LauncherTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark">
<item name="android:colorControlHighlight">#19212121</item>
@@ -207,14 +198,6 @@
<item name="android:importantForAccessibility">no</item>
</style>
<style name="AllAppsTheme">
<item name="disabledIconAlpha">.54</item>
</style>
<style name="AllAppsTheme.Dark">
<item name="disabledIconAlpha">.54</item>
</style>
<style name="BaseIconRoot" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle"/>
<style name="BaseIconUnBounded" parent="BaseIconRoot">
+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Split display specific version of Launcher3/res/xml/default_workspace_4x4.xml -->
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" >
<!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
<!-- Dialer Messaging Chrome Camera -->
<favorite
launcher:container="-101"
launcher:screen="0"
launcher:x="0"
launcher:y="0"
launcher:className="com.google.android.dialer.extensions.GoogleDialtactsActivity"
launcher:packageName="com.google.android.dialer" />
<favorite
launcher:container="-101"
launcher:screen="1"
launcher:x="1"
launcher:y="0"
launcher:className="com.google.android.apps.messaging.ui.ConversationListActivity"
launcher:packageName="com.google.android.apps.messaging" />
<favorite
launcher:container="-101"
launcher:screen="2"
launcher:x="2"
launcher:y="0"
launcher:className="com.google.android.apps.chrome.Main"
launcher:packageName="com.android.chrome" />
<favorite
launcher:container="-101"
launcher:screen="3"
launcher:x="3"
launcher:y="0"
launcher:className="com.android.camera.CameraLauncher"
launcher:packageName="com.google.android.GoogleCamera" />
<!-- Bottom row -->
<!-- Maps [space] [space] Play -->
<favorite
launcher:className="com.google.android.maps.MapsActivity"
launcher:packageName="com.google.android.apps.maps"
launcher:screen="0"
launcher:x="0"
launcher:y="-1" />
<favorite
launcher:className="com.android.vending.AssetBrowserActivity"
launcher:packageName="com.android.vending"
launcher:screen="0"
launcher:x="3"
launcher:y="-1" />
<!-- TODO: Place weather widget when it's available -->
</favorites>
@@ -34,9 +34,6 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
import com.android.launcher3.allapps.search.DefaultSearchAdapterProvider;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.util.ActivityOptionsWrapper;
@@ -212,16 +209,6 @@ public abstract class BaseDraggingActivity extends BaseActivity
return new WindowBounds(new Rect(0, 0, mwSize.x, mwSize.y), new Rect());
}
/**
* Creates and returns {@link SearchAdapterProvider} for build variant specific search result
* views
*/
@Override
public SearchAdapterProvider<?> createSearchAdapterProvider(
ActivityAllAppsContainerView<?> allApps) {
return new DefaultSearchAdapterProvider(this);
}
@Override
public boolean isAppBlockedForSafeMode() {
return mIsSafeModeEnabled;
+5 -6
View File
@@ -817,6 +817,11 @@ public class DeviceProfile {
* Returns the amount of extra (or unused) vertical space.
*/
private int updateAvailableDimensions(Resources res) {
float invIconSizeDp = inv.iconSize[mTypeIndex];
float invIconTextSizeSp = inv.iconTextSize[mTypeIndex];
iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics));
iconTextSizePx = pxFromSp(invIconTextSizeSp, mMetrics);
updateIconSize(1f, res);
updateWorkspacePadding();
@@ -873,13 +878,7 @@ public class DeviceProfile {
// Workspace
final boolean isVerticalLayout = isVerticalBarLayout();
float invIconSizeDp = inv.iconSize[mTypeIndex];
float invIconTextSizeSp = inv.iconTextSize[mTypeIndex];
iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics));
iconTextSizePx = pxFromSp(invIconTextSizeSp, mMetrics);
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * iconScale);
cellLayoutBorderSpacePx = getCellLayoutBorderSpace(inv, scale);
if (isScalableGrid) {
@@ -106,6 +106,7 @@ public class LauncherProvider extends ContentProvider {
public static final String KEY_LAYOUT_PROVIDER_AUTHORITY = "KEY_LAYOUT_PROVIDER_AUTHORITY";
private static final int TEST_WORKSPACE_LAYOUT_RES_XML = R.xml.default_test_workspace;
private static final int TEST2_WORKSPACE_LAYOUT_RES_XML = R.xml.default_test2_workspace;
static final String EMPTY_DATABASE_CREATED = "EMPTY_DATABASE_CREATED";
@@ -114,7 +115,7 @@ public class LauncherProvider extends ContentProvider {
private long mLastRestoreTimestamp = 0L;
private boolean mUseTestWorkspaceLayout;
private int mDefaultWorkspaceLayoutOverride = 0;
/**
* $ adb shell dumpsys activity provider com.android.launcher3
@@ -402,11 +403,21 @@ public class LauncherProvider extends ContentProvider {
return null;
}
case LauncherSettings.Settings.METHOD_SET_USE_TEST_WORKSPACE_LAYOUT_FLAG: {
mUseTestWorkspaceLayout = true;
switch (arg) {
case LauncherSettings.Settings.ARG_DEFAULT_WORKSPACE_LAYOUT_TEST:
mDefaultWorkspaceLayoutOverride = TEST_WORKSPACE_LAYOUT_RES_XML;
break;
case LauncherSettings.Settings.ARG_DEFAULT_WORKSPACE_LAYOUT_TEST2:
mDefaultWorkspaceLayoutOverride = TEST2_WORKSPACE_LAYOUT_RES_XML;
break;
default:
mDefaultWorkspaceLayoutOverride = 0;
break;
}
return null;
}
case LauncherSettings.Settings.METHOD_CLEAR_USE_TEST_WORKSPACE_LAYOUT_FLAG: {
mUseTestWorkspaceLayout = false;
mDefaultWorkspaceLayoutOverride = 0;
return null;
}
case LauncherSettings.Settings.METHOD_LOAD_DEFAULT_FAVORITES: {
@@ -628,8 +639,8 @@ public class LauncherProvider extends ContentProvider {
private DefaultLayoutParser getDefaultLayoutParser(LauncherWidgetHolder widgetHolder) {
InvariantDeviceProfile idp = LauncherAppState.getIDP(getContext());
int defaultLayout = mUseTestWorkspaceLayout
? TEST_WORKSPACE_LAYOUT_RES_XML : idp.defaultLayoutId;
int defaultLayout = mDefaultWorkspaceLayoutOverride > 0
? mDefaultWorkspaceLayoutOverride : idp.defaultLayoutId;
if (getContext().getSystemService(UserManager.class).isDemoUser()
&& idp.demoModeLayoutId != 0) {
@@ -377,6 +377,8 @@ public class LauncherSettings {
public static final String METHOD_SET_USE_TEST_WORKSPACE_LAYOUT_FLAG =
"set_use_test_workspace_layout_flag";
public static final String ARG_DEFAULT_WORKSPACE_LAYOUT_TEST = "default_test_workspace";
public static final String ARG_DEFAULT_WORKSPACE_LAYOUT_TEST2 = "default_test2_workspace";
public static final String METHOD_CLEAR_USE_TEST_WORKSPACE_LAYOUT_FLAG =
"clear_use_test_workspace_layout_flag";
@@ -30,7 +30,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.views.ActivityContext;
@@ -49,12 +48,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
// Used to animate Search results out and A-Z apps in, or vice-versa.
private final SearchTransitionController mSearchTransitionController;
protected SearchUiManager mSearchUiManager;
/**
* View that defines the search box. Result is rendered inside the recycler view defined in the
* base class.
*/
private View mSearchContainer;
/** {@code true} when rendered view is in search state instead of the scroll state. */
private boolean mIsSearching;
private boolean mRebindAdaptersAfterSearchAnimation;
@@ -73,6 +66,12 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
mSearchTransitionController = new SearchTransitionController(this);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mSearchUiManager.initializeSearch(this);
}
public SearchUiManager getSearchUiManager() {
return mSearchUiManager;
}
@@ -142,11 +141,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
});
}
@Override
protected final SearchAdapterProvider<?> createMainAdapterProvider() {
return mActivityContext.createSearchAdapterProvider(this);
}
@Override
public boolean shouldContainerScroll(MotionEvent ev) {
// IF the MotionEvent is inside the search box, and the container keeps on receiving
@@ -166,14 +160,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
animateToSearchState(false, 0);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mSearchContainer = findViewById(R.id.search_container_all_apps);
mSearchUiManager = (SearchUiManager) mSearchContainer;
mSearchUiManager.initializeSearch(this);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
mSearchUiManager.preDispatchKeyEvent(event);
@@ -278,18 +264,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
(int) (mSearchContainer.getAlpha() * 255));
}
@Override
public int getHeaderBottom() {
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
if (mActivityContext.getDeviceProfile().isTablet) {
return super.getHeaderBottom() + mHeader.getClipTop()
+ mBottomSheetBackground.getTop();
}
return super.getHeaderBottom() + mHeader.getClipTop();
}
return super.getHeaderBottom() + mSearchContainer.getBottom();
}
private void layoutBelowSearchContainer(View v, boolean includeTabsMargin) {
if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) {
return;
@@ -364,4 +338,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
? R.dimen.all_apps_header_pill_height
: R.dimen.all_apps_header_top_margin);
}
@Override
public boolean isInAllApps() {
// TODO: Make this abstract
return true;
}
}
@@ -60,6 +60,7 @@ import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.search.DefaultSearchAdapterProvider;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusedItemDecorator;
@@ -105,7 +106,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
protected final List<AdapterHolder> mAH;
protected final Predicate<ItemInfo> mPersonalMatcher = ItemInfoMatcher.ofUser(
Process.myUserHandle());
private final SearchAdapterProvider<?> mMainAdapterProvider;
private final AllAppsStore mAllAppsStore = new AllAppsStore();
private final RecyclerView.OnScrollListener mScrollListener =
@@ -123,11 +123,17 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
protected AllAppsPagedView mViewPager;
private SearchRecyclerView mSearchRecyclerView;
private SearchAdapterProvider<?> mMainAdapterProvider;
protected FloatingHeaderView mHeader;
protected View mBottomSheetBackground;
private View mBottomSheetHandleArea;
@Nullable private View mSearchBarProtection;
/**
* View that defines the search box. Result is rendered inside {@link #mSearchRecyclerView}.
*/
protected View mSearchContainer;
protected SearchUiManager mSearchUiManager;
protected boolean mUsingTabs;
private boolean mHasWorkApps;
@@ -135,7 +141,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
protected RecyclerViewFastScroller mTouchHandler;
protected final Point mFastScrollerOffset = new Point();
private final int mScrimColor;
protected final int mScrimColor;
private final int mHeaderProtectionColor;
protected final float mHeaderThreshold;
private final Path mTmpPath = new Path();
@@ -149,7 +155,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
protected BaseAllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mActivityContext = ActivityContext.lookupContext(context);
mMainAdapterProvider = createMainAdapterProvider();
mScrimColor = Themes.getAttrColor(context, R.attr.allAppsScrimColor);
mHeaderThreshold = getResources().getDimensionPixelSize(
@@ -160,19 +165,84 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
mActivityContext.getSystemService(UserManager.class),
this, LauncherPrefs.getPrefs(mActivityContext));
mAH = Arrays.asList(null, null, null);
mAH.set(AdapterHolder.MAIN, new AdapterHolder(AdapterHolder.MAIN));
mAH.set(AdapterHolder.WORK, new AdapterHolder(AdapterHolder.WORK));
mAH.set(AdapterHolder.SEARCH, new AdapterHolder(AdapterHolder.SEARCH));
mNavBarScrimPaint = new Paint();
mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
mAllAppsStore.addUpdateListener(this::onAppsUpdated);
mActivityContext.addOnDeviceProfileChangeListener(this);
// This is a focus listener that proxies focus from a view into the list view. This is to
// work around the search box from getting first focus and showing the cursor.
setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus && getActiveRecyclerView() != null) {
getActiveRecyclerView().requestFocus();
}
});
initContent();
}
/**
* Initializes the view hierarchy and internal variables. Any initialization which actually uses
* these members should be done in {@link #onFinishInflate()}.
* In terms of subclass initialization, the following would be parallel order for activity:
* initContent -> onPreCreate
* constructor/init -> onCreate
* onFinishInflate -> onPostCreate
*/
protected void initContent() {
mMainAdapterProvider = createMainAdapterProvider();
mAH.set(AdapterHolder.MAIN, new AdapterHolder(AdapterHolder.MAIN));
mAH.set(AdapterHolder.WORK, new AdapterHolder(AdapterHolder.WORK));
mAH.set(AdapterHolder.SEARCH, new AdapterHolder(AdapterHolder.SEARCH));
getLayoutInflater().inflate(R.layout.all_apps_content, this);
mHeader = findViewById(R.id.all_apps_header);
mBottomSheetBackground = findViewById(R.id.bottom_sheet_background);
mBottomSheetHandleArea = findViewById(R.id.bottom_sheet_handle_area);
mSearchRecyclerView = findViewById(R.id.search_results_list_view);
// Add the search box next to the header
mSearchContainer = inflateSearchBox();
addView(mSearchContainer, indexOfChild(mHeader) + 1);
mSearchUiManager = (SearchUiManager) mSearchContainer;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mAH.get(AdapterHolder.SEARCH).setup(mSearchRecyclerView,
/* Filter out A-Z apps */ itemInfo -> false);
rebindAdapters(true /* force */);
float cornerRadius = Themes.getDialogCornerRadius(getContext());
mBottomSheetCornerRadii = new float[]{
cornerRadius,
cornerRadius, // Top left radius in px
cornerRadius,
cornerRadius, // Top right radius in px
0,
0, // Bottom right
0,
0 // Bottom left
};
final TypedValue value = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, value, true);
mBottomSheetBackgroundColor = value.data;
updateBackground(mActivityContext.getDeviceProfile());
}
/**
* Inflates the search box
*/
protected View inflateSearchBox() {
return getLayoutInflater().inflate(R.layout.search_container_all_apps, this, false);
}
/** Creates the adapter provider for the main section. */
protected abstract SearchAdapterProvider<?> createMainAdapterProvider();
protected SearchAdapterProvider<?> createMainAdapterProvider() {
return new DefaultSearchAdapterProvider(mActivityContext);
}
/** The adapter provider for the main section. */
public final SearchAdapterProvider<?> getMainAdapterProvider() {
@@ -289,6 +359,13 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
// The AllAppsContainerView houses the QSB and is hence visible from the Workspace
// Overview states. We shouldn't intercept for the scrubber in these cases.
if (!isInAllApps()) {
mTouchHandler = null;
return false;
}
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
AllAppsRecyclerView rv = getActiveRecyclerView();
if (rv != null && rv.getScrollbar() != null
@@ -306,6 +383,10 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (!isInAllApps()) {
return false;
}
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
AllAppsRecyclerView rv = getActiveRecyclerView();
if (rv != null && rv.getScrollbar() != null
@@ -375,11 +456,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
return mSearchRecyclerView;
}
@Nullable
public View getSearchBarProtection() {
return mSearchBarProtection;
}
protected boolean isPersonalTab() {
return mViewPager == null || mViewPager.getNextPage() == 0;
}
@@ -414,49 +490,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
updateHeaderScroll(0);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
// This is a focus listener that proxies focus from a view into the list view. This is to
// work around the search box from getting first focus and showing the cursor.
setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus && getActiveRecyclerView() != null) {
getActiveRecyclerView().requestFocus();
}
});
mHeader = findViewById(R.id.all_apps_header);
mSearchBarProtection = findViewById(R.id.search_protection);
if (mSearchBarProtection != null) {
mSearchBarProtection.setBackgroundColor(mScrimColor);
mSearchBarProtection.setVisibility(
FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() ? VISIBLE : GONE);
}
mSearchRecyclerView = findViewById(R.id.search_results_list_view);
mAH.get(AdapterHolder.SEARCH).setup(mSearchRecyclerView,
/* Filter out A-Z apps */ itemInfo -> false);
rebindAdapters(true /* force */);
mBottomSheetBackground = findViewById(R.id.bottom_sheet_background);
mBottomSheetHandleArea = findViewById(R.id.bottom_sheet_handle_area);
float cornerRadius = Themes.getDialogCornerRadius(getContext());
mBottomSheetCornerRadii = new float[]{
cornerRadius,
cornerRadius, // Top left radius in px
cornerRadius,
cornerRadius, // Top right radius in px
0,
0, // Bottom right
0,
0 // Bottom left
};
final TypedValue value = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, value, true);
mBottomSheetBackgroundColor = value.data;
updateBackground(mActivityContext.getDeviceProfile());
}
@Override
public void onDropCompleted(View target, DragObject d, boolean success) {}
@@ -781,9 +814,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
canvas.drawPath(mTmpPath, mHeaderPaint);
}
if (!mHeader.isHeaderProtectionSupported()) {
return;
}
if (DEBUG_HEADER_PROTECTION) {
mHeaderPaint.setColor(Color.MAGENTA);
mHeaderPaint.setAlpha(255);
@@ -796,10 +826,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
}
int bottom = getHeaderBottom();
FloatingHeaderView headerView = getFloatingHeaderView();
if (!mUsingTabs && !FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
// Add protection which is otherwise added when tabs scroll up.
bottom += headerView.getTabsAdditionalPaddingTop();
}
if (isTablet) {
// Start adding header protection if search bar or tabs will attach to the top.
if (!FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() || mUsingTabs) {
@@ -836,7 +862,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
* redraws header protection
*/
public void invalidateHeader() {
if (mScrimView != null && mHeader.isHeaderProtectionSupported()) {
if (mScrimView != null) {
mScrimView.invalidate();
}
}
@@ -863,7 +889,14 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
BaseAdapterProvider[] adapterProviders);
public int getHeaderBottom() {
return (int) getTranslationY();
int bottom = (int) getTranslationY() + mHeader.getClipTop();
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
if (mActivityContext.getDeviceProfile().isTablet) {
return bottom + mBottomSheetBackground.getTop();
}
return bottom;
}
return bottom + mHeader.getTop();
}
/**
@@ -877,6 +910,12 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
rv.addOnScrollListener(mScrollListener);
}
/**
* Returns {@code true} the All Apps UI is currently being displayed on the target surface and
* is interactive.
*/
public abstract boolean isInAllApps();
/** Holds a {@link BaseAllAppsAdapter} and related fields. */
public class AdapterHolder {
public static final int MAIN = 0;
@@ -17,7 +17,6 @@ package com.android.launcher3.allapps;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.ArrayMap;
@@ -85,7 +84,6 @@ public class FloatingHeaderView extends LinearLayout implements
// These two values are necessary to ensure that the header protection is drawn correctly.
private final int mTabsAdditionalPaddingTop;
private final int mTabsAdditionalPaddingBottom;
private boolean mHeaderProtectionSupported;
protected ViewGroup mTabLayout;
private AllAppsRecyclerView mMainRV;
@@ -115,7 +113,6 @@ public class FloatingHeaderView extends LinearLayout implements
// enabled or disabled, and represent the current set of all rows.
private FloatingHeaderRow[] mAllRows = FloatingHeaderRow.NO_ROWS;
public FloatingHeaderView(@NonNull Context context) {
this(context, null);
}
@@ -126,15 +123,6 @@ public class FloatingHeaderView extends LinearLayout implements
.getDimensionPixelSize(R.dimen.all_apps_header_top_adjustment);
mTabsAdditionalPaddingBottom = context.getResources()
.getDimensionPixelSize(R.dimen.all_apps_header_bottom_adjustment);
mHeaderProtectionSupported = context.getResources().getBoolean(
R.bool.config_header_protection_supported);
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mHeaderProtectionSupported = getContext().getResources().getBoolean(
R.bool.config_header_protection_supported);
}
@Override
@@ -410,10 +398,6 @@ public class FloatingHeaderView extends LinearLayout implements
return mFloatingRowsHeight;
}
int getTabsAdditionalPaddingTop() {
return mTabsAdditionalPaddingTop;
}
int getTabsAdditionalPaddingBottom() {
return mTabsAdditionalPaddingBottom;
}
@@ -454,10 +438,6 @@ public class FloatingHeaderView extends LinearLayout implements
p.y = getTop() - mCurrentRV.getTop() - ((ViewGroup) mCurrentRV.getParent()).getTop();
}
public boolean isHeaderProtectionSupported() {
return mHeaderProtectionSupported;
}
@Override
public boolean hasOverlappingRendering() {
return false;
@@ -483,10 +463,6 @@ public class FloatingHeaderView extends LinearLayout implements
* Returns visible height of FloatingHeaderView contents requiring header protection
*/
int getPeripheralProtectionHeight() {
if (!mHeaderProtectionSupported) {
return 0;
}
// we only want to show protection when work tab is available and header is either
// collapsed or animating to/from collapsed state
if (mTabsHidden || mFloatingRowsCollapsed || !mHeaderCollapsed) {
@@ -16,61 +16,18 @@
package com.android.launcher3.allapps;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.WindowInsets;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.ExtendedEditText;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
/**
* AllAppsContainerView with launcher specific callbacks
*/
public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<Launcher> {
private final RecyclerView.OnScrollListener mActivityScrollListener =
new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
int scrolledOffset = recyclerView.computeVerticalScrollOffset();
ExtendedEditText input = mSearchUiManager.getEditText();
if (input != null) {
// Save the input box state on scroll down
if (dy > 0) {
input.saveFocusedStateAndUpdateToUnfocusedState();
}
// Scroll up and scroll to top
if (dy < 0 && scrolledOffset == 0) {
// Show keyboard
boolean isImeEnabledOnSwipeUp = Launcher.getLauncher(mActivityContext)
.getSearchConfig().isImeEnabledOnSwipeUp();
if (isImeEnabledOnSwipeUp || !TextUtils.isEmpty(input.getText())) {
input.showKeyboard();
}
// Restore state in input box
input.restoreToFocusedState();
}
}
}
};
@Override
protected void onInitializeRecyclerView(RecyclerView rv) {
super.onInitializeRecyclerView(rv);
if (FeatureFlags.SCROLL_TOP_TO_RESET.get()) {
rv.addOnScrollListener(mActivityScrollListener);
}
}
public LauncherAllAppsContainerView(Context context) {
this(context, null);
}
@@ -83,26 +40,6 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<L
super(context, attrs, defStyleAttr);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
// The AllAppsContainerView houses the QSB and is hence visible from the Workspace
// Overview states. We shouldn't intercept for the scrubber in these cases.
if (!mActivityContext.isInState(LauncherState.ALL_APPS)) {
mTouchHandler = null;
return false;
}
return super.onInterceptTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (!mActivityContext.isInState(LauncherState.ALL_APPS)) {
return false;
}
return super.onTouchEvent(ev);
}
@Override
protected int getNavBarScrimHeight(WindowInsets insets) {
if (Utilities.ATLEAST_Q) {
@@ -111,4 +48,9 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<L
return insets.getStableInsetBottom();
}
}
@Override
public boolean isInAllApps() {
return mActivityContext.getStateManager().isInStableState(LauncherState.ALL_APPS);
}
}
@@ -36,8 +36,6 @@ import android.view.ViewGroup;
import android.view.animation.Interpolator;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
@@ -109,9 +107,7 @@ public class SearchTransitionController {
}
mSearchToAzAnimator = ObjectAnimator.ofFloat(this, SEARCH_TO_AZ_PROGRESS, targetProgress);
boolean inAllApps = Launcher.getLauncher(
mAllAppsContainerView.getContext()).getStateManager().isInStableState(
LauncherState.ALL_APPS);
boolean inAllApps = mAllAppsContainerView.isInAllApps();
if (!inAllApps) {
duration = 0; // Don't want to animate when coming from QSB.
}
@@ -42,4 +42,9 @@ public class SecondaryLauncherAllAppsContainerView extends
@Override
protected void updateBackground(DeviceProfile deviceProfile) {}
@Override
public boolean isInAllApps() {
return mActivityContext.isAppDrawerShown();
}
}
@@ -53,6 +53,7 @@ import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.DisplayController;
import java.util.Collections;
import java.util.List;
@@ -267,15 +268,14 @@ public class SettingsActivity extends FragmentActivity
return !WidgetsModel.GO_DISABLE_NOTIFICATION_DOTS;
case ALLOW_ROTATION_PREFERENCE_KEY:
DeviceProfile deviceProfile = InvariantDeviceProfile.INSTANCE.get(
getContext()).getDeviceProfile(getContext());
if (deviceProfile.isTablet) {
DisplayController.Info info = InvariantDeviceProfile.INSTANCE.get(
getContext()).getDeviceProfile(getContext()).getDisplayInfo();
if (info.isTablet(info.realBounds)) {
// Launcher supports rotation by default. No need to show this setting.
return false;
}
// Initialize the UI once
preference.setDefaultValue(
RotationHelper.getAllowRotationDefaultValue(deviceProfile));
preference.setDefaultValue(RotationHelper.getAllowRotationDefaultValue(info));
return true;
case FLAGS_PREFERENCE_KEY:
@@ -35,7 +35,6 @@ import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import com.android.launcher3.BaseActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.util.DisplayController;
@@ -50,11 +49,11 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
/**
* Returns the default value of {@link #ALLOW_ROTATION_PREFERENCE_KEY} preference.
*/
public static boolean getAllowRotationDefaultValue(DeviceProfile deviceProfile) {
public static boolean getAllowRotationDefaultValue(DisplayController.Info info) {
// If the device's pixel density was scaled (usually via settings for A11y), use the
// original dimensions to determine if rotation is allowed of not.
float originalSmallestWidth = dpiFromPx(
Math.min(deviceProfile.widthPx, deviceProfile.heightPx), DENSITY_DEVICE_STABLE);
float originalSmallestWidth = dpiFromPx(Math.min(info.currentSize.x, info.currentSize.y),
DENSITY_DEVICE_STABLE);
return originalSmallestWidth >= MIN_TABLET_WIDTH;
}
@@ -99,7 +98,8 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
new Handler(UI_HELPER_EXECUTOR.getLooper(), this::setOrientationAsync);
}
private void setIgnoreAutoRotateSettings(boolean ignoreAutoRotateSettings) {
private void setIgnoreAutoRotateSettings(boolean ignoreAutoRotateSettings,
DisplayController.Info info) {
// On large devices we do not handle auto-rotate differently.
mIgnoreAutoRotateSettings = ignoreAutoRotateSettings;
if (!mIgnoreAutoRotateSettings) {
@@ -108,7 +108,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
mSharedPrefs.registerOnSharedPreferenceChangeListener(this);
}
mHomeRotationEnabled = mSharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
getAllowRotationDefaultValue(mActivity.getDeviceProfile()));
getAllowRotationDefaultValue(info));
} else {
if (mSharedPrefs != null) {
mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
@@ -122,7 +122,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
if (mDestroyed || mIgnoreAutoRotateSettings) return;
boolean wasRotationEnabled = mHomeRotationEnabled;
mHomeRotationEnabled = mSharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
getAllowRotationDefaultValue(mActivity.getDeviceProfile()));
getAllowRotationDefaultValue(mActivity.getDeviceProfile().getDisplayInfo()));
if (mHomeRotationEnabled != wasRotationEnabled) {
notifyChange();
}
@@ -132,7 +132,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
public void onDisplayInfoChanged(Context context, DisplayController.Info info, int flags) {
boolean ignoreAutoRotateSettings = info.isTablet(info.realBounds);
if (mIgnoreAutoRotateSettings != ignoreAutoRotateSettings) {
setIgnoreAutoRotateSettings(ignoreAutoRotateSettings);
setIgnoreAutoRotateSettings(ignoreAutoRotateSettings, info);
notifyChange();
}
}
@@ -169,7 +169,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
mInitialized = true;
DisplayController displayController = DisplayController.INSTANCE.get(mActivity);
DisplayController.Info info = displayController.getInfo();
setIgnoreAutoRotateSettings(info.isTablet(info.realBounds));
setIgnoreAutoRotateSettings(info.isTablet(info.realBounds), info);
displayController.addChangeListener(this);
notifyChange();
}
@@ -106,6 +106,7 @@ public final class TestProtocol {
public static final String REQUEST_STOP_EVENT_LOGGING = "stop-event-logging";
public static final String REQUEST_CLEAR_DATA = "clear-data";
public static final String REQUEST_USE_TEST_WORKSPACE_LAYOUT = "use-test-workspace-layout";
public static final String REQUEST_USE_TEST2_WORKSPACE_LAYOUT = "use-test2-workspace-layout";
public static final String REQUEST_USE_DEFAULT_WORKSPACE_LAYOUT =
"use-default-workspace-layout";
public static final String REQUEST_HOTSEAT_ICON_NAMES = "get-hotseat-icon-names";
@@ -432,10 +432,10 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
int drawableWidth, int drawableHeight, DeviceProfile dp,
@StagePosition int stagePosition) {
float insetAdjustment = getPlaceholderSizeAdjustment(dp) / 2f;
out.setX(Math.round(onScreenRectCenterX / fullscreenScaleX
- 1.0f * drawableWidth / 2));
out.setY(Math.round((onScreenRectCenterY + insetAdjustment) / fullscreenScaleY
- 1.0f * drawableHeight / 2));
out.setX(onScreenRectCenterX / fullscreenScaleX
- 1.0f * drawableWidth / 2);
out.setY((onScreenRectCenterY + insetAdjustment) / fullscreenScaleY
- 1.0f * drawableHeight / 2);
}
/**
@@ -463,20 +463,20 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
float insetAdjustment = getPlaceholderSizeAdjustment(dp, pinToRight) / 2f;
if (!dp.isLandscape) {
out.setX(Math.round(onScreenRectCenterX / fullscreenScaleX
- 1.0f * drawableWidth / 2));
out.setY(Math.round((onScreenRectCenterY + insetAdjustment) / fullscreenScaleY
- 1.0f * drawableHeight / 2));
out.setX(onScreenRectCenterX / fullscreenScaleX
- 1.0f * drawableWidth / 2);
out.setY((onScreenRectCenterY + insetAdjustment) / fullscreenScaleY
- 1.0f * drawableHeight / 2);
} else {
if (pinToRight) {
out.setX(Math.round((onScreenRectCenterX - insetAdjustment) / fullscreenScaleX
- 1.0f * drawableWidth / 2));
out.setX((onScreenRectCenterX - insetAdjustment) / fullscreenScaleX
- 1.0f * drawableWidth / 2);
} else {
out.setX(Math.round((onScreenRectCenterX + insetAdjustment) / fullscreenScaleX
- 1.0f * drawableWidth / 2));
out.setX((onScreenRectCenterX + insetAdjustment) / fullscreenScaleX
- 1.0f * drawableWidth / 2);
}
out.setY(Math.round(onScreenRectCenterY / fullscreenScaleY
- 1.0f * drawableHeight / 2));
out.setY(onScreenRectCenterY / fullscreenScaleY
- 1.0f * drawableHeight / 2);
}
}
@@ -54,7 +54,6 @@ import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
import com.android.launcher3.allapps.search.SearchAdapterProvider;
import com.android.launcher3.dot.DotInfo;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.folder.FolderIcon;
@@ -228,16 +227,6 @@ public interface ActivityContext {
return null;
}
/**
* Creates and returns {@link SearchAdapterProvider} for build variant specific search result
* views.
*/
@Nullable
default SearchAdapterProvider<?> createSearchAdapterProvider(
ActivityAllAppsContainerView<?> appsView) {
return null;
}
/**
* Hides the keyboard if it is visible
*/
@@ -162,6 +162,7 @@ public class ArrowTipView extends AbstractFloatingView {
params.gravity = gravity;
params.leftMargin = mArrowMinOffset + grid.getInsets().left;
params.rightMargin = mArrowMinOffset + grid.getInsets().right;
params.width = LayoutParams.MATCH_PARENT;
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mArrowView.getLayoutParams();
lp.gravity = gravity;
@@ -31,6 +31,7 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.compat.AccessibilityManagerCompat;
@@ -97,7 +98,11 @@ public class Snackbar extends AbstractFloatingView {
dragLayer.getWidth() - maxMarginLeftRight * 2 - insets.left - insets.right,
absoluteMaxWidth);
params.width = minWidth;
params.setMargins(0, 0, 0, marginBottom + insets.bottom);
DeviceProfile deviceProfile = activity.getDeviceProfile();
params.setMargins(0, 0, 0, marginBottom
+ (deviceProfile.isTaskbarPresent
? deviceProfile.taskbarSize + deviceProfile.getTaskbarOffsetY()
: insets.bottom));
TextView labelView = snackbar.findViewById(R.id.label);
String labelText = res.getString(labelStringResId);
@@ -21,8 +21,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import android.view.View;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,6 +31,7 @@ import com.android.launcher3.tapl.Workspace;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.ui.TaplTestsLauncher3;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -53,22 +52,24 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
@Before
public void setUp() throws Exception {
super.setUp();
mLauncher.useTest2WorkspaceLayoutOnReload();
TaplTestsLauncher3.initialize(this);
assumeTrue(mLauncher.isTwoPanels());
// Removing the Gmail widget so there are space in the right panel to run the test.
Workspace workspace = mLauncher.getWorkspace();
workspace.deleteWidget(workspace.tryGetWidget("Gmail", DEFAULT_UI_TIMEOUT));
// Pre verifying the screens
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "Photos", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
assertPageEmpty(launcher, 1);
});
}
@After
public void tearDown() {
mLauncher.useDefaultWorkspaceLayoutOnReload();
}
@Test
@PortraitLandscape
public void testDragIconToRightPanel() {
@@ -78,8 +79,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "Photos", "YouTube");
assertItemsOnPage(launcher, 1, "Weather", "Chrome");
assertItemsOnPage(launcher, 0, "Maps", "Play Store");
assertItemsOnPage(launcher, 1, "Chrome");
});
}
@@ -92,39 +93,39 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
workspace.flingBackward();
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 3);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 2, "Chrome");
assertItemsOnPage(launcher, 3, "Photos");
assertItemsOnPage(launcher, 3, "Maps");
});
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 3);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 2, "Chrome");
assertPageEmpty(launcher, 3);
assertPageEmpty(launcher, 4);
assertItemsOnPage(launcher, 5, "Photos");
assertItemsOnPage(launcher, 5, "Maps");
});
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), -1);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 2, "Chrome");
assertItemsOnPage(launcher, 3, "Photos");
assertItemsOnPage(launcher, 3, "Maps");
});
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), -1);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
workspace.flingForward();
@@ -132,8 +133,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1);
assertItemsOnPage(launcher, 0, "Chrome", "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather", "Photos");
assertItemsOnPage(launcher, 0, "Chrome", "Play Store");
assertItemsOnPage(launcher, 1, "Maps");
});
}
@@ -142,13 +143,13 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
public void testDragIconToPage2() {
Workspace workspace = mLauncher.getWorkspace();
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 2);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 2, "Photos");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 2, "Maps");
assertPageEmpty(launcher, 3);
});
}
@@ -162,8 +163,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "Photos", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
assertPageEmpty(launcher, 1);
assertPageEmpty(launcher, 2);
assertItemsOnPage(launcher, 3, "Phone");
});
@@ -178,16 +179,16 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
workspace.flingBackward();
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 5);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 5);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 2, "Messages");
assertPageEmpty(launcher, 3);
assertPageEmpty(launcher, 4);
assertItemsOnPage(launcher, 5, "Photos");
assertItemsOnPage(launcher, 5, "Maps");
});
workspace.flingBackward();
@@ -196,10 +197,10 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 4, 5, 6, 7);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertPageEmpty(launcher, 4);
assertItemsOnPage(launcher, 5, "Photos");
assertItemsOnPage(launcher, 5, "Maps");
assertItemsOnPage(launcher, 6, "Messages");
assertPageEmpty(launcher, 7);
});
@@ -208,10 +209,10 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 4, 5);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather", "Messages");
assertItemsOnPage(launcher, 0, "Play Store");
assertItemsOnPage(launcher, 1, "Messages");
assertPageEmpty(launcher, 4);
assertItemsOnPage(launcher, 5, "Photos");
assertItemsOnPage(launcher, 5, "Maps");
});
}
@@ -220,23 +221,23 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
public void testEmptyPageDoesNotGetRemovedIfPagePairIsNotEmpty() {
Workspace workspace = mLauncher.getWorkspace();
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 3);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
workspace.dragIcon(workspace.getHotseatAppIcon("Chrome"), 0);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 2, "Chrome");
assertItemsOnPage(launcher, 3, "Photos");
assertItemsOnPage(launcher, 3, "Maps");
});
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), -1);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather", "Photos");
assertItemsOnPage(launcher, 0, "Play Store");
assertItemsOnPage(launcher, 1, "Maps");
assertItemsOnPage(launcher, 2, "Chrome");
assertPageEmpty(launcher, 3);
});
@@ -248,8 +249,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather", "Photos");
assertItemsOnPage(launcher, 0, "Play Store");
assertItemsOnPage(launcher, 1, "Maps");
assertPageEmpty(launcher, 2);
assertItemsOnPage(launcher, 3, "Chrome");
});
@@ -265,8 +266,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
assertItemsOnPage(launcher, 0, "Gmail", "Photos", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 0, "Maps");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 2, "Play Store");
assertItemsOnPage(launcher, 3, "Chrome");
});
@@ -277,8 +278,8 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "Photos", "YouTube");
assertItemsOnPage(launcher, 1, "Weather", "Chrome");
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
assertItemsOnPage(launcher, 1, "Chrome");
});
}
@@ -287,27 +288,27 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
public void testMiddleEmptyPagesGetRemoved() {
Workspace workspace = mLauncher.getWorkspace();
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 2);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
workspace.dragIcon(workspace.getHotseatAppIcon("Messages"), 3);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 2, "Photos");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 2, "Maps");
assertPageEmpty(launcher, 3);
assertPageEmpty(launcher, 4);
assertItemsOnPage(launcher, 5, "Messages");
});
workspace.flingBackward();
workspace.dragIcon(workspace.getWorkspaceAppIcon("Photos"), 2);
workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 4, 5);
assertItemsOnPage(launcher, 0, "Play Store", "Gmail", "YouTube");
assertItemsOnPage(launcher, 1, "Weather");
assertItemsOnPage(launcher, 4, "Photos");
assertItemsOnPage(launcher, 0, "Play Store");
assertPageEmpty(launcher, 1);
assertItemsOnPage(launcher, 4, "Maps");
assertItemsOnPage(launcher, 5, "Messages");
});
}
@@ -335,21 +336,14 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
CellLayout page = launcher.getWorkspace().getScreenWithId(pageId);
int itemCount = page.getShortcutsAndWidgets().getChildCount();
for (int i = 0; i < itemCount; i++) {
CharSequence title = null;
View child = page.getShortcutsAndWidgets().getChildAt(i);
ItemInfo itemInfo = (ItemInfo) child.getTag();
ItemInfo itemInfo = (ItemInfo) page.getShortcutsAndWidgets().getChildAt(i).getTag();
if (itemInfo != null) {
title = itemInfo.title;
}
if (title == null) {
title = child.getContentDescription();
}
if (title != null) {
assertTrue("There was an extra item on page " + pageId + ": " + title,
itemTitleSet.remove(title));
assertTrue("There was an extra item on page " + pageId + ": " + itemInfo.title,
itemTitleSet.remove(itemInfo.title));
}
}
assertTrue("Could NOT find some of the items on page " + pageId + ": "
+ String.join(",", itemTitleSet), itemTitleSet.isEmpty());
+ itemTitleSet.stream().collect(Collectors.joining(",")),
itemTitleSet.isEmpty());
}
}
}
@@ -1853,6 +1853,14 @@ public final class LauncherInstrumentation {
getTestInfo(TestProtocol.REQUEST_USE_TEST_WORKSPACE_LAYOUT);
}
/**
* Reloads the workspace with a test layout that includes Maps/Play on workspace, and
* Dialer/Messaging/Chrome/Camera on hotseat.
*/
public void useTest2WorkspaceLayoutOnReload() {
getTestInfo(TestProtocol.REQUEST_USE_TEST2_WORKSPACE_LAYOUT);
}
/** Reloads the workspace with the default layout defined by the user's grid size selection. */
public void useDefaultWorkspaceLayoutOnReload() {
getTestInfo(TestProtocol.REQUEST_USE_DEFAULT_WORKSPACE_LAYOUT);
@@ -334,28 +334,14 @@ public final class Workspace extends Home {
* @return validated workspace after the existing appIcon being deleted.
*/
public Workspace deleteAppIcon(HomeAppIcon homeAppIcon) {
return deleteLaunchable(homeAppIcon, LONG_CLICK_EVENT);
}
/**
* Delete the widget from the workspace.
*
* @param widget to be deleted.
* @return validated workspace after the existing widget being deleted.
*/
public Workspace deleteWidget(Widget widget) {
return deleteLaunchable(widget, Widget.LONG_CLICK_EVENT);
}
private Workspace deleteLaunchable(Launchable launchable, Pattern longClickEvent) {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"removing app icon from workspace")) {
dragIconToWorkspace(
mLauncher,
launchable,
homeAppIcon,
() -> getDropPointFromDropTargetBar(mLauncher, DELETE_TARGET_TEXT_ID),
() -> mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, longClickEvent),
() -> mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT),
/* expectDropEvents= */ null);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(