Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
am b018399: SysUI: Log lockscreen gestures
Browse files Browse the repository at this point in the history
* commit 'b018399a3a2762e95126acbe14397eca15bad772':
  SysUI: Log lockscreen gestures
  • Loading branch information
Christoph Studer authored and Android Git Automerger committed Jan 14, 2015
2 parents c1691e3 + b018399 commit a80da9d
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 6 deletions.
37 changes: 37 additions & 0 deletions packages/SystemUI/src/com/android/systemui/EventLogConstants.java
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/

package com.android.systemui;

/**
* Constants to be passed as sysui_* eventlog parameters.
*/
public class EventLogConstants {
/** The user swiped up on the lockscreen, unlocking the device. */
public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_UP_UNLOCK = 1;
/** The user swiped down on the lockscreen, going to the full shade. */
public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_DOWN_FULL_SHADE = 2;
/** The user tapped in an empty area, causing the unlock hint to be shown. */
public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_UNLOCK_HINT = 3;
/** The user swiped inward on the camera icon, launching the camera. */
public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_CAMERA = 4;
/** The user swiped inward on the dialer icon, launching the dialer. */
public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_DIALER = 5;
/** The user tapped the lock, locking the device. */
public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_LOCK = 6;
/** The user tapped a notification, needs to tap again to launch. */
public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_NOTIFICATION_ACTIVATE = 7;
}
Expand Up @@ -27,6 +27,15 @@ option java_package com.android.systemui;
# NotificationPanelView.java
# ---------------------------
36020 sysui_notificationpanel_touch (type|1),(x|1),(y|1)
## type: 1: SWIPE_UP_UNLOCK Swiped up to dismiss the lockscreen.
## 2: SWIPE_DOWN_FULL_SHADE Swiped down to enter full shade.
## 3: TAP_UNLOCK_HINT Tapped in empty area, causes unlock hint.
## 4: SWIPE_CAMERA Swiped the camera icon, launches.
## 5: SWIPE_DIALER Swiped the dialer icon, launches.
## 6: TAP_LOCK Tapped the (unlocked) lock icon, locks the device.
## 7: TAP_NOTIFICATION_ACTIVATE Tapped a lockscreen notification, causes "tap again" hint.
## Note: Second tap logged as notification_clicked.
36021 sysui_lockscreen_gesture (type|1),(lengthDp|1),(velocityDp|1)

# ---------------------------
# SettingsPanelView.java
Expand Down
Expand Up @@ -126,7 +126,8 @@ public boolean onTouchEvent(MotionEvent event) {
}
return true;
case MotionEvent.ACTION_UP:
if (mDraggedFarEnough && mDragDownCallback.onDraggedDown(mStartingChild)) {
if (mDraggedFarEnough && mDragDownCallback.onDraggedDown(mStartingChild,
(int) (y - mInitialTouchY))) {
if (mStartingChild == null) {
mDragDownCallback.setEmptyDragAmount(0f);
}
Expand Down Expand Up @@ -221,7 +222,7 @@ public interface DragDownCallback {
/**
* @return true if the interaction is accepted, false if it should be cancelled
*/
boolean onDraggedDown(View startingChild);
boolean onDraggedDown(View startingChild, int dragLengthY);
void onDragDownReset();
void onThresholdReached();
void onTouchSlopExceeded();
Expand Down
Expand Up @@ -317,7 +317,7 @@ public void onAnimationUpdate(ValueAnimator animation) {
animator.addListener(mFlingEndListener);
if (!snapBack) {
startFinishingCircleAnimation(vel * 0.375f, mAnimationEndRunnable);
mCallback.onAnimationToSideStarted(mTranslation < 0);
mCallback.onAnimationToSideStarted(mTranslation < 0, mTranslation, vel);
} else {
reset(true);
}
Expand Down Expand Up @@ -461,7 +461,7 @@ public interface Callback {
*
* @param rightPage Is the page animated to the right page?
*/
void onAnimationToSideStarted(boolean rightPage);
void onAnimationToSideStarted(boolean rightPage, float translation, float vel);

/**
* Notifies the callback the animation to a side page has ended.
Expand Down
Expand Up @@ -47,6 +47,8 @@
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.R;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.KeyguardAffordanceView;
Expand Down Expand Up @@ -320,6 +322,9 @@ public boolean onLongClick(View v) {
}

private void handleTrustCircleClick() {
EventLogTags.writeSysuiLockscreenGesture(
EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_TAP_LOCK, 0 /* lengthDp - N/A */,
0 /* velocityDp - N/A */);
mIndicationController.showTransientIndication(
R.string.keyguard_indication_trust_disabled);
mLockPatternUtils.requireCredentialEntry(mLockPatternUtils.getCurrentUser());
Expand Down
Expand Up @@ -39,6 +39,8 @@
import android.widget.TextView;

import com.android.keyguard.KeyguardStatusView;
import com.android.systemui.EventLogTags;
import com.android.systemui.EventLogConstants;
import com.android.systemui.R;
import com.android.systemui.qs.QSContainer;
import com.android.systemui.qs.QSPanel;
Expand Down Expand Up @@ -1670,13 +1672,20 @@ public void onClick(View v) {
}

@Override
public void onAnimationToSideStarted(boolean rightPage) {
public void onAnimationToSideStarted(boolean rightPage, float translation, float vel) {
boolean start = getLayoutDirection() == LAYOUT_DIRECTION_RTL ? rightPage : !rightPage;
mIsLaunchTransitionRunning = true;
mLaunchAnimationEndRunnable = null;
float displayDensity = mStatusBar.getDisplayDensity();
int lengthDp = Math.abs((int) (translation / displayDensity));
int velocityDp = Math.abs((int) (vel / displayDensity));
if (start) {
EventLogTags.writeSysuiLockscreenGesture(
EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_DIALER, lengthDp, velocityDp);
mKeyguardBottomArea.launchPhone();
} else {
EventLogTags.writeSysuiLockscreenGesture(
EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_CAMERA, lengthDp, velocityDp);
mSecureCameraLaunchManager.startSecureCameraLaunch();
}
mStatusBar.startLaunchTransitionTimeout();
Expand Down
Expand Up @@ -32,6 +32,8 @@
import android.view.animation.Interpolator;
import android.widget.FrameLayout;

import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.R;
import com.android.systemui.doze.DozeLog;
import com.android.systemui.statusbar.FlingAnimationUtils;
Expand Down Expand Up @@ -338,6 +340,15 @@ public boolean onTouchEvent(MotionEvent event) {
DozeLog.traceFling(expand, mTouchAboveFalsingThreshold,
mStatusBar.isFalsingThresholdNeeded(),
mStatusBar.isScreenOnComingFromTouch());
// Log collapse gesture if on lock screen.
if (!expand && mStatusBar.getBarState() == StatusBarState.KEYGUARD) {
float displayDensity = mStatusBar.getDisplayDensity();
int heightDp = (int) Math.abs((y - mInitialTouchY) / displayDensity);
int velocityDp = (int) Math.abs(vel / displayDensity);
EventLogTags.writeSysuiLockscreenGesture(
EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_UP_UNLOCK,
heightDp, velocityDp);
}
fling(vel, expand);
mUpdateFlingOnLayout = expand && mPanelClosedOnDown && !mHasLayoutedSinceDown;
if (mUpdateFlingOnLayout) {
Expand Down Expand Up @@ -941,6 +952,9 @@ private boolean onMiddleClicked() {
switch (mStatusBar.getBarState()) {
case StatusBarState.KEYGUARD:
if (!mDozingOnDown) {
EventLogTags.writeSysuiLockscreenGesture(
EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_TAP_UNLOCK_HINT,
0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */);
startUnlockHintAnimation();
}
return true;
Expand Down
Expand Up @@ -121,6 +121,7 @@
import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.BatteryMeterView;
import com.android.systemui.DemoMode;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.FontSizeUtils;
import com.android.systemui.R;
Expand Down Expand Up @@ -3078,6 +3079,10 @@ void updateDisplaySize() {
}
}

float getDisplayDensity() {
return mDisplayMetrics.density;
}

public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
final boolean dismissShade) {
if (onlyProvisioned && !isDeviceProvisioned()) return;
Expand Down Expand Up @@ -3882,6 +3887,9 @@ private void instantCollapseNotificationPanel() {

@Override
public void onActivated(ActivatableNotificationView view) {
EventLogTags.writeSysuiLockscreenGesture(
EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_TAP_NOTIFICATION_ACTIVATE,
0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */);
mKeyguardIndicationController.showTransientIndication(R.string.notification_tap_again);
ActivatableNotificationView previousView = mStackScroller.getActivatedChild();
if (previousView != null) {
Expand Down Expand Up @@ -3962,8 +3970,12 @@ public NavigationBarView getNavigationBarView() {
// ---------------------- DragDownHelper.OnDragDownListener ------------------------------------

@Override
public boolean onDraggedDown(View startingChild) {
public boolean onDraggedDown(View startingChild, int dragLengthY) {
if (hasActiveNotifications()) {
EventLogTags.writeSysuiLockscreenGesture(
EventLogConstants.SYSUI_LOCKSCREEN_GESTURE_SWIPE_DOWN_FULL_SHADE,
(int) (dragLengthY / mDisplayMetrics.density),
0 /* velocityDp - N/A */);

// We have notifications, go to locked shade.
goToLockedShade(startingChild);
Expand Down

0 comments on commit a80da9d

Please sign in to comment.