Merge "Migrate Bubbles to wm-shell (3/n)"

This commit is contained in:
Tony Huang
2020-10-13 06:30:26 +00:00
committed by Android (Google) Code Review
17 changed files with 181 additions and 217 deletions

View File

@@ -72,8 +72,6 @@ public final class Prefs {
Key.QS_HAS_TURNED_OFF_MOBILE_DATA,
Key.TOUCHED_RINGER_TOGGLE,
Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP,
Key.HAS_SEEN_BUBBLES_EDUCATION,
Key.HAS_SEEN_BUBBLES_MANAGE_EDUCATION,
Key.HAS_SEEN_REVERSE_BOTTOM_SHEET,
Key.CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT,
Key.HAS_SEEN_PRIORITY_ONBOARDING
@@ -123,8 +121,6 @@ public final class Prefs {
String QS_HAS_TURNED_OFF_MOBILE_DATA = "QsHasTurnedOffMobileData";
String TOUCHED_RINGER_TOGGLE = "TouchedRingerToggle";
String HAS_SEEN_ODI_CAPTIONS_TOOLTIP = "HasSeenODICaptionsTooltip";
String HAS_SEEN_BUBBLES_EDUCATION = "HasSeenBubblesOnboarding";
String HAS_SEEN_BUBBLES_MANAGE_EDUCATION = "HasSeenBubblesManageOnboarding";
String HAS_SEEN_REVERSE_BOTTOM_SHEET = "HasSeenReverseBottomSheet";
String CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT = "ControlsStructureSwipeTooltipCount";
/** Tracks whether the user has seen the onboarding screen for priority conversations */

View File

@@ -80,6 +80,7 @@ import androidx.annotation.MainThread;
import androidx.annotation.Nullable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.Dumpable;
@@ -87,6 +88,7 @@ import com.android.systemui.bubbles.dagger.BubbleModule;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
import com.android.systemui.statusbar.FeatureFlags;
@@ -168,7 +170,7 @@ public class BubbleController implements Bubbles, ConfigurationController.Config
private final ShadeController mShadeController;
private final FloatingContentCoordinator mFloatingContentCoordinator;
private final BubbleDataRepository mDataRepository;
private BubbleLogger mLogger = new BubbleLoggerImpl();
private BubbleLogger mLogger;
private BubbleData mBubbleData;
private ScrimView mBubbleScrim;
@@ -365,20 +367,21 @@ public class BubbleController implements Bubbles, ConfigurationController.Config
FeatureFlags featureFlags,
DumpManager dumpManager,
FloatingContentCoordinator floatingContentCoordinator,
BubbleDataRepository dataRepository,
SysUiState sysUiState,
INotificationManager notificationManager,
@Nullable IStatusBarService statusBarService,
WindowManager windowManager,
WindowManagerShellWrapper windowManagerShellWrapper,
LauncherApps launcherApps) {
LauncherApps launcherApps,
UiEventLogger uiEventLogger) {
BubbleLogger logger = new BubbleLogger(uiEventLogger);
return new BubbleController(context, notificationShadeWindowController,
statusBarStateController, shadeController, new BubbleData(context), synchronizer,
configurationController, interruptionStateProvider, zenModeController,
statusBarStateController, shadeController, new BubbleData(context, logger),
synchronizer, configurationController, interruptionStateProvider, zenModeController,
notifUserManager, groupManager, entryManager, notifPipeline, featureFlags,
dumpManager, floatingContentCoordinator, dataRepository, sysUiState,
notificationManager, statusBarService, windowManager, windowManagerShellWrapper,
launcherApps);
dumpManager, floatingContentCoordinator,
new BubbleDataRepository(context, launcherApps), sysUiState, notificationManager,
statusBarService, windowManager, windowManagerShellWrapper, launcherApps, logger);
}
/**
@@ -407,7 +410,8 @@ public class BubbleController implements Bubbles, ConfigurationController.Config
@Nullable IStatusBarService statusBarService,
WindowManager windowManager,
WindowManagerShellWrapper windowManagerShellWrapper,
LauncherApps launcherApps) {
LauncherApps launcherApps,
BubbleLogger bubbleLogger) {
dumpManager.registerDumpable(TAG, this);
mContext = context;
mShadeController = shadeController;
@@ -417,6 +421,7 @@ public class BubbleController implements Bubbles, ConfigurationController.Config
mFloatingContentCoordinator = floatingContentCoordinator;
mDataRepository = dataRepository;
mINotificationManager = notificationManager;
mLogger = bubbleLogger;
mZenModeController.addCallback(new ZenModeController.Callback() {
@Override
public void onZenChanged(int zen) {
@@ -577,6 +582,12 @@ public class BubbleController implements Bubbles, ConfigurationController.Config
}
}
private void onBubbleExpandChanged(boolean shouldExpand) {
mSysUiState
.setFlag(QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED, shouldExpand)
.commitUpdate(mContext.getDisplayId());
}
private void setupNEM() {
mNotificationEntryManager.addNotificationEntryListener(
new NotificationEntryListener() {
@@ -791,8 +802,8 @@ public class BubbleController implements Bubbles, ConfigurationController.Config
if (mStackView == null) {
mStackView = new BubbleStackView(
mContext, mBubbleData, mSurfaceSynchronizer, mFloatingContentCoordinator,
mSysUiState, this::onAllBubblesAnimatedOut, this::onImeVisibilityChanged,
this::hideCurrentInputMethod);
this::onAllBubblesAnimatedOut, this::onImeVisibilityChanged,
this::hideCurrentInputMethod, this::onBubbleExpandChanged);
mStackView.setStackStartPosition(mPositionFromRemovedStack);
mStackView.addView(mBubbleScrim);
if (mExpandListener != null) {

View File

@@ -32,10 +32,9 @@ import android.view.View;
import androidx.annotation.Nullable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FrameworkStatsLog;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController.DismissReason;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.shared.system.SysUiStatsLog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -53,10 +52,9 @@ import java.util.function.Predicate;
/**
* Keeps track of active bubbles.
*/
@SysUISingleton
public class BubbleData {
private BubbleLoggerImpl mLogger = new BubbleLoggerImpl();
private BubbleLogger mLogger;
private int mCurrentUserId;
@@ -155,8 +153,9 @@ public class BubbleData {
*/
private HashMap<String, String> mSuppressedGroupKeys = new HashMap<>();
public BubbleData(Context context) {
public BubbleData(Context context, BubbleLogger bubbleLogger) {
mContext = context;
mLogger = bubbleLogger;
mBubbles = new ArrayList<>();
mOverflowBubbles = new ArrayList<>();
mPendingBubbles = new HashMap<>();
@@ -618,12 +617,12 @@ public class BubbleData {
* @param normalX Normalized x position of the stack
* @param normalY Normalized y position of the stack
*/
void logBubbleEvent(@Nullable BubbleViewProvider provider, int action, String packageName,
void logBubbleEvent(@Nullable BubbleViewProvider provider, int action, String packageName,
int bubbleCount, int bubbleIndex, float normalX, float normalY) {
if (provider == null) {
mLogger.logStackUiChanged(packageName, action, bubbleCount, normalX, normalY);
} else if (provider.getKey().equals(BubbleOverflow.KEY)) {
if (action == SysUiStatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED) {
if (action == FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED) {
mLogger.logShowOverflow(packageName, mCurrentUserId);
}
} else {

View File

@@ -17,6 +17,7 @@ package com.android.systemui.bubbles
import android.annotation.SuppressLint
import android.annotation.UserIdInt
import android.content.Context
import android.content.pm.LauncherApps
import android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_CACHED
import android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC
@@ -26,21 +27,16 @@ import android.util.Log
import com.android.systemui.bubbles.storage.BubbleEntity
import com.android.systemui.bubbles.storage.BubblePersistentRepository
import com.android.systemui.bubbles.storage.BubbleVolatileRepository
import com.android.systemui.dagger.SysUISingleton
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.launch
import kotlinx.coroutines.yield
import javax.inject.Inject
@SysUISingleton
internal class BubbleDataRepository @Inject constructor(
private val volatileRepository: BubbleVolatileRepository,
private val persistentRepository: BubblePersistentRepository,
private val launcherApps: LauncherApps
) {
internal class BubbleDataRepository(context: Context, private val launcherApps: LauncherApps) {
private val volatileRepository = BubbleVolatileRepository(launcherApps)
private val persistentRepository = BubblePersistentRepository(context)
private val ioScope = CoroutineScope(Dispatchers.IO)
private val uiScope = CoroutineScope(Dispatchers.Main)

View File

@@ -19,17 +19,22 @@ package com.android.systemui.bubbles;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.util.FrameworkStatsLog;
/**
* Interface for handling bubble-specific logging.
* Implementation of UiEventLogger for logging bubble UI events.
*
* See UiEventReported atom in atoms.proto for more context.
*/
public interface BubbleLogger extends UiEventLogger {
public class BubbleLogger {
private final UiEventLogger mUiEventLogger;
/**
* Bubble UI event.
*/
@VisibleForTesting
enum Event implements UiEventLogger.UiEventEnum {
public enum Event implements UiEventLogger.UiEventEnum {
@UiEvent(doc = "User dismissed the bubble via gesture, add bubble to overflow.")
BUBBLE_OVERFLOW_ADD_USER_GESTURE(483),
@@ -70,23 +75,80 @@ public interface BubbleLogger extends UiEventLogger {
}
}
public BubbleLogger(UiEventLogger uiEventLogger) {
mUiEventLogger = uiEventLogger;
}
/**
* @param b Bubble involved in this UI event
* @param e UI event
*/
void log(Bubble b, UiEventEnum e);
public void log(Bubble b, UiEventLogger.UiEventEnum e) {
mUiEventLogger.logWithInstanceId(e, b.getAppUid(), b.getPackageName(), b.getInstanceId());
}
/**
*
* @param b Bubble removed from overflow
* @param r Reason that bubble was removed from overflow
* @param r Reason that bubble was removed
*/
void logOverflowRemove(Bubble b, @BubbleController.DismissReason int r);
public void logOverflowRemove(Bubble b, @BubbleController.DismissReason int r) {
if (r == BubbleController.DISMISS_NOTIF_CANCEL) {
log(b, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_CANCEL);
} else if (r == BubbleController.DISMISS_GROUP_CANCELLED) {
log(b, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_GROUP_CANCEL);
} else if (r == BubbleController.DISMISS_NO_LONGER_BUBBLE) {
log(b, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_NO_LONGER_BUBBLE);
} else if (r == BubbleController.DISMISS_BLOCKED) {
log(b, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_BLOCKED);
}
}
/**
*
* @param b Bubble added to overflow
* @param r Reason that bubble was added to overflow
*/
void logOverflowAdd(Bubble b, @BubbleController.DismissReason int r);
}
public void logOverflowAdd(Bubble b, @BubbleController.DismissReason int r) {
if (r == BubbleController.DISMISS_AGED) {
log(b, Event.BUBBLE_OVERFLOW_ADD_AGED);
} else if (r == BubbleController.DISMISS_USER_GESTURE) {
log(b, Event.BUBBLE_OVERFLOW_ADD_USER_GESTURE);
}
}
void logStackUiChanged(String packageName, int action, int bubbleCount, float normalX,
float normalY) {
FrameworkStatsLog.write(FrameworkStatsLog.BUBBLE_UI_CHANGED,
packageName,
null /* notification channel */,
0 /* notification ID */,
0 /* bubble position */,
bubbleCount,
action,
normalX,
normalY,
false /* unread bubble */,
false /* on-going bubble */,
false /* isAppForeground (unused) */);
}
void logShowOverflow(String packageName, int currentUserId) {
mUiEventLogger.log(BubbleLogger.Event.BUBBLE_OVERFLOW_SELECTED, currentUserId,
packageName);
}
void logBubbleUiChanged(Bubble bubble, String packageName, int action, int bubbleCount,
float normalX, float normalY, int index) {
FrameworkStatsLog.write(FrameworkStatsLog.BUBBLE_UI_CHANGED,
packageName,
bubble.getChannelId() /* notification channel */,
bubble.getNotificationId() /* notification ID */,
index,
bubbleCount,
action,
normalX,
normalY,
bubble.showInShade() /* isUnread */,
false /* isOngoing (unused) */,
false /* isAppForeground (unused) */);
}
}

View File

@@ -1,103 +0,0 @@
/*
* Copyright (C) 2020 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.bubbles;
import android.os.UserHandle;
import com.android.internal.logging.UiEventLoggerImpl;
import com.android.systemui.shared.system.SysUiStatsLog;
/**
* Implementation of UiEventLogger for logging bubble UI events.
*
* See UiEventReported atom in atoms.proto for more context.
*/
public class BubbleLoggerImpl extends UiEventLoggerImpl implements BubbleLogger {
/**
* @param b Bubble involved in this UI event
* @param e UI event
*/
public void log(Bubble b, UiEventEnum e) {
logWithInstanceId(e, b.getAppUid(), b.getPackageName(), b.getInstanceId());
}
/**
* @param b Bubble removed from overflow
* @param r Reason that bubble was removed
*/
public void logOverflowRemove(Bubble b, @BubbleController.DismissReason int r) {
if (r == BubbleController.DISMISS_NOTIF_CANCEL) {
log(b, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_CANCEL);
} else if (r == BubbleController.DISMISS_GROUP_CANCELLED) {
log(b, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_GROUP_CANCEL);
} else if (r == BubbleController.DISMISS_NO_LONGER_BUBBLE) {
log(b, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_NO_LONGER_BUBBLE);
} else if (r == BubbleController.DISMISS_BLOCKED) {
log(b, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_BLOCKED);
}
}
/**
* @param b Bubble added to overflow
* @param r Reason that bubble was added to overflow
*/
public void logOverflowAdd(Bubble b, @BubbleController.DismissReason int r) {
if (r == BubbleController.DISMISS_AGED) {
log(b, Event.BUBBLE_OVERFLOW_ADD_AGED);
} else if (r == BubbleController.DISMISS_USER_GESTURE) {
log(b, Event.BUBBLE_OVERFLOW_ADD_USER_GESTURE);
}
}
void logStackUiChanged(String packageName, int action, int bubbleCount, float normalX,
float normalY) {
SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
packageName,
null /* notification channel */,
0 /* notification ID */,
0 /* bubble position */,
bubbleCount,
action,
normalX,
normalY,
false /* unread bubble */,
false /* on-going bubble */,
false /* isAppForeground (unused) */);
}
void logShowOverflow(String packageName, int currentUserId) {
super.log(BubbleLogger.Event.BUBBLE_OVERFLOW_SELECTED, currentUserId,
packageName);
}
void logBubbleUiChanged(Bubble bubble, String packageName, int action, int bubbleCount,
float normalX, float normalY, int index) {
SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
packageName,
bubble.getChannelId() /* notification channel */,
bubble.getNotificationId() /* notification ID */,
index,
bubbleCount,
action,
normalX,
normalY,
bubble.showInShade() /* isUnread */,
false /* isOngoing (unused) */,
false /* isAppForeground (unused) */);
}
}

View File

@@ -74,18 +74,13 @@ import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FrameworkStatsLog;
import com.android.systemui.Interpolators;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.bubbles.animation.AnimatableScaleMatrix;
import com.android.systemui.bubbles.animation.ExpandedAnimationController;
import com.android.systemui.bubbles.animation.PhysicsAnimationLayout;
import com.android.systemui.bubbles.animation.StackAnimationController;
import com.android.systemui.model.SysUiState;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.phone.CollapsedStatusBarFragment;
import com.android.systemui.util.RelativeTouchListener;
import com.android.wm.shell.animation.PhysicsAnimator;
import com.android.wm.shell.common.FloatingContentCoordinator;
import com.android.wm.shell.common.magnetictarget.MagnetizedObject;
@@ -121,6 +116,8 @@ public class BubbleStackView extends FrameLayout
/** Duration of the flyout alpha animations. */
private static final int FLYOUT_ALPHA_ANIMATION_DURATION = 100;
private static final int FADE_IN_DURATION = 320;
/** Percent to darken the bubbles when they're in the dismiss target. */
private static final float DARKEN_PERCENT = 0.3f;
@@ -323,8 +320,6 @@ public class BubbleStackView extends FrameLayout
/** Callback to run when we want to unbubble the given notification's conversation. */
private Consumer<String> mUnbubbleConversationCallback;
private SysUiState mSysUiState;
private boolean mViewUpdatedRequested = false;
private boolean mIsExpansionAnimating = false;
private boolean mIsBubbleSwitchAnimating = false;
@@ -400,6 +395,11 @@ public class BubbleStackView extends FrameLayout
*/
public final Consumer<Boolean> mOnImeVisibilityChanged;
/**
* Callback to run when the bubble expand status changes.
*/
private final Consumer<Boolean> mOnBubbleExpandChanged;
/**
* Callback to run to ask BubbleController to hide the current IME.
*/
@@ -660,7 +660,7 @@ public class BubbleStackView extends FrameLayout
viewInitialX + dx, velX, velY) <= 0;
updateBubbleIcons();
logBubbleEvent(null /* no bubble associated with bubble stack move */,
SysUiStatsLog.BUBBLE_UICHANGED__ACTION__STACK_MOVED);
FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__STACK_MOVED);
}
mDismissView.hide();
}
@@ -742,17 +742,15 @@ public class BubbleStackView extends FrameLayout
public BubbleStackView(Context context, BubbleData data,
@Nullable SurfaceSynchronizer synchronizer,
FloatingContentCoordinator floatingContentCoordinator,
SysUiState sysUiState,
Runnable allBubblesAnimatedOutAction,
Consumer<Boolean> onImeVisibilityChanged,
Runnable hideCurrentInputMethodCallback) {
Runnable hideCurrentInputMethodCallback,
Consumer<Boolean> onBubbleExpandChanged) {
super(context);
mBubbleData = data;
mInflater = LayoutInflater.from(context);
mSysUiState = sysUiState;
Resources res = getResources();
mMaxBubbles = res.getInteger(R.integer.bubbles_max_rendered);
mBubbleSize = res.getDimensionPixelSize(R.dimen.individual_bubble_size);
@@ -865,6 +863,7 @@ public class BubbleStackView extends FrameLayout
mOnImeVisibilityChanged = onImeVisibilityChanged;
mHideCurrentInputMethodCallback = hideCurrentInputMethodCallback;
mOnBubbleExpandChanged = onBubbleExpandChanged;
setOnApplyWindowInsetsListener((View view, WindowInsets insets) -> {
onImeVisibilityChanged.accept(insets.getInsets(WindowInsets.Type.ime()).bottom > 0);
@@ -974,7 +973,7 @@ public class BubbleStackView extends FrameLayout
animate()
.setInterpolator(Interpolators.PANEL_CLOSE_ACCELERATED)
.setDuration(CollapsedStatusBarFragment.FADE_IN_DURATION);
.setDuration(FADE_IN_DURATION);
}
/**
@@ -1066,7 +1065,7 @@ public class BubbleStackView extends FrameLayout
mBubbleData.setExpanded(false);
mContext.startActivityAsUser(intent, bubble.getUser());
logBubbleEvent(bubble,
SysUiStatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_SETTINGS);
FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_SETTINGS);
}
});
@@ -1082,8 +1081,7 @@ public class BubbleStackView extends FrameLayout
* Whether the educational view should show for the expanded view "manage" menu.
*/
private boolean shouldShowManageEdu() {
final boolean seen = Prefs.getBoolean(mContext,
Prefs.Key.HAS_SEEN_BUBBLES_MANAGE_EDUCATION, false /* default */);
final boolean seen = getPrefBoolean(ManageEducationViewKt.PREF_MANAGED_EDUCATION);
final boolean shouldShow = (!seen || BubbleDebugConfig.forceShowUserEducation(mContext))
&& mExpandedBubble != null;
if (BubbleDebugConfig.DEBUG_USER_EDUCATION) {
@@ -1107,8 +1105,7 @@ public class BubbleStackView extends FrameLayout
* Whether education view should show for the collapsed stack.
*/
private boolean shouldShowStackEdu() {
final boolean seen = Prefs.getBoolean(getContext(),
Prefs.Key.HAS_SEEN_BUBBLES_EDUCATION, false /* default */);
final boolean seen = getPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION);
final boolean shouldShow = !seen || BubbleDebugConfig.forceShowUserEducation(mContext);
if (BubbleDebugConfig.DEBUG_USER_EDUCATION) {
Log.d(TAG, "Show stack edu: " + shouldShow);
@@ -1116,6 +1113,11 @@ public class BubbleStackView extends FrameLayout
return shouldShow;
}
private boolean getPrefBoolean(String key) {
return mContext.getSharedPreferences(mContext.getPackageName(), Context.MODE_PRIVATE)
.getBoolean(key, false /* default */);
}
/**
* @return true if education view for collapsed stack should show and was not showing before.
*/
@@ -1488,7 +1490,7 @@ public class BubbleStackView extends FrameLayout
new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
animateInFlyoutForBubble(bubble);
requestUpdate();
logBubbleEvent(bubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__POSTED);
logBubbleEvent(bubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__POSTED);
}
// via BubbleData.Listener
@@ -1508,7 +1510,7 @@ public class BubbleStackView extends FrameLayout
bubble.cleanupViews();
}
updatePointerPosition();
logBubbleEvent(bubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED);
logBubbleEvent(bubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED);
return;
}
}
@@ -1526,7 +1528,7 @@ public class BubbleStackView extends FrameLayout
void updateBubble(Bubble bubble) {
animateInFlyoutForBubble(bubble);
requestUpdate();
logBubbleEvent(bubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__UPDATED);
logBubbleEvent(bubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__UPDATED);
}
public void updateBubbleOrder(List<Bubble> bubbles) {
@@ -1622,8 +1624,9 @@ public class BubbleStackView extends FrameLayout
requestUpdate();
logBubbleEvent(previouslySelected,
SysUiStatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED);
logBubbleEvent(bubbleToSelect, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED);
FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED);
logBubbleEvent(bubbleToSelect,
FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED);
notifyExpansionChanged(previouslySelected, false /* expanded */);
notifyExpansionChanged(bubbleToSelect, true /* expanded */);
});
@@ -1653,18 +1656,17 @@ public class BubbleStackView extends FrameLayout
hideCurrentInputMethod();
mSysUiState
.setFlag(QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED, shouldExpand)
.commitUpdate(mContext.getDisplayId());
mOnBubbleExpandChanged.accept(shouldExpand);
if (mIsExpanded) {
animateCollapse();
logBubbleEvent(mExpandedBubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED);
logBubbleEvent(mExpandedBubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED);
} else {
animateExpansion();
// TODO: move next line to BubbleData
logBubbleEvent(mExpandedBubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED);
logBubbleEvent(mExpandedBubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED);
logBubbleEvent(mExpandedBubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED);
logBubbleEvent(mExpandedBubble,
FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED);
}
notifyExpansionChanged(mExpandedBubble, mIsExpanded);
}
@@ -2285,7 +2287,7 @@ public class BubbleStackView extends FrameLayout
});
mFlyout.removeCallbacks(mHideFlyout);
mFlyout.postDelayed(mHideFlyout, FLYOUT_HIDE_AFTER);
logBubbleEvent(bubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__FLYOUT);
logBubbleEvent(bubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__FLYOUT);
}
/** Hide the flyout immediately and cancel any pending hide runnables. */

View File

@@ -25,8 +25,6 @@ import android.widget.LinearLayout
import android.widget.TextView
import com.android.internal.util.ContrastColorUtil
import com.android.systemui.Interpolators
import com.android.systemui.Prefs
import com.android.systemui.Prefs.Key.HAS_SEEN_BUBBLES_MANAGE_EDUCATION
import com.android.systemui.R
/**
@@ -38,8 +36,8 @@ class ManageEducationView constructor(context: Context) : LinearLayout(context)
private val TAG = if (BubbleDebugConfig.TAG_WITH_CLASS_NAME) "BubbleManageEducationView"
else BubbleDebugConfig.TAG_BUBBLES
private val ANIMATE_DURATION : Long = 200
private val ANIMATE_DURATION_SHORT : Long = 40
private val ANIMATE_DURATION: Long = 200
private val ANIMATE_DURATION_SHORT: Long = 40
private val manageView by lazy { findViewById<View>(R.id.manage_education_view) }
private val manageButton by lazy { findViewById<Button>(R.id.manage) }
@@ -50,7 +48,7 @@ class ManageEducationView constructor(context: Context) : LinearLayout(context)
private var isHiding = false
init {
LayoutInflater.from(context).inflate(R.layout.bubbles_manage_button_education, this);
LayoutInflater.from(context).inflate(R.layout.bubbles_manage_button_education, this)
visibility = View.GONE
elevation = resources.getDimensionPixelSize(R.dimen.bubble_elevation).toFloat()
@@ -95,7 +93,7 @@ class ManageEducationView constructor(context: Context) : LinearLayout(context)
*
* @param show whether the user education view should show or not.
*/
fun show(expandedView: BubbleExpandedView, rect : Rect) {
fun show(expandedView: BubbleExpandedView, rect: Rect) {
if (visibility == VISIBLE) return
alpha = 0f
@@ -136,10 +134,13 @@ class ManageEducationView constructor(context: Context) : LinearLayout(context)
.withEndAction {
isHiding = false
visibility = GONE
};
}
}
private fun setShouldShow(shouldShow: Boolean) {
Prefs.putBoolean(context, HAS_SEEN_BUBBLES_MANAGE_EDUCATION, !shouldShow)
context.getSharedPreferences(context.packageName, Context.MODE_PRIVATE)
.edit().putBoolean(PREF_MANAGED_EDUCATION, !shouldShow).apply()
}
}
}
const val PREF_MANAGED_EDUCATION: String = "HasSeenBubblesManageOnboarding"

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.util
package com.android.systemui.bubbles
import android.graphics.PointF
import android.os.Handler

View File

@@ -24,21 +24,19 @@ import android.widget.LinearLayout
import android.widget.TextView
import com.android.internal.util.ContrastColorUtil
import com.android.systemui.Interpolators
import com.android.systemui.Prefs
import com.android.systemui.Prefs.Key.HAS_SEEN_BUBBLES_EDUCATION
import com.android.systemui.R
/**
* User education view to highlight the collapsed stack of bubbles.
* Shown only the first time a user taps the stack.
*/
class StackEducationView constructor(context: Context) : LinearLayout(context){
class StackEducationView constructor(context: Context) : LinearLayout(context) {
private val TAG = if (BubbleDebugConfig.TAG_WITH_CLASS_NAME) "BubbleStackEducationView"
else BubbleDebugConfig.TAG_BUBBLES
private val ANIMATE_DURATION : Long = 200
private val ANIMATE_DURATION_SHORT : Long = 40
private val ANIMATE_DURATION: Long = 200
private val ANIMATE_DURATION_SHORT: Long = 40
private val view by lazy { findViewById<View>(R.id.stack_education_layout) }
private val titleTextView by lazy { findViewById<TextView>(R.id.stack_education_title) }
@@ -47,7 +45,7 @@ class StackEducationView constructor(context: Context) : LinearLayout(context){
private var isHiding = false
init {
LayoutInflater.from(context).inflate(R.layout.bubble_stack_user_education, this);
LayoutInflater.from(context).inflate(R.layout.bubble_stack_user_education, this)
visibility = View.GONE
elevation = resources.getDimensionPixelSize(R.dimen.bubble_elevation).toFloat()
@@ -93,7 +91,7 @@ class StackEducationView constructor(context: Context) : LinearLayout(context){
*
* @return true if user education was shown, false otherwise.
*/
fun show(stackPosition: PointF) : Boolean{
fun show(stackPosition: PointF): Boolean {
if (visibility == VISIBLE) return false
setAlpha(0f)
@@ -129,6 +127,9 @@ class StackEducationView constructor(context: Context) : LinearLayout(context){
}
private fun setShouldShow(shouldShow: Boolean) {
Prefs.putBoolean(context, HAS_SEEN_BUBBLES_EDUCATION, !shouldShow)
context.getSharedPreferences(context.packageName, Context.MODE_PRIVATE)
.edit().putBoolean(PREF_MANAGED_EDUCATION, !shouldShow).apply()
}
}
}
const val PREF_STACK_EDUCATION: String = "HasSeenBubblesOnboarding"

View File

@@ -21,9 +21,9 @@ import android.content.Context;
import android.content.pm.LauncherApps;
import android.view.WindowManager;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.bubbles.BubbleDataRepository;
import com.android.systemui.bubbles.Bubbles;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager;
@@ -68,13 +68,13 @@ public interface BubbleModule {
FeatureFlags featureFlags,
DumpManager dumpManager,
FloatingContentCoordinator floatingContentCoordinator,
BubbleDataRepository bubbleDataRepository,
SysUiState sysUiState,
INotificationManager notifManager,
IStatusBarService statusBarService,
WindowManager windowManager,
WindowManagerShellWrapper windowManagerShellWrapper,
LauncherApps launcherApps) {
LauncherApps launcherApps,
UiEventLogger uiEventLogger) {
return BubbleController.create(
context,
notificationShadeWindowController,
@@ -91,12 +91,12 @@ public interface BubbleModule {
featureFlags,
dumpManager,
floatingContentCoordinator,
bubbleDataRepository,
sysUiState,
notifManager,
statusBarService,
windowManager,
windowManagerShellWrapper,
launcherApps);
launcherApps,
uiEventLogger);
}
}

View File

@@ -18,16 +18,11 @@ package com.android.systemui.bubbles.storage
import android.content.Context
import android.util.AtomicFile
import android.util.Log
import com.android.systemui.dagger.SysUISingleton
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import javax.inject.Inject
@SysUISingleton
class BubblePersistentRepository @Inject constructor(
context: Context
) {
class BubblePersistentRepository(context: Context) {
private val bubbleFile: AtomicFile = AtomicFile(File(context.filesDir,
"overflow_bubbles.xml"), "overflow-bubbles")

View File

@@ -19,8 +19,6 @@ import android.content.pm.LauncherApps
import android.os.UserHandle
import com.android.internal.annotations.VisibleForTesting
import com.android.systemui.bubbles.ShortcutKey
import com.android.systemui.dagger.SysUISingleton
import javax.inject.Inject
private const val CAPACITY = 16
@@ -28,10 +26,7 @@ private const val CAPACITY = 16
* BubbleVolatileRepository holds the most updated snapshot of list of bubbles for in-memory
* manipulation.
*/
@SysUISingleton
class BubbleVolatileRepository @Inject constructor(
private val launcherApps: LauncherApps
) {
class BubbleVolatileRepository(private val launcherApps: LauncherApps) {
/**
* An ordered set of bubbles based on their natural ordering.
*/

View File

@@ -194,6 +194,8 @@ public class BubbleControllerTest extends SysuiTestCase {
@Mock private WindowManagerShellWrapper mWindowManagerShellWrapper;
@Mock private BubbleLogger mBubbleLogger;
private BubbleData mBubbleData;
private TestableLooper mTestableLooper;
@@ -249,7 +251,7 @@ public class BubbleControllerTest extends SysuiTestCase {
mock(HeadsUpManager.class),
mock(Handler.class)
);
mBubbleData = new BubbleData(mContext);
mBubbleData = new BubbleData(mContext, mBubbleLogger);
when(mFeatureFlagsOldPipeline.isNewNotifPipelineRenderingEnabled()).thenReturn(false);
mBubbleController = new TestableBubbleController(
mContext,
@@ -273,7 +275,8 @@ public class BubbleControllerTest extends SysuiTestCase {
mStatusBarService,
mWindowManager,
mWindowManagerShellWrapper,
mLauncherApps);
mLauncherApps,
mBubbleLogger);
mBubbleController.setExpandListener(mBubbleExpandListener);
// Get a reference to the BubbleController's entry listener

View File

@@ -95,6 +95,8 @@ public class BubbleDataTest extends SysuiTestCase {
private PendingIntent mExpandIntent;
@Mock
private PendingIntent mDeleteIntent;
@Mock
private BubbleLogger mBubbleLogger;
@Captor
private ArgumentCaptor<BubbleData.Update> mUpdateCaptor;
@@ -134,7 +136,7 @@ public class BubbleDataTest extends SysuiTestCase {
mBubbleB3 = new Bubble(mEntryB3, mSuppressionListener, mPendingIntentCanceledListener);
mBubbleC1 = new Bubble(mEntryC1, mSuppressionListener, mPendingIntentCanceledListener);
mBubbleData = new BubbleData(getContext());
mBubbleData = new BubbleData(getContext(), mBubbleLogger);
// Used by BubbleData to set lastAccessedTime
when(mTimeSource.currentTimeMillis()).thenReturn(1000L);

View File

@@ -188,6 +188,8 @@ public class NewNotifPipelineBubbleControllerTest extends SysuiTestCase {
private LauncherApps mLauncherApps;
@Mock
private WindowManagerShellWrapper mWindowManagerShellWrapper;
@Mock
private BubbleLogger mBubbleLogger;
private BubbleData mBubbleData;
@@ -251,7 +253,7 @@ public class NewNotifPipelineBubbleControllerTest extends SysuiTestCase {
mock(HeadsUpManager.class),
mock(Handler.class)
);
mBubbleData = new BubbleData(mContext);
mBubbleData = new BubbleData(mContext, mBubbleLogger);
when(mFeatureFlagsNewPipeline.isNewNotifPipelineRenderingEnabled()).thenReturn(true);
mBubbleController = new TestableBubbleController(
mContext,
@@ -275,7 +277,8 @@ public class NewNotifPipelineBubbleControllerTest extends SysuiTestCase {
mStatusBarService,
mWindowManager,
mWindowManagerShellWrapper,
mLauncherApps);
mLauncherApps,
mBubbleLogger);
mBubbleController.addNotifCallback(mNotifCallback);
mBubbleController.setExpandListener(mBubbleExpandListener);

View File

@@ -66,14 +66,15 @@ public class TestableBubbleController extends BubbleController {
IStatusBarService statusBarService,
WindowManager windowManager,
WindowManagerShellWrapper windowManagerShellWrapper,
LauncherApps launcherApps) {
LauncherApps launcherApps,
BubbleLogger bubbleLogger) {
super(context,
notificationShadeWindowController, statusBarStateController, shadeController,
data, Runnable::run, configurationController, interruptionStateProvider,
zenModeController, lockscreenUserManager, groupManager, entryManager,
notifPipeline, featureFlags, dumpManager, floatingContentCoordinator,
dataRepository, sysUiState, notificationManager, statusBarService,
windowManager, windowManagerShellWrapper, launcherApps);
windowManager, windowManagerShellWrapper, launcherApps, bubbleLogger);
setInflateSynchronously(true);
}
}