diff options
36 files changed, 285 insertions, 141 deletions
diff --git a/Android.bp b/Android.bp index de88d42ea0..fabf234465 100644 --- a/Android.bp +++ b/Android.bp @@ -273,7 +273,7 @@ android_library { "androidx.room_room-runtime", ], plugins: ["androidx.room_room-compiler-plugin"], - manifest: "quickstep/AndroidManifest.xml", + manifest: "quickstep/AndroidManifest-launcher.xml", additional_manifests: [ "go/AndroidManifest.xml", "AndroidManifest-common.xml", @@ -367,6 +367,7 @@ android_app { enabled: false, }, + certificate: "platform", platform_apis: true, min_sdk_version: "current", target_sdk_version: "current", diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index 60ddfb6ce5..2a04c48b0e 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -44,6 +44,8 @@ <!-- for rotating surface by arbitrary degree --> <uses-permission android:name="android.permission.ROTATE_SURFACE_FLINGER" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> + <!-- for double tap to sleep --> + <uses-permission android:name="android.permission.DEVICE_POWER" /> <!-- Permissions required for read/write access to the workspace data. These permission name @@ -131,12 +133,13 @@ <!-- The content provider for exposing various launcher grid options. - TODO: Add proper permissions --> <provider android:name="com.android.launcher3.graphics.GridCustomizationsProvider" android:authorities="${packageName}.grid_control" - android:exported="true" /> + android:exported="true" + android:writePermission="${packageName}.permission.WRITE_SETTINGS" + android:readPermission="${packageName}.permission.READ_SETTINGS" /> <!-- The settings activity. To extend point settings_fragment_name to appropriate fragment class diff --git a/quickstep/res/drawable/ic_clear_all.xml b/quickstep/res/drawable/ic_clear_all.xml new file mode 100644 index 0000000000..09a8e06a7b --- /dev/null +++ b/quickstep/res/drawable/ic_clear_all.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2020 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path android:fillColor="#FF000000" android:pathData="M5,13H19V11H5M3,17H17V15H3M7,7V9H21V7" /> +</vector> diff --git a/quickstep/res/layout/overview_actions_container.xml b/quickstep/res/layout/overview_actions_container.xml index 0fda0bf8d4..35f59dfce3 100644 --- a/quickstep/res/layout/overview_actions_container.xml +++ b/quickstep/res/layout/overview_actions_container.xml @@ -41,6 +41,20 @@ android:theme="@style/ThemeControlHighlightWorkspaceColor" /> <Space + android:layout_width="0dp" + android:layout_height="1dp" + android:layout_weight="1" /> + + <Button + android:id="@+id/action_clear_all" + style="@style/OverviewActionButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:drawableStart="@drawable/ic_clear_all" + android:text="@string/recents_clear_all" + android:theme="@style/ThemeControlHighlightWorkspaceColor" /> + + <Space android:id="@+id/action_split_space" android:layout_width="@dimen/overview_actions_button_spacing" android:layout_height="1dp" diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index e5787209d2..87ddac2ccc 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -74,7 +74,6 @@ public class BackgroundAppState extends OverviewState { public int getVisibleElements(Launcher launcher) { return super.getVisibleElements(launcher) & ~OVERVIEW_ACTIONS - & ~CLEAR_ALL_BUTTON & ~VERTICAL_SWIPE_INDICATOR; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index b9221eef9d..92a26d8685 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -46,7 +46,7 @@ public class OverviewModalTaskState extends OverviewState { @Override public int getVisibleElements(Launcher launcher) { - return OVERVIEW_ACTIONS | CLEAR_ALL_BUTTON; + return OVERVIEW_ACTIONS; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 214679acbe..52532ebf6e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -107,7 +107,7 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { - return CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS; + return OVERVIEW_ACTIONS; } @Override diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index f3fb259aa5..1c260abd1a 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -505,15 +505,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, HashMap<Integer, ThumbnailData> snapshots = mGestureState.consumeRecentsAnimationCanceledSnapshot(); if (snapshots != null) { - mRecentsView.switchToScreenshot(snapshots, () -> { - if (mRecentsAnimationController != null) { - mRecentsAnimationController.cleanupScreenshot(); - } else if (mDeferredCleanupRecentsAnimationController != null) { - mDeferredCleanupRecentsAnimationController.cleanupScreenshot(); - mDeferredCleanupRecentsAnimationController = null; - } - }); mRecentsView.onRecentsAnimationComplete(); + if (mRecentsAnimationController != null) { + mRecentsAnimationController.cleanupScreenshot(); + } else if (mDeferredCleanupRecentsAnimationController != null) { + mDeferredCleanupRecentsAnimationController.cleanupScreenshot(); + mDeferredCleanupRecentsAnimationController = null; + } } }); diff --git a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java index ea9f032000..34eecd17e9 100644 --- a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java @@ -237,7 +237,7 @@ public final class LauncherActivityInterface extends @Override public void onStateTransitionComplete(LauncherState toState) { // Are we going from Recents to Workspace? - if (toState == LauncherState.NORMAL) { + if (toState == LauncherState.NORMAL || toState == LauncherState.ALL_APPS) { exitRunnable.run(); notifyRecentsOfOrientation(deviceState); stateManager.removeStateListener(this); diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java index 6e47ff4716..8019bf00f9 100644 --- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java @@ -202,6 +202,11 @@ public class TaskOverlayFactory implements ResourceBasedOverride { overviewPanel.initiateSplitSelect(mThumbnailView.getTaskView()); } + private void clearAllTasks() { + final RecentsView recentsView = mThumbnailView.getTaskView().getRecentsView(); + recentsView.dismissAllTasks(); + } + /** * Called when the overlay is no longer used. */ @@ -309,13 +314,20 @@ public class TaskOverlayFactory implements ResourceBasedOverride { } @SuppressLint("NewApi") + @Override public void onScreenshot() { endLiveTileMode(() -> saveScreenshot(mTask)); } + @Override public void onSplit() { endLiveTileMode(TaskOverlay.this::enterSplitSelect); } + + @Override + public void onClearAllTasksRequested() { + endLiveTileMode(TaskOverlay.this::clearAllTasks); + } } } @@ -329,5 +341,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { /** User wants to start split screen with current app. */ void onSplit(); + + void onClearAllTasksRequested(); } } diff --git a/quickstep/src/com/android/quickstep/fallback/RecentsState.java b/quickstep/src/com/android/quickstep/fallback/RecentsState.java index 8b5f091e11..601021b5bf 100644 --- a/quickstep/src/com/android/quickstep/fallback/RecentsState.java +++ b/quickstep/src/com/android/quickstep/fallback/RecentsState.java @@ -106,7 +106,7 @@ public class RecentsState implements BaseState<RecentsState> { * For this state, whether clear all button should be shown. */ public boolean hasClearAllButton() { - return hasFlag(FLAG_CLEAR_ALL_BUTTON); + return false; } /** diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java index e47c0893e5..0d170aefb4 100644 --- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java @@ -136,6 +136,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo mMultiValueAlpha.setUpdateVisibility(true); findViewById(R.id.action_screenshot).setOnClickListener(this); + findViewById(R.id.action_clear_all).setOnClickListener(this); mSplitButton = findViewById(R.id.action_split); mSplitButton.setOnClickListener(this); } @@ -154,11 +155,13 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo if (mCallbacks == null) { return; } - int id = view.getId(); + final int id = view.getId(); if (id == R.id.action_screenshot) { mCallbacks.onScreenshot(); } else if (id == R.id.action_split) { mCallbacks.onSplit(); + } else if (id == R.id.action_clear_all) { + mCallbacks.onClearAllTasksRequested(); } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 904537fddf..cdd79d5376 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -3977,6 +3977,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T mActivity.getStatsLogManager().logger().log(LAUNCHER_TASK_CLEAR_ALL); } + public void dismissAllTasks() { + dismissAllTasks(null); + } + private void dismissCurrentTask() { TaskView taskView = getNextPageTaskView(); if (taskView != null) { diff --git a/res/drawable/all_apps_search_hint.xml b/res/drawable/all_apps_search_hint.xml index b2ff7a428e..a066e98d9d 100644 --- a/res/drawable/all_apps_search_hint.xml +++ b/res/drawable/all_apps_search_hint.xml @@ -16,5 +16,5 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="@android:color/transparent" android:state_focused="true" /> - <item android:color="?android:attr/colorAccent"/> + <item android:color="?android:attr/textColorSecondary" android:alpha="?android:attr/disabledAlpha" /> </selector>
\ No newline at end of file diff --git a/res/drawable/bg_all_apps_searchbox.xml b/res/drawable/bg_all_apps_searchbox.xml index 3c321e4c49..b95e468c18 100644 --- a/res/drawable/bg_all_apps_searchbox.xml +++ b/res/drawable/bg_all_apps_searchbox.xml @@ -14,7 +14,6 @@ limitations under the License. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="?attr/popupColorPrimary" /> + <solid android:color="?attr/allappsHeaderProtectionColor" /> <corners android:radius="@dimen/rounded_button_radius" /> - <stroke android:color="?attr/allappsHeaderProtectionColor" android:width=".5dp" /> </shape>
\ No newline at end of file diff --git a/res/layout/search_container_all_apps.xml b/res/layout/search_container_all_apps.xml index db218c3d4b..6d8f3613a9 100644 --- a/res/layout/search_container_all_apps.xml +++ b/res/layout/search_container_all_apps.xml @@ -17,21 +17,25 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/search_container_all_apps" android:layout_width="match_parent" - android:layout_height="@dimen/all_apps_search_bar_field_height" + android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_gravity="top|center_horizontal" android:background="@drawable/bg_all_apps_searchbox" android:focusableInTouchMode="true" - android:gravity="center" + android:gravity="center_vertical" 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:paddingVertical="12dp" + android:paddingStart="12dp" + android:paddingEnd="12dp" + android:drawablePadding="8dp" + android:drawableStart="@drawable/ic_allapps_search" android:saveEnabled="false" android:scrollHorizontally="true" android:singleLine="true" android:textColor="?android:attr/textColorSecondary" android:textColorHint="@drawable/all_apps_search_hint" - android:textSize="16sp" />
\ No newline at end of file + android:textSize="20sp" />
\ No newline at end of file diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml index 054fe47125..8e4160b243 100644 --- a/res/values-v31/colors.xml +++ b/res/values-v31/colors.xml @@ -19,7 +19,7 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> <color name="popup_color_primary_light">@android:color/system_accent2_50</color> <color name="popup_color_secondary_light">@android:color/system_neutral2_100</color> - <color name="popup_color_tertiary_light">@android:color/system_neutral2_300</color> + <color name="popup_color_tertiary_light">@android:color/system_neutral2_100</color> <color name="popup_color_neutral_dark">@android:color/system_neutral1_1000</color> <color name="popup_color_primary_dark">@android:color/system_neutral2_800</color> <color name="popup_color_secondary_dark">@android:color/system_neutral1_900</color> diff --git a/res/values-zh-rCN/ice_config.xml b/res/values-zh-rCN/ice_config.xml new file mode 100644 index 0000000000..b822fcaaa8 --- /dev/null +++ b/res/values-zh-rCN/ice_config.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2023 Project ICE + + 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. +--> +<resources> + <!-- Sort sections of apps list, in case AlphabeticIndex (of current locale) + returns duplicate labels for some reasons. --> + <bool name="config_appsListSortSections">true</bool> +</resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index cd41bafcee..e434e1b994 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -107,7 +107,12 @@ <dimen name="all_apps_search_bar_field_height">48dp</dimen> <!-- all_apps_search_bar_field_height / 2 --> <dimen name="all_apps_search_bar_content_overlap">24dp</dimen> - <dimen name="all_apps_search_bar_bottom_padding">30dp</dimen> + <!-- affects padding above apps lists when tabs and floating header rows are not visible --> + <!-- (always affects padding above search results) --> + <dimen name="all_apps_search_bar_bottom_padding">24dp</dimen> + <!-- margin adjustment for layout relative to bottom of search container --> + <!-- if the search container is obscuring things, try adjusting this --> + <dimen name="all_apps_search_bar_bottom_adjustment">-6dp</dimen> <dimen name="all_apps_empty_search_message_top_offset">40dp</dimen> <dimen name="all_apps_header_pill_height">48dp</dimen> <dimen name="all_apps_header_pill_corner_radius">12dp</dimen> @@ -117,7 +122,10 @@ <dimen name="all_apps_header_top_padding">36dp</dimen> <!-- Additional top padding to add when Floating Searchbar is enabled. --> <dimen name="all_apps_additional_top_padding_floating_search">16dp</dimen> - <dimen name="all_apps_header_bottom_padding">14dp</dimen> + <!-- influences header protection drawn height below personal/work tabs --> + <!-- if app icons are appearing above the protection rectangle, or if they are shifted below + it and cropped at the top, try adjusting this --> + <dimen name="all_apps_header_bottom_padding">10dp</dimen> <dimen name="all_apps_header_top_adjustment">6dp</dimen> <dimen name="all_apps_header_bottom_adjustment">4dp</dimen> <dimen name="all_apps_work_profile_tab_footer_top_padding">16dp</dimen> diff --git a/res/values/ice_config.xml b/res/values/ice_config.xml new file mode 100644 index 0000000000..b89ba194b2 --- /dev/null +++ b/res/values/ice_config.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2023 Project ICE + + 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. +--> +<resources> + <!-- Sort sections of apps list, in case AlphabeticIndex (of current locale) + returns duplicate labels for some reasons. --> + <bool name="config_appsListSortSections">false</bool> +</resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 5dc4f0afa1..d5f3f410b5 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -94,6 +94,7 @@ <item name="android:colorControlHighlight">#19FFFFFF</item> <item name="android:colorPrimary">#FF212121</item> <item name="allAppsScrimColor">?android:attr/colorBackgroundFloating</item> + <item name="allappsHeaderProtectionColor">@color/popup_color_tertiary_dark</item> <item name="allAppsNavBarScrimColor">#80000000</item> <item name="popupColorPrimary">@color/popup_color_primary_dark</item> <item name="popupColorSecondary">@color/popup_color_secondary_dark</item> @@ -199,7 +200,9 @@ <item name="android:importantForAccessibility">no</item> </style> - <style name="BaseIconRoot" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle"/> + <style name="BaseIconRoot" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle"> + <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> + </style> <style name="BaseIconUnBounded" parent="BaseIconRoot"> <item name="android:layout_width">match_parent</item> diff --git a/res/xml/default_workspace_4x4.xml b/res/xml/default_workspace_4x5.xml index bf3c62c77d..bf3c62c77d 100644 --- a/res/xml/default_workspace_4x4.xml +++ b/res/xml/default_workspace_4x5.xml diff --git a/res/xml/default_workspace_5x5.xml b/res/xml/default_workspace_5x5.xml index b4ac8f63df..e612cebf92 100644 --- a/res/xml/default_workspace_5x5.xml +++ b/res/xml/default_workspace_5x5.xml @@ -17,7 +17,7 @@ <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, [Maps/Music], Browser, Camera --> + <!-- Dialer, Messaging, [Maps/Music/Settings], Browser, Camera --> <resolve launcher:container="-101" launcher:screen="0" @@ -47,6 +47,7 @@ launcher:y="0" > <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MAPS;end" /> <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MUSIC;end" /> + <favorite launcher:uri="#Intent;action=android.settings.SETTINGS;end" /> </resolve> <resolve diff --git a/res/xml/default_workspace_3x3.xml b/res/xml/default_workspace_5x6.xml index 31376e1d5e..e612cebf92 100644 --- a/res/xml/default_workspace_3x3.xml +++ b/res/xml/default_workspace_5x6.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 The Android Open Source Project +<!-- Copyright (C) 2009 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. @@ -17,13 +17,22 @@ <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) --> - <!-- Messaging, [All Apps], Dialer --> - + <!-- Dialer, Messaging, [Maps/Music/Settings], Browser, Camera --> <resolve launcher:container="-101" launcher:screen="0" launcher:x="0" launcher:y="0" > + <favorite launcher:uri="#Intent;action=android.intent.action.DIAL;end" /> + <favorite launcher:uri="tel:123" /> + <favorite launcher:uri="#Intent;action=android.intent.action.CALL_BUTTON;end" /> + </resolve> + + <resolve + launcher:container="-101" + launcher:screen="1" + launcher:x="1" + launcher:y="0" > <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MESSAGING;end" /> <favorite launcher:uri="sms:" /> <favorite launcher:uri="smsto:" /> @@ -31,16 +40,33 @@ <favorite launcher:uri="mmsto:" /> </resolve> - <!-- All Apps --> - <resolve launcher:container="-101" launcher:screen="2" launcher:x="2" launcher:y="0" > - <favorite launcher:uri="#Intent;action=android.intent.action.DIAL;end" /> - <favorite launcher:uri="tel:123" /> - <favorite launcher:uri="#Intent;action=android.intent.action.CALL_BUTTON;end" /> + <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MAPS;end" /> + <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MUSIC;end" /> + <favorite launcher:uri="#Intent;action=android.settings.SETTINGS;end" /> + </resolve> + + <resolve + launcher:container="-101" + launcher:screen="3" + launcher:x="3" + launcher:y="0" > + <favorite + launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_BROWSER;end" /> + <favorite launcher:uri="http://www.example.com/" /> + </resolve> + + <resolve + launcher:container="-101" + launcher:screen="4" + launcher:x="4" + launcher:y="0" > + <favorite launcher:uri="#Intent;action=android.media.action.STILL_IMAGE_CAMERA;end" /> + <favorite launcher:uri="#Intent;action=android.intent.action.CAMERA_BUTTON;end" /> </resolve> <!-- Bottom row --> @@ -48,21 +74,23 @@ launcher:screen="0" launcher:x="0" launcher:y="-1" > - <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_EMAIL;end" /> - <favorite launcher:uri="mailto:" /> + <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_EMAIL;end" /> + <favorite launcher:uri="mailto:" /> + </resolve> <resolve launcher:screen="0" launcher:x="1" launcher:y="-1" > - <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_GALLERY;end" /> - <favorite launcher:uri="#Intent;type=images/*;end" /> + <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_GALLERY;end" /> + <favorite launcher:uri="#Intent;type=images/*;end" /> + </resolve> <resolve launcher:screen="0" - launcher:x="2" + launcher:x="4" launcher:y="-1" > <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MARKET;end" /> <favorite launcher:uri="market://details?id=com.android.launcher" /> diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml index c9a44a1be0..14503e2832 100644 --- a/res/xml/device_profiles.xml +++ b/res/xml/device_profiles.xml @@ -18,56 +18,23 @@ <profiles xmlns:launcher="http://schemas.android.com/apk/res-auto" > <grid-option - launcher:name="3_by_3" - launcher:numRows="3" - launcher:numColumns="3" - launcher:numFolderRows="2" - launcher:numFolderColumns="3" - launcher:numHotseatIcons="3" - launcher:dbFile="launcher_3_by_3.db" - launcher:defaultLayoutId="@xml/default_workspace_3x3" - launcher:deviceCategory="phone" > - - <display-option - launcher:name="Super Short Stubby" - launcher:minWidthDps="255" - launcher:minHeightDps="300" - launcher:iconImageSize="48" - launcher:iconTextSize="13.0" - launcher:allAppsBorderSpace="16" - launcher:allAppsCellHeight="104" - launcher:canBeDefault="true" /> - - <display-option - launcher:name="Shorter Stubby" - launcher:minWidthDps="255" - launcher:minHeightDps="400" - launcher:iconImageSize="48" - launcher:iconTextSize="13.0" - launcher:allAppsBorderSpace="16" - launcher:allAppsCellHeight="104" - launcher:canBeDefault="true" /> - - </grid-option> - - <grid-option - launcher:name="4_by_4" - launcher:numRows="4" + launcher:name="4_by_5" + launcher:numRows="5" launcher:numColumns="4" launcher:numFolderRows="3" - launcher:numFolderColumns="4" + launcher:numFolderColumns="3" launcher:numHotseatIcons="4" launcher:numExtendedHotseatIcons="6" - launcher:dbFile="launcher_4_by_4.db" + launcher:dbFile="launcher_4_by_5.db" launcher:inlineNavButtonsEndSpacing="@dimen/taskbar_button_margin_split" - launcher:defaultLayoutId="@xml/default_workspace_4x4" + launcher:defaultLayoutId="@xml/default_workspace_4x5" launcher:deviceCategory="phone|multi_display" > <display-option launcher:name="Short Stubby" launcher:minWidthDps="275" launcher:minHeightDps="420" - launcher:iconImageSize="48" + launcher:iconImageSize="66" launcher:iconTextSize="13.0" launcher:allAppsBorderSpace="16" launcher:allAppsCellHeight="104" @@ -77,7 +44,7 @@ launcher:name="Stubby" launcher:minWidthDps="255" launcher:minHeightDps="450" - launcher:iconImageSize="48" + launcher:iconImageSize="66" launcher:iconTextSize="13.0" launcher:allAppsBorderSpace="16" launcher:allAppsCellHeight="104" @@ -87,7 +54,7 @@ launcher:name="Nexus S" launcher:minWidthDps="296" launcher:minHeightDps="491.33" - launcher:iconImageSize="48" + launcher:iconImageSize="66" launcher:iconTextSize="13.0" launcher:allAppsBorderSpace="16" launcher:allAppsCellHeight="104" @@ -97,7 +64,7 @@ launcher:name="Nexus 4" launcher:minWidthDps="359" launcher:minHeightDps="567" - launcher:iconImageSize="54" + launcher:iconImageSize="66" launcher:iconTextSize="13.0" launcher:allAppsBorderSpace="16" launcher:allAppsCellHeight="104" @@ -107,7 +74,7 @@ launcher:name="Nexus 5" launcher:minWidthDps="335" launcher:minHeightDps="567" - launcher:iconImageSize="54" + launcher:iconImageSize="66" launcher:iconTextSize="13.0" launcher:allAppsBorderSpace="16" launcher:allAppsCellHeight="104" @@ -133,7 +100,7 @@ launcher:minWidthDps="406" launcher:minHeightDps="694" launcher:iconImageSize="56" - launcher:iconTextSize="14.4" + launcher:iconTextSize="12.0" launcher:allAppsBorderSpace="16" launcher:allAppsCellHeight="104" launcher:canBeDefault="true" /> @@ -143,7 +110,7 @@ launcher:minWidthDps="406" launcher:minHeightDps="694" launcher:iconImageSize="56" - launcher:iconTextSize="14.4" + launcher:iconTextSize="12.0" launcher:allAppsBorderSpace="16" launcher:allAppsCellHeight="104" launcher:canBeDefault="true" /> @@ -153,7 +120,30 @@ launcher:minWidthDps="255" launcher:minHeightDps="400" launcher:iconImageSize="48" - launcher:iconTextSize="13.0" + launcher:iconTextSize="12.0" + launcher:allAppsBorderSpace="16" + launcher:allAppsCellHeight="104" + launcher:canBeDefault="true" /> + + </grid-option> + + <grid-option + launcher:name="5_by_6" + launcher:numRows="6" + launcher:numColumns="5" + launcher:numFolderRows="5" + launcher:numFolderColumns="4" + launcher:numHotseatIcons="5" + launcher:dbFile="launcher_5_by_6.db" + launcher:defaultLayoutId="@xml/default_workspace_5x6" + launcher:deviceCategory="phone|multi_display" > + + <display-option + launcher:name="Large Phone" + launcher:minWidthDps="406" + launcher:minHeightDps="694" + launcher:iconImageSize="56" + launcher:iconTextSize="12.0" launcher:allAppsBorderSpace="16" launcher:allAppsCellHeight="104" launcher:canBeDefault="true" /> diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java index bc4a5c343f..38ce740ff3 100644 --- a/src/com/android/launcher3/AppWidgetResizeFrame.java +++ b/src/com/android/launcher3/AppWidgetResizeFrame.java @@ -15,7 +15,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; -import android.appwidget.AppWidgetProviderInfo; import android.content.Context; import android.graphics.Rect; import android.graphics.drawable.Drawable; @@ -221,23 +220,6 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O mWidgetPadding = getDefaultPaddingForWidget(getContext(), widgetView.getAppWidgetInfo().provider, null); - // Only show resize handles for the directions in which resizing is possible. - InvariantDeviceProfile idp = LauncherAppState.getIDP(cellLayout.getContext()); - mVerticalResizeActive = (info.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0 - && mMinVSpan < idp.numRows && mMaxVSpan > 1 - && mMinVSpan < mMaxVSpan; - if (!mVerticalResizeActive) { - mDragHandles[INDEX_TOP].setVisibility(GONE); - mDragHandles[INDEX_BOTTOM].setVisibility(GONE); - } - mHorizontalResizeActive = (info.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0 - && mMinHSpan < idp.numColumns && mMaxHSpan > 1 - && mMinHSpan < mMaxHSpan; - if (!mHorizontalResizeActive) { - mDragHandles[INDEX_LEFT].setVisibility(GONE); - mDragHandles[INDEX_RIGHT].setVisibility(GONE); - } - mReconfigureButton = (ImageButton) findViewById(R.id.widget_reconfigure_button); if (info.isReconfigurable()) { mReconfigureButton.setVisibility(VISIBLE); @@ -293,12 +275,10 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O } public boolean beginResizeIfPointInRegion(int x, int y) { - mLeftBorderActive = (x < mTouchTargetWidth) && mHorizontalResizeActive; - mRightBorderActive = (x > getWidth() - mTouchTargetWidth) && mHorizontalResizeActive; - mTopBorderActive = (y < mTouchTargetWidth + mTopTouchRegionAdjustment) - && mVerticalResizeActive; - mBottomBorderActive = (y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment) - && mVerticalResizeActive; + mLeftBorderActive = x < mTouchTargetWidth; + mRightBorderActive = x > getWidth() - mTouchTargetWidth; + mTopBorderActive = y < mTouchTargetWidth + mTopTouchRegionAdjustment; + mBottomBorderActive = y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment; boolean anyBordersActive = mLeftBorderActive || mRightBorderActive || mTopBorderActive || mBottomBorderActive; diff --git a/src/com/android/launcher3/LauncherFiles.java b/src/com/android/launcher3/LauncherFiles.java index e59eac8dd2..583640eddc 100644 --- a/src/com/android/launcher3/LauncherFiles.java +++ b/src/com/android/launcher3/LauncherFiles.java @@ -17,10 +17,8 @@ public class LauncherFiles { public static final String LAUNCHER_DB = "launcher.db"; public static final String LAUNCHER_6_BY_5_DB = "launcher_6_by_5.db"; + public static final String LAUNCHER_5_BY_6_DB = "launcher_5_by_6.db"; public static final String LAUNCHER_4_BY_5_DB = "launcher_4_by_5.db"; - public static final String LAUNCHER_4_BY_4_DB = "launcher_4_by_4.db"; - public static final String LAUNCHER_3_BY_3_DB = "launcher_3_by_3.db"; - public static final String LAUNCHER_2_BY_2_DB = "launcher_2_by_2.db"; public static final String BACKUP_DB = "backup.db"; public static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs"; public static final String MANAGED_USER_PREFERENCES_KEY = @@ -34,10 +32,8 @@ public class LauncherFiles { public static final List<String> GRID_DB_FILES = Collections.unmodifiableList(Arrays.asList( LAUNCHER_DB, LAUNCHER_6_BY_5_DB, - LAUNCHER_4_BY_5_DB, - LAUNCHER_4_BY_4_DB, - LAUNCHER_3_BY_3_DB, - LAUNCHER_2_BY_2_DB)); + LAUNCHER_5_BY_6_DB, + LAUNCHER_4_BY_5_DB)); public static final List<String> OTHER_FILES = Collections.unmodifiableList(Arrays.asList( BACKUP_DB, diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index ba492d57e2..482a1c5e35 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2150,8 +2150,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> private Runnable getWidgetResizeFrameRunnable(DragOptions options, LauncherAppWidgetHostView hostView, CellLayout cellLayout) { AppWidgetProviderInfo pInfo = hostView.getAppWidgetInfo(); - if (pInfo != null && pInfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE - && !options.isAccessibleDrag) { + if (pInfo != null && !options.isAccessibleDrag) { return () -> { if (!isPageInTransition()) { AppWidgetResizeFrame.showForWidget(hostView, cellLayout); diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index bc8c23e310..fe914dc028 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -103,7 +103,8 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> public static final float PULL_MULTIPLIER = .02f; public static final float FLING_VELOCITY_MULTIPLIER = 1200f; protected static final String BUNDLE_KEY_CURRENT_PAGE = "launcher.allapps.current_page"; - private static final long DEFAULT_SEARCH_TRANSITION_DURATION_MS = 300; + // As of this writing, search transition does not seem to work properly, so set duration to 0. + private static final long DEFAULT_SEARCH_TRANSITION_DURATION_MS = 0; // Render the header protection at all times to debug clipping issues. private static final boolean DEBUG_HEADER_PROTECTION = false; /** Context of an activity or window that is inflating this container. */ @@ -332,6 +333,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> // If exiting search, revert predictive back scale on all apps mAllAppsTransitionController.animateAllAppsToNoScale(); } + setScrollbarVisibility(!goingToSearch); mSearchTransitionController.animateToSearchState(goingToSearch, durationMs, /* onEndRunnable = */ () -> { mIsSearching = goingToSearch; @@ -595,13 +597,22 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> tabsHidden); int padding = mHeader.getMaxTranslation(); - mAH.forEach(adapterHolder -> { - adapterHolder.mPadding.top = padding; + for (int i = 0; i < mAH.size(); i++) { + final AdapterHolder adapterHolder = mAH.get(i); + // Search and other adapters need to be handled a bit differently; otherwise, when + // when leaving search, the All Apps view may be noticeably shifted downward because + // its padding was unnecessarily impacted, and never restored, upon entering search. + if (i != AdapterHolder.SEARCH && !tabsHidden && mHeader.getFloatingRowsHeight() == 0) { + // Only the Search adapter needs padding when there are tabs but no floating rows. + adapterHolder.mPadding.top = 0; + } else { + adapterHolder.mPadding.top = padding; + } adapterHolder.applyPadding(); if (adapterHolder.mRecyclerView != null) { adapterHolder.mRecyclerView.scrollToTop(); } - }); + } removeCustomRules(mHeader); if (!isSearchSupported()) { @@ -625,6 +636,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> mTabsProtectionAlpha = tabsAlpha; invalidateHeader(); } + getSearchView().setBackgroundResource(R.drawable.bg_all_apps_searchbox); if (mSearchUiManager.getEditText() == null) { return; } @@ -664,13 +676,15 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> } RelativeLayout.LayoutParams layoutParams = (LayoutParams) v.getLayoutParams(); - layoutParams.addRule(RelativeLayout.ALIGN_TOP, R.id.search_container_all_apps); + layoutParams.addRule(RelativeLayout.BELOW, R.id.search_container_all_apps); int topMargin = getContext().getResources().getDimensionPixelSize( - R.dimen.all_apps_header_top_margin); + R.dimen.all_apps_search_bar_bottom_adjustment); if (includeTabsMargin) { topMargin += getContext().getResources().getDimensionPixelSize( - R.dimen.all_apps_header_pill_height); + R.dimen.all_apps_header_pill_height) + + getContext().getResources().getDimensionPixelSize( + R.dimen.all_apps_tabs_margin_top); } layoutParams.topMargin = topMargin; } @@ -707,6 +721,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> layoutParams.removeRule(RelativeLayout.ABOVE); layoutParams.removeRule(RelativeLayout.ALIGN_TOP); layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_TOP); + layoutParams.removeRule(RelativeLayout.BELOW); } protected BaseAllAppsAdapter<T> createAdapter(AlphabeticalAppsList<T> appsList) { @@ -1001,6 +1016,13 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> } } + protected void setScrollbarVisibility(boolean visible) { + AllAppsRecyclerView rv = getActiveRecyclerView(); + if (rv != null && rv.getScrollbar() != null) { + rv.getScrollbar().setVisibility(visible ? VISIBLE : GONE); + } + } + protected void updateSearchResultsVisibility() { if (isSearching()) { getSearchRecyclerView().setVisibility(VISIBLE); diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index 29767bf465..2567fab1d6 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -20,6 +20,7 @@ import android.content.Context; import androidx.annotation.Nullable; import androidx.recyclerview.widget.DiffUtil; +import com.android.launcher3.R; import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; @@ -28,7 +29,6 @@ import com.android.launcher3.views.ActivityContext; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import java.util.Objects; import java.util.TreeMap; import java.util.function.Predicate; @@ -85,6 +85,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement private final int mNumAppsPerRowAllApps; private int mNumAppRowsInAdapter; private Predicate<ItemInfo> mItemFilter; + private final boolean mSortSections; public AlphabeticalAppsList(Context context, @Nullable AllAppsStore appsStore, WorkProfileManager workProfileManager) { @@ -96,6 +97,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement if (mAllAppsStore != null) { mAllAppsStore.addUpdateListener(this); } + mSortSections = context.getResources().getBoolean(R.bool.config_appsListSortSections); } public void updateItemFilter(Predicate<ItemInfo> itemFilter) { @@ -201,9 +203,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement // As a special case for some languages (currently only Simplified Chinese), we may need to // coalesce sections - Locale curLocale = mActivityContext.getResources().getConfiguration().locale; - boolean localeRequiresSectionSorting = curLocale.equals(Locale.SIMPLIFIED_CHINESE); - if (localeRequiresSectionSorting) { + if (mSortSections) { // Compute the section headers. We use a TreeMap with the section name comparator to // ensure that the sections are ordered when we iterate over it later appSteam = appSteam.collect(Collectors.groupingBy( diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index b3ea3ab225..050e8101d0 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -225,7 +225,6 @@ public class FloatingHeaderView extends LinearLayout implements for (FloatingHeaderRow row : mAllRows) { row.setup(this, mAllRows, tabsHidden); } - updateExpectedHeight(); mTabsHidden = tabsHidden; mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE); @@ -250,6 +249,8 @@ public class FloatingHeaderView extends LinearLayout implements rvType == AdapterHolder.MAIN ? mMainRV : rvType == AdapterHolder.WORK ? mWorkRV : mSearchRV; mCurrentRV.addOnScrollListener(mOnScrollListener); + + updateExpectedHeight(); } private void updateExpectedHeight() { @@ -259,10 +260,7 @@ public class FloatingHeaderView extends LinearLayout implements return; } mMaxTranslation += mFloatingRowsHeight; - if (!mTabsHidden) { - mMaxTranslation += mTabsAdditionalPaddingBottom - + getResources().getDimensionPixelSize(R.dimen.all_apps_tabs_margin_top); - } + // No need for mMaxTranslation to be any taller now that we align below the header. } int getMaxTranslation() { diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java index 4427a49dab..f94658c404 100644 --- a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java +++ b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java @@ -132,7 +132,7 @@ public class AllAppsSearchBarController public boolean onBackKey() { // Only hide the search field if there is no query String query = Utilities.trim(mInput.getEditableText().toString()); - if (query.isEmpty()) { + if (!query.isEmpty()) { reset(); return true; } diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java index 78c305b2eb..d83efd6c16 100644 --- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java @@ -77,7 +77,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText mSearchQueryBuilder = new SpannableStringBuilder(); Selection.setSelection(mSearchQueryBuilder, 0); - setHint(prefixTextWithIcon(getContext(), R.drawable.ic_allapps_search, getHint())); mContentOverlap = getResources().getDimensionPixelSize(R.dimen.all_apps_search_bar_content_overlap); diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index b7e6378047..832cb31eb4 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -192,7 +192,7 @@ public final class FeatureFlags { "Uses two panel on home screen. Only applicable on large screen devices."); public static final BooleanFlag ENABLE_SCRIM_FOR_APP_LAUNCH = getDebugFlag(270393276, - "ENABLE_SCRIM_FOR_APP_LAUNCH", false, + "ENABLE_SCRIM_FOR_APP_LAUNCH", true, "Enables scrim during app launch animation."); public static final BooleanFlag ENABLE_ENFORCED_ROUNDED_CORNERS = getReleaseFlag(270393258, diff --git a/src/com/android/launcher3/touch/WorkspaceTouchListener.java b/src/com/android/launcher3/touch/WorkspaceTouchListener.java index 96ae4a32fd..9fcb4d9156 100644 --- a/src/com/android/launcher3/touch/WorkspaceTouchListener.java +++ b/src/com/android/launcher3/touch/WorkspaceTouchListener.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.touch; +import static android.provider.Settings.Secure.DOUBLE_TAP_SLEEP_GESTURE; + import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_MOVE; @@ -26,8 +28,12 @@ import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_CLOSE_TAP_OUTSIDE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_LONGPRESS; +import android.content.ContentResolver; +import android.content.Context; import android.graphics.PointF; import android.graphics.Rect; +import android.os.PowerManager; +import android.provider.Settings; import android.view.GestureDetector; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; @@ -71,15 +77,21 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe private int mLongPressState = STATE_CANCELLED; + private final PowerManager mPm; + private final GestureDetector mGestureDetector; + private final ContentResolver mContentResolver; + public WorkspaceTouchListener(Launcher launcher, Workspace<?> workspace) { mLauncher = launcher; mWorkspace = workspace; // Use twice the touch slop as we are looking for long press which is more // likely to cause movement. mTouchSlop = 2 * ViewConfiguration.get(launcher).getScaledTouchSlop(); + mPm = (PowerManager) workspace.getContext().getSystemService(Context.POWER_SERVICE); mGestureDetector = new GestureDetector(workspace.getContext(), this); + mContentResolver = workspace.getContext().getContentResolver(); } @Override @@ -210,4 +222,11 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe } } } + + @Override + public boolean onDoubleTap(MotionEvent event) { + if (Settings.Secure.getInt(mContentResolver, DOUBLE_TAP_SLEEP_GESTURE, 0) == 1) + mPm.goToSleep(event.getEventTime()); + return true; + } } diff --git a/src_build_config/com/android/launcher3/BuildConfig.java b/src_build_config/com/android/launcher3/BuildConfig.java index 1f2e0e5387..ab6c528580 100644 --- a/src_build_config/com/android/launcher3/BuildConfig.java +++ b/src_build_config/com/android/launcher3/BuildConfig.java @@ -24,7 +24,7 @@ public final class BuildConfig { * Flag to state if the QSB is on the first screen and placed on the top, * this can be overwritten in other launchers with a different value, if needed. */ - public static final boolean QSB_ON_FIRST_SCREEN = true; + public static final boolean QSB_ON_FIRST_SCREEN = false; /** * Flag to control various developer centric features |