android.util.DebugUtils Java Examples

The following examples show how to use android.util.DebugUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Fragment.java    From droidel with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(128);
    DebugUtils.buildShortClassTag(this, sb);
    if (mIndex >= 0) {
        sb.append(" #");
        sb.append(mIndex);
    }
    if (mFragmentId != 0) {
        sb.append(" id=0x");
        sb.append(Integer.toHexString(mFragmentId));
    }
    if (mTag != null) {
        sb.append(" ");
        sb.append(mTag);
    }
    sb.append('}');
    return sb.toString();
}
 
Example #2
Source File: VolumeRecord.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    pw.println("VolumeRecord:");
    pw.increaseIndent();
    pw.printPair("type", DebugUtils.valueToString(VolumeInfo.class, "TYPE_", type));
    pw.printPair("fsUuid", fsUuid);
    pw.printPair("partGuid", partGuid);
    pw.println();
    pw.printPair("nickname", nickname);
    pw.printPair("userFlags",
            DebugUtils.flagsToString(VolumeRecord.class, "USER_FLAG_", userFlags));
    pw.println();
    pw.printPair("createdMillis", TimeUtils.formatForLogging(createdMillis));
    pw.printPair("lastTrimMillis", TimeUtils.formatForLogging(lastTrimMillis));
    pw.printPair("lastBenchMillis", TimeUtils.formatForLogging(lastBenchMillis));
    pw.decreaseIndent();
    pw.println();
}
 
Example #3
Source File: VolumeInfo.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    pw.println("VolumeInfo{" + id + "}:");
    pw.increaseIndent();
    pw.printPair("type", DebugUtils.valueToString(getClass(), "TYPE_", type));
    pw.printPair("diskId", getDiskId());
    pw.printPair("partGuid", partGuid);
    pw.printPair("mountFlags", DebugUtils.flagsToString(getClass(), "MOUNT_FLAG_", mountFlags));
    pw.printPair("mountUserId", mountUserId);
    pw.printPair("state", DebugUtils.valueToString(getClass(), "STATE_", state));
    pw.println();
    pw.printPair("fsType", fsType);
    pw.printPair("fsUuid", fsUuid);
    pw.printPair("fsLabel", fsLabel);
    pw.println();
    pw.printPair("path", path);
    pw.printPair("internalPath", internalPath);
    pw.decreaseIndent();
    pw.println();
}
 
Example #4
Source File: Fragment.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(128);
    DebugUtils.buildShortClassTag(this, sb);
    if (mIndex >= 0) {
        sb.append(" #");
        sb.append(mIndex);
    }
    if (mFragmentId != 0) {
        sb.append(" id=0x");
        sb.append(Integer.toHexString(mFragmentId));
    }
    if (mTag != null) {
        sb.append(" ");
        sb.append(mTag);
    }
    sb.append('}');
    return sb.toString();
}
 
Example #5
Source File: VoiceInteractor.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(128);
    DebugUtils.buildShortClassTag(this, sb);
    if (mVisualPrompt != null && mVoicePrompts != null && mVoicePrompts.length == 1
        && mVisualPrompt.equals(mVoicePrompts[0])) {
        sb.append(" ");
        sb.append(mVisualPrompt);
    } else {
        if (mVisualPrompt != null) {
            sb.append(" visual="); sb.append(mVisualPrompt);
        }
        if (mVoicePrompts != null) {
            sb.append(", voice=");
            for (int i=0; i<mVoicePrompts.length; i++) {
                if (i > 0) sb.append(" | ");
                sb.append(mVoicePrompts[i]);
            }
        }
    }
    sb.append('}');
    return sb.toString();
}
 
Example #6
Source File: LoaderManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(64);
    sb.append("LoaderInfo{");
    sb.append(Integer.toHexString(System.identityHashCode(this)));
    sb.append(" #");
    sb.append(mId);
    sb.append(" : ");
    DebugUtils.buildShortClassTag(mLoader, sb);
    sb.append("}}");
    return sb.toString();
}
 
Example #7
Source File: NetworkPolicyManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * @hide
 */
public static String uidPoliciesToString(int uidPolicies) {
    final StringBuilder string = new StringBuilder().append(uidPolicies).append(" (");
    if (uidPolicies == POLICY_NONE) {
        string.append("NONE");
    } else {
        string.append(DebugUtils.flagsToString(NetworkPolicyManager.class,
                "POLICY_", uidPolicies));
    }
    string.append(")");
    return string.toString();
}
 
Example #8
Source File: NetworkPolicyManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * @hide
 */
public static String uidRulesToString(int uidRules) {
    final StringBuilder string = new StringBuilder().append(uidRules).append(" (");
    if (uidRules == RULE_NONE) {
        string.append("NONE");
    } else {
        string.append(DebugUtils.flagsToString(NetworkPolicyManager.class, "RULE_", uidRules));
    }
    string.append(")");
    return string.toString();
}
 
Example #9
Source File: SaveInfo.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    if (!sDebug) return super.toString();

    final StringBuilder builder = new StringBuilder("SaveInfo: [type=")
            .append(DebugUtils.flagsToString(SaveInfo.class, "SAVE_DATA_TYPE_", mType))
            .append(", requiredIds=").append(Arrays.toString(mRequiredIds))
            .append(", style=").append(DebugUtils.flagsToString(SaveInfo.class,
                    "NEGATIVE_BUTTON_STYLE_", mNegativeButtonStyle));
    if (mOptionalIds != null) {
        builder.append(", optionalIds=").append(Arrays.toString(mOptionalIds));
    }
    if (mDescription != null) {
        builder.append(", description=").append(mDescription);
    }
    if (mFlags != 0) {
        builder.append(", flags=").append(mFlags);
    }
    if (mCustomDescription != null) {
        builder.append(", customDescription=").append(mCustomDescription);
    }
    if (mValidator != null) {
        builder.append(", validator=").append(mValidator);
    }
    if (mSanitizerKeys != null) {
        builder.append(", sanitizerKeys=").append(mSanitizerKeys.length);
    }
    if (mSanitizerValues != null) {
        builder.append(", sanitizerValues=").append(mSanitizerValues.length);
    }
    if (mTriggerId != null) {
        builder.append(", triggerId=").append(mTriggerId);
    }

    return builder.append("]").toString();
}
 
Example #10
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(128);
    DebugUtils.buildShortClassTag(this, sb);
    sb.append(" ");
    sb.append(mInterface.asBinder());
    sb.append(" pkg=");
    sb.append(mCallingPackage);
    sb.append(" uid=");
    UserHandle.formatUid(sb, mCallingUid);
    sb.append('}');
    return sb.toString();
}
 
Example #11
Source File: Loader.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(64);
    DebugUtils.buildShortClassTag(this, sb);
    sb.append(" id=");
    sb.append(mId);
    sb.append("}");
    return sb.toString();
}
 
Example #12
Source File: Loader.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * For debugging, converts an instance of the Loader's data class to
 * a string that can be printed.  Must handle a null data.
 */
public String dataToString(D data) {
    StringBuilder sb = new StringBuilder(64);
    DebugUtils.buildShortClassTag(data, sb);
    sb.append("}");
    return sb.toString();
}
 
Example #13
Source File: VoiceInteractor.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(128);
    DebugUtils.buildShortClassTag(this, sb);
    sb.append(" ");
    sb.append(getRequestTypeName());
    sb.append(" name=");
    sb.append(mName);
    sb.append('}');
    return sb.toString();
}
 
Example #14
Source File: LoaderManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(128);
    sb.append("LoaderManager{");
    sb.append(Integer.toHexString(System.identityHashCode(this)));
    sb.append(" in ");
    DebugUtils.buildShortClassTag(mHost, sb);
    sb.append("}}");
    return sb.toString();
}
 
Example #15
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
private void log(String reason, ActivityIntentInfo info, int match,
        int userId) {
    Slog.w(TAG, reason
            + "; match: "
            + DebugUtils.flagsToString(IntentFilter.class, "MATCH_", match)
            + "; userId: " + userId
            + "; intent info: " + info);
}
 
Example #16
Source File: FragmentManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder(128);
    sb.append("FragmentManager{");
    sb.append(Integer.toHexString(System.identityHashCode(this)));
    sb.append(" in ");
    if (mParent != null) {
        DebugUtils.buildShortClassTag(mParent, sb);
    } else {
        DebugUtils.buildShortClassTag(mHost, sb);
    }
    sb.append("}}");
    return sb.toString();
}
 
Example #17
Source File: DiskInfo.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    pw.println("DiskInfo{" + id + "}:");
    pw.increaseIndent();
    pw.printPair("flags", DebugUtils.flagsToString(getClass(), "FLAG_", flags));
    pw.printPair("size", size);
    pw.printPair("label", label);
    pw.println();
    pw.printPair("sysPath", sysPath);
    pw.decreaseIndent();
    pw.println();
}
 
Example #18
Source File: ActivityManagerShellCommand.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
int getUidState(PrintWriter pw) throws RemoteException {
    mInternal.enforceCallingPermission(android.Manifest.permission.DUMP,
            "getUidState()");
    int state = mInternal.getUidState(Integer.parseInt(getNextArgRequired()));
    pw.print(state);
    pw.print(" (");
    pw.printf(DebugUtils.valueToString(ActivityManager.class, "PROCESS_STATE_", state));
    pw.println(")");
    return 0;
}
 
Example #19
Source File: MultipathPolicyTracker.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    // Do not use in production. Access to class data is only safe on the handler thrad.
    pw.println("MultipathPolicyTracker:");
    pw.increaseIndent();
    for (MultipathTracker t : mMultipathTrackers.values()) {
        pw.println(String.format("Network %s: quota %d, budget %d. Preference: %s",
                t.network, t.getQuota(), t.getMultipathBudget(),
                DebugUtils.flagsToString(ConnectivityManager.class, "MULTIPATH_PREFERENCE_",
                        t.getMultipathPreference())));
    }
    pw.decreaseIndent();
}
 
Example #20
Source File: VibratorService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private int runVibrate() {
    Trace.traceBegin(Trace.TRACE_TAG_VIBRATOR, "runVibrate");
    try {
        try {
            final int zenMode = Settings.Global.getInt(mContext.getContentResolver(),
                    Settings.Global.ZEN_MODE);
            if (zenMode != Settings.Global.ZEN_MODE_OFF) {
                try (PrintWriter pw = getOutPrintWriter();) {
                    pw.print("Ignoring because device is on DND mode ");
                    pw.println(DebugUtils.flagsToString(Settings.Global.class, "ZEN_MODE_",
                            zenMode));
                    return 0;
                }
            }
        } catch (SettingNotFoundException e) {
            // ignore
        }

        final long duration = Long.parseLong(getNextArgRequired());
        if (duration > MAX_VIBRATION_MS) {
            throw new IllegalArgumentException("maximum duration is " + MAX_VIBRATION_MS);
        }
        String description = getNextArg();
        if (description == null) {
            description = "Shell command";
        }

        VibrationEffect effect =
                VibrationEffect.createOneShot(duration, VibrationEffect.DEFAULT_AMPLITUDE);
        vibrate(Binder.getCallingUid(), description, effect, AudioAttributes.USAGE_UNKNOWN,
                mToken);
        return 0;
    } finally {
        Trace.traceEnd(Trace.TRACE_TAG_VIBRATOR);
    }
}
 
Example #21
Source File: PackageUserState.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
private boolean reportIfDebug(boolean result, int flags) {
    if (DEBUG && !result) {
        Slog.i(LOG_TAG, "No match!; flags: "
                + DebugUtils.flagsToString(PackageManager.class, "MATCH_", flags) + " "
                + Debug.getCaller());
    }
    return result;
}