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

Commit 6fe98599 authored by Evan Laird's avatar Evan Laird Committed by Android (Google) Code Review
Browse files

Merge changes from topic "network-slice-bg" into main

* changes:
  [Sb] Slice flag to teamfood
  [Sb] Define a network slice UI for mobile icons
  [Sb] Add background and foreground support to icon tints
  [Sb] Add prioritize_latency tracking in mobile connections
  [Sb] Add self-certified network capabilities
  [Sb] Network slice UI flag
parents 36fb07f7 ed6ceb86
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@
    <uses-permission android:name="android.permission.PEERS_MAC_ADDRESS"/>
    <uses-permission android:name="android.permission.READ_WIFI_CREDENTIAL"/>
    <uses-permission android:name="android.permission.LOCATION_HARDWARE" />
    <uses-permission android:name="android.permission.NETWORK_FACTORY" />
    <!-- Physical hardware -->
    <uses-permission android:name="android.permission.MANAGE_USB" />
    <uses-permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS" />
@@ -1062,5 +1063,9 @@
            <meta-data android:name="androidx.emoji2.text.EmojiCompatInitializer"
                tools:node="remove" />
        </provider>

        <!-- Allow SystemUI to listen for the capabilities defined in the linked xml -->
        <property android:name="android.net.PROPERTY_SELF_CERTIFIED_CAPABILITIES"
                  android:value="@xml/self_certified_network_capabilities_both" />
    </application>
</manifest>
+2 −1
Original line number Diff line number Diff line
@@ -371,7 +371,8 @@ private fun StatusIcons(
            val iconContainer = StatusIconContainer(context, null)
            val iconManager = createTintedIconManager(iconContainer, StatusBarLocation.QS)
            iconManager.setTint(
                Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
                Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary),
                Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimaryInverse),
            )
            statusBarIconController.addIconGroup(iconManager)

+50 −1
Original line number Diff line number Diff line
@@ -71,7 +71,11 @@ public interface DarkIconDispatcher {
      */
    void applyDark(DarkReceiver object);

    /** The default tint (applicable for dark backgrounds) is white */
    int DEFAULT_ICON_TINT = Color.WHITE;
    /** To support an icon which wants to create contrast, the default tint is black-on-white. */
    int DEFAULT_INVERSE_ICON_TINT = Color.BLACK;

    Rect sTmpRect = new Rect();
    int[] sTmpInt2 = new int[2];

@@ -87,6 +91,18 @@ public interface DarkIconDispatcher {
        }
    }

    /**
     * @return the tint to apply to a foreground, given that the background is tinted
     *         per {@link #getTint}
     */
    static int getInverseTint(Collection<Rect> tintAreas, View view, int inverseColor) {
        if (isInAreas(tintAreas, view)) {
            return inverseColor;
        } else {
            return DEFAULT_INVERSE_ICON_TINT;
        }
    }

    /**
     * @return true if more than half of the view area are in any of the given
     *         areas, false otherwise
@@ -129,7 +145,40 @@ public interface DarkIconDispatcher {
     */
    @ProvidesInterface(version = DarkReceiver.VERSION)
    interface DarkReceiver {
        int VERSION = 2;
        int VERSION = 3;

        /**
         * @param areas list of regions on screen where the tint applies
         * @param darkIntensity float representing the level of tint. In the range [0,1]
         * @param tint the tint applicable as a foreground contrast to the dark regions. This value
         *             is interpolated between a default light and dark tone, and is therefore
         *             usable as-is, as long as the view is in one of the areas defined in
         *             {@code areas}.
         *
         * @see DarkIconDispatcher#isInArea(Rect, View) for utilizing {@code areas}
         *
         * Note: only one of {@link #onDarkChanged(ArrayList, float, int)} or
         * {@link #onDarkChangedWithContrast(ArrayList, int, int)} need to be implemented, as both
         * will be called in the same circumstances.
         */
        void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint);

        /**
         * New version of onDarkChanged, which describes a tint plus an optional contrastTint
         * that can be used if the tint is applied to the background of an icon.
         *
         * We use the 2 here to avoid the case where an existing override of onDarkChanged
         * might pass in parameters as bare numbers (e.g. 0 instead of 0f) which might get
         * mistakenly cast to (int) and therefore trigger this method.
         *
         * @param areas list of areas where dark tint applies
         * @param tint int describing the tint color to use
         * @param contrastTint if desired, a contrasting color that can be used for a foreground
         *
         * Note: only one of {@link #onDarkChanged(ArrayList, float, int)} or
         * {@link #onDarkChangedWithContrast(ArrayList, int, int)} need to be implemented, as both
         * will be called in the same circumstances.
         */
        default void onDarkChangedWithContrast(ArrayList<Rect> areas, int tint, int contrastTint) {}
    }
}
+15 −8
Original line number Diff line number Diff line
@@ -52,15 +52,22 @@
                android:visibility="gone"
                />
        </FrameLayout>
        <FrameLayout
            android:id="@+id/mobile_type_container"
            android:layout_height="@dimen/status_bar_mobile_container_height"
            android:layout_width="wrap_content"
            android:layout_marginStart="2.5sp"
            android:layout_marginEnd="1sp"
            android:visibility="gone"
            >
            <ImageView
                android:id="@+id/mobile_type"
                android:layout_height="@dimen/status_bar_mobile_type_size"
                android:layout_width="wrap_content"
                android:layout_gravity="center_vertical"
                android:adjustViewBounds="true"
            android:paddingStart="2.5sp"
            android:paddingEnd="1sp"
            android:visibility="gone" />
                />
        </FrameLayout>
        <Space
            android:id="@+id/mobile_roaming_space"
            android:layout_height="match_parent"
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2023 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.
  ~
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    >
    <corners
        android:topLeftRadius="0dp"
        android:topRightRadius="@dimen/status_bar_mobile_container_corner_radius"
        android:bottomRightRadius="0dp"
        android:bottomLeftRadius="@dimen/status_bar_mobile_container_corner_radius"/>
    <solid android:color="#FFF" />
    <padding
        android:left="2sp"
        android:right="2sp"/>
</shape>
Loading