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

Commit c64b4e1f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add a new dumpsys to fetch app component usage info."

parents 0fc8bd4c 003c5e72
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1864,6 +1864,21 @@ public class UsageStatsService extends SystemService implements
                        mResponseStatsTracker.dump(idpw);
                    }
                    return;
                } else if ("app-component-usage".equals(arg)) {
                    final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
                    synchronized (mLock) {
                        if (!mLastTimeComponentUsedGlobal.isEmpty()) {
                            ipw.println("App Component Usages:");
                            ipw.increaseIndent();
                            for (String pkg : mLastTimeComponentUsedGlobal.keySet()) {
                                ipw.println("package=" + pkg
                                            + " lastUsed=" + UserUsageStatsService.formatDateTime(
                                                    mLastTimeComponentUsedGlobal.get(pkg), true));
                            }
                            ipw.decreaseIndent();
                        }
                    }
                    return;
                } else if (arg != null && !arg.startsWith("-")) {
                    // Anything else that doesn't start with '-' is a pkg to filter
                    pkgs.add(arg);