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

Commit 6ebed274 authored by yyalan's avatar yyalan
Browse files

[Action Corner] Settings

Pages only. Without the actual logic.

Bug: 412558312
Flag: com.android.settings.flags.action_corner_customization
Test: In follow-up CLs
Change-Id: I8885490f6c415af49c7f5e9ca104c317d19902a8
parent 225beade
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -97,3 +97,10 @@ flag {
  description: "Use three finger tap to open a custom app"
  bug: "399645334"
}

flag {
  name: "action_corner_customization"
  namespace: "android_settings"
  description: "Use action corners to trigger a chosen action"
  bug: "412558312"
}
+15 −0
Original line number Diff line number Diff line
@@ -5040,6 +5040,21 @@
    <!-- Text for 'Done' button in gesture education [CHAR LIMIT=10] -->
    <string name="gesture_button_done">Done</string>
    <!-- Title text for 'Customize action corners' preference. This preference allows the user to select actions to be triggered when moving the cursor to a corner. [CHAR LIMIT=60] -->
    <string name="action_corners_title">Customize action corners</string>
    <!-- Summary text for 'Customize action corners' preference. [CHAR LIMIT=NONE] -->
    <string name="action_corners_summary">Use cursors to navigate the system</string>
    <!-- Intro text for 'Customize action corners'. [CHAR LIMIT=NONE] -->
    <string name="action_corners_intro">Choose the following areas to customize action corners</string>
    <!-- Text for 'Bottom-left corner'. [CHAR LIMIT=60] -->
    <string name="action_corners_bottom_left_title">Bottom-left corner</string>
    <!-- Text for 'Bottom-right corner'. [CHAR LIMIT=60] -->
    <string name="action_corners_bottom_right_title">Bottom-right corner</string>
    <!-- Text for 'Top-left corner'. [CHAR LIMIT=60] -->
    <string name="action_corners_top_left_title">Top-left corner</string>
    <!-- Text for 'Top-right corner'. [CHAR LIMIT=60] -->
    <string name="action_corners_top_right_title">Top-right corner</string>
    <!-- Title for the button to trigger the 'modifier keys settings' page. [CHAR LIMIT=35] -->
    <string name="modifier_keys_settings">Modifier keys</string>
    <!-- Summary text for the 'modifier_keys_settings' page. [CHAR LIMIT=100] -->
+53 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/action_corners_title">

    <com.android.settingslib.widget.TopIntroPreference
        android:key="action_corners_intro"
        android:title="@string/action_corners_intro"
        settings:searchable="false"/>

    <!-- TODO (b/413860922): replace with the correct animation -->
    <com.android.settingslib.widget.IllustrationPreference
        android:key="action_corners_video"
        settings:lottie_rawRes="@raw/lottie_swipe_fingerprint"/>

    <com.android.settingslib.widget.MainSwitchPreference
        android:key="action_corners_switch"
        android:title="@string/action_corners_title" />

    <PreferenceCategory
        android:key="action_corners_customization_category">
        <Preference
            android:key="action_corners_bottom_left"
            android:title="@string/action_corners_bottom_left_title" />
        <Preference
            android:key="action_corners_bottom_right"
            android:title="@string/action_corners_bottom_right_title" />
        <Preference
            android:key="action_corners_top_left"
            android:title="@string/action_corners_top_left_title" />
        <Preference
            android:key="action_corners_top_right"
            android:title="@string/action_corners_top_right_title" />
    </PreferenceCategory>

</PreferenceScreen>
+8 −0
Original line number Diff line number Diff line
@@ -52,6 +52,14 @@
        android:key="three_finger_tap"
        android:title="@string/three_finger_tap_preference_title"
        settings:controller="com.android.settings.inputmethod.TouchpadThreeFingerTapPreferenceController"
        android:order="36"/>

    <Preference
        android:fragment="com.android.settings.inputmethod.ActionCornersFragment"
        android:key="action_corners"
        android:title="@string/action_corners_title"
        android:summary="@string/action_corners_summary"
        android:featureFlag="com.android.settings.flags.action_corner_customization"
        android:order="37"/>

    <SwitchPreferenceCompat
+63 −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.settings.inputmethod;

import static com.android.settings.inputmethod.InputPeripheralsSettingsUtils.isMouse;
import static com.android.settings.inputmethod.InputPeripheralsSettingsUtils.isTouchpad;

import android.app.settings.SettingsEnums;
import android.content.Context;

import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;

/** Input settings for action corners. */
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class ActionCornersFragment extends InputDeviceDashboardFragment {

    private static final String TAG = "ActionCornersFragment";

    //TODO (b/413277948): Metrics
    @Override
    public int getMetricsCategory() {
        return SettingsEnums.PAGE_UNKNOWN;
    }

    @Override
    protected int getPreferenceScreenResId() {
        return R.xml.action_corners_customization;
    }

    @Override
    protected String getLogTag() {
        return TAG;
    }

    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
            new BaseSearchIndexProvider(R.xml.action_corners_customization) {
                @Override
                protected boolean isPageSearchEnabled(Context context) {
                    return isTouchpad() || isMouse();
                }
            };

    @Override
    protected boolean needToFinishEarly() {
        return isMouseDetached() && isTouchpadDetached();
    }
}