diff options
32 files changed, 241 insertions, 145 deletions
diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java index 67ad4594599f..b54e17beb100 100644 --- a/core/java/android/appwidget/AppWidgetManager.java +++ b/core/java/android/appwidget/AppWidgetManager.java @@ -1684,10 +1684,14 @@ public class AppWidgetManager { private IBinder mIBinder; ConnectionTask(@NonNull FilterComparison filter) { - mContext.bindService(filter.getIntent(), - Context.BindServiceFlags.of(Context.BIND_AUTO_CREATE), - mHandler::post, - this); + try { + mContext.bindService(filter.getIntent(), + Context.BindServiceFlags.of(Context.BIND_AUTO_CREATE), + mHandler::post, + this); + } catch (Exception e) { + Log.e(TAG, "Error connecting to service in connection cache", e); + } } @Override @@ -1737,7 +1741,11 @@ public class AppWidgetManager { handleNext(); return; } - mContext.unbindService(this); + try { + mContext.unbindService(this); + } catch (Exception e) { + Log.e(TAG, "Error unbinding the cached connection", e); + } mActiveConnections.values().remove(this); } } diff --git a/core/java/android/hardware/input/InputSettings.java b/core/java/android/hardware/input/InputSettings.java index b380e259577c..cd48047bccb4 100644 --- a/core/java/android/hardware/input/InputSettings.java +++ b/core/java/android/hardware/input/InputSettings.java @@ -385,6 +385,42 @@ public class InputSettings { } /** + * Whether touchpad acceleration is enabled or not. + * + * @param context The application context. + * + * @hide + */ + public static boolean isTouchpadAccelerationEnabled(@NonNull Context context) { + if (!isPointerAccelerationFeatureFlagEnabled()) { + return false; + } + + return Settings.System.getIntForUser(context.getContentResolver(), + Settings.System.TOUCHPAD_ACCELERATION_ENABLED, 1, UserHandle.USER_CURRENT) + == 1; + } + + /** + * Enables or disables touchpad acceleration. + * + * @param context The application context. + * @param enabled Will enable touchpad acceleration if true, disable it if + * false. + * @hide + */ + @RequiresPermission(Manifest.permission.WRITE_SETTINGS) + public static void setTouchpadAccelerationEnabled(@NonNull Context context, + boolean enabled) { + if (!isPointerAccelerationFeatureFlagEnabled()) { + return; + } + Settings.System.putIntForUser(context.getContentResolver(), + Settings.System.TOUCHPAD_ACCELERATION_ENABLED, enabled ? 1 : 0, + UserHandle.USER_CURRENT); + } + + /** * Returns true if the feature flag for disabling system gestures on touchpads is enabled. * * @hide @@ -835,7 +871,6 @@ public class InputSettings { UserHandle.USER_CURRENT); } - /** * Whether Accessibility bounce keys feature is enabled. * diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 962680891a72..2b18b01734d3 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6330,6 +6330,17 @@ public final class Settings { public static final String TOUCHPAD_SYSTEM_GESTURES = "touchpad_system_gestures"; /** + * Whether touchpad acceleration is enabled. + * + * When enabled, the speed of the pointer will increase as the user moves their + * finger faster on the touchpad. + * + * @hide + */ + public static final String TOUCHPAD_ACCELERATION_ENABLED = + "touchpad_acceleration_enabled"; + + /** * Whether to enable reversed vertical scrolling for connected mice. * * When enabled, scrolling down on the mouse wheel will move the screen up and vice versa. @@ -6624,6 +6635,7 @@ public final class Settings { PRIVATE_SETTINGS.add(TOUCHPAD_TAP_DRAGGING); PRIVATE_SETTINGS.add(TOUCHPAD_RIGHT_CLICK_ZONE); PRIVATE_SETTINGS.add(TOUCHPAD_SYSTEM_GESTURES); + PRIVATE_SETTINGS.add(TOUCHPAD_ACCELERATION_ENABLED); PRIVATE_SETTINGS.add(CAMERA_FLASH_NOTIFICATION); PRIVATE_SETTINGS.add(SCREEN_FLASH_NOTIFICATION); PRIVATE_SETTINGS.add(SCREEN_FLASH_NOTIFICATION_COLOR); diff --git a/core/proto/android/providers/settings/system.proto b/core/proto/android/providers/settings/system.proto index 64c9f540a97b..325790c22fce 100644 --- a/core/proto/android/providers/settings/system.proto +++ b/core/proto/android/providers/settings/system.proto @@ -218,7 +218,8 @@ message SystemSettingsProto { optional SettingProto tap_to_click = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto tap_dragging = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto three_finger_tap_customization = 6 [ (android.privacy).dest = DEST_AUTOMATIC ]; - optional SettingProto system_gestures = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];; + optional SettingProto system_gestures = 7 [ (android.privacy).dest = DEST_AUTOMATIC ]; + optional SettingProto acceleration_enabled = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];; } optional Touchpad touchpad = 36; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipMenuController.java index 85353d307056..bad4a934adbf 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipMenuController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipMenuController.java @@ -18,7 +18,6 @@ package com.android.wm.shell.common.pip; import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; -import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH; import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; @@ -111,7 +110,7 @@ public interface PipMenuController { int width, int height) { final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height, TYPE_APPLICATION_OVERLAY, - FLAG_WATCH_OUTSIDE_TOUCH | FLAG_SPLIT_TOUCH | FLAG_SLIPPERY | FLAG_NOT_TOUCHABLE, + FLAG_WATCH_OUTSIDE_TOUCH | FLAG_SLIPPERY | FLAG_NOT_TOUCHABLE, PixelFormat.TRANSLUCENT); lp.privateFlags |= PRIVATE_FLAG_TRUSTED_OVERLAY; lp.setTitle(title); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java index 89573ccef24b..84b710d52717 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitWindowManager.java @@ -19,7 +19,6 @@ package com.android.wm.shell.common.split; import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; -import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH; import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY; @@ -126,7 +125,7 @@ public final class SplitWindowManager extends WindowlessWindowManager { WindowManager.LayoutParams lp = new WindowManager.LayoutParams( dividerBounds.width(), dividerBounds.height(), TYPE_DOCK_DIVIDER, FLAG_NOT_FOCUSABLE | FLAG_NOT_TOUCH_MODAL | FLAG_WATCH_OUTSIDE_TOUCH - | FLAG_SPLIT_TOUCH | FLAG_SLIPPERY, + | FLAG_SLIPPERY, PixelFormat.TRANSLUCENT); lp.token = new Binder(); lp.setTitle(mWindowName); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopHeaderManageWindowsMenu.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopHeaderManageWindowsMenu.kt index ff52a45c94e2..575aac381c42 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopHeaderManageWindowsMenu.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopHeaderManageWindowsMenu.kt @@ -74,8 +74,7 @@ class DesktopHeaderManageWindowsMenu( override fun addToContainer(menuView: ManageWindowsView) { val menuPosition = Point(x, y) val flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or - WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH or - WindowManager.LayoutParams.FLAG_SPLIT_TOUCH + WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH val desktopRepository = desktopUserRepositories.getProfile(callerTaskInfo.userId) menuViewContainer = if (Flags.enableFullyImmersiveInDesktop() && desktopRepository.isTaskInFullImmersiveState(callerTaskInfo.taskId)) { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java index 7d1471f44674..b531079f18c1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java @@ -17,7 +17,6 @@ package com.android.wm.shell.windowdecor; import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; -import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH; import static android.view.WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL; import static android.view.WindowManager.LayoutParams.INPUT_FEATURE_SPY; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY; @@ -122,7 +121,7 @@ class DragResizeInputListener implements AutoCloseable { mDecorationSurface, mClientToken, null /* hostInputToken */, - FLAG_NOT_FOCUSABLE | FLAG_SPLIT_TOUCH, + FLAG_NOT_FOCUSABLE, PRIVATE_FLAG_TRUSTED_OVERLAY, INPUT_FEATURE_SPY, TYPE_APPLICATION, diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt index 9d73950abcf0..e5c989ed5f97 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt @@ -245,8 +245,7 @@ class HandleMenu( width = menuWidth, height = menuHeight, flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or - WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH or - WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, + WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, view = handleMenuView.rootView, forciblyShownTypes = if (forceShowSystemBars) { systemBars() } else { 0 }, ignoreCutouts = Flags.showAppHandleLargeScreens() diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt index cc54d25b3639..1ce0366728b9 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt @@ -178,8 +178,7 @@ class MaximizeMenu( menuHeight, WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE - or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH - or WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, + or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSPARENT ) lp.title = "Maximize Menu for Task=" + taskInfo.taskId diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java index fa7183ad0fd8..3fcb09349033 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java @@ -22,7 +22,6 @@ import static android.view.WindowInsets.Type.captionBar; import static android.view.WindowInsets.Type.mandatorySystemGestures; import static android.view.WindowInsets.Type.statusBars; import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; -import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH; import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; @@ -333,7 +332,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> outResult.mCaptionWidth, outResult.mCaptionHeight, TYPE_APPLICATION, - FLAG_NOT_FOCUSABLE | FLAG_SPLIT_TOUCH, + FLAG_NOT_FOCUSABLE, PixelFormat.TRANSPARENT); lp.setTitle("Caption of Task=" + mTaskInfo.taskId); lp.setTrustedOverlay(); @@ -750,7 +749,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> width, height, TYPE_APPLICATION, - FLAG_NOT_FOCUSABLE | FLAG_WATCH_OUTSIDE_TOUCH | FLAG_SPLIT_TOUCH, + FLAG_NOT_FOCUSABLE | FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSPARENT); lp.setTitle("Additional window of Task=" + mTaskInfo.taskId); lp.setTrustedOverlay(); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/viewhost/ReusableWindowDecorViewHost.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/viewhost/ReusableWindowDecorViewHost.kt index da41e1b1d8d8..4a09614029dc 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/viewhost/ReusableWindowDecorViewHost.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/viewhost/ReusableWindowDecorViewHost.kt @@ -24,7 +24,6 @@ import android.view.SurfaceControl import android.view.View import android.view.WindowManager import android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE -import android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH import android.view.WindowManager.LayoutParams.TYPE_APPLICATION import android.widget.FrameLayout import androidx.tracing.Trace @@ -72,7 +71,7 @@ class ReusableWindowDecorViewHost( 0 /* width*/, 0 /* height */, TYPE_APPLICATION, - FLAG_NOT_FOCUSABLE or FLAG_SPLIT_TOUCH, + FLAG_NOT_FOCUSABLE, PixelFormat.TRANSPARENT, ) .apply { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingDividerWindowManager.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingDividerWindowManager.kt index 583282247f58..fbbf1a5db72c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingDividerWindowManager.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingDividerWindowManager.kt @@ -34,7 +34,6 @@ import android.view.WindowManager import android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE import android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL import android.view.WindowManager.LayoutParams.FLAG_SLIPPERY -import android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH import android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH import android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION import android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY @@ -240,7 +239,6 @@ class DesktopTilingDividerWindowManager( FLAG_NOT_FOCUSABLE or FLAG_NOT_TOUCH_MODAL or FLAG_WATCH_OUTSIDE_TOUCH or - FLAG_SPLIT_TOUCH or FLAG_SLIPPERY, PixelFormat.TRANSLUCENT, ) diff --git a/packages/SettingsLib/OWNERS b/packages/SettingsLib/OWNERS index e4bc7b4660e1..04df308e72a0 100644 --- a/packages/SettingsLib/OWNERS +++ b/packages/SettingsLib/OWNERS @@ -3,6 +3,7 @@ cantol@google.com chiujason@google.com cipson@google.com dsandler@android.com +dswliu@google.com edgarwang@google.com evanlaird@google.com jiannan@google.com diff --git a/packages/SettingsLib/SettingsTheme/res/layout-v35/settingslib_expressive_collapsable_textview.xml b/packages/SettingsLib/SettingsTheme/res/layout/settingslib_expressive_collapsable_textview.xml index 7d7bec14ed78..7d7bec14ed78 100644 --- a/packages/SettingsLib/SettingsTheme/res/layout-v35/settingslib_expressive_collapsable_textview.xml +++ b/packages/SettingsLib/SettingsTheme/res/layout/settingslib_expressive_collapsable_textview.xml diff --git a/packages/SettingsLib/SettingsTheme/res/values-v31/styles_expressive.xml b/packages/SettingsLib/SettingsTheme/res/values-v31/styles_expressive.xml index b5f22b73cecd..ec67d068123a 100644 --- a/packages/SettingsLib/SettingsTheme/res/values-v31/styles_expressive.xml +++ b/packages/SettingsLib/SettingsTheme/res/values-v31/styles_expressive.xml @@ -104,6 +104,11 @@ <item name="android:layout_width">match_parent</item> </style> + <style name="SettingslibTextAppearance.LinkableTextStyle.Expressive" + parent="@style/TextAppearance.SettingsLib.LabelLarge"> + <item name="android:textColor">?android:attr/colorAccent</item> + </style> + <style name="SettingslibTextButtonStyle.Expressive" parent="@style/Widget.Material3Expressive.Button.TextButton.Icon"> <item name="android:theme">@style/Theme.Material3.DynamicColors.DayNight</item> diff --git a/packages/SettingsLib/SettingsTheme/res/values-v35/styles_expressive.xml b/packages/SettingsLib/SettingsTheme/res/values-v35/styles_expressive.xml index 1a085681864a..3af88c48e8ca 100644 --- a/packages/SettingsLib/SettingsTheme/res/values-v35/styles_expressive.xml +++ b/packages/SettingsLib/SettingsTheme/res/values-v35/styles_expressive.xml @@ -70,11 +70,6 @@ <item name="android:textAppearance">@style/TextAppearance.SettingsLib.TitleLarge.Emphasized</item> </style> - <style name="SettingslibTextAppearance.LinkableTextStyle.Expressive" - parent="@style/TextAppearance.SettingsLib.LabelLarge"> - <item name="android:textColor">?android:attr/colorAccent</item> - </style> - <style name="SettingsLibStatusBannerCardStyle"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> diff --git a/packages/SettingsLib/TopIntroPreference/res/layout-v33/top_intro_preference.xml b/packages/SettingsLib/TopIntroPreference/res/layout-v33/top_intro_preference.xml deleted file mode 100644 index 195d45f3a639..000000000000 --- a/packages/SettingsLib/TopIntroPreference/res/layout-v33/top_intro_preference.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2022 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. - --> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" - android:paddingBottom="16dp" - android:paddingTop="8dp" - android:background="?android:attr/selectableItemBackground" - android:clipToPadding="false"> - - <TextView - android:id="@android:id/title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="start" - android:textAlignment="viewStart" - android:clickable="false" - android:longClickable="false" - android:maxLines="10" - android:hyphenationFrequency="normalFast" - android:lineBreakWordStyle="phrase" - android:textAppearance="@style/TextAppearance.TopIntroText"/> -</LinearLayout>
\ No newline at end of file diff --git a/packages/SettingsLib/TopIntroPreference/res/layout-v35/settingslib_expressive_top_intro.xml b/packages/SettingsLib/TopIntroPreference/res/layout/settingslib_expressive_top_intro.xml index fb13ef79cc3b..834814ccbc6b 100644 --- a/packages/SettingsLib/TopIntroPreference/res/layout-v35/settingslib_expressive_top_intro.xml +++ b/packages/SettingsLib/TopIntroPreference/res/layout/settingslib_expressive_top_intro.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (C) 2024 The Android Open Source Project + Copyright (C) 2025 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. diff --git a/packages/SettingsLib/TopIntroPreference/res/layout/top_intro_preference.xml b/packages/SettingsLib/TopIntroPreference/res/layout/top_intro_preference.xml deleted file mode 100644 index bee6bc70f2c8..000000000000 --- a/packages/SettingsLib/TopIntroPreference/res/layout/top_intro_preference.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?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. - --> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" - android:paddingBottom="16dp" - android:paddingTop="8dp" - android:background="?android:attr/selectableItemBackground" - android:clipToPadding="false"> - - <TextView - android:id="@android:id/title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="start" - android:textAlignment="viewStart" - android:clickable="false" - android:longClickable="false" - android:maxLines="10" - android:textAppearance="@style/TextAppearance.TopIntroText"/> -</LinearLayout>
\ No newline at end of file diff --git a/packages/SettingsLib/TopIntroPreference/src/com/android/settingslib/widget/TopIntroPreference.kt b/packages/SettingsLib/TopIntroPreference/src/com/android/settingslib/widget/TopIntroPreference.kt index 4428480eaa3e..08ba836b21ca 100644 --- a/packages/SettingsLib/TopIntroPreference/src/com/android/settingslib/widget/TopIntroPreference.kt +++ b/packages/SettingsLib/TopIntroPreference/src/com/android/settingslib/widget/TopIntroPreference.kt @@ -17,20 +17,20 @@ package com.android.settingslib.widget import android.content.Context -import android.os.Build import android.text.TextUtils import android.util.AttributeSet import android.view.View -import androidx.annotation.RequiresApi import androidx.preference.Preference import androidx.preference.PreferenceViewHolder import com.android.settingslib.widget.preference.topintro.R -open class TopIntroPreference @JvmOverloads constructor( +open class TopIntroPreference +@JvmOverloads +constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, - defStyleRes: Int = 0 + defStyleRes: Int = 0, ) : Preference(context, attrs, defStyleAttr, defStyleRes), GroupSectionDividerMixin { private var isCollapsable: Boolean = false @@ -40,25 +40,18 @@ open class TopIntroPreference @JvmOverloads constructor( private var learnMoreText: CharSequence? = null init { - if (SettingsThemeHelper.isExpressiveTheme(context)) { - layoutResource = R.layout.settingslib_expressive_top_intro - initAttributes(context, attrs, defStyleAttr) - } else { - layoutResource = R.layout.top_intro_preference - } + layoutResource = R.layout.settingslib_expressive_top_intro + initAttributes(context, attrs, defStyleAttr) + isSelectable = false } private fun initAttributes(context: Context, attrs: AttributeSet?, defStyleAttr: Int) { - context.obtainStyledAttributes( - attrs, - COLLAPSABLE_TEXT_VIEW_ATTRS, defStyleAttr, 0 - ).apply { + context.obtainStyledAttributes(attrs, COLLAPSABLE_TEXT_VIEW_ATTRS, defStyleAttr, 0).apply { isCollapsable = getBoolean(IS_COLLAPSABLE, false) - minLines = getInt( - MIN_LINES, - if (isCollapsable) DEFAULT_MIN_LINES else DEFAULT_MAX_LINES - ).coerceIn(1, DEFAULT_MAX_LINES) + minLines = + getInt(MIN_LINES, if (isCollapsable) DEFAULT_MIN_LINES else DEFAULT_MAX_LINES) + .coerceIn(1, DEFAULT_MAX_LINES) recycle() } } @@ -68,10 +61,6 @@ open class TopIntroPreference @JvmOverloads constructor( holder.isDividerAllowedAbove = false holder.isDividerAllowedBelow = false - if (!SettingsThemeHelper.isExpressiveTheme(context)) { - return - } - (holder.findViewById(R.id.collapsable_text_view) as? CollapsableTextView)?.apply { setCollapsable(isCollapsable) setMinLines(minLines) @@ -89,9 +78,9 @@ open class TopIntroPreference @JvmOverloads constructor( /** * Sets whether the text view is collapsable. + * * @param collapsable True if the text view should be collapsable, false otherwise. */ - @RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM) fun setCollapsable(collapsable: Boolean) { isCollapsable = collapsable notifyChanged() @@ -99,9 +88,9 @@ open class TopIntroPreference @JvmOverloads constructor( /** * Sets the minimum number of lines to display when collapsed. + * * @param lines The minimum number of lines. */ - @RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM) fun setMinLines(lines: Int) { minLines = lines.coerceIn(1, DEFAULT_MAX_LINES) notifyChanged() @@ -109,9 +98,9 @@ open class TopIntroPreference @JvmOverloads constructor( /** * Sets the action when clicking on the hyperlink in the text. + * * @param listener The click listener for hyperlink. */ - @RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM) fun setHyperlinkListener(listener: View.OnClickListener) { if (hyperlinkListener != listener) { hyperlinkListener = listener @@ -121,9 +110,9 @@ open class TopIntroPreference @JvmOverloads constructor( /** * Sets the action when clicking on the learn more view. + * * @param listener The click listener for learn more. */ - @RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM) fun setLearnMoreAction(listener: View.OnClickListener) { if (learnMoreListener != listener) { learnMoreListener = listener @@ -133,9 +122,9 @@ open class TopIntroPreference @JvmOverloads constructor( /** * Sets the text of learn more view. + * * @param text The text of learn more. */ - @RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM) fun setLearnMoreText(text: CharSequence) { if (!TextUtils.equals(learnMoreText, text)) { learnMoreText = text diff --git a/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java b/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java index 1f56f10cca7d..cf0447f9fb3a 100644 --- a/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java +++ b/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java @@ -117,6 +117,7 @@ public class SystemSettings { Settings.System.TOUCHPAD_TAP_TO_CLICK, Settings.System.TOUCHPAD_TAP_DRAGGING, Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE, + Settings.System.TOUCHPAD_ACCELERATION_ENABLED, Settings.System.CAMERA_FLASH_NOTIFICATION, Settings.System.SCREEN_FLASH_NOTIFICATION, Settings.System.SCREEN_FLASH_NOTIFICATION_COLOR, diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java index 4d98a11bdfe7..4f649ed49be3 100644 --- a/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java +++ b/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java @@ -234,6 +234,7 @@ public class SystemSettingsValidators { VALIDATORS.put(System.TOUCHPAD_TAP_DRAGGING, BOOLEAN_VALIDATOR); VALIDATORS.put(System.TOUCHPAD_RIGHT_CLICK_ZONE, BOOLEAN_VALIDATOR); VALIDATORS.put(System.TOUCHPAD_SYSTEM_GESTURES, BOOLEAN_VALIDATOR); + VALIDATORS.put(System.TOUCHPAD_ACCELERATION_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(System.LOCK_TO_APP_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put( System.EGG_MODE, diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index 0224b297e005..30dcd09d35ab 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -714,6 +714,9 @@ android_library { use_resource_processor: true, manifest: "tests/AndroidManifest-base.xml", resource_dirs: [], + + kotlin_lang_version: "1.9", + additional_manifests: ["tests/AndroidManifest.xml"], srcs: [ "tests/src/**/*.kt", diff --git a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt index 71b622aa0608..9b852df88604 100644 --- a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt +++ b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt @@ -61,6 +61,8 @@ import com.android.systemui.plugins.clocks.ClockTickRate import com.android.systemui.plugins.clocks.WeatherData import com.android.systemui.plugins.clocks.ZenData import com.android.systemui.plugins.clocks.ZenData.ZenMode +import com.android.systemui.power.domain.interactor.PowerInteractor +import com.android.systemui.power.shared.model.ScreenPowerState import com.android.systemui.res.R as SysuiR import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.settings.UserTracker @@ -106,6 +108,7 @@ constructor( private val zenModeController: ZenModeController, private val zenModeInteractor: ZenModeInteractor, private val userTracker: UserTracker, + private val powerInteractor: PowerInteractor, ) { var loggers = listOf( @@ -377,13 +380,13 @@ constructor( override fun onTimeChanged() { refreshTime() } - - private fun refreshTime() { - clock?.smallClock?.events?.onTimeTick() - clock?.largeClock?.events?.onTimeTick() - } } + private fun refreshTime() { + clock?.smallClock?.events?.onTimeTick() + clock?.largeClock?.events?.onTimeTick() + } + @VisibleForTesting internal fun listenForDnd(scope: CoroutineScope): Job { ModesUi.assertInNewMode() @@ -474,6 +477,7 @@ constructor( listenForAnyStateToAodTransition(this) listenForAnyStateToLockscreenTransition(this) listenForAnyStateToDozingTransition(this) + listenForScreenPowerOn(this) } } smallTimeListener?.update(shouldTimeListenerRun) @@ -643,6 +647,17 @@ constructor( } } + @VisibleForTesting + internal fun listenForScreenPowerOn(scope: CoroutineScope): Job { + return scope.launch { + powerInteractor.screenPowerState.collect { powerState -> + if (powerState != ScreenPowerState.SCREEN_OFF) { + refreshTime() + } + } + } + } + class TimeListener(val clockFace: ClockFaceController, val executor: DelayableExecutor) { val predrawListener = ViewTreeObserver.OnPreDrawListener { diff --git a/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt index bac2c47f51c7..1729a4dfa945 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt @@ -55,6 +55,7 @@ import com.android.systemui.plugins.clocks.ClockTickRate import com.android.systemui.plugins.clocks.ThemeConfig import com.android.systemui.plugins.clocks.ZenData import com.android.systemui.plugins.clocks.ZenData.ZenMode +import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.res.R import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.policy.BatteryController @@ -131,6 +132,7 @@ class ClockEventControllerTest : SysuiTestCase() { @Mock private lateinit var parentView: View @Mock private lateinit var keyguardTransitionInteractor: KeyguardTransitionInteractor @Mock private lateinit var userTracker: UserTracker + @Mock private lateinit var powerInteractor: PowerInteractor @Mock private lateinit var zenModeController: ZenModeController private var zenModeControllerCallback: ZenModeController.Callback? = null @@ -178,6 +180,7 @@ class ClockEventControllerTest : SysuiTestCase() { zenModeController, zenModeInteractor, userTracker, + powerInteractor, ) underTest.clock = clock diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java index cffdfbd36532..8ef44ad31021 100644 --- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java @@ -5666,6 +5666,16 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku } public boolean canAccessAppWidget(Widget widget, int uid, String packageName) { + if (packageName != null + && widget.provider != null + && isDifferentPackageFromProvider(widget.provider, packageName) + && widget.host != null + && isDifferentPackageFromHost(widget.host, packageName)) { + // An AppWidget can only be accessed by either + // 1. The package that provides the AppWidget. + // 2. The package that hosts the AppWidget. + return false; + } if (isHostInPackageForUid(widget.host, uid, packageName)) { // Apps hosting the AppWidget have access to it. return true; @@ -5768,6 +5778,22 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku && provider.id.componentName.getPackageName().equals(packageName); } + private boolean isDifferentPackageFromHost( + @NonNull final Host host, @NonNull final String packageName) { + if (host.id == null || host.id.packageName == null) { + return true; + } + return !packageName.equals(host.id.packageName); + } + + private boolean isDifferentPackageFromProvider( + @NonNull final Provider provider, @NonNull final String packageName) { + if (provider.id == null || provider.id.componentName == null) { + return true; + } + return !packageName.equals(provider.id.componentName.getPackageName()); + } + private boolean isProfileEnabled(int profileId) { final long identity = Binder.clearCallingIdentity(); try { diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index d2073aaa834c..8e09e3b8e112 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -33,6 +33,7 @@ import static android.app.AppOpsManager.MODE_DEFAULT; import static android.app.AppOpsManager.MODE_ERRORED; import static android.app.AppOpsManager.MODE_FOREGROUND; import static android.app.AppOpsManager.MODE_IGNORED; +import static android.app.AppOpsManager.OP_BLUETOOTH_CONNECT; import static android.app.AppOpsManager.OP_CAMERA; import static android.app.AppOpsManager.OP_CAMERA_SANDBOXED; import static android.app.AppOpsManager.OP_FLAGS_ALL; @@ -3267,6 +3268,11 @@ public class AppOpsService extends IAppOpsService.Stub { packageName); } if (!isIncomingPackageValid(packageName, UserHandle.getUserId(uid))) { + // TODO(b/333931259): Remove extra logging after this issue is diagnosed. + if (code == OP_BLUETOOTH_CONNECT) { + Slog.e(TAG, "noting OP_BLUETOOTH_CONNECT returned MODE_ERRORED as incoming " + + "package: " + packageName + " and uid: " + uid + " is invalid"); + } return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, packageName); } @@ -3306,6 +3312,13 @@ public class AppOpsService extends IAppOpsService.Stub { } } catch (SecurityException e) { logVerifyAndGetBypassFailure(uid, e, "noteOperation"); + // TODO(b/333931259): Remove extra logging after this issue is diagnosed. + if (code == OP_BLUETOOTH_CONNECT) { + Slog.e(TAG, "noting OP_BLUETOOTH_CONNECT returned MODE_ERRORED as" + + " verifyAndGetBypass returned a SecurityException for package: " + + packageName + " and uid: " + uid + " and attributionTag: " + + attributionTag, e); + } return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, packageName); } @@ -3323,6 +3336,17 @@ public class AppOpsService extends IAppOpsService.Stub { if (DEBUG) Slog.d(TAG, "noteOperation: no op for code " + code + " uid " + uid + " package " + packageName + "flags: " + AppOpsManager.flagsToString(flags)); + // TODO(b/333931259): Remove extra logging after this issue is diagnosed. + if (code == OP_BLUETOOTH_CONNECT) { + Slog.e(TAG, "noting OP_BLUETOOTH_CONNECT returned MODE_ERRORED as" + + " #getOpsLocked returned null for" + + " uid: " + uid + + " packageName: " + packageName + + " attributionTag: " + attributionTag + + " pvr.isAttributionTagValid: " + pvr.isAttributionTagValid + + " pvr.bypass: " + pvr.bypass); + Slog.e(TAG, "mUidStates.get(" + uid + "): " + mUidStates.get(uid)); + } return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, packageName); } @@ -3367,6 +3391,11 @@ public class AppOpsService extends IAppOpsService.Stub { attributedOp.rejected(uidState.getState(), flags); scheduleOpNotedIfNeededLocked(code, uid, packageName, attributionTag, virtualDeviceId, flags, uidMode); + // TODO(b/333931259): Remove extra logging after this issue is diagnosed. + if (code == OP_BLUETOOTH_CONNECT && uidMode == MODE_ERRORED) { + Slog.e(TAG, "noting OP_BLUETOOTH_CONNECT returned MODE_ERRORED as" + + " uid mode is MODE_ERRORED"); + } return new SyncNotedAppOp(uidMode, code, attributionTag, packageName); } } else { @@ -3386,6 +3415,11 @@ public class AppOpsService extends IAppOpsService.Stub { attributedOp.rejected(uidState.getState(), flags); scheduleOpNotedIfNeededLocked(code, uid, packageName, attributionTag, virtualDeviceId, flags, mode); + // TODO(b/333931259): Remove extra logging after this issue is diagnosed. + if (code == OP_BLUETOOTH_CONNECT && mode == MODE_ERRORED) { + Slog.e(TAG, "noting OP_BLUETOOTH_CONNECT returned MODE_ERRORED as" + + " package mode is MODE_ERRORED"); + } return new SyncNotedAppOp(mode, code, attributionTag, packageName); } } diff --git a/services/core/java/com/android/server/input/InputSettingsObserver.java b/services/core/java/com/android/server/input/InputSettingsObserver.java index e25ea4b43827..d1f07cb8ae23 100644 --- a/services/core/java/com/android/server/input/InputSettingsObserver.java +++ b/services/core/java/com/android/server/input/InputSettingsObserver.java @@ -90,6 +90,8 @@ class InputSettingsObserver extends ContentObserver { (reason) -> updateTouchpadRightClickZoneEnabled()), Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_SYSTEM_GESTURES), (reason) -> updateTouchpadSystemGesturesEnabled()), + Map.entry(Settings.System.getUriFor(Settings.System.TOUCHPAD_ACCELERATION_ENABLED), + (reason) -> updateTouchpadAccelerationEnabled()), Map.entry(Settings.System.getUriFor(Settings.System.SHOW_TOUCHES), (reason) -> updateShowTouches()), Map.entry(Settings.System.getUriFor(Settings.System.POINTER_LOCATION), @@ -241,6 +243,11 @@ class InputSettingsObserver extends ContentObserver { mNative.setTouchpadSystemGesturesEnabled(InputSettings.useTouchpadSystemGestures(mContext)); } + private void updateTouchpadAccelerationEnabled() { + mNative.setTouchpadAccelerationEnabled( + InputSettings.isTouchpadAccelerationEnabled(mContext)); + } + private void updateShowTouches() { mNative.setShowTouches(getBoolean(Settings.System.SHOW_TOUCHES, false)); } diff --git a/services/core/java/com/android/server/input/NativeInputManagerService.java b/services/core/java/com/android/server/input/NativeInputManagerService.java index 4d38c8401e2d..f34338a397db 100644 --- a/services/core/java/com/android/server/input/NativeInputManagerService.java +++ b/services/core/java/com/android/server/input/NativeInputManagerService.java @@ -158,6 +158,8 @@ interface NativeInputManagerService { void setTouchpadSystemGesturesEnabled(boolean enabled); + void setTouchpadAccelerationEnabled(boolean enabled); + void setShowTouches(boolean enabled); void setNonInteractiveDisplays(int[] displayIds); @@ -463,6 +465,9 @@ interface NativeInputManagerService { public native void setTouchpadSystemGesturesEnabled(boolean enabled); @Override + public native void setTouchpadAccelerationEnabled(boolean enabled); + + @Override public native void setShowTouches(boolean enabled); @Override diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java index 9d840d0c0d35..b905041b59e5 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java @@ -26,6 +26,7 @@ import static android.app.AppOpsManager.ATTRIBUTION_FLAGS_NONE; import static android.app.AppOpsManager.MODE_ALLOWED; import static android.app.AppOpsManager.MODE_ERRORED; import static android.app.AppOpsManager.MODE_IGNORED; +import static android.app.AppOpsManager.OP_BLUETOOTH_CONNECT; import static android.content.pm.ApplicationInfo.AUTO_REVOKE_DISALLOWED; import static android.content.pm.ApplicationInfo.AUTO_REVOKE_DISCOURAGED; import static android.permission.flags.Flags.serverSideAttributionRegistration; @@ -1668,7 +1669,22 @@ public class PermissionManagerService extends IPermissionManager.Stub { throw new SecurityException(msg + ":" + e.getMessage()); } } - return Math.max(checkedOpResult, notedOpResult); + int result = Math.max(checkedOpResult, notedOpResult); + // TODO(b/333931259): Remove extra logging after this issue is diagnosed. + if (op == OP_BLUETOOTH_CONNECT && result == MODE_ERRORED) { + if (result == checkedOpResult) { + Slog.e(LOG_TAG, "BLUETOOTH_CONNECT permission hard denied as" + + " checkOp for resolvedAttributionSource " + + resolvedAttributionSource + " and op " + op + + " returned MODE_ERRORED"); + } else { + Slog.e(LOG_TAG, "BLUETOOTH_CONNECT permission hard denied as" + + " noteOp for resolvedAttributionSource " + + resolvedAttributionSource + " and op " + notedOp + + " returned MODE_ERRORED"); + } + } + return result; } } diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 911c686c711f..e1f3f0ef5615 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -357,6 +357,7 @@ public: void setTouchpadRightClickZoneEnabled(bool enabled); void setTouchpadThreeFingerTapShortcutEnabled(bool enabled); void setTouchpadSystemGesturesEnabled(bool enabled); + void setTouchpadAccelerationEnabled(bool enabled); void setInputDeviceEnabled(uint32_t deviceId, bool enabled); void setShowTouches(bool enabled); void setNonInteractiveDisplays(const std::set<ui::LogicalDisplayId>& displayIds); @@ -540,6 +541,10 @@ private: // True to enable system gestures (three- and four-finger swipes) on touchpads. bool touchpadSystemGesturesEnabled{true}; + // True if the speed of the pointer will increase as the user moves + // their finger faster on the touchpad. + bool touchpadAccelerationEnabled{true}; + // True if a pointer icon should be shown for stylus pointers. bool stylusPointerIconEnabled{false}; @@ -869,6 +874,7 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon outConfig->touchpadThreeFingerTapShortcutEnabled = mLocked.touchpadThreeFingerTapShortcutEnabled; outConfig->touchpadSystemGesturesEnabled = mLocked.touchpadSystemGesturesEnabled; + outConfig->touchpadAccelerationEnabled = mLocked.touchpadAccelerationEnabled; outConfig->disabledDevices = mLocked.disabledInputDevices; @@ -1666,6 +1672,21 @@ void NativeInputManager::setTouchpadSystemGesturesEnabled(bool enabled) { InputReaderConfiguration::Change::TOUCHPAD_SETTINGS); } +void NativeInputManager::setTouchpadAccelerationEnabled(bool enabled) { + { // acquire lock + std::scoped_lock _l(mLock); + + if (mLocked.touchpadAccelerationEnabled == enabled) { + return; + } + + mLocked.touchpadAccelerationEnabled = enabled; + } // release lock + + mInputManager->getReader().requestRefreshConfiguration( + InputReaderConfiguration::Change::TOUCHPAD_SETTINGS); +} + void NativeInputManager::setInputDeviceEnabled(uint32_t deviceId, bool enabled) { bool refresh = false; @@ -2644,6 +2665,13 @@ static void nativeSetTouchpadSystemGesturesEnabled(JNIEnv* env, jobject nativeIm im->setTouchpadSystemGesturesEnabled(enabled); } +static void nativeSetTouchpadAccelerationEnabled(JNIEnv* env, jobject nativeImplObj, + jboolean enabled) { + NativeInputManager* im = getNativeInputManager(env, nativeImplObj); + + im->setTouchpadAccelerationEnabled(enabled); +} + static void nativeSetShowTouches(JNIEnv* env, jobject nativeImplObj, jboolean enabled) { NativeInputManager* im = getNativeInputManager(env, nativeImplObj); @@ -3354,6 +3382,7 @@ static const JNINativeMethod gInputManagerMethods[] = { {"setTouchpadThreeFingerTapShortcutEnabled", "(Z)V", (void*)nativeSetTouchpadThreeFingerTapShortcutEnabled}, {"setTouchpadSystemGesturesEnabled", "(Z)V", (void*)nativeSetTouchpadSystemGesturesEnabled}, + {"setTouchpadAccelerationEnabled", "(Z)V", (void*)nativeSetTouchpadAccelerationEnabled}, {"setShowTouches", "(Z)V", (void*)nativeSetShowTouches}, {"setNonInteractiveDisplays", "([I)V", (void*)nativeSetNonInteractiveDisplays}, {"reloadCalibration", "()V", (void*)nativeReloadCalibration}, |