Merge "Apply "Dominant Palette A - 800" color to the background of One-Handed mode" into sc-dev
This commit is contained in:
@@ -49,12 +49,6 @@
|
|||||||
when the PIP menu is shown in center. -->
|
when the PIP menu is shown in center. -->
|
||||||
<string translatable="false" name="pip_menu_bounds">"596 280 1324 690"</string>
|
<string translatable="false" name="pip_menu_bounds">"596 280 1324 690"</string>
|
||||||
|
|
||||||
<!-- one handed background panel default color RGB -->
|
|
||||||
<item name="config_one_handed_background_rgb" format="float" type="dimen">0.5</item>
|
|
||||||
|
|
||||||
<!-- one handed background panel default alpha -->
|
|
||||||
<item name="config_one_handed_background_alpha" format="float" type="dimen">0.5</item>
|
|
||||||
|
|
||||||
<!-- maximum animation duration for the icon when entering the starting window -->
|
<!-- maximum animation duration for the icon when entering the starting window -->
|
||||||
<integer name="max_starting_window_intro_icon_anim_duration">1000</integer>
|
<integer name="max_starting_window_intro_icon_anim_duration">1000</integer>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.wm.shell.onehanded;
|
package com.android.wm.shell.onehanded;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.graphics.Color;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -30,6 +30,7 @@ import android.window.DisplayAreaOrganizer;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.wm.shell.R;
|
import com.android.wm.shell.R;
|
||||||
@@ -50,8 +51,7 @@ public class OneHandedBackgroundPanelOrganizer extends DisplayAreaOrganizer
|
|||||||
|
|
||||||
private final Object mLock = new Object();
|
private final Object mLock = new Object();
|
||||||
private final SurfaceSession mSurfaceSession = new SurfaceSession();
|
private final SurfaceSession mSurfaceSession = new SurfaceSession();
|
||||||
private final float[] mColor;
|
private final float[] mDefaultColor;
|
||||||
private final float mAlpha;
|
|
||||||
private final Executor mMainExecutor;
|
private final Executor mMainExecutor;
|
||||||
private final OneHandedSurfaceTransactionHelper.SurfaceControlTransactionFactory
|
private final OneHandedSurfaceTransactionHelper.SurfaceControlTransactionFactory
|
||||||
mSurfaceControlTransactionFactory;
|
mSurfaceControlTransactionFactory;
|
||||||
@@ -88,16 +88,15 @@ public class OneHandedBackgroundPanelOrganizer extends DisplayAreaOrganizer
|
|||||||
public OneHandedBackgroundPanelOrganizer(Context context, DisplayLayout displayLayout,
|
public OneHandedBackgroundPanelOrganizer(Context context, DisplayLayout displayLayout,
|
||||||
Executor executor) {
|
Executor executor) {
|
||||||
super(executor);
|
super(executor);
|
||||||
final Resources res = context.getResources();
|
|
||||||
final float defaultRGB = res.getFloat(R.dimen.config_one_handed_background_rgb);
|
|
||||||
mColor = new float[]{defaultRGB, defaultRGB, defaultRGB};
|
|
||||||
mAlpha = res.getFloat(R.dimen.config_one_handed_background_alpha);
|
|
||||||
// Ensure the mBkgBounds is portrait, due to OHM only support on portrait
|
// Ensure the mBkgBounds is portrait, due to OHM only support on portrait
|
||||||
if (displayLayout.height() > displayLayout.width()) {
|
if (displayLayout.height() > displayLayout.width()) {
|
||||||
mBkgBounds = new Rect(0, 0, displayLayout.width(), displayLayout.height());
|
mBkgBounds = new Rect(0, 0, displayLayout.width(), displayLayout.height());
|
||||||
} else {
|
} else {
|
||||||
mBkgBounds = new Rect(0, 0, displayLayout.height(), displayLayout.width());
|
mBkgBounds = new Rect(0, 0, displayLayout.height(), displayLayout.width());
|
||||||
}
|
}
|
||||||
|
final int defaultColor = ContextCompat.getColor(context, R.color.GM2_grey_800);
|
||||||
|
mDefaultColor = new float[]{Color.red(defaultColor) / 255.0f,
|
||||||
|
Color.green(defaultColor) / 255.0f, Color.blue(defaultColor) / 255.0f};
|
||||||
mMainExecutor = executor;
|
mMainExecutor = executor;
|
||||||
mSurfaceControlTransactionFactory = SurfaceControl.Transaction::new;
|
mSurfaceControlTransactionFactory = SurfaceControl.Transaction::new;
|
||||||
}
|
}
|
||||||
@@ -153,8 +152,8 @@ public class OneHandedBackgroundPanelOrganizer extends DisplayAreaOrganizer
|
|||||||
.setParent(mParentLeash)
|
.setParent(mParentLeash)
|
||||||
.setBufferSize(mBkgBounds.width(), mBkgBounds.height())
|
.setBufferSize(mBkgBounds.width(), mBkgBounds.height())
|
||||||
.setColorLayer()
|
.setColorLayer()
|
||||||
.setFormat(PixelFormat.RGBA_8888)
|
.setFormat(PixelFormat.RGB_888)
|
||||||
.setOpaque(false)
|
.setOpaque(true)
|
||||||
.setName("one-handed-background-panel")
|
.setName("one-handed-background-panel")
|
||||||
.setCallsite("OneHandedBackgroundPanelOrganizer")
|
.setCallsite("OneHandedBackgroundPanelOrganizer")
|
||||||
.build();
|
.build();
|
||||||
@@ -178,8 +177,7 @@ public class OneHandedBackgroundPanelOrganizer extends DisplayAreaOrganizer
|
|||||||
SurfaceControl.Transaction transaction =
|
SurfaceControl.Transaction transaction =
|
||||||
mSurfaceControlTransactionFactory.getTransaction();
|
mSurfaceControlTransactionFactory.getTransaction();
|
||||||
transaction.setLayer(mBackgroundSurface, -1 /* at bottom-most layer */)
|
transaction.setLayer(mBackgroundSurface, -1 /* at bottom-most layer */)
|
||||||
.setColor(mBackgroundSurface, mColor)
|
.setColor(mBackgroundSurface, mDefaultColor)
|
||||||
.setAlpha(mBackgroundSurface, mAlpha)
|
|
||||||
.show(mBackgroundSurface)
|
.show(mBackgroundSurface)
|
||||||
.apply();
|
.apply();
|
||||||
transaction.close();
|
transaction.close();
|
||||||
@@ -210,5 +208,7 @@ public class OneHandedBackgroundPanelOrganizer extends DisplayAreaOrganizer
|
|||||||
pw.println(mIsShowing);
|
pw.println(mIsShowing);
|
||||||
pw.print(innerPrefix + "mBkgBounds=");
|
pw.print(innerPrefix + "mBkgBounds=");
|
||||||
pw.println(mBkgBounds);
|
pw.println(mBkgBounds);
|
||||||
|
pw.print(innerPrefix + "mDefaultColor=");
|
||||||
|
pw.println(mDefaultColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user