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

Commit 4126bd59 authored by Yuhan Yang's avatar Yuhan Yang
Browse files

Add elevation to the autoclick panel

Add a level 4 elelvation on hover and level 3 elevation on resting.

Screenshot:
go/sc-njixmty5mti1mdq1mdqzmnxjytq3nzvjyy1mma

Bug: 413445844
Test: manually verified on test devices
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: I20a343236be74185e76e5d61e25c5f661f341902
parent 6c79fb17
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
@@ -5877,6 +5877,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
@@ -1173,7 +1173,7 @@ public class AutoclickController extends BaseEventStreamTransformation {
                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