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 Project: android_9.0.0_r45   Author: lulululbj   File: VolumeRecord.java    License: 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 #2
Source Project: android_9.0.0_r45   Author: lulululbj   File: VolumeInfo.java    License: 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 #3
Source Project: android_9.0.0_r45   Author: lulululbj   File: Fragment.java    License: 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 #4
Source Project: android_9.0.0_r45   Author: lulululbj   File: VoiceInteractor.java    License: 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 #5
Source Project: droidel   Author: cuplv   File: Fragment.java    License: 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 #6
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ComponentResolver.java    License: 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 #7
Source Project: AndroidComponentPlugin   Author: androidmalin   File: PackageUserState.java    License: 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;
}
 
Example #8
Source Project: android_9.0.0_r45   Author: lulululbj   File: VibratorService.java    License: 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 #9
Source Project: android_9.0.0_r45   Author: lulululbj   File: MultipathPolicyTracker.java    License: 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 #10
Source Project: android_9.0.0_r45   Author: lulululbj   File: ActivityManagerShellCommand.java    License: 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 #11
Source Project: android_9.0.0_r45   Author: lulululbj   File: DiskInfo.java    License: 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 #12
Source Project: android_9.0.0_r45   Author: lulululbj   File: FragmentManager.java    License: 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 #13
Source Project: android_9.0.0_r45   Author: lulululbj   File: LoaderManager.java    License: 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 #14
Source Project: android_9.0.0_r45   Author: lulululbj   File: LoaderManager.java    License: 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 Project: android_9.0.0_r45   Author: lulululbj   File: VoiceInteractor.java    License: 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 #16
Source Project: android_9.0.0_r45   Author: lulululbj   File: Loader.java    License: 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 #17
Source Project: android_9.0.0_r45   Author: lulululbj   File: Loader.java    License: 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 #18
Source Project: android_9.0.0_r45   Author: lulululbj   File: VoiceInteractionSession.java    License: 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 #19
Source Project: android_9.0.0_r45   Author: lulululbj   File: SaveInfo.java    License: 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 #20
Source Project: android_9.0.0_r45   Author: lulululbj   File: NetworkPolicyManager.java    License: 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 #21
Source Project: android_9.0.0_r45   Author: lulululbj   File: NetworkPolicyManager.java    License: 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();
}