diff --git a/Android.mk b/Android.mk index 3a9a2c3ebb..a099ada991 100644 --- a/Android.mk +++ b/Android.mk @@ -78,9 +78,8 @@ include $(CLEAR_VARS) LOCAL_USE_AAPT2 := true LOCAL_MODULE_TAGS := optional -LOCAL_STATIC_ANDROID_LIBRARIES := \ - Launcher3CommonDepsLib \ - SecondaryDisplayLauncherLib +LOCAL_STATIC_ANDROID_LIBRARIES := Launcher3CommonDepsLib + LOCAL_SRC_FILES := \ $(call all-java-files-under, src) \ $(call all-java-files-under, src_shortcuts_overrides) \ @@ -154,9 +153,7 @@ else endif LOCAL_MODULE := Launcher3QuickStepLib LOCAL_PRIVILEGED_MODULE := true -LOCAL_STATIC_ANDROID_LIBRARIES := \ - Launcher3CommonDepsLib \ - SecondaryDisplayLauncherLib +LOCAL_STATIC_ANDROID_LIBRARIES := Launcher3CommonDepsLib LOCAL_SRC_FILES := \ $(call all-java-files-under, src) \ diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index 555cc7302b..26698eb145 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -184,5 +184,20 @@ android:writePermission="android.permission.WRITE_SECURE_SETTINGS" android:exported="true" android:enabled="false" /> + + + + + + + + + diff --git a/iconloaderlib/src/com/android/launcher3/icons/BitmapRenderer.java b/iconloaderlib/src/com/android/launcher3/icons/BitmapRenderer.java index a66b929efb..5751ed95cb 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/BitmapRenderer.java +++ b/iconloaderlib/src/com/android/launcher3/icons/BitmapRenderer.java @@ -17,9 +17,13 @@ package com.android.launcher3.icons; import android.annotation.TargetApi; import android.graphics.Bitmap; +import android.graphics.Bitmap.Config; import android.graphics.Canvas; import android.graphics.Picture; +import android.graphics.Rect; +import android.graphics.RectF; import android.os.Build; +import android.os.Build.VERSION_CODES; /** * Interface representing a bitmap draw operation. @@ -29,6 +33,7 @@ public interface BitmapRenderer { boolean USE_HARDWARE_BITMAP = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P; static Bitmap createSoftwareBitmap(int width, int height, BitmapRenderer renderer) { + GraphicsUtils.noteNewBitmapCreated(); Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); renderer.draw(new Canvas(result)); return result; @@ -40,11 +45,26 @@ public interface BitmapRenderer { return createSoftwareBitmap(width, height, renderer); } + GraphicsUtils.noteNewBitmapCreated(); Picture picture = new Picture(); renderer.draw(picture.beginRecording(width, height)); picture.endRecording(); return Bitmap.createBitmap(picture); } + /** + * Returns a bitmap from subset of the source bitmap. The new bitmap may be the + * same object as source, or a copy may have been made. + */ + static Bitmap createBitmap(Bitmap source, int x, int y, int width, int height) { + if (Build.VERSION.SDK_INT >= VERSION_CODES.O && source.getConfig() == Config.HARDWARE) { + return createHardwareBitmap(width, height, c -> c.drawBitmap(source, + new Rect(x, y, x + width, y + height), new RectF(0, 0, width, height), null)); + } else { + GraphicsUtils.noteNewBitmapCreated(); + return Bitmap.createBitmap(source, x, y, width, height); + } + } + void draw(Canvas out); } diff --git a/iconloaderlib/src/com/android/launcher3/icons/GraphicsUtils.java b/iconloaderlib/src/com/android/launcher3/icons/GraphicsUtils.java index 3e818a5568..22f1f2357e 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/GraphicsUtils.java +++ b/iconloaderlib/src/com/android/launcher3/icons/GraphicsUtils.java @@ -21,15 +21,17 @@ import android.graphics.Region; import android.graphics.RegionIterator; import android.util.Log; +import androidx.annotation.ColorInt; + import java.io.ByteArrayOutputStream; import java.io.IOException; -import androidx.annotation.ColorInt; - public class GraphicsUtils { private static final String TAG = "GraphicsUtils"; + public static Runnable sOnNewBitmapRunnable = () -> { }; + /** * Set the alpha component of {@code color} to be {@code alpha}. Unlike the support lib version, * it bounds the alpha in valid range instead of throwing an exception to allow for safer @@ -73,4 +75,11 @@ public class GraphicsUtils { } return area; } + + /** + * Utility method to track new bitmap creation + */ + public static void noteNewBitmapCreated() { + sOnNewBitmapRunnable.run(); + } } diff --git a/iconloaderlib/src/com/android/launcher3/icons/ShadowGenerator.java b/iconloaderlib/src/com/android/launcher3/icons/ShadowGenerator.java index 5df8043904..770272728d 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/ShadowGenerator.java +++ b/iconloaderlib/src/com/android/launcher3/icons/ShadowGenerator.java @@ -19,7 +19,6 @@ package com.android.launcher3.icons; import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound; import android.graphics.Bitmap; -import android.graphics.Bitmap.Config; import android.graphics.BlurMaskFilter; import android.graphics.BlurMaskFilter.Blur; import android.graphics.Canvas; @@ -135,9 +134,7 @@ public class ShadowGenerator { bounds.offsetTo(center - width / 2f, center - height / 2f); int size = center * 2; - Bitmap result = Bitmap.createBitmap(size, size, Config.ARGB_8888); - drawShadow(new Canvas(result)); - return result; + return BitmapRenderer.createHardwareBitmap(size, size, this::drawShadow); } public void drawShadow(Canvas c) { diff --git a/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml b/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml index f0e70a8e8f..fa3a0f856a 100644 --- a/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml +++ b/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml @@ -15,5 +15,5 @@ --> - + diff --git a/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml b/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml index ee38e3b9f4..d94c665e86 100644 --- a/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml +++ b/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml @@ -24,21 +24,22 @@ + android:backgroundTint="@color/bottom_panel_background" + android:background="@drawable/bottom_sheet_top_border" /> + android:paddingRight="@dimen/bottom_sheet_edu_padding">