Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +34 −9 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView boolean mVisible; boolean mTaskLaunched; // Broadcast receiver to handle messages from our RecentsService BroadcastReceiver mServiceBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading @@ -63,6 +64,14 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView } }; // Broadcast receiver to handle messages from the system BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { finish(); } }; /** Updates the set of recent tasks */ void updateRecentsTasks() { RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); Loading Loading @@ -111,12 +120,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView RecentsTaskLoader.initialize(this); RecentsConfiguration.reinitialize(this); // Set the background dim WindowManager.LayoutParams wlp = getWindow().getAttributes(); wlp.dimAmount = Constants.Values.Window.BackgroundDim; getWindow().setAttributes(wlp); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); // Create the view hierarchy mRecentsView = new RecentsView(this); mRecentsView.setCallbacks(this); Loading Loading @@ -170,22 +173,44 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onResume]", "", Console.AnsiRed); super.onResume(); } @Override public void onAttachedToWindow() { Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onAttachedToWindow]", "", Console.AnsiRed); super.onAttachedToWindow(); // Register the broadcast receiver to handle messages from our service IntentFilter filter = new IntentFilter(); filter.addAction(RecentsService.ACTION_TOGGLE_RECENTS_ACTIVITY); filter.addAction(RecentsService.ACTION_FINISH_RECENTS_ACTIVITY); registerReceiver(mServiceBroadcastReceiver, filter); // Register the broadcast receiver to handle messages when the screen is turned off filter = new IntentFilter(); filter.addAction(Intent.ACTION_SCREEN_OFF); registerReceiver(mScreenOffReceiver, filter); } @Override protected void onPause() { Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onPause]", "", public void onDetachedFromWindow() { Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onDetachedFromWindow]", "", Console.AnsiRed); super.onPause(); super.onDetachedFromWindow(); // Unregister any broadcast receivers we have registered unregisterReceiver(mServiceBroadcastReceiver); unregisterReceiver(mScreenOffReceiver); } @Override protected void onPause() { Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onPause]", "", Console.AnsiRed); super.onPause(); } @Override Loading packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +7 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.recents; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Rect; import android.util.DisplayMetrics; Loading Loading @@ -62,6 +63,12 @@ public class RecentsConfiguration { DisplayMetrics dm = res.getDisplayMetrics(); mDisplayMetrics = dm; boolean isLandscape = res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; Console.log(Constants.DebugFlags.UI.MeasureAndLayout, "[RecentsConfiguration|orientation]", isLandscape ? "Landscape" : "Portrait", Console.AnsiGreen); displayRect.set(0, 0, dm.widthPixels, dm.heightPixels); animationPxMovementPerSecond = res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second); Loading packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java +4 −7 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.Context; import android.content.pm.ActivityInfo; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Handler; Loading Loading @@ -213,6 +212,7 @@ class TaskResourceLoader implements Runnable { Console.log(Constants.DebugFlags.App.TaskDataLoader, " [TaskResourceLoader|loadThumbnail]", thumbnail); thumbnail.setHasAlpha(false); loadThumbnail = thumbnail; mThumbnailCache.put(t.key, thumbnail); } else { Loading Loading @@ -331,13 +331,9 @@ public class RecentsTaskLoader { // Create the default assets Bitmap icon = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); icon.eraseColor(0x00000000); mDefaultThumbnail = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(); c.setBitmap(icon); c.drawColor(0x00000000); c.setBitmap(mDefaultThumbnail); c.drawColor(0x00000000); c.setBitmap(null); mDefaultThumbnail.eraseColor(0x00000000); mDefaultApplicationIcon = new BitmapDrawable(context.getResources(), icon); Console.log(Constants.DebugFlags.App.TaskDataLoader, "[RecentsTaskLoader|defaultBitmaps]", Loading Loading @@ -454,6 +450,7 @@ public class RecentsTaskLoader { "[RecentsTaskLoader|loadingTaskThumbnail]"); task.thumbnail = ssp.getTaskThumbnail(task.key.id); if (task.thumbnail != null) { task.thumbnail.setHasAlpha(false); mThumbnailCache.put(task.key, task.thumbnail); } else { task.thumbnail = mDefaultThumbnail; Loading packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java +2 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; Loading Loading @@ -52,9 +51,7 @@ public class SystemServicesProxy { if (Constants.DebugFlags.App.EnableSystemServicesProxy) { // Create a dummy icon mDummyIcon = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(mDummyIcon); c.drawColor(0xFF999999); c.setBitmap(null); mDummyIcon.eraseColor(0xFF999999); } } Loading Loading @@ -117,9 +114,7 @@ public class SystemServicesProxy { // If we are mocking, then just return a dummy thumbnail if (Constants.DebugFlags.App.EnableSystemServicesProxy) { Bitmap thumbnail = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(thumbnail); c.drawColor(0xff333333); c.setBitmap(null); thumbnail.eraseColor(0xff333333); return thumbnail; } Loading packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +6 −4 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = MeasureSpec.getSize(widthMeasureSpec); int widthMode = MeasureSpec.getMode(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); Loading @@ -118,6 +119,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV // We measure our stack views sans the status bar. It will handle the nav bar itself. RecentsConfiguration config = RecentsConfiguration.getInstance(); int childWidth = width - config.systemInsets.right; int childHeight = height - config.systemInsets.top; // Measure each child Loading @@ -125,7 +127,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() != GONE) { child.measure(widthMeasureSpec, child.measure(MeasureSpec.makeMeasureSpec(childWidth, widthMode), MeasureSpec.makeMeasureSpec(childHeight, heightMode)); } } Loading Loading @@ -255,11 +257,11 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK); try { UserHandle taskUser = new UserHandle(task.userId); if (opts != null) { getContext().startActivityAsUser(i, opts.toBundle(), new UserHandle(task.userId)); getContext().startActivityAsUser(i, opts.toBundle(), taskUser); } else { getContext().startActivityAsUser(i, new UserHandle(task.userId)); getContext().startActivityAsUser(i, taskUser); } } catch (ActivityNotFoundException anfe) { Console.logError(getContext(), "Could not start Activity"); Loading Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +34 −9 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView boolean mVisible; boolean mTaskLaunched; // Broadcast receiver to handle messages from our RecentsService BroadcastReceiver mServiceBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading @@ -63,6 +64,14 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView } }; // Broadcast receiver to handle messages from the system BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { finish(); } }; /** Updates the set of recent tasks */ void updateRecentsTasks() { RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); Loading Loading @@ -111,12 +120,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView RecentsTaskLoader.initialize(this); RecentsConfiguration.reinitialize(this); // Set the background dim WindowManager.LayoutParams wlp = getWindow().getAttributes(); wlp.dimAmount = Constants.Values.Window.BackgroundDim; getWindow().setAttributes(wlp); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); // Create the view hierarchy mRecentsView = new RecentsView(this); mRecentsView.setCallbacks(this); Loading Loading @@ -170,22 +173,44 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onResume]", "", Console.AnsiRed); super.onResume(); } @Override public void onAttachedToWindow() { Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onAttachedToWindow]", "", Console.AnsiRed); super.onAttachedToWindow(); // Register the broadcast receiver to handle messages from our service IntentFilter filter = new IntentFilter(); filter.addAction(RecentsService.ACTION_TOGGLE_RECENTS_ACTIVITY); filter.addAction(RecentsService.ACTION_FINISH_RECENTS_ACTIVITY); registerReceiver(mServiceBroadcastReceiver, filter); // Register the broadcast receiver to handle messages when the screen is turned off filter = new IntentFilter(); filter.addAction(Intent.ACTION_SCREEN_OFF); registerReceiver(mScreenOffReceiver, filter); } @Override protected void onPause() { Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onPause]", "", public void onDetachedFromWindow() { Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onDetachedFromWindow]", "", Console.AnsiRed); super.onPause(); super.onDetachedFromWindow(); // Unregister any broadcast receivers we have registered unregisterReceiver(mServiceBroadcastReceiver); unregisterReceiver(mScreenOffReceiver); } @Override protected void onPause() { Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onPause]", "", Console.AnsiRed); super.onPause(); } @Override Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +7 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.recents; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Rect; import android.util.DisplayMetrics; Loading Loading @@ -62,6 +63,12 @@ public class RecentsConfiguration { DisplayMetrics dm = res.getDisplayMetrics(); mDisplayMetrics = dm; boolean isLandscape = res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; Console.log(Constants.DebugFlags.UI.MeasureAndLayout, "[RecentsConfiguration|orientation]", isLandscape ? "Landscape" : "Portrait", Console.AnsiGreen); displayRect.set(0, 0, dm.widthPixels, dm.heightPixels); animationPxMovementPerSecond = res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second); Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java +4 −7 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.Context; import android.content.pm.ActivityInfo; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Handler; Loading Loading @@ -213,6 +212,7 @@ class TaskResourceLoader implements Runnable { Console.log(Constants.DebugFlags.App.TaskDataLoader, " [TaskResourceLoader|loadThumbnail]", thumbnail); thumbnail.setHasAlpha(false); loadThumbnail = thumbnail; mThumbnailCache.put(t.key, thumbnail); } else { Loading Loading @@ -331,13 +331,9 @@ public class RecentsTaskLoader { // Create the default assets Bitmap icon = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); icon.eraseColor(0x00000000); mDefaultThumbnail = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(); c.setBitmap(icon); c.drawColor(0x00000000); c.setBitmap(mDefaultThumbnail); c.drawColor(0x00000000); c.setBitmap(null); mDefaultThumbnail.eraseColor(0x00000000); mDefaultApplicationIcon = new BitmapDrawable(context.getResources(), icon); Console.log(Constants.DebugFlags.App.TaskDataLoader, "[RecentsTaskLoader|defaultBitmaps]", Loading Loading @@ -454,6 +450,7 @@ public class RecentsTaskLoader { "[RecentsTaskLoader|loadingTaskThumbnail]"); task.thumbnail = ssp.getTaskThumbnail(task.key.id); if (task.thumbnail != null) { task.thumbnail.setHasAlpha(false); mThumbnailCache.put(task.key, task.thumbnail); } else { task.thumbnail = mDefaultThumbnail; Loading
packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java +2 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; Loading Loading @@ -52,9 +51,7 @@ public class SystemServicesProxy { if (Constants.DebugFlags.App.EnableSystemServicesProxy) { // Create a dummy icon mDummyIcon = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(mDummyIcon); c.drawColor(0xFF999999); c.setBitmap(null); mDummyIcon.eraseColor(0xFF999999); } } Loading Loading @@ -117,9 +114,7 @@ public class SystemServicesProxy { // If we are mocking, then just return a dummy thumbnail if (Constants.DebugFlags.App.EnableSystemServicesProxy) { Bitmap thumbnail = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(thumbnail); c.drawColor(0xff333333); c.setBitmap(null); thumbnail.eraseColor(0xff333333); return thumbnail; } Loading
packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +6 −4 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = MeasureSpec.getSize(widthMeasureSpec); int widthMode = MeasureSpec.getMode(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); Loading @@ -118,6 +119,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV // We measure our stack views sans the status bar. It will handle the nav bar itself. RecentsConfiguration config = RecentsConfiguration.getInstance(); int childWidth = width - config.systemInsets.right; int childHeight = height - config.systemInsets.top; // Measure each child Loading @@ -125,7 +127,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() != GONE) { child.measure(widthMeasureSpec, child.measure(MeasureSpec.makeMeasureSpec(childWidth, widthMode), MeasureSpec.makeMeasureSpec(childHeight, heightMode)); } } Loading Loading @@ -255,11 +257,11 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK); try { UserHandle taskUser = new UserHandle(task.userId); if (opts != null) { getContext().startActivityAsUser(i, opts.toBundle(), new UserHandle(task.userId)); getContext().startActivityAsUser(i, opts.toBundle(), taskUser); } else { getContext().startActivityAsUser(i, new UserHandle(task.userId)); getContext().startActivityAsUser(i, taskUser); } } catch (ActivityNotFoundException anfe) { Console.logError(getContext(), "Could not start Activity"); Loading