public class

CrashInfoParcel

extends java.lang.Object

 java.lang.Object

↳androidx.wear.watchface.control.data.CrashInfoParcel

Gradle dependencies

compile group: 'androidx.wear.watchface', name: 'watchface-data', version: '1.3.0-alpha03'

  • groupId: androidx.wear.watchface
  • artifactId: watchface-data
  • version: 1.3.0-alpha03

Artifact androidx.wear.watchface:watchface-data:1.3.0-alpha03 it located at Google repository (https://maven.google.com/)

Overview

Used for sending details of an exception over aidl.

Summary

Fields
public final CrashInfocrashInfo

public static final <any>CREATOR

Constructors
publicCrashInfoParcel(java.lang.Throwable exception)

Methods
public intdescribeContents()

public java.lang.StringtoString()

public voidwriteToParcel(Parcel dest, int flags)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Fields

public final CrashInfo crashInfo

public static final <any> CREATOR

Constructors

public CrashInfoParcel(java.lang.Throwable exception)

Methods

public int describeContents()

public void writeToParcel(Parcel dest, int flags)

public java.lang.String toString()

Source

/*
 * Copyright 2021 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.wear.watchface.control.data;

import static android.app.ApplicationErrorReport.CrashInfo;

import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.StringBuilderPrinter;

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

/**
 * Used for sending details of an exception over aidl.
 *
 */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@SuppressLint("BanParcelableUsage")
public class CrashInfoParcel implements Parcelable {
    @NonNull public final CrashInfo crashInfo;

    public CrashInfoParcel(@NonNull Throwable exception) {
        crashInfo = new CrashInfo(exception);
    }

    CrashInfoParcel(Parcel in) {
        crashInfo = new CrashInfo(in);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        crashInfo.writeToParcel(dest, flags);
    }

    public static final Parcelable.Creator<CrashInfoParcel> CREATOR =
            new Parcelable.Creator<CrashInfoParcel>() {
                @Override
                public CrashInfoParcel createFromParcel(Parcel source) {
                    return new CrashInfoParcel(source);
                }

                @Override
                public CrashInfoParcel[] newArray(int size) {
                    return new CrashInfoParcel[size];
                }
            };

    @NonNull
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        StringBuilderPrinter pr = new StringBuilderPrinter(sb);
        crashInfo.dump(pr, "");
        return sb.toString();
    }
}