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

Commit 3dd81750 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add more logging to ShortcutService for debugging b&r issues." into main

parents ad71615f 79fb63c1
Loading
Loading
Loading
Loading
+34 −23
Original line number Diff line number Diff line
@@ -2501,33 +2501,19 @@ public final class ShortcutInfo implements Parcelable {
        return toStringInner(/* secure =*/ false, /* includeInternalData =*/ true, indent);
    }

    private void addIndentOrComma(StringBuilder sb, String indent) {
        if (indent != null) {
            sb.append("\n  ");
            sb.append(indent);
        } else {
            sb.append(", ");
        }
    }

    private String toStringInner(boolean secure, boolean includeInternalData, String indent) {
    /** @hide */
    public String toSimpleString() {
        final StringBuilder sb = new StringBuilder();

        if (indent != null) {
            sb.append(indent);
        sb.append(mId);
        addReadableFlags(sb);
        return sb.toString();
    }

        sb.append("ShortcutInfo {");

        sb.append("id=");
        sb.append(secure ? "***" : mId);

        sb.append(", flags=0x");
        sb.append(Integer.toHexString(mFlags));
    private void addReadableFlags(StringBuilder sb) {
        sb.append(" [");
        if ((mFlags & FLAG_SHADOW) != 0) {
            // Note the shadow flag isn't actually used anywhere and it's just for dumpsys, so
            // we don't have an isXxx for this.
            // Note the shadow flag isn't actually used anywhere and it's
            // just for dumpsys, so we don't have an isXxx for this.
            sb.append("Sdw");
        }
        if (!isEnabled()) {
@@ -2576,7 +2562,32 @@ public final class ShortcutInfo implements Parcelable {
            sb.append("Hid-L");
        }
        sb.append("]");
    }

    private void addIndentOrComma(StringBuilder sb, String indent) {
        if (indent != null) {
            sb.append("\n  ");
            sb.append(indent);
        } else {
            sb.append(", ");
        }
    }

    private String toStringInner(boolean secure, boolean includeInternalData, String indent) {
        final StringBuilder sb = new StringBuilder();

        if (indent != null) {
            sb.append(indent);
        }

        sb.append("ShortcutInfo {");

        sb.append("id=");
        sb.append(secure ? "***" : mId);

        sb.append(", flags=0x");
        sb.append(Integer.toHexString(mFlags));
        addReadableFlags(sb);
        addIndentOrComma(sb, indent);

        sb.append("packageName=");
+6 −0
Original line number Diff line number Diff line
@@ -282,6 +282,12 @@ class ShortcutLauncher extends ShortcutPackageItem {
            for (int j = 0; j < idSize; j++) {
                ShortcutService.writeTagValue(out, TAG_PIN, ids.valueAt(j));
            }
            if (ShortcutService.DEBUG_REBOOT) {
                Slog.d(TAG, "Persist shortcut ids pinned by "
                    + getPackageName() + " from "
                    + up.userId + "@" + up.packageName + " ids=["
                    + String.join(", ", ids) + "]");
            }
            out.endTag(null, TAG_PACKAGE);
        }

+9 −1
Original line number Diff line number Diff line
@@ -1850,9 +1850,17 @@ class ShortcutPackage extends ShortcutPackageItem {
            }
            getPackageInfo().saveToXml(mShortcutUser.mService, out, forBackup);

            if (ShortcutService.DEBUG_REBOOT) {
                Slog.d(TAG, "Persisting shortcuts from "
                    + getOwnerUserId() + "@" + getPackageName());
            }
            for (int j = 0; j < size; j++) {
                final ShortcutInfo si = mShortcuts.valueAt(j);
                saveShortcut(
                        out, mShortcuts.valueAt(j), forBackup, getPackageInfo().isBackupAllowed());
                        out, si, forBackup, getPackageInfo().isBackupAllowed());
                if (ShortcutService.DEBUG_REBOOT) {
                    Slog.d(TAG, si.toSimpleString());
                }
            }

            if (!forBackup) {
+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ public class ShortcutService extends IShortcutService.Stub {
    static final boolean DEBUG = false; // STOPSHIP if true
    static final boolean DEBUG_LOAD = false; // STOPSHIP if true
    static final boolean DEBUG_PROCSTATE = false; // STOPSHIP if true
    static final boolean DEBUG_REBOOT = true;
    static final boolean DEBUG_REBOOT = Build.IS_DEBUGGABLE;

    @VisibleForTesting
    static final long DEFAULT_RESET_INTERVAL_SEC = 24 * 60 * 60; // 1 day