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

Commit 72cf68b6 authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Use ProtoLog directly where KtProtoLog was used

We now support using ProtoLog directly in Kotlin code although not processed.

Flag: EXEMPT refactor
Test: n/a
Change-Id: I78ddc11d9e06ac357bc1b45f770af5b4bf260853
parent f19f3caf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -20,10 +20,10 @@ import android.app.Activity
import android.content.pm.ShortcutManager
import android.graphics.drawable.Icon
import android.os.Bundle
import com.android.internal.protolog.ProtoLog
import com.android.wm.shell.Flags
import com.android.wm.shell.R
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES
import com.android.wm.shell.util.KtProtoLog

/** Activity to create a shortcut to open bubbles */
class CreateBubbleShortcutActivity : Activity() {
@@ -31,7 +31,7 @@ class CreateBubbleShortcutActivity : Activity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (Flags.enableRetrievableBubbles()) {
            KtProtoLog.d(WM_SHELL_BUBBLES, "Creating a shortcut for bubbles")
            ProtoLog.d(WM_SHELL_BUBBLES, "Creating a shortcut for bubbles")
            createShortcut()
        }
        finish()
+2 −2
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@ import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.android.internal.protolog.ProtoLog
import com.android.wm.shell.Flags
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES
import com.android.wm.shell.util.KtProtoLog

/** Activity that sends a broadcast to open bubbles */
class ShowBubblesActivity : Activity() {
@@ -37,7 +37,7 @@ class ShowBubblesActivity : Activity() {
                    // Set the package as the receiver is not exported
                    `package` = packageName
                }
            KtProtoLog.v(WM_SHELL_BUBBLES, "Sending broadcast to show bubbles")
            ProtoLog.v(WM_SHELL_BUBBLES, "Sending broadcast to show bubbles")
            sendBroadcast(intent)
        }
        finish()
+6 −6
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@ package com.android.wm.shell.common

import android.window.WindowContainerToken
import android.window.WindowContainerTransaction
import com.android.internal.protolog.ProtoLog
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TASK_ORG
import com.android.wm.shell.util.KtProtoLog

/**
 * Controller to manage behavior of activities launched with
@@ -30,7 +30,7 @@ class LaunchAdjacentController(private val syncQueue: SyncTransactionQueue) {
    var launchAdjacentEnabled: Boolean = true
        set(value) {
            if (field != value) {
                KtProtoLog.d(WM_SHELL_TASK_ORG, "set launch adjacent flag root enabled=%b", value)
                ProtoLog.d(WM_SHELL_TASK_ORG, "set launch adjacent flag root enabled=%b", value)
                field = value
                container?.let { c ->
                    if (value) {
@@ -52,7 +52,7 @@ class LaunchAdjacentController(private val syncQueue: SyncTransactionQueue) {
     * @see WindowContainerTransaction.setLaunchAdjacentFlagRoot
     */
    fun setLaunchAdjacentRoot(container: WindowContainerToken) {
        KtProtoLog.d(WM_SHELL_TASK_ORG, "set new launch adjacent flag root container")
        ProtoLog.d(WM_SHELL_TASK_ORG, "set new launch adjacent flag root container")
        this.container = container
        if (launchAdjacentEnabled) {
            enableContainer(container)
@@ -67,7 +67,7 @@ class LaunchAdjacentController(private val syncQueue: SyncTransactionQueue) {
     * @see WindowContainerTransaction.clearLaunchAdjacentFlagRoot
     */
    fun clearLaunchAdjacentRoot() {
        KtProtoLog.d(WM_SHELL_TASK_ORG, "clear launch adjacent flag root container")
        ProtoLog.d(WM_SHELL_TASK_ORG, "clear launch adjacent flag root container")
        container?.let {
            disableContainer(it)
            container = null
@@ -75,14 +75,14 @@ class LaunchAdjacentController(private val syncQueue: SyncTransactionQueue) {
    }

    private fun enableContainer(container: WindowContainerToken) {
        KtProtoLog.v(WM_SHELL_TASK_ORG, "enable launch adjacent flag root container")
        ProtoLog.v(WM_SHELL_TASK_ORG, "enable launch adjacent flag root container")
        val wct = WindowContainerTransaction()
        wct.setLaunchAdjacentFlagRoot(container)
        syncQueue.queue(wct)
    }

    private fun disableContainer(container: WindowContainerToken) {
        KtProtoLog.v(WM_SHELL_TASK_ORG, "disable launch adjacent flag root container")
        ProtoLog.v(WM_SHELL_TASK_ORG, "disable launch adjacent flag root container")
        val wct = WindowContainerTransaction()
        wct.clearLaunchAdjacentFlagRoot(container)
        syncQueue.queue(wct)
+6 −6
Original line number Diff line number Diff line
@@ -23,9 +23,9 @@ import android.content.pm.PackageManager
import android.os.UserHandle
import android.view.WindowManager.PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.protolog.ProtoLog
import com.android.wm.shell.R
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL
import com.android.wm.shell.util.KtProtoLog
import java.util.Arrays

/**
@@ -52,7 +52,7 @@ class MultiInstanceHelper @JvmOverloads constructor(
        val packageName = componentName.packageName
        for (pkg in staticAppsSupportingMultiInstance) {
            if (pkg == packageName) {
                KtProtoLog.v(WM_SHELL, "application=%s in allowlist supports multi-instance",
                ProtoLog.v(WM_SHELL, "application=%s in allowlist supports multi-instance",
                    packageName)
                return true
            }
@@ -70,10 +70,10 @@ class MultiInstanceHelper @JvmOverloads constructor(
            // If the above call doesn't throw a NameNotFoundException, then the activity property
            // should override the application property value
            if (activityProp.isBoolean) {
                KtProtoLog.v(WM_SHELL, "activity=%s supports multi-instance", componentName)
                ProtoLog.v(WM_SHELL, "activity=%s supports multi-instance", componentName)
                return activityProp.boolean
            } else {
                KtProtoLog.w(WM_SHELL, "Warning: property=%s for activity=%s has non-bool type=%d",
                ProtoLog.w(WM_SHELL, "Warning: property=%s for activity=%s has non-bool type=%d",
                    PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI, packageName, activityProp.type)
            }
        } catch (nnfe: PackageManager.NameNotFoundException) {
@@ -85,10 +85,10 @@ class MultiInstanceHelper @JvmOverloads constructor(
            val appProp = packageManager.getProperty(
                PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI, packageName)
            if (appProp.isBoolean) {
                KtProtoLog.v(WM_SHELL, "application=%s supports multi-instance", packageName)
                ProtoLog.v(WM_SHELL, "application=%s supports multi-instance", packageName)
                return appProp.boolean
            } else {
                KtProtoLog.w(WM_SHELL,
                ProtoLog.w(WM_SHELL,
                    "Warning: property=%s for application=%s has non-bool type=%d",
                    PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI, packageName, appProp.type)
            }
+6 −6
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

package com.android.wm.shell.desktopmode

import com.android.internal.protolog.ProtoLog
import com.android.internal.util.FrameworkStatsLog
import com.android.wm.shell.protolog.ShellProtoLogGroup
import com.android.wm.shell.util.KtProtoLog

/** Event logger for logging desktop mode session events */
class DesktopModeEventLogger {
@@ -27,7 +27,7 @@ class DesktopModeEventLogger {
     * entering desktop mode
     */
    fun logSessionEnter(sessionId: Int, enterReason: EnterReason) {
        KtProtoLog.v(
        ProtoLog.v(
            ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
            "DesktopModeLogger: Logging session enter, session: %s reason: %s",
            sessionId,
@@ -47,7 +47,7 @@ class DesktopModeEventLogger {
     * exiting desktop mode
     */
    fun logSessionExit(sessionId: Int, exitReason: ExitReason) {
        KtProtoLog.v(
        ProtoLog.v(
            ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
            "DesktopModeLogger: Logging session exit, session: %s reason: %s",
            sessionId,
@@ -67,7 +67,7 @@ class DesktopModeEventLogger {
     * session id [sessionId]
     */
    fun logTaskAdded(sessionId: Int, taskUpdate: TaskUpdate) {
        KtProtoLog.v(
        ProtoLog.v(
            ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
            "DesktopModeLogger: Logging task added, session: %s taskId: %s",
            sessionId,
@@ -99,7 +99,7 @@ class DesktopModeEventLogger {
     * session id [sessionId]
     */
    fun logTaskRemoved(sessionId: Int, taskUpdate: TaskUpdate) {
        KtProtoLog.v(
        ProtoLog.v(
            ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
            "DesktopModeLogger: Logging task remove, session: %s taskId: %s",
            sessionId,
@@ -131,7 +131,7 @@ class DesktopModeEventLogger {
     * having session id [sessionId]
     */
    fun logTaskInfoChanged(sessionId: Int, taskUpdate: TaskUpdate) {
        KtProtoLog.v(
        ProtoLog.v(
            ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
            "DesktopModeLogger: Logging task info changed, session: %s taskId: %s",
            sessionId,
Loading