Merge "add more power manager metrics" into mnc-dev
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user