public class

ErrorEvent

extends AnalyticsEvent

 java.lang.Object

androidx.car.app.mediaextensions.analytics.event.AnalyticsEvent

↳androidx.car.app.mediaextensions.analytics.event.ErrorEvent

Gradle dependencies

compile group: 'androidx.car.app', name: 'app', version: '1.7.0-beta01'

  • groupId: androidx.car.app
  • artifactId: app
  • version: 1.7.0-beta01

Artifact androidx.car.app:app:1.7.0-beta01 it located at Google repository (https://maven.google.com/)

Overview

Analytics event indicating a parsing error.

Summary

Fields
public static final intERROR_CODE_INVALID_BUNDLE

Indicates an invalid bundle

public static final intERROR_CODE_INVALID_EVENT

Indicates invalid event

public static final intERROR_CODE_INVALID_EXTRAS

Indicates an invalid intent

from AnalyticsEventEVENT_TYPE_BROWSE_NODE_CHANGED_EVENT, EVENT_TYPE_ERROR_EVENT, EVENT_TYPE_MEDIA_CLICKED_EVENT, EVENT_TYPE_UNKNOWN_EVENT, EVENT_TYPE_VIEW_CHANGE_EVENT, EVENT_TYPE_VISIBLE_ITEMS_EVENT, VIEW_ACTION_HIDE, VIEW_ACTION_MODE_NONE, VIEW_ACTION_MODE_SCROLL, VIEW_ACTION_SHOW, VIEW_COMPONENT_BROWSE_ACTION_OVERFLOW, VIEW_COMPONENT_BROWSE_LIST, VIEW_COMPONENT_BROWSE_TABS, VIEW_COMPONENT_ERROR_MESSAGE, VIEW_COMPONENT_LAUNCHER, VIEW_COMPONENT_MEDIA_HOST, VIEW_COMPONENT_MINI_PLAYBACK, VIEW_COMPONENT_PLAYBACK, VIEW_COMPONENT_QUEUE_LIST, VIEW_COMPONENT_SETTINGS_VIEW, VIEW_COMPONENT_UNKNOWN_COMPONENT
Constructors
publicErrorEvent(Bundle eventBundle, int errorCode)

Methods
public intgetErrorCode()

Returns error code

public java.lang.StringtoString()

from AnalyticsEventgetAnalyticsVersion, getComponent, getEventType, getTimestampMillis
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Fields

public static final int ERROR_CODE_INVALID_EXTRAS

Indicates an invalid intent

public static final int ERROR_CODE_INVALID_BUNDLE

Indicates an invalid bundle

public static final int ERROR_CODE_INVALID_EVENT

Indicates invalid event

Constructors

public ErrorEvent(Bundle eventBundle, int errorCode)

Methods

public int getErrorCode()

Returns error code

public java.lang.String toString()

Source

/*
 * Copyright 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 androidx.car.app.mediaextensions.analytics.event;

import static androidx.annotation.RestrictTo.Scope.LIBRARY;

import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.os.Bundle;

import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;

import java.lang.annotation.Retention;

/**
 * Analytics event indicating a parsing error.
 */
public class ErrorEvent extends AnalyticsEvent{

    /** Indicates an invalid intent*/
    public static final int ERROR_CODE_INVALID_EXTRAS = 0;
    /** Indicates an invalid bundle*/
    public static final int ERROR_CODE_INVALID_BUNDLE = 1;
    /** Indicates invalid event */
    public static final int ERROR_CODE_INVALID_EVENT = 2;

    @Retention(SOURCE)
    @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    @IntDef (
            value = {ERROR_CODE_INVALID_EXTRAS, ERROR_CODE_INVALID_BUNDLE, ERROR_CODE_INVALID_EVENT}
    )
    public @interface ErrorCode {}

    private @ErrorCode int mErrorCode;

    @RestrictTo(LIBRARY)
    public ErrorEvent(@NonNull Bundle eventBundle, @ErrorCode int errorCode) {
        super(eventBundle, EVENT_TYPE_ERROR_EVENT);
        mErrorCode = errorCode;
    }

    /**
     * Returns error code
     */
    public @ErrorCode int getErrorCode() {
        return mErrorCode;
    }

    @NonNull
    @Override
    public String toString() {
        return "ErrorEvent{"
                + "mErrorCode="
                + mErrorCode
                + '}';
    }
}