diff options
author | Chris Wren <cwren@android.com> | 2015-06-30 17:20:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-30 17:20:29 +0000 |
commit | 392527c4cc04be275a1d055a76ee83806beb2cb9 (patch) | |
tree | 38c3dbae5974db8851c1f09e7d802d73caef0d19 | |
parent | e40d7a632668a3813a443195ba8e2146407a0517 (diff) | |
parent | 9bb290bcc36fe11f96312feb40aaf3323a96ebae (diff) | |
download | frameworks_base-392527c4cc04be275a1d055a76ee83806beb2cb9.zip frameworks_base-392527c4cc04be275a1d055a76ee83806beb2cb9.tar.gz frameworks_base-392527c4cc04be275a1d055a76ee83806beb2cb9.tar.bz2 |
Merge "add more power manager metrics" into mnc-dev
3 files changed, 19 insertions, 0 deletions
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java index 6dc66ea..263e522 100644 --- a/core/java/com/android/internal/logging/MetricsLogger.java +++ b/core/java/com/android/internal/logging/MetricsLogger.java @@ -41,6 +41,9 @@ public class MetricsLogger implements MetricsConstants { public static final int ACTION_BRIGHTNESS_AUTO = 219; public static final int BRIGHTNESS_DIALOG = 220; public static final int SYSTEM_ALERT_WINDOW_APPS = 221; + public static final int DREAMING = 222; + public static final int DOZING = 223; + // Temporary constants go here, to await migration to MetricsConstants. public static void visible(Context context, int category) throws IllegalArgumentException { diff --git a/services/core/java/com/android/server/dreams/DreamController.java b/services/core/java/com/android/server/dreams/DreamController.java index cff4814..8105675 100644 --- a/services/core/java/com/android/server/dreams/DreamController.java +++ b/services/core/java/com/android/server/dreams/DreamController.java @@ -16,6 +16,8 @@ package com.android.server.dreams; +import com.android.internal.logging.MetricsLogger; + import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -25,6 +27,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.os.IBinder.DeathRecipient; +import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.service.dreams.DreamService; @@ -55,6 +58,7 @@ final class DreamController { private final Handler mHandler; private final Listener mListener; private final IWindowManager mIWindowManager; + private long mDreamStartTime; private final Intent mDreamingStartedIntent = new Intent(Intent.ACTION_DREAMING_STARTED) .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); @@ -123,6 +127,10 @@ final class DreamController { mCurrentDream = new DreamRecord(token, name, isTest, canDoze, userId); + mDreamStartTime = SystemClock.elapsedRealtime(); + MetricsLogger.visible(mContext, + mCurrentDream.mCanDoze ? MetricsLogger.DOZING : MetricsLogger.DREAMING); + try { mIWindowManager.addWindowToken(token, WindowManager.LayoutParams.TYPE_DREAM); } catch (RemoteException ex) { @@ -185,6 +193,11 @@ final class DreamController { Slog.i(TAG, "Stopping dream: name=" + oldDream.mName + ", isTest=" + oldDream.mIsTest + ", canDoze=" + oldDream.mCanDoze + ", userId=" + oldDream.mUserId); + MetricsLogger.hidden(mContext, + oldDream.mCanDoze ? MetricsLogger.DOZING : MetricsLogger.DREAMING); + MetricsLogger.histogram(mContext, + oldDream.mCanDoze ? "dozing_minutes" : "dreaming_minutes" , + (int) ((SystemClock.elapsedRealtime() - mDreamStartTime) / (1000L * 60L))); mHandler.removeCallbacks(mStopUnconnectedDreamRunnable); mHandler.removeCallbacks(mStopStubbornDreamRunnable); diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index b41dd06..b77a2534 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -95,6 +95,8 @@ import android.view.KeyCharacterMap; import android.view.KeyCharacterMap.FallbackAction; import android.view.KeyEvent; import android.view.MotionEvent; + +import com.android.internal.logging.MetricsLogger; import com.android.internal.policy.PhoneWindow; import android.view.Surface; import android.view.View; @@ -5348,6 +5350,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { public void finishedGoingToSleep(int why) { EventLog.writeEvent(70000, 0); if (DEBUG_WAKEUP) Slog.i(TAG, "Finished going to sleep... (why=" + why + ")"); + MetricsLogger.histogram(mContext, "screen_timeout", mLockScreenTimeout / 1000); // We must get this work done here because the power manager will drop // the wake lock and let the system suspend once this function returns. |