Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +2 −2 Original line number Diff line number Diff line Loading @@ -1291,7 +1291,7 @@ public class BubbleStackView extends FrameLayout // We only show user education for conversation bubbles right now return false; } final boolean seen = getPrefBoolean(ManageEducationViewKt.PREF_MANAGED_EDUCATION); final boolean seen = getPrefBoolean(ManageEducationView.PREF_MANAGED_EDUCATION); final boolean shouldShow = (!seen || BubbleDebugConfig.forceShowUserEducation(mContext)) && mExpandedBubble != null && mExpandedBubble.getExpandedView() != null; if (BubbleDebugConfig.DEBUG_USER_EDUCATION) { Loading Loading @@ -1342,7 +1342,7 @@ public class BubbleStackView extends FrameLayout // We only show user education for conversation bubbles right now return false; } final boolean seen = getPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION); final boolean seen = getPrefBoolean(StackEducationView.PREF_STACK_EDUCATION); final boolean shouldShow = !seen || BubbleDebugConfig.forceShowUserEducation(mContext); if (BubbleDebugConfig.DEBUG_USER_EDUCATION) { Log.d(TAG, "Show stack edu: " + shouldShow); Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt +12 −13 Original line number Diff line number Diff line Loading @@ -33,15 +33,16 @@ import com.android.wm.shell.animation.Interpolators * User education view to highlight the manage button that allows a user to configure the settings * for the bubble. Shown only the first time a user expands a bubble. */ class ManageEducationView(context: Context, positioner: BubblePositioner) : LinearLayout(context) { class ManageEducationView( context: Context, private val positioner: BubblePositioner ) : LinearLayout(context) { private val TAG = if (BubbleDebugConfig.TAG_WITH_CLASS_NAME) "ManageEducationView" else BubbleDebugConfig.TAG_BUBBLES private val ANIMATE_DURATION: Long = 200 companion object { const val PREF_MANAGED_EDUCATION: String = "HasSeenBubblesManageOnboarding" private const val ANIMATE_DURATION: Long = 200 } private val positioner: BubblePositioner = positioner private val manageView by lazy { requireViewById<ViewGroup>(R.id.manage_education_view) } private val manageButton by lazy { requireViewById<Button>(R.id.manage_button) } private val gotItButton by lazy { requireViewById<Button>(R.id.got_it) } Loading Loading @@ -128,7 +129,7 @@ class ManageEducationView(context: Context, positioner: BubblePositioner) : Line .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .alpha(1f) } setShouldShow(false) updateManageEducationSeen() } /** Loading Loading @@ -218,13 +219,11 @@ class ManageEducationView(context: Context, positioner: BubblePositioner) : Line } } private fun setShouldShow(shouldShow: Boolean) { private fun updateManageEducationSeen() { context .getSharedPreferences(context.packageName, Context.MODE_PRIVATE) .edit() .putBoolean(PREF_MANAGED_EDUCATION, !shouldShow) .putBoolean(PREF_MANAGED_EDUCATION, true) .apply() } } const val PREF_MANAGED_EDUCATION: String = "HasSeenBubblesManageOnboarding" libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt +10 −16 Original line number Diff line number Diff line Loading @@ -34,19 +34,15 @@ import com.android.wm.shell.animation.Interpolators */ class StackEducationView( context: Context, positioner: BubblePositioner, controller: BubbleController private val positioner: BubblePositioner, private val controller: BubbleController ) : 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 positioner: BubblePositioner = positioner private val controller: BubbleController = controller companion object { const val PREF_STACK_EDUCATION: String = "HasSeenBubblesOnboarding" private const val ANIMATE_DURATION: Long = 200 private const val ANIMATE_DURATION_SHORT: Long = 40 } private val view by lazy { requireViewById<View>(R.id.stack_education_layout) } private val titleTextView by lazy { requireViewById<TextView>(R.id.stack_education_title) } Loading Loading @@ -175,7 +171,7 @@ class StackEducationView( .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .alpha(1f) } setShouldShow(false) updateStackEducationSeen() return true } Loading @@ -196,13 +192,11 @@ class StackEducationView( .withEndAction { visibility = GONE } } private fun setShouldShow(shouldShow: Boolean) { private fun updateStackEducationSeen() { context .getSharedPreferences(context.packageName, Context.MODE_PRIVATE) .edit() .putBoolean(PREF_STACK_EDUCATION, !shouldShow) .putBoolean(PREF_STACK_EDUCATION, true) .apply() } } const val PREF_STACK_EDUCATION: String = "HasSeenBubblesOnboarding" packages/SystemUI/tests/src/com/android/systemui/wmshell/BubbleEducationControllerTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import androidx.test.filters.SmallTest import com.android.systemui.model.SysUiStateTest import com.android.wm.shell.bubbles.Bubble import com.android.wm.shell.bubbles.BubbleEducationController import com.android.wm.shell.bubbles.PREF_MANAGED_EDUCATION import com.android.wm.shell.bubbles.PREF_STACK_EDUCATION import com.android.wm.shell.bubbles.ManageEducationView.Companion.PREF_MANAGED_EDUCATION import com.android.wm.shell.bubbles.StackEducationView.Companion.PREF_STACK_EDUCATION import com.google.common.truth.Truth.assertThat import com.google.common.util.concurrent.MoreExecutors.directExecutor import org.junit.Assert.assertEquals Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -29,8 +29,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.google.common.truth.Truth.assertThat; import static kotlinx.coroutines.flow.FlowKt.emptyFlow; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; Loading @@ -50,6 +48,8 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static kotlinx.coroutines.flow.FlowKt.emptyFlow; import android.app.ActivityManager; import android.app.IActivityManager; import android.app.INotificationManager; Loading Loading @@ -186,7 +186,7 @@ import com.android.wm.shell.bubbles.BubbleStackView; import com.android.wm.shell.bubbles.BubbleViewInfoTask; import com.android.wm.shell.bubbles.BubbleViewProvider; import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.bubbles.StackEducationViewKt; import com.android.wm.shell.bubbles.StackEducationView; import com.android.wm.shell.bubbles.properties.BubbleProperties; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.FloatingContentCoordinator; Loading Loading @@ -1930,7 +1930,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testShowStackEdu_isNotConversationBubble() { // Setup setPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION, false); setPrefBoolean(StackEducationView.PREF_STACK_EDUCATION, false); BubbleEntry bubbleEntry = createBubbleEntry(false /* isConversation */); mBubbleController.updateBubble(bubbleEntry); assertTrue(mBubbleController.hasBubbles()); Loading @@ -1948,7 +1948,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testShowStackEdu_isConversationBubble() { // Setup setPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION, false); setPrefBoolean(StackEducationView.PREF_STACK_EDUCATION, false); BubbleEntry bubbleEntry = createBubbleEntry(true /* isConversation */); mBubbleController.updateBubble(bubbleEntry); assertTrue(mBubbleController.hasBubbles()); Loading @@ -1966,7 +1966,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testShowStackEdu_isSeenConversationBubble() { // Setup setPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION, true); setPrefBoolean(StackEducationView.PREF_STACK_EDUCATION, true); BubbleEntry bubbleEntry = createBubbleEntry(true /* isConversation */); mBubbleController.updateBubble(bubbleEntry); assertTrue(mBubbleController.hasBubbles()); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +2 −2 Original line number Diff line number Diff line Loading @@ -1291,7 +1291,7 @@ public class BubbleStackView extends FrameLayout // We only show user education for conversation bubbles right now return false; } final boolean seen = getPrefBoolean(ManageEducationViewKt.PREF_MANAGED_EDUCATION); final boolean seen = getPrefBoolean(ManageEducationView.PREF_MANAGED_EDUCATION); final boolean shouldShow = (!seen || BubbleDebugConfig.forceShowUserEducation(mContext)) && mExpandedBubble != null && mExpandedBubble.getExpandedView() != null; if (BubbleDebugConfig.DEBUG_USER_EDUCATION) { Loading Loading @@ -1342,7 +1342,7 @@ public class BubbleStackView extends FrameLayout // We only show user education for conversation bubbles right now return false; } final boolean seen = getPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION); final boolean seen = getPrefBoolean(StackEducationView.PREF_STACK_EDUCATION); final boolean shouldShow = !seen || BubbleDebugConfig.forceShowUserEducation(mContext); if (BubbleDebugConfig.DEBUG_USER_EDUCATION) { Log.d(TAG, "Show stack edu: " + shouldShow); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt +12 −13 Original line number Diff line number Diff line Loading @@ -33,15 +33,16 @@ import com.android.wm.shell.animation.Interpolators * User education view to highlight the manage button that allows a user to configure the settings * for the bubble. Shown only the first time a user expands a bubble. */ class ManageEducationView(context: Context, positioner: BubblePositioner) : LinearLayout(context) { class ManageEducationView( context: Context, private val positioner: BubblePositioner ) : LinearLayout(context) { private val TAG = if (BubbleDebugConfig.TAG_WITH_CLASS_NAME) "ManageEducationView" else BubbleDebugConfig.TAG_BUBBLES private val ANIMATE_DURATION: Long = 200 companion object { const val PREF_MANAGED_EDUCATION: String = "HasSeenBubblesManageOnboarding" private const val ANIMATE_DURATION: Long = 200 } private val positioner: BubblePositioner = positioner private val manageView by lazy { requireViewById<ViewGroup>(R.id.manage_education_view) } private val manageButton by lazy { requireViewById<Button>(R.id.manage_button) } private val gotItButton by lazy { requireViewById<Button>(R.id.got_it) } Loading Loading @@ -128,7 +129,7 @@ class ManageEducationView(context: Context, positioner: BubblePositioner) : Line .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .alpha(1f) } setShouldShow(false) updateManageEducationSeen() } /** Loading Loading @@ -218,13 +219,11 @@ class ManageEducationView(context: Context, positioner: BubblePositioner) : Line } } private fun setShouldShow(shouldShow: Boolean) { private fun updateManageEducationSeen() { context .getSharedPreferences(context.packageName, Context.MODE_PRIVATE) .edit() .putBoolean(PREF_MANAGED_EDUCATION, !shouldShow) .putBoolean(PREF_MANAGED_EDUCATION, true) .apply() } } const val PREF_MANAGED_EDUCATION: String = "HasSeenBubblesManageOnboarding"
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt +10 −16 Original line number Diff line number Diff line Loading @@ -34,19 +34,15 @@ import com.android.wm.shell.animation.Interpolators */ class StackEducationView( context: Context, positioner: BubblePositioner, controller: BubbleController private val positioner: BubblePositioner, private val controller: BubbleController ) : 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 positioner: BubblePositioner = positioner private val controller: BubbleController = controller companion object { const val PREF_STACK_EDUCATION: String = "HasSeenBubblesOnboarding" private const val ANIMATE_DURATION: Long = 200 private const val ANIMATE_DURATION_SHORT: Long = 40 } private val view by lazy { requireViewById<View>(R.id.stack_education_layout) } private val titleTextView by lazy { requireViewById<TextView>(R.id.stack_education_title) } Loading Loading @@ -175,7 +171,7 @@ class StackEducationView( .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .alpha(1f) } setShouldShow(false) updateStackEducationSeen() return true } Loading @@ -196,13 +192,11 @@ class StackEducationView( .withEndAction { visibility = GONE } } private fun setShouldShow(shouldShow: Boolean) { private fun updateStackEducationSeen() { context .getSharedPreferences(context.packageName, Context.MODE_PRIVATE) .edit() .putBoolean(PREF_STACK_EDUCATION, !shouldShow) .putBoolean(PREF_STACK_EDUCATION, true) .apply() } } const val PREF_STACK_EDUCATION: String = "HasSeenBubblesOnboarding"
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubbleEducationControllerTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import androidx.test.filters.SmallTest import com.android.systemui.model.SysUiStateTest import com.android.wm.shell.bubbles.Bubble import com.android.wm.shell.bubbles.BubbleEducationController import com.android.wm.shell.bubbles.PREF_MANAGED_EDUCATION import com.android.wm.shell.bubbles.PREF_STACK_EDUCATION import com.android.wm.shell.bubbles.ManageEducationView.Companion.PREF_MANAGED_EDUCATION import com.android.wm.shell.bubbles.StackEducationView.Companion.PREF_STACK_EDUCATION import com.google.common.truth.Truth.assertThat import com.google.common.util.concurrent.MoreExecutors.directExecutor import org.junit.Assert.assertEquals Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -29,8 +29,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.google.common.truth.Truth.assertThat; import static kotlinx.coroutines.flow.FlowKt.emptyFlow; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; Loading @@ -50,6 +48,8 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static kotlinx.coroutines.flow.FlowKt.emptyFlow; import android.app.ActivityManager; import android.app.IActivityManager; import android.app.INotificationManager; Loading Loading @@ -186,7 +186,7 @@ import com.android.wm.shell.bubbles.BubbleStackView; import com.android.wm.shell.bubbles.BubbleViewInfoTask; import com.android.wm.shell.bubbles.BubbleViewProvider; import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.bubbles.StackEducationViewKt; import com.android.wm.shell.bubbles.StackEducationView; import com.android.wm.shell.bubbles.properties.BubbleProperties; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.FloatingContentCoordinator; Loading Loading @@ -1930,7 +1930,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testShowStackEdu_isNotConversationBubble() { // Setup setPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION, false); setPrefBoolean(StackEducationView.PREF_STACK_EDUCATION, false); BubbleEntry bubbleEntry = createBubbleEntry(false /* isConversation */); mBubbleController.updateBubble(bubbleEntry); assertTrue(mBubbleController.hasBubbles()); Loading @@ -1948,7 +1948,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testShowStackEdu_isConversationBubble() { // Setup setPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION, false); setPrefBoolean(StackEducationView.PREF_STACK_EDUCATION, false); BubbleEntry bubbleEntry = createBubbleEntry(true /* isConversation */); mBubbleController.updateBubble(bubbleEntry); assertTrue(mBubbleController.hasBubbles()); Loading @@ -1966,7 +1966,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testShowStackEdu_isSeenConversationBubble() { // Setup setPrefBoolean(StackEducationViewKt.PREF_STACK_EDUCATION, true); setPrefBoolean(StackEducationView.PREF_STACK_EDUCATION, true); BubbleEntry bubbleEntry = createBubbleEntry(true /* isConversation */); mBubbleController.updateBubble(bubbleEntry); assertTrue(mBubbleController.hasBubbles()); Loading