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

Commit 3de74227 authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "DeviceConfig: Split android:window_manager into android and window_manager"

parents e9980944 1c2e9a19
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -2359,6 +2359,11 @@ package android.print {


package android.provider {
package android.provider {


  public interface AndroidDeviceConfig {
    field public static final String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE = "system_gestures_excluded_by_pre_q_sticky_immersive";
    field public static final String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp";
  }

  public static final class CalendarContract.Calendars implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns {
  public static final class CalendarContract.Calendars implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns {
    field public static final String[] SYNC_WRITABLE_COLUMNS;
    field public static final String[] SYNC_WRITABLE_COLUMNS;
  }
  }
@@ -2394,13 +2399,13 @@ package android.provider {
    method public static void removeOnPropertiesChangedListener(@NonNull android.provider.DeviceConfig.OnPropertiesChangedListener);
    method public static void removeOnPropertiesChangedListener(@NonNull android.provider.DeviceConfig.OnPropertiesChangedListener);
    method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static void resetToDefaults(int, @Nullable String);
    method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static void resetToDefaults(int, @Nullable String);
    method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(@NonNull String, @NonNull String, @Nullable String, boolean);
    method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(@NonNull String, @NonNull String, @Nullable String, boolean);
    field public static final String NAMESPACE_ANDROID = "android";
    field public static final String NAMESPACE_AUTOFILL = "autofill";
    field public static final String NAMESPACE_AUTOFILL = "autofill";
    field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
    field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
    field public static final String NAMESPACE_PERMISSIONS = "permissions";
    field public static final String NAMESPACE_PERMISSIONS = "permissions";
    field public static final String NAMESPACE_PRIVACY = "privacy";
    field public static final String NAMESPACE_PRIVACY = "privacy";
    field public static final String NAMESPACE_ROLLBACK = "rollback";
    field public static final String NAMESPACE_ROLLBACK = "rollback";
    field public static final String NAMESPACE_ROLLBACK_BOOT = "rollback_boot";
    field public static final String NAMESPACE_ROLLBACK_BOOT = "rollback_boot";
    field public static final String NAMESPACE_WINDOW_MANAGER = "android:window_manager";
  }
  }


  public static interface DeviceConfig.OnPropertiesChangedListener {
  public static interface DeviceConfig.OnPropertiesChangedListener {
@@ -2417,11 +2422,6 @@ package android.provider {
    method @Nullable public String getString(@NonNull String, @Nullable String);
    method @Nullable public String getString(@NonNull String, @Nullable String);
  }
  }


  public static interface DeviceConfig.WindowManager {
    field public static final String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE = "system_gestures_excluded_by_pre_q_sticky_immersive";
    field public static final String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp";
  }

  public final class MediaStore {
  public final class MediaStore {
    method @RequiresPermission(android.Manifest.permission.CLEAR_APP_USER_DATA) public static void deleteContributedMedia(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
    method @RequiresPermission(android.Manifest.permission.CLEAR_APP_USER_DATA) public static void deleteContributedMedia(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
    method @RequiresPermission(android.Manifest.permission.CLEAR_APP_USER_DATA) public static long getContributedMediaSize(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
    method @RequiresPermission(android.Manifest.permission.CLEAR_APP_USER_DATA) public static long getContributedMediaSize(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
+48 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2019 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 android.provider;

import android.annotation.TestApi;

/**
 * Interface for accessing keys belonging to {@link DeviceConfig#NAMESPACE_ANDROID}.
 * @hide
 */
@TestApi
public interface AndroidDeviceConfig {

    /**
     * Key for accessing the system gesture exclusion limit (an integer in dp).
     *
     * <p>Note: On Devices running Q, this key is in the "android:window_manager" namespace.
     *
     * @see android.provider.DeviceConfig#NAMESPACE_ANDROID
     */
    String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp";

    /**
     * Key for controlling whether system gestures are implicitly excluded by windows requesting
     * sticky immersive mode from apps that are targeting an SDK prior to Q.
     *
     * <p>Note: On Devices running Q, this key is in the "android:window_manager" namespace.
     *
     * @see android.provider.DeviceConfig#NAMESPACE_ANDROID
     */
    String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE =
            "system_gestures_excluded_by_pre_q_sticky_immersive";

}
+12 −45
Original line number Original line Diff line number Diff line
@@ -314,13 +314,22 @@ public final class DeviceConfig {
    public static final String NAMESPACE_SETTINGS_UI = "settings_ui";
    public static final String NAMESPACE_SETTINGS_UI = "settings_ui";


    /**
    /**
     * Namespace for window manager related features. The names to access the properties in this
     * Namespace for android related features, i.e. for flags that affect not just a single
     * namespace should be defined in {@link WindowManager}.
     * component, but the entire system.
     *
     * The keys for this namespace are defined in {@link AndroidDeviceConfig}.
     *
     *
     * @hide
     * @hide
     */
     */
    @TestApi
    @TestApi
    public static final String NAMESPACE_WINDOW_MANAGER = "android:window_manager";
    public static final String NAMESPACE_ANDROID = "android";

    /**
     * Namespace for window manager related features.
     *
     * @hide
     */
    public static final String NAMESPACE_WINDOW_MANAGER = "window_manager";


    /**
    /**
     * List of namespaces which can be read without READ_DEVICE_CONFIG permission
     * List of namespaces which can be read without READ_DEVICE_CONFIG permission
@@ -348,48 +357,6 @@ public final class DeviceConfig {
    @TestApi
    @TestApi
    public static final String NAMESPACE_PERMISSIONS = "permissions";
    public static final String NAMESPACE_PERMISSIONS = "permissions";


    /**
     * Interface for accessing keys belonging to {@link #NAMESPACE_WINDOW_MANAGER}.
     * @hide
     */
    @TestApi
    public interface WindowManager {

        /**
         * Key for accessing the system gesture exclusion limit (an integer in dp).
         *
         * @see android.provider.DeviceConfig#NAMESPACE_WINDOW_MANAGER
         * @hide
         */
        @TestApi
        String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp";

        /**
         * Key for controlling whether system gestures are implicitly excluded by windows requesting
         * sticky immersive mode from apps that are targeting an SDK prior to Q.
         *
         * @see android.provider.DeviceConfig#NAMESPACE_WINDOW_MANAGER
         * @hide
         */
        @TestApi
        String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE =
                "system_gestures_excluded_by_pre_q_sticky_immersive";

        /**
         * The minimum duration between gesture exclusion logging for a given window in
         * milliseconds.
         *
         * Events that happen in-between will be silently dropped.
         *
         * A non-positive value disables logging.
         *
         * @see android.provider.DeviceConfig#NAMESPACE_WINDOW_MANAGER
         * @hide
         */
        String KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS =
                "system_gesture_exclusion_log_debounce_millis";
    }

    private static final Object sLock = new Object();
    private static final Object sLock = new Object();
    @GuardedBy("sLock")
    @GuardedBy("sLock")
    private static ArrayMap<OnPropertiesChangedListener, Pair<String, Executor>> sListeners =
    private static ArrayMap<OnPropertiesChangedListener, Pair<String, Executor>> sListeners =
+3 −3
Original line number Original line Diff line number Diff line
@@ -857,7 +857,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        mWallpaperController = new WallpaperController(mWmService, this);
        mWallpaperController = new WallpaperController(mWmService, this);
        display.getDisplayInfo(mDisplayInfo);
        display.getDisplayInfo(mDisplayInfo);
        display.getMetrics(mDisplayMetrics);
        display.getMetrics(mDisplayMetrics);
        mSystemGestureExclusionLimit = mWmService.mSystemGestureExclusionLimitDp
        mSystemGestureExclusionLimit = mWmService.mConstants.mSystemGestureExclusionLimitDp
                * mDisplayMetrics.densityDpi / DENSITY_DEFAULT;
                * mDisplayMetrics.densityDpi / DENSITY_DEFAULT;
        isDefaultDisplay = mDisplayId == DEFAULT_DISPLAY;
        isDefaultDisplay = mDisplayId == DEFAULT_DISPLAY;
        mDisplayFrames = new DisplayFrames(mDisplayId, mDisplayInfo,
        mDisplayFrames = new DisplayFrames(mDisplayId, mDisplayInfo,
@@ -2037,7 +2037,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
    }
    }


    void updateSystemGestureExclusionLimit() {
    void updateSystemGestureExclusionLimit() {
        mSystemGestureExclusionLimit = mWmService.mSystemGestureExclusionLimitDp
        mSystemGestureExclusionLimit = mWmService.mConstants.mSystemGestureExclusionLimitDp
                * mDisplayMetrics.densityDpi / DENSITY_DEFAULT;
                * mDisplayMetrics.densityDpi / DENSITY_DEFAULT;
        updateSystemGestureExclusion();
        updateSystemGestureExclusion();
    }
    }
@@ -5094,7 +5094,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
     * @return Whether gesture exclusion area should be logged for the given window
     * @return Whether gesture exclusion area should be logged for the given window
     */
     */
    static boolean logsGestureExclusionRestrictions(WindowState win) {
    static boolean logsGestureExclusionRestrictions(WindowState win) {
        if (win.mWmService.mSystemGestureExclusionLogDebounceTimeoutMillis <= 0) {
        if (win.mWmService.mConstants.mSystemGestureExclusionLogDebounceTimeoutMillis <= 0) {
            return false;
            return false;
        }
        }
        final WindowManager.LayoutParams attrs = win.getAttrs();
        final WindowManager.LayoutParams attrs = win.getAttrs();
+3 −29
Original line number Original line Diff line number Diff line
@@ -27,9 +27,9 @@ import android.util.ArraySet;
import com.android.internal.R;
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.BackgroundThread;
import com.android.internal.os.BackgroundThread;
import com.android.server.wm.utils.DeviceConfigInterface;


import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.concurrent.Executor;


/**
/**
 * A Blacklist for packages that should force the display out of high refresh rate.
 * A Blacklist for packages that should force the display out of high refresh rate.
@@ -45,25 +45,7 @@ class HighRefreshRateBlacklist {
    private OnPropertiesChangedListener mListener = new OnPropertiesChangedListener();
    private OnPropertiesChangedListener mListener = new OnPropertiesChangedListener();


    static HighRefreshRateBlacklist create(@NonNull Resources r) {
    static HighRefreshRateBlacklist create(@NonNull Resources r) {
        return new HighRefreshRateBlacklist(r, new DeviceConfigInterface() {
        return new HighRefreshRateBlacklist(r, DeviceConfigInterface.REAL);
            @Override
            public @Nullable String getProperty(@NonNull String namespace, @NonNull String name) {
                return DeviceConfig.getProperty(namespace, name);
            }

            @Override
            public void addOnPropertiesChangedListener(@NonNull String namespace,
                    @NonNull Executor executor,
                    @NonNull DeviceConfig.OnPropertiesChangedListener listener) {
                DeviceConfig.addOnPropertiesChangedListener(namespace, executor, listener);
            }

            @Override
            public void removePropertiesChangedListener(
                    DeviceConfig.OnPropertiesChangedListener listener) {
                DeviceConfig.removeOnPropertiesChangedListener(listener);
            }
        });
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -116,19 +98,11 @@ class HighRefreshRateBlacklist {
    /** Used to prevent WmTests leaking issues. */
    /** Used to prevent WmTests leaking issues. */
    @VisibleForTesting
    @VisibleForTesting
    void dispose() {
    void dispose() {
        mDeviceConfig.removePropertiesChangedListener(mListener);
        mDeviceConfig.removeOnPropertiesChangedListener(mListener);
        mDeviceConfig = null;
        mDeviceConfig = null;
        mBlacklistedPackages.clear();
        mBlacklistedPackages.clear();
    }
    }


    interface DeviceConfigInterface {
        @Nullable String getProperty(@NonNull String namespace, @NonNull String name);
        void addOnPropertiesChangedListener(@NonNull String namespace, @NonNull Executor executor,
                @NonNull DeviceConfig.OnPropertiesChangedListener listener);
        void removePropertiesChangedListener(
                @NonNull DeviceConfig.OnPropertiesChangedListener listener);
    }

    private class OnPropertiesChangedListener implements DeviceConfig.OnPropertiesChangedListener {
    private class OnPropertiesChangedListener implements DeviceConfig.OnPropertiesChangedListener {
        public void onPropertiesChanged(@NonNull DeviceConfig.Properties properties) {
        public void onPropertiesChanged(@NonNull DeviceConfig.Properties properties) {
            updateBlacklist(
            updateBlacklist(
Loading