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

Commit bacef820 authored by Svetoslav's avatar Svetoslav Committed by The Android Automerger
Browse files

Handle print serivce crashes.

1. Now after a print service crashes we are bringing it to the same
    state of its lifecycle. For example, if a service does a discovery
    and crashes we recreate the discovery session call the start
    discovery method and so on.

2. Turned off debugging logs since we have fully fledged state dump.

bug:10697779

Change-Id: Id790537461428e96b197eef12258996bda2bd1ce
parent f2221848
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;

import java.util.List;

/**
 * Base class that provides the content of a document to be printed.
 *
+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ import java.util.Map;
public class FusedPrintersProvider extends Loader<List<PrinterInfo>> {
    private static final String LOG_TAG = "FusedPrintersProvider";

    private static final boolean DEBUG = true && Build.IS_DEBUGGABLE;
    private static final boolean DEBUG = false;

    private static final double WEIGHT_DECAY_COEFFICIENT = 0.95f;

+5 −19
Original line number Diff line number Diff line
@@ -73,9 +73,9 @@ public final class PrintSpoolerService extends Service {

    private static final String LOG_TAG = "PrintSpoolerService";

    private static final boolean DEBUG_PRINT_JOB_LIFECYCLE = true;
    private static final boolean DEBUG_PRINT_JOB_LIFECYCLE = false;

    private static final boolean DEBUG_PERSISTENCE = true;
    private static final boolean DEBUG_PERSISTENCE = false;

    private static final boolean PERSISTNECE_MANAGER_ENABLED = true;

@@ -838,18 +838,8 @@ public final class PrintSpoolerService extends Service {
                                    resolution.getHorizontalDpi()));
                            serializer.attribute(null, ATTR_VERTICAL_DPI, String.valueOf(
                                    resolution.getVerticalDpi()));
                            // We prefer to store only the package name and
                            // resource id and fallback to the label.
                            if (!TextUtils.isEmpty(mediaSize.mPackageName)
                                    && resolution.mLabelResId > 0) {
                                serializer.attribute(null, ATTR_PACKAGE_NAME,
                                        resolution.mPackageName);
                                serializer.attribute(null, ATTR_LABEL_RES_ID,
                                        String.valueOf(resolution.mLabelResId));
                            } else {
                            serializer.attribute(null, ATTR_LABEL,
                                    resolution.getLabel(getPackageManager()));
                            }
                            serializer.endTag(null, TAG_RESOLUTION);
                        }

@@ -1047,11 +1037,7 @@ public final class PrintSpoolerService extends Service {
                            ATTR_HORIZONTAL_DPI));
                    final int verticalDpi = Integer.parseInt(parser.getAttributeValue(null,
                            ATTR_VERTICAL_DPI));
                    String packageName = parser.getAttributeValue(null, ATTR_PACKAGE_NAME);
                    final int labelResId = Integer.parseInt(
                            parser.getAttributeValue(null, ATTR_LABEL_RES_ID));
                    Resolution resolution = new Resolution(id, label, packageName, labelResId,
                                horizontalDpi, verticalDpi);
                    Resolution resolution = new Resolution(id, label, horizontalDpi, verticalDpi);
                    builder.setResolution(resolution);
                    parser.next();
                    skipEmptyTextTags(parser);
+1 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.printspooler;

import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -43,7 +42,7 @@ import java.io.OutputStream;
final class RemotePrintDocumentAdapter {
    private static final String LOG_TAG = "RemotePrintDocumentAdapter";

    private static final boolean DEBUG = true && Build.IS_DEBUGGABLE;
    private static final boolean DEBUG = false;

    private final IPrintDocumentAdapter mRemoteInterface;

Loading