summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/model
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-10-31 13:33:03 -0700
committerSunny Goyal <sunnygoyal@google.com>2017-11-08 15:13:10 -0800
commitea529083bd45bae8edcb86d0be056ff90921d0c1 (patch)
treeeec9878251ef5c2807b191137d4e781caf857577 /src/com/android/launcher3/model
parent4d52411cea344ca3cdbf525c21696cf7e4193063 (diff)
downloadandroid_packages_apps_Trebuchet-ea529083bd45bae8edcb86d0be056ff90921d0c1.tar.gz
android_packages_apps_Trebuchet-ea529083bd45bae8edcb86d0be056ff90921d0c1.tar.bz2
android_packages_apps_Trebuchet-ea529083bd45bae8edcb86d0be056ff90921d0c1.zip
Using view elevation for shadow during click feedback instead of
creating a shadow bitmap Change-Id: I331186664c3c448596af3172e0e080921a6a1908
Diffstat (limited to 'src/com/android/launcher3/model')
-rw-r--r--src/com/android/launcher3/model/LoaderCursor.java14
-rw-r--r--src/com/android/launcher3/model/LoaderTask.java15
2 files changed, 16 insertions, 13 deletions
diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java
index 47f370a17..ccef9b7c7 100644
--- a/src/com/android/launcher3/model/LoaderCursor.java
+++ b/src/com/android/launcher3/model/LoaderCursor.java
@@ -16,15 +16,11 @@
package com.android.launcher3.model;
-import static com.android.launcher3.ItemInfoWithIcon.FLAG_SYSTEM_NO;
-import static com.android.launcher3.ItemInfoWithIcon.FLAG_SYSTEM_YES;
-
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.Intent.ShortcutIconResource;
-import android.content.pm.ApplicationInfo;
import android.content.pm.LauncherActivityInfo;
import android.database.Cursor;
import android.database.CursorWrapper;
@@ -36,6 +32,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.util.LongSparseArray;
+import com.android.launcher3.AppInfo;
import com.android.launcher3.IconCache;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.ItemInfo;
@@ -52,7 +49,6 @@ import com.android.launcher3.logging.FileLog;
import com.android.launcher3.util.ContentWriter;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.LongArrayMap;
-import com.android.launcher3.util.PackageManagerHelper;
import java.net.URISyntaxException;
import java.security.InvalidParameterException;
@@ -206,7 +202,6 @@ public class LoaderCursor extends CursorWrapper {
return TextUtils.isEmpty(title) ? "" : Utilities.trim(title);
}
-
/**
* Make an ShortcutInfo object for a restored application or shortcut item that points
* to a package that is not yet installed on the system.
@@ -279,12 +274,7 @@ public class LoaderCursor extends CursorWrapper {
}
if (lai != null) {
- ApplicationInfo appInfo = lai.getApplicationInfo();
- if (PackageManagerHelper.isAppSuspended(appInfo)) {
- info.runtimeStatusFlags |= ShortcutInfo.FLAG_DISABLED_SUSPENDED;
- }
- info.runtimeStatusFlags |= (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0
- ? FLAG_SYSTEM_NO : FLAG_SYSTEM_YES;
+ AppInfo.updateRuntimeFlagsForActivityTarget(info, lai);
}
// from the db
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index c2cfebb85..310416f0b 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -25,6 +25,7 @@ import android.content.IntentFilter;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.PackageInstaller;
import android.graphics.Bitmap;
+import android.graphics.drawable.AdaptiveIconDrawable;
import android.os.Handler;
import android.os.Process;
import android.os.UserHandle;
@@ -35,6 +36,7 @@ import android.util.MutableInt;
import com.android.launcher3.AllAppsList;
import com.android.launcher3.AppInfo;
+import com.android.launcher3.ClickShadowView;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.IconCache;
import com.android.launcher3.InstallShortcutReceiver;
@@ -52,6 +54,7 @@ import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIconPreviewVerifier;
+import com.android.launcher3.graphics.IconNormalizer;
import com.android.launcher3.graphics.LauncherIcons;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.provider.ImportDataTask;
@@ -145,7 +148,9 @@ public class LoaderTask implements Runnable {
TraceHelper.beginSection(TAG);
try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
- TraceHelper.partitionSection(TAG, "step 1.1: loading workspace");
+ TraceHelper.partitionSection(TAG, "step 1.1: loading UI resources");
+ loadUiResources();
+ TraceHelper.partitionSection(TAG, "step 1.2: loading workspace");
loadWorkspace();
verifyNotStopped();
@@ -208,6 +213,14 @@ public class LoaderTask implements Runnable {
this.notify();
}
+ public void loadUiResources() {
+ if (Utilities.ATLEAST_OREO) {
+ ClickShadowView.setAdaptiveIconScaleFactor(
+ IconNormalizer.getInstance(mApp.getContext()).getScale(
+ new AdaptiveIconDrawable(null, null), null, null, null));
+ }
+ }
+
private void loadWorkspace() {
final Context context = mApp.getContext();
final ContentResolver contentResolver = context.getContentResolver();