Loading packages/SystemUI/res/layout/recents_on_tv.xml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -18,7 +18,6 @@ android:id="@+id/recents_view" android:id="@+id/recents_view" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="match_parent" android:background="@drawable/recents_tv_background_gradient" android:clipChildren="false" android:clipChildren="false" android:clipToPadding="false" android:clipToPadding="false" android:layoutDirection="rtl"> android:layoutDirection="rtl"> Loading packages/SystemUI/res/layout/recents_tv_task_card_view.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -59,7 +59,7 @@ <ImageView <ImageView android:id="@+id/card_view_thumbnail" android:id="@+id/card_view_thumbnail" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="@dimen/recents_tv_card_height" android:layout_height="@dimen/recents_tv_screenshot_height" android:scaleType="centerCrop" android:scaleType="centerCrop" android:gravity="center" android:gravity="center" android:layout_alignParentTop="true" android:layout_alignParentTop="true" Loading packages/SystemUI/res/values/dimens_tv.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ <resources> <resources> <!-- Dimens for recents card in the recents view on tv --> <!-- Dimens for recents card in the recents view on tv --> <dimen name="recents_tv_card_width">268dip</dimen> <dimen name="recents_tv_card_width">268dip</dimen> <dimen name="recents_tv_card_height">151dip</dimen> <dimen name="recents_tv_screenshot_height">151dip</dimen> <dimen name="recents_tv_card_extra_badge_size">20dip</dimen> <dimen name="recents_tv_card_extra_badge_size">20dip</dimen> <dimen name="recents_tv_banner_width">114dip</dimen> <dimen name="recents_tv_banner_width">114dip</dimen> <dimen name="recents_tv_banner_height">64dip</dimen> <dimen name="recents_tv_banner_height">64dip</dimen> Loading packages/SystemUI/res/values/values_tv.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -15,4 +15,5 @@ limitations under the License. --> --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <item format="float" type="integer" name="unselected_scale">1.0</item> <item format="float" type="integer" name="unselected_scale">1.0</item> <item format="float" type="integer" name="selected_scale">1.1</item> </resources> </resources> packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +109 −0 Original line number Original line Diff line number Diff line Loading @@ -66,6 +66,7 @@ import com.android.systemui.recents.model.RecentsTaskLoader; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.TaskGrouping; import com.android.systemui.recents.model.TaskGrouping; import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.tv.views.TaskCardView; import com.android.systemui.recents.views.TaskStackLayoutAlgorithm; import com.android.systemui.recents.views.TaskStackLayoutAlgorithm; import com.android.systemui.recents.views.TaskStackView; import com.android.systemui.recents.views.TaskStackView; import com.android.systemui.recents.views.TaskStackViewScroller; import com.android.systemui.recents.views.TaskStackViewScroller; Loading Loading @@ -166,6 +167,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener boolean mCanReuseTaskStackViews = true; boolean mCanReuseTaskStackViews = true; boolean mDraggingInRecents; boolean mDraggingInRecents; boolean mLaunchedWhileDocking; boolean mLaunchedWhileDocking; private boolean mIsRunningOnTv; // Task launching // Task launching Rect mSearchBarBounds = new Rect(); Rect mSearchBarBounds = new Rect(); Loading Loading @@ -230,8 +232,10 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener UiModeManager uiModeManager = (UiModeManager) mContext.getSystemService(Context.UI_MODE_SERVICE); UiModeManager uiModeManager = (UiModeManager) mContext.getSystemService(Context.UI_MODE_SERVICE); if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { mRecentsIntentActivityName = RECENTS_TV_ACTIVITY; mRecentsIntentActivityName = RECENTS_TV_ACTIVITY; mIsRunningOnTv = true; } else { } else { mRecentsIntentActivityName = RECENTS_ACTIVITY; mRecentsIntentActivityName = RECENTS_ACTIVITY; mIsRunningOnTv = false; } } } } Loading Loading @@ -793,6 +797,22 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener } } } } /** * Creates the activity options for an app->recents transition on TV. */ private ActivityOptions getThumbnailTransitionActivityOptionsForTV( ActivityManager.RunningTaskInfo topTask) { Bitmap thumbnail = mThumbnailTransitionBitmapCache; Rect rect = TaskCardView.getStartingCardThumbnailRect(mContext); if (thumbnail != null) { return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, null, (int) rect.left, (int) rect.top, (int) rect.width(), (int) rect.height(), mHandler, null); } // If both the screenshot and thumbnail fails, then just fall back to the default transition return getUnknownTransitionActivityOptions(); } private Bitmap getThumbnailBitmap(ActivityManager.RunningTaskInfo topTask, Task toTask, private Bitmap getThumbnailBitmap(ActivityManager.RunningTaskInfo topTask, Task toTask, TaskViewTransform toTransform) { TaskViewTransform toTransform) { Bitmap thumbnail; Bitmap thumbnail; Loading Loading @@ -872,6 +892,11 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener boolean isTopTaskHome, boolean animate) { boolean isTopTaskHome, boolean animate) { RecentsTaskLoader loader = Recents.getTaskLoader(); RecentsTaskLoader loader = Recents.getTaskLoader(); // If we are on TV, divert to a different helper method if (mIsRunningOnTv) { setUpAndStartTvRecents(topTask, isTopTaskHome, animate); return; } // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we // should always preload the tasks now. If we are dragging in recents, reload them as // should always preload the tasks now. If we are dragging in recents, reload them as // the stacks might have changed. // the stacks might have changed. Loading Loading @@ -946,6 +971,90 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener mLastToggleTime = SystemClock.elapsedRealtime(); mLastToggleTime = SystemClock.elapsedRealtime(); } } /** * Used to set up the animations of Tv Recents, then start the Recents Activity. * TODO: Add the Transitions for Home -> Recents TV * TODO: Shift Transition code to separate class under /tv directory and access * from here */ private void setUpAndStartTvRecents(ActivityManager.RunningTaskInfo topTask, boolean isTopTaskHome, boolean animate) { RecentsTaskLoader loader = Recents.getTaskLoader(); // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we // should always preload the tasks now. If we are dragging in recents, reload them as // the stacks might have changed. if (mLaunchedWhileDocking || mTriggeredFromAltTab || sInstanceLoadPlan == null) { // Create a new load plan if preloadRecents() was never triggered sInstanceLoadPlan = loader.createLoadPlan(mContext); } if (mLaunchedWhileDocking || mTriggeredFromAltTab || !sInstanceLoadPlan.hasTasks()) { loader.preloadTasks(sInstanceLoadPlan, topTask.id, isTopTaskHome); } TaskStack stack = sInstanceLoadPlan.getTaskStack(); // Update the header bar if necessary updateHeaderBarLayout(false /* tryAndBindSearchWidget */, stack); // Prepare the dummy stack for the transition TaskStackLayoutAlgorithm.VisibilityReport stackVr = mDummyStackView.computeStackVisibilityReport(); if (!animate) { ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, -1, -1); startRecentsActivity(topTask, opts, false /* fromHome */, false /* fromSearchHome */, false /* fromThumbnail*/, stackVr); return; } boolean hasRecentTasks = stack.getTaskCount() > 0; boolean useThumbnailTransition = (topTask != null) && !isTopTaskHome && hasRecentTasks; if (useThumbnailTransition) { // Try starting with a thumbnail transition ActivityOptions opts = getThumbnailTransitionActivityOptionsForTV(topTask); if (opts != null) { startRecentsActivity(topTask, opts, false /* fromHome */, false /* fromSearchHome */, true /* fromThumbnail */, stackVr); } else { // Fall through below to the non-thumbnail transition useThumbnailTransition = false; } } if (!useThumbnailTransition) { // If there is no thumbnail transition, but is launching from home into recents, then // use a quick home transition and do the animation from home if (hasRecentTasks) { SystemServicesProxy ssp = Recents.getSystemServices(); String homeActivityPackage = ssp.getHomeActivityPackageName(); String searchWidgetPackage = null; if (RecentsDebugFlags.Static.EnableSearchBar) { searchWidgetPackage = Prefs.getString(mContext, Prefs.Key.OVERVIEW_SEARCH_APP_WIDGET_PACKAGE, null); } else { AppWidgetProviderInfo searchWidgetInfo = ssp.resolveSearchAppWidget(); if (searchWidgetInfo != null) { searchWidgetPackage = searchWidgetInfo.provider.getPackageName(); } } // Determine whether we are coming from a search owned home activity boolean fromSearchHome = (homeActivityPackage != null) && homeActivityPackage.equals(searchWidgetPackage); ActivityOptions opts = getHomeTransitionActivityOptions(fromSearchHome); startRecentsActivity(topTask, opts, true /* fromHome */, fromSearchHome, false /* fromThumbnail */, stackVr); } else { // Otherwise we do the normal fade from an unknown source ActivityOptions opts = getUnknownTransitionActivityOptions(); startRecentsActivity(topTask, opts, true /* fromHome */, false /* fromSearchHome */, false /* fromThumbnail */, stackVr); } } mLastToggleTime = SystemClock.elapsedRealtime(); } /** /** * Starts the recents activity. * Starts the recents activity. */ */ Loading Loading
packages/SystemUI/res/layout/recents_on_tv.xml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -18,7 +18,6 @@ android:id="@+id/recents_view" android:id="@+id/recents_view" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="match_parent" android:background="@drawable/recents_tv_background_gradient" android:clipChildren="false" android:clipChildren="false" android:clipToPadding="false" android:clipToPadding="false" android:layoutDirection="rtl"> android:layoutDirection="rtl"> Loading
packages/SystemUI/res/layout/recents_tv_task_card_view.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -59,7 +59,7 @@ <ImageView <ImageView android:id="@+id/card_view_thumbnail" android:id="@+id/card_view_thumbnail" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="@dimen/recents_tv_card_height" android:layout_height="@dimen/recents_tv_screenshot_height" android:scaleType="centerCrop" android:scaleType="centerCrop" android:gravity="center" android:gravity="center" android:layout_alignParentTop="true" android:layout_alignParentTop="true" Loading
packages/SystemUI/res/values/dimens_tv.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ <resources> <resources> <!-- Dimens for recents card in the recents view on tv --> <!-- Dimens for recents card in the recents view on tv --> <dimen name="recents_tv_card_width">268dip</dimen> <dimen name="recents_tv_card_width">268dip</dimen> <dimen name="recents_tv_card_height">151dip</dimen> <dimen name="recents_tv_screenshot_height">151dip</dimen> <dimen name="recents_tv_card_extra_badge_size">20dip</dimen> <dimen name="recents_tv_card_extra_badge_size">20dip</dimen> <dimen name="recents_tv_banner_width">114dip</dimen> <dimen name="recents_tv_banner_width">114dip</dimen> <dimen name="recents_tv_banner_height">64dip</dimen> <dimen name="recents_tv_banner_height">64dip</dimen> Loading
packages/SystemUI/res/values/values_tv.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -15,4 +15,5 @@ limitations under the License. --> --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <item format="float" type="integer" name="unselected_scale">1.0</item> <item format="float" type="integer" name="unselected_scale">1.0</item> <item format="float" type="integer" name="selected_scale">1.1</item> </resources> </resources>
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +109 −0 Original line number Original line Diff line number Diff line Loading @@ -66,6 +66,7 @@ import com.android.systemui.recents.model.RecentsTaskLoader; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.TaskGrouping; import com.android.systemui.recents.model.TaskGrouping; import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.tv.views.TaskCardView; import com.android.systemui.recents.views.TaskStackLayoutAlgorithm; import com.android.systemui.recents.views.TaskStackLayoutAlgorithm; import com.android.systemui.recents.views.TaskStackView; import com.android.systemui.recents.views.TaskStackView; import com.android.systemui.recents.views.TaskStackViewScroller; import com.android.systemui.recents.views.TaskStackViewScroller; Loading Loading @@ -166,6 +167,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener boolean mCanReuseTaskStackViews = true; boolean mCanReuseTaskStackViews = true; boolean mDraggingInRecents; boolean mDraggingInRecents; boolean mLaunchedWhileDocking; boolean mLaunchedWhileDocking; private boolean mIsRunningOnTv; // Task launching // Task launching Rect mSearchBarBounds = new Rect(); Rect mSearchBarBounds = new Rect(); Loading Loading @@ -230,8 +232,10 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener UiModeManager uiModeManager = (UiModeManager) mContext.getSystemService(Context.UI_MODE_SERVICE); UiModeManager uiModeManager = (UiModeManager) mContext.getSystemService(Context.UI_MODE_SERVICE); if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { mRecentsIntentActivityName = RECENTS_TV_ACTIVITY; mRecentsIntentActivityName = RECENTS_TV_ACTIVITY; mIsRunningOnTv = true; } else { } else { mRecentsIntentActivityName = RECENTS_ACTIVITY; mRecentsIntentActivityName = RECENTS_ACTIVITY; mIsRunningOnTv = false; } } } } Loading Loading @@ -793,6 +797,22 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener } } } } /** * Creates the activity options for an app->recents transition on TV. */ private ActivityOptions getThumbnailTransitionActivityOptionsForTV( ActivityManager.RunningTaskInfo topTask) { Bitmap thumbnail = mThumbnailTransitionBitmapCache; Rect rect = TaskCardView.getStartingCardThumbnailRect(mContext); if (thumbnail != null) { return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, null, (int) rect.left, (int) rect.top, (int) rect.width(), (int) rect.height(), mHandler, null); } // If both the screenshot and thumbnail fails, then just fall back to the default transition return getUnknownTransitionActivityOptions(); } private Bitmap getThumbnailBitmap(ActivityManager.RunningTaskInfo topTask, Task toTask, private Bitmap getThumbnailBitmap(ActivityManager.RunningTaskInfo topTask, Task toTask, TaskViewTransform toTransform) { TaskViewTransform toTransform) { Bitmap thumbnail; Bitmap thumbnail; Loading Loading @@ -872,6 +892,11 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener boolean isTopTaskHome, boolean animate) { boolean isTopTaskHome, boolean animate) { RecentsTaskLoader loader = Recents.getTaskLoader(); RecentsTaskLoader loader = Recents.getTaskLoader(); // If we are on TV, divert to a different helper method if (mIsRunningOnTv) { setUpAndStartTvRecents(topTask, isTopTaskHome, animate); return; } // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we // should always preload the tasks now. If we are dragging in recents, reload them as // should always preload the tasks now. If we are dragging in recents, reload them as // the stacks might have changed. // the stacks might have changed. Loading Loading @@ -946,6 +971,90 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener mLastToggleTime = SystemClock.elapsedRealtime(); mLastToggleTime = SystemClock.elapsedRealtime(); } } /** * Used to set up the animations of Tv Recents, then start the Recents Activity. * TODO: Add the Transitions for Home -> Recents TV * TODO: Shift Transition code to separate class under /tv directory and access * from here */ private void setUpAndStartTvRecents(ActivityManager.RunningTaskInfo topTask, boolean isTopTaskHome, boolean animate) { RecentsTaskLoader loader = Recents.getTaskLoader(); // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we // should always preload the tasks now. If we are dragging in recents, reload them as // the stacks might have changed. if (mLaunchedWhileDocking || mTriggeredFromAltTab || sInstanceLoadPlan == null) { // Create a new load plan if preloadRecents() was never triggered sInstanceLoadPlan = loader.createLoadPlan(mContext); } if (mLaunchedWhileDocking || mTriggeredFromAltTab || !sInstanceLoadPlan.hasTasks()) { loader.preloadTasks(sInstanceLoadPlan, topTask.id, isTopTaskHome); } TaskStack stack = sInstanceLoadPlan.getTaskStack(); // Update the header bar if necessary updateHeaderBarLayout(false /* tryAndBindSearchWidget */, stack); // Prepare the dummy stack for the transition TaskStackLayoutAlgorithm.VisibilityReport stackVr = mDummyStackView.computeStackVisibilityReport(); if (!animate) { ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, -1, -1); startRecentsActivity(topTask, opts, false /* fromHome */, false /* fromSearchHome */, false /* fromThumbnail*/, stackVr); return; } boolean hasRecentTasks = stack.getTaskCount() > 0; boolean useThumbnailTransition = (topTask != null) && !isTopTaskHome && hasRecentTasks; if (useThumbnailTransition) { // Try starting with a thumbnail transition ActivityOptions opts = getThumbnailTransitionActivityOptionsForTV(topTask); if (opts != null) { startRecentsActivity(topTask, opts, false /* fromHome */, false /* fromSearchHome */, true /* fromThumbnail */, stackVr); } else { // Fall through below to the non-thumbnail transition useThumbnailTransition = false; } } if (!useThumbnailTransition) { // If there is no thumbnail transition, but is launching from home into recents, then // use a quick home transition and do the animation from home if (hasRecentTasks) { SystemServicesProxy ssp = Recents.getSystemServices(); String homeActivityPackage = ssp.getHomeActivityPackageName(); String searchWidgetPackage = null; if (RecentsDebugFlags.Static.EnableSearchBar) { searchWidgetPackage = Prefs.getString(mContext, Prefs.Key.OVERVIEW_SEARCH_APP_WIDGET_PACKAGE, null); } else { AppWidgetProviderInfo searchWidgetInfo = ssp.resolveSearchAppWidget(); if (searchWidgetInfo != null) { searchWidgetPackage = searchWidgetInfo.provider.getPackageName(); } } // Determine whether we are coming from a search owned home activity boolean fromSearchHome = (homeActivityPackage != null) && homeActivityPackage.equals(searchWidgetPackage); ActivityOptions opts = getHomeTransitionActivityOptions(fromSearchHome); startRecentsActivity(topTask, opts, true /* fromHome */, fromSearchHome, false /* fromThumbnail */, stackVr); } else { // Otherwise we do the normal fade from an unknown source ActivityOptions opts = getUnknownTransitionActivityOptions(); startRecentsActivity(topTask, opts, true /* fromHome */, false /* fromSearchHome */, false /* fromThumbnail */, stackVr); } } mLastToggleTime = SystemClock.elapsedRealtime(); } /** /** * Starts the recents activity. * Starts the recents activity. */ */ Loading