Loading core/java/android/app/Activity.java +8 −0 Original line number Diff line number Diff line Loading @@ -971,6 +971,7 @@ public class Activity extends ContextThemeWrapper private final ActivityManager.TaskDescription mTaskDescription = new ActivityManager.TaskDescription(); private int mLastTaskDescriptionHashCode; protected static final int[] FOCUSED_STATE_SET = {com.android.internal.R.attr.state_focused}; Loading Loading @@ -7612,6 +7613,13 @@ public class Activity extends ContextThemeWrapper mTaskDescription.setIcon(Icon.createWithBitmap(icon)); } } if (mLastTaskDescriptionHashCode == mTaskDescription.hashCode()) { // Early return if the hashCode is the same. // Note that we do not use #equals() to perform the check because there are several // places in this class that directly sets the value to mTaskDescription. return; } mLastTaskDescriptionHashCode = mTaskDescription.hashCode(); ActivityClient.getInstance().setTaskDescription(mToken, mTaskDescription); } Loading core/java/android/app/ActivityManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -2308,6 +2308,32 @@ public class ActivityManager { + " colorBackgrounFloating: " + mColorBackgroundFloating; } @Override public int hashCode() { int result = 17; if (mLabel != null) { result = result * 31 + mLabel.hashCode(); } if (mIcon != null) { result = result * 31 + mIcon.hashCode(); } if (mIconFilename != null) { result = result * 31 + mIconFilename.hashCode(); } result = result * 31 + mColorPrimary; result = result * 31 + mColorBackground; result = result * 31 + mColorBackgroundFloating; result = result * 31 + mStatusBarColor; result = result * 31 + mNavigationBarColor; result = result * 31 + mStatusBarAppearance; result = result * 31 + (mEnsureStatusBarContrastWhenTransparent ? 1 : 0); result = result * 31 + (mEnsureNavigationBarContrastWhenTransparent ? 1 : 0); result = result * 31 + mResizeMode; result = result * 31 + mMinWidth; result = result * 31 + mMinHeight; return result; } @Override public boolean equals(@Nullable Object obj) { if (!(obj instanceof TaskDescription)) { Loading services/tests/wmtests/src/com/android/server/wm/TaskStackChangedListenerTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.graphics.Color; import android.graphics.PixelFormat; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; Loading Loading @@ -167,7 +168,7 @@ public class TaskStackChangedListenerTest { @Presubmit public void testTaskDescriptionChanged() throws Exception { final Object[] params = new Object[2]; final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(2); registerTaskStackChangedListener(new TaskStackListener() { int mTaskId = -1; Loading Loading @@ -510,6 +511,8 @@ public class TaskStackChangedListenerTest { protected void onPostResume() { super.onPostResume(); setTaskDescription(new TaskDescription("Test Label")); // Sets the color of the status-bar should update the TaskDescription again. getWindow().setStatusBarColor(Color.RED); synchronized (sLock) { // Hold the lock to ensure no one is trying to access fields of this Activity in // this test. Loading Loading
core/java/android/app/Activity.java +8 −0 Original line number Diff line number Diff line Loading @@ -971,6 +971,7 @@ public class Activity extends ContextThemeWrapper private final ActivityManager.TaskDescription mTaskDescription = new ActivityManager.TaskDescription(); private int mLastTaskDescriptionHashCode; protected static final int[] FOCUSED_STATE_SET = {com.android.internal.R.attr.state_focused}; Loading Loading @@ -7612,6 +7613,13 @@ public class Activity extends ContextThemeWrapper mTaskDescription.setIcon(Icon.createWithBitmap(icon)); } } if (mLastTaskDescriptionHashCode == mTaskDescription.hashCode()) { // Early return if the hashCode is the same. // Note that we do not use #equals() to perform the check because there are several // places in this class that directly sets the value to mTaskDescription. return; } mLastTaskDescriptionHashCode = mTaskDescription.hashCode(); ActivityClient.getInstance().setTaskDescription(mToken, mTaskDescription); } Loading
core/java/android/app/ActivityManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -2308,6 +2308,32 @@ public class ActivityManager { + " colorBackgrounFloating: " + mColorBackgroundFloating; } @Override public int hashCode() { int result = 17; if (mLabel != null) { result = result * 31 + mLabel.hashCode(); } if (mIcon != null) { result = result * 31 + mIcon.hashCode(); } if (mIconFilename != null) { result = result * 31 + mIconFilename.hashCode(); } result = result * 31 + mColorPrimary; result = result * 31 + mColorBackground; result = result * 31 + mColorBackgroundFloating; result = result * 31 + mStatusBarColor; result = result * 31 + mNavigationBarColor; result = result * 31 + mStatusBarAppearance; result = result * 31 + (mEnsureStatusBarContrastWhenTransparent ? 1 : 0); result = result * 31 + (mEnsureNavigationBarContrastWhenTransparent ? 1 : 0); result = result * 31 + mResizeMode; result = result * 31 + mMinWidth; result = result * 31 + mMinHeight; return result; } @Override public boolean equals(@Nullable Object obj) { if (!(obj instanceof TaskDescription)) { Loading
services/tests/wmtests/src/com/android/server/wm/TaskStackChangedListenerTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.graphics.Color; import android.graphics.PixelFormat; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; Loading Loading @@ -167,7 +168,7 @@ public class TaskStackChangedListenerTest { @Presubmit public void testTaskDescriptionChanged() throws Exception { final Object[] params = new Object[2]; final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(2); registerTaskStackChangedListener(new TaskStackListener() { int mTaskId = -1; Loading Loading @@ -510,6 +511,8 @@ public class TaskStackChangedListenerTest { protected void onPostResume() { super.onPostResume(); setTaskDescription(new TaskDescription("Test Label")); // Sets the color of the status-bar should update the TaskDescription again. getWindow().setStatusBarColor(Color.RED); synchronized (sLock) { // Hold the lock to ensure no one is trying to access fields of this Activity in // this test. Loading