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

Commit 2f8c5f74 authored by Antonio Kantek's avatar Antonio Kantek
Browse files

Disable fill dialog on Automotive with multi-window

The autofill fill dialog should be disabled on Automotive multi-window
until it is fixed.

Bug: 420943436
Fix: 419125012
Test: atest CtsAutoFillServiceTestCases:LoginActivityTest#testCancelFillDialog_showDropdown_v2
Flag: android.service.autofill.disable_fill_dialog_on_automotive_multi_window
Change-Id: I52e98b57042b7dba6a96f76ad847465f06a4e3ef
parent 02e10010
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -20,10 +20,14 @@ import static android.service.autofill.Flags.improveFillDialogAconfig;

import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.app.ActivityThread;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.provider.DeviceConfig;
import android.service.autofill.Flags;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;
import android.view.View;

import com.android.internal.util.ArrayUtils;
@@ -38,6 +42,8 @@ import java.util.Set;
@TestApi
public class AutofillFeatureFlags {

    private static final String TAG = AutofillFeatureFlags.class.getSimpleName();

    /**
     * {@code DeviceConfig} property used to set which Smart Suggestion modes for Augmented Autofill
     * are available.
@@ -428,6 +434,7 @@ public class AutofillFeatureFlags {
     * @hide
     */
    public static final int DEFAULT_MAX_INPUT_LENGTH_FOR_AUTOFILL = 3;

    private AutofillFeatureFlags() {};

    /**
@@ -678,14 +685,31 @@ public class AutofillFeatureFlags {
     * @hide
     */
    public static boolean isImproveFillDialogEnabled() {
        // TODO(b/266379948): Add condition for checking whether device has PCC first
        // TODO(b/420943436): Temporarily skipping this test on Automotive with Multi-Window
        // until b/420943436 is fixed.
        if (Flags.disableFillDialogOnAutomotiveMultiWindow()
                && isAutomotiveWithMultiWindow()) {
            return false;
        }

        // TODO(b/266379948): Add condition for checking whether device has PCC first
        return improveFillDialogAconfig() && DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_AUTOFILL,
                DEVICE_CONFIG_IMPROVE_FILL_DIALOG_ENABLED,
                DEFAULT_IMPROVE_FILL_DIALOG_ENABLED);
    }

    private static boolean isAutomotiveWithMultiWindow() {
        try {
            return ActivityThread.getPackageManager().hasSystemFeature(
                    PackageManager.FEATURE_CAR_SPLITSCREEN_MULTITASKING, 0 /* version */);
        } catch (RemoteException e) {
            Log.e(TAG, "Error retrieving system features to confirm "
                    + "FEATURE_CAR_SPLITSCREEN_MULTITASKING", e);
            return false;
        }
    }

    /**
     * Whether Autofill Pre Trigger Removal is enabled.
     *
+10 −0
Original line number Diff line number Diff line
@@ -133,3 +133,13 @@ flag {
  description: "Log the UID of the augmented autofill service in FillRequest events"
  bug: "411232512"
}

flag {
  name: "disable_fill_dialog_on_automotive_multi_window"
  namespace: "autofill"
  description: "Disable fill dialog on automotive multi-window target"
  bug: "420943436"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}