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

Commit 93b2701f authored by Candice Lo's avatar Candice Lo Committed by Android (Google) Code Review
Browse files

Merge "feat(EvenDimmer): Add popup for removing accessibility shortcuts" into main

parents 60bbddd7 b7f72925
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.database.ContentObserver;
@@ -63,6 +64,7 @@ import android.widget.Toast;
import com.android.internal.R;
import com.android.internal.accessibility.dialog.AccessibilityTarget;
import com.android.internal.accessibility.util.ShortcutUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.function.pooled.PooledLambda;

import java.lang.annotation.Retention;
@@ -122,6 +124,13 @@ public class AccessibilityShortcutController {
            .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
            .setUsage(AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY)
            .build();

    /**
     * An intent action to launch Extra Dim dialog.
     */
    @VisibleForTesting
    static final String ACTION_LAUNCH_REMOVE_EXTRA_DIM_DIALOG =
            "com.android.systemui.action.LAUNCH_REMOVE_EXTRA_DIM_DIALOG";
    private static Map<ComponentName, FrameworkFeatureInfo> sFrameworkShortcutFeaturesMap;

    private final Context mContext;
@@ -846,7 +855,7 @@ public class AccessibilityShortcutController {
            if (com.android.server.display.feature.flags.Flags.evenDimmer()
                    && context.getResources().getBoolean(
                    com.android.internal.R.bool.config_evenDimmerEnabled)) {
                launchExtraDimDialog();
                launchExtraDimDialog(context);
                return true;
            } else {
                // Assuming that the default state will be to have the feature off
@@ -863,8 +872,12 @@ public class AccessibilityShortcutController {
            }
        }

        private void launchExtraDimDialog() {
            // TODO: launch Extra dim dialog for feature migration
        private void launchExtraDimDialog(Context context) {
            final Intent intent = new Intent(ACTION_LAUNCH_REMOVE_EXTRA_DIM_DIALOG);
            intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
            intent.setPackage(
                    context.getString(com.android.internal.R.string.config_systemUi));
            context.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -72,7 +72,8 @@ public final class ShortcutConstants {
            UserShortcutType.TRIPLETAP,
            UserShortcutType.TWOFINGER_DOUBLETAP,
            UserShortcutType.QUICK_SETTINGS,
            UserShortcutType.GESTURE
            UserShortcutType.GESTURE,
            UserShortcutType.ALL
    })
    public @interface UserShortcutType {
        int DEFAULT = 0;
@@ -84,6 +85,7 @@ public final class ShortcutConstants {
        int QUICK_SETTINGS = 1 << 4;
        int GESTURE = 1 << 5;
        // LINT.ThenChange(:shortcut_type_array)
        int ALL = SOFTWARE | HARDWARE | TRIPLETAP | TWOFINGER_DOUBLETAP | QUICK_SETTINGS | GESTURE;
    }

    /**
+8 −0
Original line number Diff line number Diff line
@@ -1062,6 +1062,14 @@
            </intent-filter>
        </receiver>

        <receiver android:name=".accessibility.extradim.ExtraDimDialogReceiver"
            android:singleUser="true"
            android:exported="false">
            <intent-filter android:priority="1">
                <action android:name="com.android.systemui.action.LAUNCH_REMOVE_EXTRA_DIM_DIALOG" />
            </intent-filter>
        </receiver>

        <activity android:name=".logcat.LogAccessDialogActivity"
                  android:theme="@android:style/Theme.Translucent.NoTitleBar"
                  android:excludeFromRecents="true"
+36 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2024 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"
        xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
        android:width="200dp"
        android:height="32dp"
        android:viewportWidth="304"
        android:viewportHeight="48">
<path
    android:pathData="M2,22L302,22A2,2 0,0 1,304 24L304,24A2,2 0,0 1,302 26L2,26A2,2 0,0 1,0 24L0,24A2,2 0,0 1,2 22z"
    android:fillColor="@color/brightness_slider_track"/>
<path
    android:pathData="M24,0L205.71,0A24,24 0,0 1,229.71 24L229.71,24A24,24 0,0 1,205.71 48L24,48A24,24 0,0 1,0 24L0,24A24,24 0,0 1,24 0z"
    android:fillColor="?attr/shadeActive"/>
<path
    android:pathData="M0,24C0,10.75 10.75,0 24,0H63.85V48H24C10.75,48 0,37.25 0,24Z"
    android:fillColor="?androidprv:attr/colorAccentPrimaryVariant"/>
<path
    android:pathData="M208.98,21.26V17.37H205.09L202.34,14.62L199.6,17.37H195.71V21.26L192.96,24L195.71,26.75V30.63H199.6L202.34,33.38L205.09,30.63H208.98V26.75L211.72,24L208.98,21.26ZM207.32,26.06V28.98H204.4L202.34,31.03L200.29,28.98H197.37V26.06L195.31,24L197.37,21.94V19.02H200.29L202.34,16.97L204.4,19.02H207.32V21.94L209.37,24L207.32,26.06ZM206.49,24C206.49,26.29 204.63,28.15 202.34,28.15V19.85C204.63,19.85 206.49,21.71 206.49,24Z"
    android:fillColor="?attr/onShadeActive"
    android:fillType="evenOdd"/>
</vector>
+41 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2024 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:id="@+id/illustration_frame"
    android:orientation="vertical"
    android:paddingHorizontal="16dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:layout_marginVertical="24dp"
        android:scaleType="fitCenter"
        android:importantForAccessibility="no"
        android:theme="@style/Theme.SystemUI.QuickSettings"
        android:src="@drawable/brightness_bar"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:textSize="16sp"
        android:text="@string/accessibility_deprecate_extra_dim_dialog_description"
        android:textAppearance="@style/TextAppearance.Dialog.Body"/>
</LinearLayout>
 No newline at end of file
Loading