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

Commit d34e2142 authored by Pablo Gamito's avatar Pablo Gamito Committed by Android (Google) Code Review
Browse files

Merge changes I6b03ce62,I309744fa into main

* changes:
  Add lint rule to make make sure we update the ProtoLogTool when updating the ProtoLog class name
  Update KtProtoLog doc strings
parents e8474198 941547d4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -39,7 +39,9 @@ import com.android.internal.protolog.common.LogLevel;
 * Methods in this class are stubs, that are replaced by optimised versions by the ProtoLogTool
 * during build.
 */
// LINT.IfChange
public class ProtoLog {
// LINT.ThenChange(frameworks/base/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt)

    // Needs to be set directly otherwise the protologtool tries to transform the method call
    public static boolean REQUIRE_PROTOLOGTOOL = true;
+7 −7
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import com.android.internal.protolog.common.IProtoLogGroup
import com.android.internal.protolog.ProtoLog

/**
 * Log messages using an API similar to [com.android.internal.protolog.common.ProtoLog]. Useful for
 * Log messages using an API similar to [com.android.internal.protolog.ProtoLog]. Useful for
 * logging from Kotlin classes as ProtoLog does not have support for Kotlin.
 *
 * All messages are logged to logcat if logging is enabled for that [IProtoLogGroup].
@@ -29,42 +29,42 @@ import com.android.internal.protolog.ProtoLog
// TODO(b/168581922): remove once ProtoLog adds support for Kotlin
class KtProtoLog {
    companion object {
        /** @see [com.android.internal.protolog.common.ProtoLog.d] */
        /** @see [com.android.internal.protolog.ProtoLog.d] */
        fun d(group: IProtoLogGroup, messageString: String, vararg args: Any) {
            if (group.isLogToLogcat) {
                Log.d(group.tag, String.format(messageString, *args))
            }
        }

        /** @see [com.android.internal.protolog.common.ProtoLog.v] */
        /** @see [com.android.internal.protolog.ProtoLog.v] */
        fun v(group: IProtoLogGroup, messageString: String, vararg args: Any) {
            if (group.isLogToLogcat) {
                Log.v(group.tag, String.format(messageString, *args))
            }
        }

        /** @see [com.android.internal.protolog.common.ProtoLog.i] */
        /** @see [com.android.internal.protolog.ProtoLog.i] */
        fun i(group: IProtoLogGroup, messageString: String, vararg args: Any) {
            if (group.isLogToLogcat) {
                Log.i(group.tag, String.format(messageString, *args))
            }
        }

        /** @see [com.android.internal.protolog.common.ProtoLog.w] */
        /** @see [com.android.internal.protolog.ProtoLog.w] */
        fun w(group: IProtoLogGroup, messageString: String, vararg args: Any) {
            if (group.isLogToLogcat) {
                Log.w(group.tag, String.format(messageString, *args))
            }
        }

        /** @see [com.android.internal.protolog.common.ProtoLog.e] */
        /** @see [com.android.internal.protolog.ProtoLog.e] */
        fun e(group: IProtoLogGroup, messageString: String, vararg args: Any) {
            if (group.isLogToLogcat) {
                Log.e(group.tag, String.format(messageString, *args))
            }
        }

        /** @see [com.android.internal.protolog.common.ProtoLog.wtf] */
        /** @see [com.android.internal.protolog.ProtoLog.wtf] */
        fun wtf(group: IProtoLogGroup, messageString: String, vararg args: Any) {
            if (group.isLogToLogcat) {
                Log.wtf(group.tag, String.format(messageString, *args))