From b96238a120b3b44f28ab66f72ae0b4c52ed1edf5 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Thu, 10 May 2018 10:45:25 -0700 Subject: [PATCH] Add user event logging for recents onboarding > Actual logging will happen in launcher side Bug: 73784423 Test: Builds Change-Id: I99ae31a74c2e5921915dc3bbf6d08669b5c98584 --- .../shared/recents/IOverviewProxy.aidl | 5 +++ .../shared/system/LauncherEventUtil.java | 29 +++++++++++++ .../systemui/recents/RecentsOnboarding.java | 41 ++++++++++++++++--- 3 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 packages/SystemUI/shared/src/com/android/systemui/shared/system/LauncherEventUtil.java diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl index 939a86888562b..2ff98ba8ab30d 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl @@ -85,4 +85,9 @@ oneway interface IOverviewProxy { * cancel (long) press. */ void onQuickStep(in MotionEvent event); + + /** + * Sent when there was an action on one of the onboarding tips view. + */ + void onTip(int actionType, int viewType); } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/LauncherEventUtil.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/LauncherEventUtil.java new file mode 100644 index 0000000000000..eed9580e22136 --- /dev/null +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/LauncherEventUtil.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2018 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.shared.system; + +public class LauncherEventUtil { + + // Constants for the Action + public static final int VISIBLE = 0; + public static final int DISMISS = 1; + + // Constants for the Target (View) + public static final int RECENTS_SWIPE_UP_ONBOARDING_TIP = 0; + public static final int RECENTS_QUICK_SCRUB_ONBOARDING_TIP = 1; + +} diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java index d16e1b1429b43..0a39abb401a40 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java @@ -24,6 +24,10 @@ import static com.android.systemui.Prefs.Key.HAS_SEEN_RECENTS_QUICK_SCRUB_ONBOAR import static com.android.systemui.Prefs.Key.HAS_SEEN_RECENTS_SWIPE_UP_ONBOARDING; import static com.android.systemui.Prefs.Key.OVERVIEW_OPENED_COUNT; import static com.android.systemui.Prefs.Key.OVERVIEW_OPENED_FROM_HOME_COUNT; +import static com.android.systemui.shared.system.LauncherEventUtil.VISIBLE; +import static com.android.systemui.shared.system.LauncherEventUtil.DISMISS; +import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_QUICK_SCRUB_ONBOARDING_TIP; +import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_SWIPE_UP_ONBOARDING_TIP; import android.annotation.StringRes; import android.annotation.TargetApi; @@ -38,6 +42,7 @@ import android.graphics.drawable.ShapeDrawable; import android.os.Build; import android.os.SystemProperties; import android.os.UserManager; +import android.os.RemoteException; import android.util.TypedValue; import android.view.Gravity; import android.view.LayoutInflater; @@ -53,7 +58,9 @@ import com.android.systemui.OverviewProxyService; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.recents.misc.SysUiTaskStackChangeListener; +import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.system.ActivityManagerWrapper; +import com.android.systemui.shared.system.LauncherEventUtil; import java.util.Collections; import java.util.HashSet; @@ -120,6 +127,7 @@ public class RecentsOnboarding { return; } + boolean shouldLog = false; if (!alreadySeenSwipeUpOnboarding) { if (getOpenedOverviewFromHomeCount() >= SWIPE_UP_SHOW_ON_OVERVIEW_OPENED_FROM_HOME_COUNT) { @@ -128,10 +136,13 @@ public class RecentsOnboarding { if (mNumAppsLaunchedSinceSwipeUpTipDismiss == SWIPE_UP_SHOW_ON_APP_LAUNCH_AFTER_DISMISS) { mNumAppsLaunchedSinceSwipeUpTipDismiss = 0; - show(R.string.recents_swipe_up_onboarding); + shouldLog = show(R.string.recents_swipe_up_onboarding); } } else { - show(R.string.recents_swipe_up_onboarding); + shouldLog = show(R.string.recents_swipe_up_onboarding); + } + if (shouldLog) { + notifyOnTip(VISIBLE, RECENTS_SWIPE_UP_ONBOARDING_TIP); } } } else { @@ -140,12 +151,16 @@ public class RecentsOnboarding { if (mOverviewOpenedCountSinceQuickScrubTipDismiss == QUICK_SCRUB_SHOW_ON_OVERVIEW_OPENED_COUNT) { mOverviewOpenedCountSinceQuickScrubTipDismiss = 0; - show(R.string.recents_quick_scrub_onboarding); + shouldLog = show(R.string.recents_quick_scrub_onboarding); } } else { - show(R.string.recents_quick_scrub_onboarding); + shouldLog = show(R.string.recents_quick_scrub_onboarding); + } + if (shouldLog) { + notifyOnTip(VISIBLE, RECENTS_QUICK_SCRUB_ONBOARDING_TIP); } } + } } else { hide(false); @@ -244,6 +259,9 @@ public class RecentsOnboarding { if (v.getTag().equals(R.string.recents_swipe_up_onboarding)) { mHasDismissedSwipeUpTip = true; mNumAppsLaunchedSinceSwipeUpTipDismiss = 0; + notifyOnTip(DISMISS, RECENTS_SWIPE_UP_ONBOARDING_TIP); + } else { + notifyOnTip(DISMISS, RECENTS_QUICK_SCRUB_ONBOARDING_TIP); } }); @@ -265,6 +283,15 @@ public class RecentsOnboarding { } } + private void notifyOnTip(int action, int target) { + try { + IOverviewProxy overviewProxy = mOverviewProxyService.getProxy(); + if(overviewProxy != null) { + overviewProxy.onTip(action, target); + } + } catch (RemoteException e) {} + } + public void onConnectedToLauncher() { if (!ONBOARDING_ENABLED) { return; @@ -307,9 +334,9 @@ public class RecentsOnboarding { } } - public void show(@StringRes int stringRes) { + public boolean show(@StringRes int stringRes) { if (!shouldShow()) { - return; + return false; } mDismissView.setTag(stringRes); mLayout.setTag(stringRes); @@ -328,7 +355,9 @@ public class RecentsOnboarding { .setDuration(SHOW_DURATION_MS) .setInterpolator(new DecelerateInterpolator()) .start(); + return true; } + return false; } /**