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

Commit 127ed31a authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11044623 from 1865f112 to 24Q1-release

Change-Id: I5e1a9a25cbd8719dd12f74566db67e1daaafa4fd
parents aa0b8c94 1865f112
Loading
Loading
Loading
Loading

aconfig/Android.bp

0 → 100644
+39 −0
Original line number Diff line number Diff line
//
// 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.
//

/*****
 * These flags are meant for SystemUI-owned flags that can be read by non-systemui
 * processes.
 */

package {
    default_visibility: [
        "//visibility:public",
    ]
}

aconfig_declarations {
    name: "com_android_systemui_shared_flags",
    package: "com.android.systemui.shared",
    srcs: [
        "*.aconfig",
    ],
}

java_aconfig_library {
    name: "com_android_systemui_shared_flags_lib",
    aconfig_declarations: "com_android_systemui_shared_flags",
}
+8 −0
Original line number Diff line number Diff line
package: "com.android.systemui.shared"

flag {
    name: "example_shared_flag"
    namespace: "systemui"
    description: "An Example Flag"
    bug: "308482106"
}
 No newline at end of file
+17 −3
Original line number Diff line number Diff line
@@ -43,9 +43,11 @@ public class BitmapInfo {

    public static final int FLAG_THEMED = 1 << 0;
    public static final int FLAG_NO_BADGE = 1 << 1;
    public static final int FLAG_SKIP_USER_BADGE = 1 << 2;
    @IntDef(flag = true, value = {
            FLAG_THEMED,
            FLAG_NO_BADGE,
            FLAG_SKIP_USER_BADGE,
    })
    public @interface DrawableCreationFlags {}

@@ -155,20 +157,32 @@ public class BitmapInfo {
        drawable.mDisabledAlpha = GraphicsUtils.getFloat(context, R.attr.disabledIconAlpha, 1f);
        drawable.mCreationFlags = creationFlags;
        if ((creationFlags & FLAG_NO_BADGE) == 0) {
            Drawable badge = getBadgeDrawable(context, (creationFlags & FLAG_THEMED) != 0);
            Drawable badge = getBadgeDrawable(context, (creationFlags & FLAG_THEMED) != 0,
                    (creationFlags & FLAG_SKIP_USER_BADGE) != 0);
            if (badge != null) {
                drawable.setBadge(badge);
            }
        }
    }

    public Drawable getBadgeDrawable(Context context, boolean isThemed) {
        return getBadgeDrawable(context, isThemed, false);
    }

    /**
     * Returns a drawable representing the badge for this info
     */
    @Nullable
    public Drawable getBadgeDrawable(Context context, boolean isThemed) {
    private Drawable getBadgeDrawable(Context context, boolean isThemed, boolean skipUserBadge) {
        if (badgeInfo != null) {
            return badgeInfo.newIcon(context, isThemed ? FLAG_THEMED : 0);
            int creationFlag = isThemed ? FLAG_THEMED : 0;
            if (skipUserBadge) {
                creationFlag |= FLAG_SKIP_USER_BADGE;
            }
            return badgeInfo.newIcon(context, creationFlag);
        }
        if (skipUserBadge) {
            return null;
        } else if ((flags & FLAG_INSTANT) != 0) {
            return context.getDrawable(isThemed
                    ? R.drawable.ic_instant_app_badge_themed

tracinglib/Android.bp

0 → 100644
+29 −0
Original line number Diff line number Diff line
// 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.

package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

java_library {
    name: "tracinglib",
    static_libs: [
        "kotlinx_coroutines_android",
    ],
    srcs: [
        "src/**/*.kt"
    ],
    kotlincflags: ["-Xjvm-default=all"],
    platform_apis: true,
}
+69 −0
Original line number Diff line number Diff line
/*
 * 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.
 */

package com.android.app.tracing

import com.android.app.tracing.TraceUtils.Companion.instant
import com.android.app.tracing.TraceUtils.Companion.traceCoroutine
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.CopyableThreadContextElement
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.ExperimentalCoroutinesApi

/**
 * Used for safely persisting [TraceData] state when coroutines are suspended and resumed.
 *
 * This is internal machinery for [traceCoroutine]. It cannot be made `internal` or `private`
 * because [traceCoroutine] is a Public-API inline function.
 *
 * @see traceCoroutine
 */
@OptIn(DelicateCoroutinesApi::class)
@ExperimentalCoroutinesApi
class TraceContextElement(private val traceData: TraceData = TraceData()) :
    CopyableThreadContextElement<TraceData?> {

    companion object Key : CoroutineContext.Key<TraceContextElement>

    override val key: CoroutineContext.Key<TraceContextElement> = Key

    @OptIn(ExperimentalStdlibApi::class)
    override fun updateThreadContext(context: CoroutineContext): TraceData? {
        val oldState = threadLocalTrace.get()
        oldState?.endAllOnThread()
        threadLocalTrace.set(traceData)
        instant("resuming ${context[CoroutineDispatcher]}")
        traceData.beginAllOnThread()
        return oldState
    }

    @OptIn(ExperimentalStdlibApi::class)
    override fun restoreThreadContext(context: CoroutineContext, oldState: TraceData?) {
        instant("suspending ${context[CoroutineDispatcher]}")
        traceData.endAllOnThread()
        threadLocalTrace.set(oldState)
        oldState?.beginAllOnThread()
    }

    override fun copyForChild(): CopyableThreadContextElement<TraceData?> {
        return TraceContextElement(traceData.copy())
    }

    override fun mergeForChild(overwritingElement: CoroutineContext.Element): CoroutineContext {
        return TraceContextElement(traceData.copy())
    }
}
Loading