Merge branch 'heads/android-14.0.0_r18' into 14-dev

This commit is contained in:
MrSluffy
2023-12-14 15:26:43 +08:00
parent 32700b0100
commit cc8f9828ab
756 changed files with 23785 additions and 12235 deletions
+24 -11
View File
@@ -23,6 +23,7 @@ import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MA
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.Person;
import android.app.WallpaperManager;
import android.content.Context;
@@ -392,14 +393,12 @@ public final class Utilities {
public static void scaleRectAboutCenter(Rect r, float scale) {
if (scale != 1.0f) {
int cx = r.centerX();
int cy = r.centerY();
r.offset(-cx, -cy);
r.left = (int) (r.left * scale + 0.5f);
r.top = (int) (r.top * scale + 0.5f);
r.right = (int) (r.right * scale + 0.5f);
r.bottom = (int) (r.bottom * scale + 0.5f);
r.offset(cx, cy);
float cx = r.exactCenterX();
float cy = r.exactCenterY();
r.left = Math.round(cx + (r.left - cx) * scale);
r.top = Math.round(cy + (r.top - cy) * scale);
r.right = Math.round(cx + (r.right - cx) * scale);
r.bottom = Math.round(cy + (r.bottom - cy) * scale);
}
}
@@ -629,6 +628,18 @@ public final class Utilities {
handler.sendMessage(msg);
}
/**
* Utility method to allow background activity launch for the provided activity
* options
*/
public static ActivityOptions allowBGLaunch(ActivityOptions options) {
if (ATLEAST_U) {
options.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
}
return options;
}
/**
* Returns the full drawable for info without any flattening or pre-processing.
*
@@ -640,12 +651,13 @@ public final class Utilities {
*/
@TargetApi(Build.VERSION_CODES.TIRAMISU)
public static Drawable getFullDrawable(Context context, ItemInfo info, int width, int height,
boolean shouldThemeIcon, Object[] outObj) {
boolean shouldThemeIcon, Object[] outObj, boolean[] outIsIconThemed) {
Drawable icon = loadFullDrawableWithoutTheme(context, info, width, height, outObj);
if (ATLEAST_T && icon instanceof AdaptiveIconDrawable && shouldThemeIcon) {
AdaptiveIconDrawable aid = (AdaptiveIconDrawable) icon.mutate();
Drawable mono = aid.getMonochrome();
if (mono != null && Themes.isThemedIconEnabled(context)) {
outIsIconThemed[0] = true;
int[] colors = ThemedIconDrawable.getColors(context);
mono = mono.mutate();
mono.setTint(colors[1]);
@@ -719,7 +731,8 @@ public final class Utilities {
* profile badge
**/
@TargetApi(Build.VERSION_CODES.O)
public static Drawable getBadge(Context context, ItemInfo info, Object obj) {
public static Drawable getBadge(Context context, ItemInfo info, Object obj,
boolean isIconThemed) {
LauncherAppState appState = LauncherAppState.getInstance(context);
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
boolean iconBadged = (info instanceof ItemInfoWithIcon)
@@ -737,7 +750,7 @@ public final class Utilities {
} else {
return Process.myUserHandle().equals(info.user)
? new ColorDrawable(Color.TRANSPARENT)
: context.getDrawable(com.android.launcher3.icons.R.drawable.ic_instant_app_badge);
: context.getDrawable(R.drawable.ic_work_app_badge);
}
}