android.util.TimeUtils Java Examples

The following examples show how to use android.util.TimeUtils. 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: MediaRouterService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(PrintWriter pw, String prefix) {
    pw.println(prefix + "Handler");

    final String indent = prefix + "  ";
    pw.println(indent + "mRunning=" + mRunning);
    pw.println(indent + "mDiscoveryMode=" + mDiscoveryMode);
    pw.println(indent + "mSelectedRouteRecord=" + mSelectedRouteRecord);
    pw.println(indent + "mConnectionPhase=" + mConnectionPhase);
    pw.println(indent + "mConnectionTimeoutReason=" + mConnectionTimeoutReason);
    pw.println(indent + "mConnectionTimeoutStartTime=" + (mConnectionTimeoutReason != 0 ?
            TimeUtils.formatUptime(mConnectionTimeoutStartTime) : "<n/a>"));

    mWatcher.dump(pw, prefix);

    final int providerCount = mProviderRecords.size();
    if (providerCount != 0) {
        for (int i = 0; i < providerCount; i++) {
            mProviderRecords.get(i).dump(pw, prefix);
        }
    } else {
        pw.println(indent + "<no providers>");
    }
}
 
Example #2
Source File: ActivityMetricsLogger.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void logAppDisplayed(WindowingModeTransitionInfoSnapshot info) {
    if (info.type != TYPE_TRANSITION_WARM_LAUNCH && info.type != TYPE_TRANSITION_COLD_LAUNCH) {
        return;
    }

    EventLog.writeEvent(AM_ACTIVITY_LAUNCH_TIME,
            info.userId, info.activityRecordIdHashCode, info.launchedActivityShortComponentName,
            info.windowsDrawnDelayMs);

    StringBuilder sb = mStringBuilder;
    sb.setLength(0);
    sb.append("Displayed ");
    sb.append(info.launchedActivityShortComponentName);
    sb.append(": ");
    TimeUtils.formatDuration(info.windowsDrawnDelayMs, sb);
    Log.i(TAG, sb.toString());
}
 
Example #3
Source File: PendingIntentRecord.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public String toString() {
    if (stringName != null) {
        return stringName;
    }
    StringBuilder sb = new StringBuilder(128);
    sb.append("PendingIntentRecord{");
    sb.append(Integer.toHexString(System.identityHashCode(this)));
    sb.append(' ');
    sb.append(key.packageName);
    sb.append(' ');
    sb.append(key.typeName());
    if (whitelistDuration != null) {
        sb.append( " (whitelist: ");
        for (int i = 0; i < whitelistDuration.size(); i++) {
            if (i != 0) {
                sb.append(",");
            }
            sb.append(Integer.toHexString(System.identityHashCode(whitelistDuration.keyAt(i))));
            sb.append(":");
            TimeUtils.formatDuration(whitelistDuration.valueAt(i), sb);
        }
        sb.append(")");
    }
    sb.append('}');
    return stringName = sb.toString();
}
 
Example #4
Source File: PreloadsFileCacheExpirationJobService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public static void schedule(Context context) {
    int keepPreloadsMinDays = Resources.getSystem().getInteger(
            R.integer.config_keepPreloadsMinDays); // Default is 1 week
    long keepPreloadsMinTimeoutMs = DEBUG ? TimeUnit.MINUTES.toMillis(2)
            : TimeUnit.DAYS.toMillis(keepPreloadsMinDays);
    long keepPreloadsMaxTimeoutMs = DEBUG ? TimeUnit.MINUTES.toMillis(3)
            : TimeUnit.DAYS.toMillis(keepPreloadsMinDays + 1);

    if (DEBUG) {
        StringBuilder sb = new StringBuilder("Scheduling expiration job to run in ");
        TimeUtils.formatDuration(keepPreloadsMinTimeoutMs, sb);
        Slog.i(TAG, sb.toString());
    }
    JobInfo expirationJob = new JobInfo.Builder(JOB_ID,
            new ComponentName(context, PreloadsFileCacheExpirationJobService.class))
            .setPersisted(true)
            .setMinimumLatency(keepPreloadsMinTimeoutMs)
            .setOverrideDeadline(keepPreloadsMaxTimeoutMs)
            .build();

    JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
    jobScheduler.schedule(expirationJob);
}
 
Example #5
Source File: JobSchedulerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
void setNextHeartbeatAlarm() {
    final long heartbeatLength;
    synchronized (mLock) {
        heartbeatLength = mConstants.STANDBY_HEARTBEAT_TIME;
    }
    final long now = sElapsedRealtimeClock.millis();
    final long nextBeatOrdinal = (now + heartbeatLength) / heartbeatLength;
    final long nextHeartbeat = nextBeatOrdinal * heartbeatLength;
    if (DEBUG_STANDBY) {
        Slog.i(TAG, "Setting heartbeat alarm for " + nextHeartbeat
                + " = " + TimeUtils.formatDuration(nextHeartbeat - now));
    }
    AlarmManager am = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE);
    am.setExact(AlarmManager.ELAPSED_REALTIME, nextHeartbeat,
            HEARTBEAT_TAG, mHeartbeatAlarm, mHandler);
}
 
Example #6
Source File: JobServiceContext.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void handleMessage(Message message) {
    switch (message.what) {
        case MSG_TIMEOUT:
            synchronized (mLock) {
                if (message.obj == mRunningCallback) {
                    handleOpTimeoutLocked();
                } else {
                    JobCallback jc = (JobCallback)message.obj;
                    StringBuilder sb = new StringBuilder(128);
                    sb.append("Ignoring timeout of no longer active job");
                    if (jc.mStoppedReason != null) {
                        sb.append(", stopped ");
                        TimeUtils.formatDuration(sElapsedRealtimeClock.millis()
                                - jc.mStoppedTime, sb);
                        sb.append(" because: ");
                        sb.append(jc.mStoppedReason);
                    }
                    Slog.w(TAG, sb.toString());
                }
            }
            break;
        default:
            Slog.e(TAG, "Unrecognised message: " + message);
    }
}
 
Example #7
Source File: ContentProviderConnection.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void toClientString(StringBuilder sb) {
    sb.append(client.toShortString());
    sb.append(" s");
    sb.append(stableCount);
    sb.append("/");
    sb.append(numStableIncs);
    sb.append(" u");
    sb.append(unstableCount);
    sb.append("/");
    sb.append(numUnstableIncs);
    if (waiting) {
        sb.append(" WAITING");
    }
    if (dead) {
        sb.append(" DEAD");
    }
    long nowReal = SystemClock.elapsedRealtime();
    sb.append(" ");
    TimeUtils.formatDuration(nowReal-createTime, sb);
}
 
Example #8
Source File: PersistentConnection.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(String prefix, PrintWriter pw) {
    synchronized (mLock) {
        pw.print(prefix);
        pw.print(mComponentName.flattenToShortString());
        pw.print(mBound ? "  [bound]" : "  [not bound]");
        pw.print(mIsConnected ? "  [connected]" : "  [not connected]");
        if (mRebindScheduled) {
            pw.print("  reconnect in ");
            TimeUtils.formatDuration((mReconnectTime - injectUptimeMillis()), pw);
        }
        pw.println();

        pw.print(prefix);
        pw.print("  Next backoff(sec): ");
        pw.print(mNextBackoffMs / 1000);
    }
}
 
Example #9
Source File: AppTimeTracker.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(PrintWriter pw, String prefix, boolean details) {
    pw.print(prefix); pw.print("mReceiver="); pw.println(mReceiver);
    pw.print(prefix); pw.print("mTotalTime=");
    TimeUtils.formatDuration(mTotalTime, pw);
    pw.println();
    for (int i = 0; i < mPackageTimes.size(); i++) {
        pw.print(prefix); pw.print("mPackageTime:"); pw.print(mPackageTimes.keyAt(i));
        pw.print("=");
        TimeUtils.formatDuration(mPackageTimes.valueAt(i).value, pw);
        pw.println();
    }
    if (details && mStartedTime != 0) {
        pw.print(prefix); pw.print("mStartedTime=");
        TimeUtils.formatDuration(SystemClock.elapsedRealtime(), mStartedTime, pw);
        pw.println();
        pw.print(prefix); pw.print("mStartedPackage="); pw.println(mStartedPackage);
    }
}
 
Example #10
Source File: WirelessChargerDetector.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(PrintWriter pw) {
    synchronized (mLock) {
        pw.println();
        pw.println("Wireless Charger Detector State:");
        pw.println("  mGravitySensor=" + mGravitySensor);
        pw.println("  mPoweredWirelessly=" + mPoweredWirelessly);
        pw.println("  mAtRest=" + mAtRest);
        pw.println("  mRestX=" + mRestX + ", mRestY=" + mRestY + ", mRestZ=" + mRestZ);
        pw.println("  mDetectionInProgress=" + mDetectionInProgress);
        pw.println("  mDetectionStartTime=" + (mDetectionStartTime == 0 ? "0 (never)"
                : TimeUtils.formatUptime(mDetectionStartTime)));
        pw.println("  mMustUpdateRestPosition=" + mMustUpdateRestPosition);
        pw.println("  mTotalSamples=" + mTotalSamples);
        pw.println("  mMovingSamples=" + mMovingSamples);
        pw.println("  mFirstSampleX=" + mFirstSampleX
                + ", mFirstSampleY=" + mFirstSampleY + ", mFirstSampleZ=" + mFirstSampleZ);
        pw.println("  mLastSampleX=" + mLastSampleX
                + ", mLastSampleY=" + mLastSampleY + ", mLastSampleZ=" + mLastSampleZ);
    }
}
 
Example #11
Source File: DeviceIdleController.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
void exitMaintenanceEarlyIfNeededLocked() {
    if (mState == STATE_IDLE_MAINTENANCE || mLightState == LIGHT_STATE_IDLE_MAINTENANCE
            || mLightState == LIGHT_STATE_PRE_IDLE) {
        if (isOpsInactiveLocked()) {
            final long now = SystemClock.elapsedRealtime();
            if (DEBUG) {
                StringBuilder sb = new StringBuilder();
                sb.append("Exit: start=");
                TimeUtils.formatDuration(mMaintenanceStartTime, sb);
                sb.append(" now=");
                TimeUtils.formatDuration(now, sb);
                Slog.d(TAG, sb.toString());
            }
            if (mState == STATE_IDLE_MAINTENANCE) {
                stepIdleStateLocked("s:early");
            } else if (mLightState == LIGHT_STATE_PRE_IDLE) {
                stepLightIdleStateLocked("s:predone");
            } else {
                stepLightIdleStateLocked("s:early");
            }
        }
    }
}
 
Example #12
Source File: DeviceIdleController.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
void dumpTempWhitelistSchedule(PrintWriter pw, boolean printTitle) {
    final int size = mTempWhitelistAppIdEndTimes.size();
    if (size > 0) {
        String prefix = "";
        if (printTitle) {
            pw.println("  Temp whitelist schedule:");
            prefix = "    ";
        }
        final long timeNow = SystemClock.elapsedRealtime();
        for (int i = 0; i < size; i++) {
            pw.print(prefix);
            pw.print("UID=");
            pw.print(mTempWhitelistAppIdEndTimes.keyAt(i));
            pw.print(": ");
            Pair<MutableLong, String> entry = mTempWhitelistAppIdEndTimes.valueAt(i);
            TimeUtils.formatDuration(entry.first.value, timeNow, pw);
            pw.print(" - ");
            pw.println(entry.second);
        }
    }
}
 
Example #13
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 #14
Source File: AsyncTaskLoader.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
    super.dump(prefix, fd, writer, args);
    if (mTask != null) {
        writer.print(prefix); writer.print("mTask="); writer.print(mTask);
                writer.print(" waiting="); writer.println(mTask.waiting);
    }
    if (mCancellingTask != null) {
        writer.print(prefix); writer.print("mCancellingTask="); writer.print(mCancellingTask);
                writer.print(" waiting="); writer.println(mCancellingTask.waiting);
    }
    if (mUpdateThrottle != 0) {
        writer.print(prefix); writer.print("mUpdateThrottle=");
                TimeUtils.formatDuration(mUpdateThrottle, writer);
                writer.print(" mLastLoadCompleteTime=");
                TimeUtils.formatDuration(mLastLoadCompleteTime,
                        SystemClock.uptimeMillis(), writer);
                writer.println();
    }
}
 
Example #15
Source File: NetworkTimeUpdateService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
    pw.print("PollingIntervalMs: ");
    TimeUtils.formatDuration(mPollingIntervalMs, pw);
    pw.print("\nPollingIntervalShorterMs: ");
    TimeUtils.formatDuration(mPollingIntervalShorterMs, pw);
    pw.println("\nTryAgainTimesMax: " + mTryAgainTimesMax);
    pw.print("TimeErrorThresholdMs: ");
    TimeUtils.formatDuration(mTimeErrorThresholdMs, pw);
    pw.println("\nTryAgainCounter: " + mTryAgainCounter);
    pw.println("NTP cache age: " + mTime.getCacheAge());
    pw.println("NTP cache certainty: " + mTime.getCacheCertainty());
    pw.println();
}
 
Example #16
Source File: ActiveServices.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void dumpServiceLocalLocked(ServiceRecord r) {
    dumpUserHeaderLocked(r.userId);
    pw.print("  * ");
    pw.println(r);
    if (dumpAll) {
        r.dump(pw, "    ");
        needSep = true;
    } else {
        pw.print("    app=");
        pw.println(r.app);
        pw.print("    created=");
        TimeUtils.formatDuration(r.createRealTime, nowReal, pw);
        pw.print(" started=");
        pw.print(r.startRequested);
        pw.print(" connections=");
        pw.println(r.connections.size());
        if (r.connections.size() > 0) {
            pw.println("    Connections:");
            for (int conni=0; conni<r.connections.size(); conni++) {
                ArrayList<ConnectionRecord> clist = r.connections.valueAt(conni);
                for (int i = 0; i < clist.size(); i++) {
                    ConnectionRecord conn = clist.get(i);
                    pw.print("      ");
                    pw.print(conn.binding.intent.intent.getIntent()
                            .toShortString(false, false, false, false));
                    pw.print(" -> ");
                    ProcessRecord proc = conn.binding.client;
                    pw.println(proc != null ? proc.toShortString() : "null");
                }
            }
        }
    }
}
 
Example #17
Source File: AppOpsService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void dump(PrintWriter pw) {
    pw.println("  Settings:");

    pw.print("    "); pw.print(KEY_TOP_STATE_SETTLE_TIME); pw.print("=");
    TimeUtils.formatDuration(TOP_STATE_SETTLE_TIME, pw);
    pw.println();
    pw.print("    "); pw.print(KEY_FG_SERVICE_STATE_SETTLE_TIME); pw.print("=");
    TimeUtils.formatDuration(FG_SERVICE_STATE_SETTLE_TIME, pw);
    pw.println();
    pw.print("    "); pw.print(KEY_BG_STATE_SETTLE_TIME); pw.print("=");
    TimeUtils.formatDuration(BG_STATE_SETTLE_TIME, pw);
    pw.println();
}
 
Example #18
Source File: AppOpsService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void dumpTimesLocked(PrintWriter pw, String firstPrefix, String prefix, long[] times,
        long now, SimpleDateFormat sdf, Date date) {
    boolean hasTime = false;
    for (int i = 0; i < _NUM_UID_STATE; i++) {
        if (times[i] != 0) {
            hasTime = true;
            break;
        }
    }
    if (!hasTime) {
        return;
    }
    boolean first = true;
    for (int i = 0; i < _NUM_UID_STATE; i++) {
        if (times[i] != 0) {
            pw.print(first ? firstPrefix : prefix);
            first = false;
            pw.print(UID_STATE_NAMES[i]);
            pw.print(" = ");
            date.setTime(times[i]);
            pw.print(sdf.format(date));
            pw.print(" (");
            TimeUtils.formatDuration(times[i]-now, pw);
            pw.println(")");
        }
    }
}
 
Example #19
Source File: ActivityMetricsLogger.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void logAppFullyDrawn(WindowingModeTransitionInfoSnapshot info) {
    if (info.type != TYPE_TRANSITION_WARM_LAUNCH && info.type != TYPE_TRANSITION_COLD_LAUNCH) {
        return;
    }

    StringBuilder sb = mStringBuilder;
    sb.setLength(0);
    sb.append("Fully drawn ");
    sb.append(info.launchedActivityShortComponentName);
    sb.append(": ");
    TimeUtils.formatDuration(info.windowsFullyDrawnDelayMs, sb);
    Log.i(TAG, sb.toString());
}
 
Example #20
Source File: SettingsState.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
public void dumpHistoricalOperations(PrintWriter pw) {
    synchronized (mLock) {
        if (mHistoricalOperations == null) {
            return;
        }
        pw.println("Historical operations");
        final int operationCount = mHistoricalOperations.size();
        for (int i = 0; i < operationCount; i++) {
            int index = mNextHistoricalOpIdx - 1 - i;
            if (index < 0) {
                index = operationCount + index;
            }
            HistoricalOperation operation = mHistoricalOperations.get(index);
            pw.print(TimeUtils.formatForLogging(operation.mTimestamp));
            pw.print(" ");
            pw.print(operation.mOperation);
            if (operation.mSetting != null) {
                pw.print(" ");
                // Only print the name of the setting, since we don't know the
                // historical package and values for it so they would be misleading
                // to print here (all we could print is what the current data is).
                pw.print(operation.mSetting.getName());
            }
            pw.println();
        }
        pw.println();
        pw.println();
    }
}
 
Example #21
Source File: ServiceRecord.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void dumpStartList(PrintWriter pw, String prefix, List<StartItem> list, long now) {
    final int N = list.size();
    for (int i=0; i<N; i++) {
        StartItem si = list.get(i);
        pw.print(prefix); pw.print("#"); pw.print(i);
                pw.print(" id="); pw.print(si.id);
                if (now != 0) {
                    pw.print(" dur=");
                    TimeUtils.formatDuration(si.deliveredTime, now, pw);
                }
                if (si.deliveryCount != 0) {
                    pw.print(" dc="); pw.print(si.deliveryCount);
                }
                if (si.doneExecutingCount != 0) {
                    pw.print(" dxc="); pw.print(si.doneExecutingCount);
                }
                pw.println("");
        pw.print(prefix); pw.print("  intent=");
                if (si.intent != null) pw.println(si.intent.toString());
                else pw.println("null");
        if (si.neededGrants != null) {
            pw.print(prefix); pw.print("  neededGrants=");
                    pw.println(si.neededGrants);
        }
        if (si.uriPermissions != null) {
            si.uriPermissions.dump(pw, prefix);
        }
    }
}
 
Example #22
Source File: Choreographer.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void dump(String prefix, PrintWriter writer) {
    String innerPrefix = prefix + "  ";
    writer.print(prefix); writer.println("Choreographer:");
    writer.print(innerPrefix); writer.print("mFrameScheduled=");
            writer.println(mFrameScheduled);
    writer.print(innerPrefix); writer.print("mLastFrameTime=");
            writer.println(TimeUtils.formatUptime(mLastFrameTimeNanos / 1000000));
}
 
Example #23
Source File: Message.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
String toString(long now) {
    StringBuilder b = new StringBuilder();
    b.append("{ when=");
    TimeUtils.formatDuration(when - now, b);

    if (target != null) {
        if (callback != null) {
            b.append(" callback=");
            b.append(callback.getClass().getName());
        } else {
            b.append(" what=");
            b.append(what);
        }

        if (arg1 != 0) {
            b.append(" arg1=");
            b.append(arg1);
        }

        if (arg2 != 0) {
            b.append(" arg2=");
            b.append(arg2);
        }

        if (obj != null) {
            b.append(" obj=");
            b.append(obj);
        }

        b.append(" target=");
        b.append(target.getClass().getName());
    } else {
        b.append(" barrier=");
        b.append(arg1);
    }

    b.append(" }");
    return b.toString();
}
 
Example #24
Source File: ClipDescription.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/** @hide */
public boolean toShortString(StringBuilder b) {
    boolean first = !toShortStringTypesOnly(b);
    if (mLabel != null) {
        if (!first) {
            b.append(' ');
        }
        first = false;
        b.append('"');
        b.append(mLabel);
        b.append('"');
    }
    if (mExtras != null) {
        if (!first) {
            b.append(' ');
        }
        first = false;
        b.append(mExtras.toString());
    }
    if (mTimeStamp > 0) {
        if (!first) {
            b.append(' ');
        }
        first = false;
        b.append('<');
        b.append(TimeUtils.logTimeOfDay(mTimeStamp));
        b.append('>');
    }
    return !first;
}
 
Example #25
Source File: UserManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private static void dumpTimeAgo(PrintWriter pw, StringBuilder sb, long nowTime, long time) {
    if (time == 0) {
        pw.println("<unknown>");
    } else {
        sb.setLength(0);
        TimeUtils.formatDuration(nowTime - time, sb);
        sb.append(" ago");
        pw.println(sb);
    }
}
 
Example #26
Source File: PowerManagerService.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();
    sb.append(getLockLevelString());
    sb.append(" '");
    sb.append(mTag);
    sb.append("'");
    sb.append(getLockFlagsString());
    if (mDisabled) {
        sb.append(" DISABLED");
    }
    if (mNotifiedAcquired) {
        sb.append(" ACQ=");
        TimeUtils.formatDuration(mAcquireTime-SystemClock.uptimeMillis(), sb);
    }
    if (mNotifiedLong) {
        sb.append(" LONG");
    }
    sb.append(" (uid=");
    sb.append(mOwnerUid);
    if (mOwnerPid != 0) {
        sb.append(" pid=");
        sb.append(mOwnerPid);
    }
    if (mWorkSource != null) {
        sb.append(" ws=");
        sb.append(mWorkSource);
    }
    sb.append(")");
    return sb.toString();
}
 
Example #27
Source File: PersistentDataStore.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void dump(final PrintWriter pw, final String prefix) {
    for (int i = 0; i < mConfigurations.size(); i++) {
        final int userSerial = mConfigurations.keyAt(i);
        long time = mTimeStamps.get(userSerial, -1);
        String packageName = mPackageNames.get(userSerial);
        pw.println(prefix + "User " + userSerial + ":");
        if (time != -1) {
            pw.println(prefix + "  set at: " + TimeUtils.formatForLogging(time));
        }
        if (packageName != null) {
            pw.println(prefix + "  set by: " + packageName);
        }
        pw.println(prefix + "  " + mConfigurations.valueAt(i));
    }
}
 
Example #28
Source File: WindowAnimator.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void dumpLocked(PrintWriter pw, String prefix, boolean dumpAll) {
    final String subPrefix = "  " + prefix;
    final String subSubPrefix = "  " + subPrefix;

    for (int i = 0; i < mDisplayContentsAnimators.size(); i++) {
        pw.print(prefix); pw.print("DisplayContentsAnimator #");
                pw.print(mDisplayContentsAnimators.keyAt(i));
                pw.println(":");
        final DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i);
        final DisplayContent dc =
                mService.mRoot.getDisplayContent(mDisplayContentsAnimators.keyAt(i));
        dc.dumpWindowAnimators(pw, subPrefix);
        if (displayAnimator.mScreenRotationAnimation != null) {
            pw.print(subPrefix); pw.println("mScreenRotationAnimation:");
            displayAnimator.mScreenRotationAnimation.printTo(subSubPrefix, pw);
        } else if (dumpAll) {
            pw.print(subPrefix); pw.println("no ScreenRotationAnimation ");
        }
        pw.println();
    }

    pw.println();

    if (dumpAll) {
        pw.print(prefix); pw.print("mAnimTransactionSequence=");
                pw.print(mAnimTransactionSequence);
        pw.print(prefix); pw.print("mCurrentTime=");
                pw.println(TimeUtils.formatUptime(mCurrentTime));
    }
    if (mBulkUpdateParams != 0) {
        pw.print(prefix); pw.print("mBulkUpdateParams=0x");
                pw.print(Integer.toHexString(mBulkUpdateParams));
                pw.println(bulkUpdateParamsToString(mBulkUpdateParams));
    }
    if (mWindowDetachedWallpaper != null) {
        pw.print(prefix); pw.print("mWindowDetachedWallpaper=");
            pw.println(mWindowDetachedWallpaper);
    }
}
 
Example #29
Source File: TimeController.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void dumpControllerStateLocked(IndentingPrintWriter pw,
        Predicate<JobStatus> predicate) {
    final long nowElapsed = sElapsedRealtimeClock.millis();
    pw.println("Elapsed clock: " + nowElapsed);

    pw.print("Next delay alarm in ");
    TimeUtils.formatDuration(mNextDelayExpiredElapsedMillis, nowElapsed, pw);
    pw.println();
    pw.print("Next deadline alarm in ");
    TimeUtils.formatDuration(mNextJobExpiredElapsedMillis, nowElapsed, pw);
    pw.println();
    pw.println();

    for (JobStatus ts : mTrackedJobs) {
        if (!predicate.test(ts)) {
            continue;
        }
        pw.print("#");
        ts.printUniqueId(pw);
        pw.print(" from ");
        UserHandle.formatUid(pw, ts.getSourceUid());
        pw.print(": Delay=");
        if (ts.hasTimingDelayConstraint()) {
            TimeUtils.formatDuration(ts.getEarliestRunTime(), nowElapsed, pw);
        } else {
            pw.print("N/A");
        }
        pw.print(", Deadline=");
        if (ts.hasDeadlineConstraint()) {
            TimeUtils.formatDuration(ts.getLatestRunTimeElapsed(), nowElapsed, pw);
        } else {
            pw.print("N/A");
        }
        pw.println();
    }
}
 
Example #30
Source File: AlarmManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void dump(PrintWriter pw) {
    pw.println("  Settings:");

    pw.print("    "); pw.print(KEY_MIN_FUTURITY); pw.print("=");
    TimeUtils.formatDuration(MIN_FUTURITY, pw);
    pw.println();

    pw.print("    "); pw.print(KEY_MIN_INTERVAL); pw.print("=");
    TimeUtils.formatDuration(MIN_INTERVAL, pw);
    pw.println();

    pw.print("    "); pw.print(KEY_MAX_INTERVAL); pw.print("=");
    TimeUtils.formatDuration(MAX_INTERVAL, pw);
    pw.println();

    pw.print("    "); pw.print(KEY_LISTENER_TIMEOUT); pw.print("=");
    TimeUtils.formatDuration(LISTENER_TIMEOUT, pw);
    pw.println();

    pw.print("    "); pw.print(KEY_ALLOW_WHILE_IDLE_SHORT_TIME); pw.print("=");
    TimeUtils.formatDuration(ALLOW_WHILE_IDLE_SHORT_TIME, pw);
    pw.println();

    pw.print("    "); pw.print(KEY_ALLOW_WHILE_IDLE_LONG_TIME); pw.print("=");
    TimeUtils.formatDuration(ALLOW_WHILE_IDLE_LONG_TIME, pw);
    pw.println();

    pw.print("    "); pw.print(KEY_ALLOW_WHILE_IDLE_WHITELIST_DURATION); pw.print("=");
    TimeUtils.formatDuration(ALLOW_WHILE_IDLE_WHITELIST_DURATION, pw);
    pw.println();

    for (int i = 0; i < KEYS_APP_STANDBY_DELAY.length; i++) {
        pw.print("    "); pw.print(KEYS_APP_STANDBY_DELAY[i]); pw.print("=");
        TimeUtils.formatDuration(APP_STANDBY_MIN_DELAYS[i], pw);
        pw.println();
    }
}