Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44161a70 authored by Yuhan Yang's avatar Yuhan Yang Committed by Android (Google) Code Review
Browse files

Merge "Add elevation to the autoclick panel" into main

parents 2283dcea 4126bd59
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -17,12 +17,13 @@
*/
-->

<com.android.server.accessibility.autoclick.AutoclickLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.server.accessibility.autoclick.AutoclickTypeLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/accessibility_autoclick_type_panel"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/accessibility_autoclick_type_panel_rounded_background"
    android:elevation="@dimen/accessibility_autoclick_panel_resting_elevation"
    android:orientation="vertical"
    android:paddingVertical="8dp"
    android:paddingHorizontal="16dp">
@@ -158,4 +159,4 @@

    </LinearLayout>

</com.android.server.accessibility.autoclick.AutoclickLinearLayout>
</com.android.server.accessibility.autoclick.AutoclickTypeLinearLayout>
+6 −0
Original line number Diff line number Diff line
@@ -782,6 +782,12 @@
    <!-- The accessibility autoclick scroll panel button width and height -->
    <dimen name="accessibility_autoclick_scroll_panel_button_size">36dp</dimen>

    <!-- The elevation for autoclick type panel when it is resting. -->
    <dimen name="accessibility_autoclick_panel_resting_elevation">6dp</dimen>

    <!-- The elevation for autoclick type panel when it is hovered. -->
    <dimen name="accessibility_autoclick_panel_hover_elevation">8dp</dimen>

    <!-- Margin around the various security views -->
    <dimen name="keyguard_muliuser_selector_margin">8dp</dimen>

+2 −0
Original line number Diff line number Diff line
@@ -5895,6 +5895,8 @@
  <java-symbol type="dimen" name="accessibility_autoclick_type_panel_button_size" />
  <java-symbol type="dimen" name="accessibility_autoclick_type_panel_divider_height" />
  <java-symbol type="dimen" name="accessibility_autoclick_type_panel_divider_width" />
  <java-symbol type="dimen" name="accessibility_autoclick_panel_resting_elevation" />
  <java-symbol type="dimen" name="accessibility_autoclick_panel_hover_elevation" />
  <java-symbol type="id" name="accessibility_autoclick_type_panel" />
  <java-symbol type="id" name="accessibility_autoclick_button_group_container" />
  <java-symbol type="id" name="accessibility_autoclick_click_type_button_group_container" />
+1 −1
Original line number Diff line number Diff line
@@ -1191,7 +1191,7 @@ public class AutoclickController extends BaseEventStreamTransformation implement
                clearLongPressState();
            }

            if (mAutoclickTypePanel.isHoveringDraggableArea()
            if (mAutoclickTypePanel.isHoveringDraggableArea(mLastMotionEvent)
                    && !mAutoclickTypePanel.getIsDragging()) {
                mAutoclickTypePanel.onDragStart(mLastMotionEvent);
                return;
+49 −0
Original line number Diff line number Diff line
/*
 * Copyright 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.
 * 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.
 */

package com.android.server.accessibility.autoclick;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * A custom LinearLayout extending AutoclickLinearLayout.
 * This class overrides onInterceptHoverEvent as true to take over all the on hover event.
 * This prevents the elevation from flickering when moving across children on the layout.
 */
public class AutoclickTypeLinearLayout extends AutoclickLinearLayout {
    public AutoclickTypeLinearLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public AutoclickTypeLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public AutoclickTypeLinearLayout(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public boolean onInterceptHoverEvent(MotionEvent event) {
        // Call the parent's method to keep the onInterceptHoverEvent() logic.
        super.onInterceptHoverEvent(event);
        // But always return true to intercept the event.
        return true;
    }
}
Loading