Loading packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java +17 −6 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import com.android.systemui.statusbar.phone.KeyguardBouncer; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.wm.shell.animation.FlingAnimationUtils; import java.util.Optional; import javax.inject.Inject; import javax.inject.Named; Loading Loading @@ -77,7 +78,7 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private float mCurrentExpansion; private final CentralSurfaces mCentralSurfaces; private final Optional<CentralSurfaces> mCentralSurfaces; private VelocityTracker mVelocityTracker; Loading Loading @@ -107,7 +108,9 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { // If the user scrolling favors a vertical direction, begin capturing // scrolls. mCapture = Math.abs(distanceY) > Math.abs(distanceX); mBouncerInitiallyShowing = mCentralSurfaces.isBouncerShowing(); mBouncerInitiallyShowing = mCentralSurfaces .map(CentralSurfaces::isBouncerShowing) .orElse(false); if (mCapture) { // Since the user is dragging the bouncer up, set scrimmed to false. Loading @@ -129,13 +132,17 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { return true; } if (!mCentralSurfaces.isPresent()) { return true; } // For consistency, we adopt the expansion definition found in the // PanelViewController. In this case, expansion refers to the view above the // bouncer. As that view's expansion shrinks, the bouncer appears. The bouncer // is fully hidden at full expansion (1) and fully visible when fully collapsed // (0). final float screenTravelPercentage = Math.abs(e1.getY() - e2.getY()) / mCentralSurfaces.getDisplayHeight(); / mCentralSurfaces.get().getDisplayHeight(); setPanelExpansion(mBouncerInitiallyShowing ? screenTravelPercentage : 1 - screenTravelPercentage); return true; Loading Loading @@ -171,7 +178,7 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { public BouncerSwipeTouchHandler( DisplayMetrics displayMetrics, StatusBarKeyguardViewManager statusBarKeyguardViewManager, CentralSurfaces centralSurfaces, Optional<CentralSurfaces> centralSurfaces, NotificationShadeWindowController notificationShadeWindowController, ValueAnimatorCreator valueAnimatorCreator, VelocityTrackerFactory velocityTrackerFactory, Loading @@ -195,7 +202,7 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { @Override public void getTouchInitiationRegion(Region region) { if (mCentralSurfaces.isBouncerShowing()) { if (mCentralSurfaces.map(CentralSurfaces::isBouncerShowing).orElse(false)) { region.op(new Rect(0, 0, mDisplayMetrics.widthPixels, Math.round( mDisplayMetrics.heightPixels * mBouncerZoneScreenPercentage)), Loading Loading @@ -306,8 +313,12 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { } protected void flingToExpansion(float velocity, float expansion) { if (!mCentralSurfaces.isPresent()) { return; } // The animation utils deal in pixel units, rather than expansion height. final float viewHeight = mCentralSurfaces.getDisplayHeight(); final float viewHeight = mCentralSurfaces.get().getDisplayHeight(); final float currentHeight = viewHeight * mCurrentExpansion; final float targetHeight = viewHeight * expansion; Loading packages/SystemUI/src/com/android/systemui/tv/TvSysUIComponent.java +13 −3 Original line number Diff line number Diff line Loading @@ -22,6 +22,12 @@ import com.android.systemui.dagger.SysUIComponent; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SystemUIBinder; import com.android.systemui.dagger.SystemUIModule; import com.android.systemui.statusbar.dagger.CentralSurfacesDependenciesModule; import com.android.systemui.statusbar.notification.dagger.NotificationsModule; import com.android.systemui.statusbar.notification.row.NotificationRowModule; import com.android.systemui.keyguard.dagger.KeyguardModule; import com.android.systemui.recents.RecentsModule; import dagger.Subcomponent; Loading @@ -30,13 +36,17 @@ import dagger.Subcomponent; */ @SysUISingleton @Subcomponent(modules = { CentralSurfacesDependenciesModule.class, DefaultComponentBinder.class, DependencyProvider.class, SystemUIBinder.class, KeyguardModule.class, NotificationRowModule.class, NotificationsModule.class, RecentsModule.class, SystemUIModule.class, TvSystemUIBinder.class, TVSystemUICoreStartableModule.class, TvSystemUIModule.class, TvSystemUIBinder.class}) TvSystemUIModule.class}) public interface TvSysUIComponent extends SysUIComponent { /** Loading packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import java.util.Optional; @SmallTest @RunWith(AndroidTestingRunner.class) public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { Loading Loading @@ -110,7 +112,7 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { mTouchHandler = new BouncerSwipeTouchHandler( mDisplayMetrics, mStatusBarKeyguardViewManager, mCentralSurfaces, Optional.of(mCentralSurfaces), mNotificationShadeWindowController, mValueAnimatorCreator, mVelocityTrackerFactory, Loading Loading
packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java +17 −6 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import com.android.systemui.statusbar.phone.KeyguardBouncer; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.wm.shell.animation.FlingAnimationUtils; import java.util.Optional; import javax.inject.Inject; import javax.inject.Named; Loading Loading @@ -77,7 +78,7 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private float mCurrentExpansion; private final CentralSurfaces mCentralSurfaces; private final Optional<CentralSurfaces> mCentralSurfaces; private VelocityTracker mVelocityTracker; Loading Loading @@ -107,7 +108,9 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { // If the user scrolling favors a vertical direction, begin capturing // scrolls. mCapture = Math.abs(distanceY) > Math.abs(distanceX); mBouncerInitiallyShowing = mCentralSurfaces.isBouncerShowing(); mBouncerInitiallyShowing = mCentralSurfaces .map(CentralSurfaces::isBouncerShowing) .orElse(false); if (mCapture) { // Since the user is dragging the bouncer up, set scrimmed to false. Loading @@ -129,13 +132,17 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { return true; } if (!mCentralSurfaces.isPresent()) { return true; } // For consistency, we adopt the expansion definition found in the // PanelViewController. In this case, expansion refers to the view above the // bouncer. As that view's expansion shrinks, the bouncer appears. The bouncer // is fully hidden at full expansion (1) and fully visible when fully collapsed // (0). final float screenTravelPercentage = Math.abs(e1.getY() - e2.getY()) / mCentralSurfaces.getDisplayHeight(); / mCentralSurfaces.get().getDisplayHeight(); setPanelExpansion(mBouncerInitiallyShowing ? screenTravelPercentage : 1 - screenTravelPercentage); return true; Loading Loading @@ -171,7 +178,7 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { public BouncerSwipeTouchHandler( DisplayMetrics displayMetrics, StatusBarKeyguardViewManager statusBarKeyguardViewManager, CentralSurfaces centralSurfaces, Optional<CentralSurfaces> centralSurfaces, NotificationShadeWindowController notificationShadeWindowController, ValueAnimatorCreator valueAnimatorCreator, VelocityTrackerFactory velocityTrackerFactory, Loading @@ -195,7 +202,7 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { @Override public void getTouchInitiationRegion(Region region) { if (mCentralSurfaces.isBouncerShowing()) { if (mCentralSurfaces.map(CentralSurfaces::isBouncerShowing).orElse(false)) { region.op(new Rect(0, 0, mDisplayMetrics.widthPixels, Math.round( mDisplayMetrics.heightPixels * mBouncerZoneScreenPercentage)), Loading Loading @@ -306,8 +313,12 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { } protected void flingToExpansion(float velocity, float expansion) { if (!mCentralSurfaces.isPresent()) { return; } // The animation utils deal in pixel units, rather than expansion height. final float viewHeight = mCentralSurfaces.getDisplayHeight(); final float viewHeight = mCentralSurfaces.get().getDisplayHeight(); final float currentHeight = viewHeight * mCurrentExpansion; final float targetHeight = viewHeight * expansion; Loading
packages/SystemUI/src/com/android/systemui/tv/TvSysUIComponent.java +13 −3 Original line number Diff line number Diff line Loading @@ -22,6 +22,12 @@ import com.android.systemui.dagger.SysUIComponent; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SystemUIBinder; import com.android.systemui.dagger.SystemUIModule; import com.android.systemui.statusbar.dagger.CentralSurfacesDependenciesModule; import com.android.systemui.statusbar.notification.dagger.NotificationsModule; import com.android.systemui.statusbar.notification.row.NotificationRowModule; import com.android.systemui.keyguard.dagger.KeyguardModule; import com.android.systemui.recents.RecentsModule; import dagger.Subcomponent; Loading @@ -30,13 +36,17 @@ import dagger.Subcomponent; */ @SysUISingleton @Subcomponent(modules = { CentralSurfacesDependenciesModule.class, DefaultComponentBinder.class, DependencyProvider.class, SystemUIBinder.class, KeyguardModule.class, NotificationRowModule.class, NotificationsModule.class, RecentsModule.class, SystemUIModule.class, TvSystemUIBinder.class, TVSystemUICoreStartableModule.class, TvSystemUIModule.class, TvSystemUIBinder.class}) TvSystemUIModule.class}) public interface TvSysUIComponent extends SysUIComponent { /** Loading
packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import java.util.Optional; @SmallTest @RunWith(AndroidTestingRunner.class) public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { Loading Loading @@ -110,7 +112,7 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { mTouchHandler = new BouncerSwipeTouchHandler( mDisplayMetrics, mStatusBarKeyguardViewManager, mCentralSurfaces, Optional.of(mCentralSurfaces), mNotificationShadeWindowController, mValueAnimatorCreator, mVelocityTrackerFactory, Loading