diff --git a/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index f84d38e..9494247 100755
--- a/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -782,7 +782,7 @@ public final class DefaultPermissionGrantPolicy {
.addCategory(Intent.CATEGORY_LAUNCHER_APP);
grantPermissionsToSystemPackage(pm,
getDefaultSystemHandlerActivityPackage(pm, homeIntent, userId), userId,
- ALWAYS_LOCATION_PERMISSIONS);
+ ALWAYS_LOCATION_PERMISSIONS, STORAGE_PERMISSIONS); //yim
// Watches
if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH, 0)) {
diff --git a/packages/apps/Launcher3/AndroidManifest.xml b/packages/apps/Launcher3/AndroidManifest.xml
old mode 100644
new mode 100755
index b031ffb..753b1dd
--- a/packages/apps/Launcher3/AndroidManifest.xml
+++ b/packages/apps/Launcher3/AndroidManifest.xml
@@ -25,7 +25,7 @@
Manifest entries specific to Launcher3. This is merged with AndroidManifest-common.xml.
Refer comments around specific entries on how to extend individual components.
-->
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ launcher:defaultLayoutId="@xml/default_workspace_6x6" >
diff --git a/packages/apps/Launcher3/go/src/com/android/launcher3/model/LoaderResults.java b/packages/apps/Launcher3/go/src/com/android/launcher3/model/LoaderResults.java
old mode 100644
new mode 100755
index 7130531..dcb4636
--- a/packages/apps/Launcher3/go/src/com/android/launcher3/model/LoaderResults.java
+++ b/packages/apps/Launcher3/go/src/com/android/launcher3/model/LoaderResults.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,12 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.model.BgDataModel.Callbacks;
+import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.LooperExecutor;
+import com.android.launcher3.widget.WidgetListRowEntry;
+
+import java.util.ArrayList;
+import java.util.HashMap;
/**
* Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}.
@@ -39,9 +44,17 @@ public class LoaderResults extends BaseLoaderResults {
@Override
public void bindDeepShortcuts() {
+ final HashMap shortcutMapCopy;
+ synchronized (mBgDataModel) {
+ shortcutMapCopy = new HashMap<>(mBgDataModel.deepShortcutMap);
+ }
+ executeCallbacksTask(c -> c.bindDeepShortcutMap(shortcutMapCopy), mUiExecutor);
}
@Override
public void bindWidgets() {
+ final ArrayList widgets =
+ mBgDataModel.widgetsModel.getWidgetsList(mApp.getContext());
+ executeCallbacksTask(c -> c.bindAllWidgets(widgets), mUiExecutor);
}
}
diff --git a/packages/apps/Launcher3/go/src/com/android/launcher3/model/WidgetsModel.java b/packages/apps/Launcher3/go/src/com/android/launcher3/model/WidgetsModel.java
old mode 100644
new mode 100755
index 3b3dc01..9d87788
--- a/packages/apps/Launcher3/go/src/com/android/launcher3/model/WidgetsModel.java
+++ b/packages/apps/Launcher3/go/src/com/android/launcher3/model/WidgetsModel.java
@@ -1,35 +1,45 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package com.android.launcher3.model;
+import static android.appwidget.AppWidgetProviderInfo.WIDGET_FEATURE_HIDE_FROM_PICKER;
+
+import static com.android.launcher3.pm.ShortcutConfigActivityInfo.queryList;
+
+import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Process;
import android.os.UserHandle;
+import android.util.Log;
import androidx.annotation.Nullable;
+import com.android.launcher3.AppFilter;
+import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.LauncherAppWidgetProviderInfo;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.compat.AlphabeticIndexCompat;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.ComponentWithLabelAndIcon;
+import com.android.launcher3.icons.IconCache;
+import com.android.launcher3.model.data.PackageItemInfo;
+import com.android.launcher3.pm.ShortcutConfigActivityInfo;
+import com.android.launcher3.util.MultiHashMap;
import com.android.launcher3.util.PackageUserKey;
+import com.android.launcher3.util.Preconditions;
+import com.android.launcher3.widget.WidgetItemComparator;
import com.android.launcher3.widget.WidgetListRowEntry;
+import com.android.launcher3.widget.WidgetManagerHelper;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
/**
@@ -40,9 +50,15 @@ import java.util.Set;
public class WidgetsModel {
// True is the widget support is disabled.
- public static final boolean GO_DISABLE_WIDGETS = true;
+ public static final boolean GO_DISABLE_WIDGETS = false;
+
+ private static final String TAG = "WidgetsModel";
+ private static final boolean DEBUG = false;
- private static final ArrayList EMPTY_WIDGET_LIST = new ArrayList<>();
+ /* Map of widgets and shortcuts that are tracked per package. */
+ private final MultiHashMap mWidgetsList = new MultiHashMap<>();
+
+ private AppFilter mAppFilter;
/**
* Returns a list of {@link WidgetListRowEntry}. All {@link WidgetItem} in a single row
@@ -53,25 +69,196 @@ public class WidgetsModel {
* @see com.android.launcher3.widget.WidgetsListAdapter#setWidgets(ArrayList)
*/
public synchronized ArrayList getWidgetsList(Context context) {
- return EMPTY_WIDGET_LIST;
+ ArrayList result = new ArrayList<>();
+ AlphabeticIndexCompat indexer = new AlphabeticIndexCompat(context);
+
+ WidgetItemComparator widgetComparator = new WidgetItemComparator();
+ for (Map.Entry> entry : mWidgetsList.entrySet()) {
+ WidgetListRowEntry row = new WidgetListRowEntry(entry.getKey(), entry.getValue());
+ row.titleSectionName = (row.pkgItem.title == null) ? "" :
+ indexer.computeSectionName(row.pkgItem.title);
+ Collections.sort(row.widgets, widgetComparator);
+ result.add(row);
+ }
+ return result;
}
/**
* @param packageUser If null, all widgets and shortcuts are updated and returned, otherwise
* only widgets and shortcuts associated with the package/user are.
*/
- public List update(LauncherAppState app,
- @Nullable PackageUserKey packageUser) {
- return Collections.emptyList();
+ public List update(
+ LauncherAppState app, @Nullable PackageUserKey packageUser) {
+ Preconditions.assertWorkerThread();
+
+ Context context = app.getContext();
+ final ArrayList widgetsAndShortcuts = new ArrayList<>();
+ List updatedItems = new ArrayList<>();
+ try {
+ InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
+ PackageManager pm = app.getContext().getPackageManager();
+
+ // Widgets
+ WidgetManagerHelper widgetManager = new WidgetManagerHelper(context);
+ for (AppWidgetProviderInfo widgetInfo : widgetManager.getAllProviders(packageUser)) {
+ LauncherAppWidgetProviderInfo launcherWidgetInfo =
+ LauncherAppWidgetProviderInfo.fromProviderInfo(context, widgetInfo);
+
+ widgetsAndShortcuts.add(new WidgetItem(
+ launcherWidgetInfo, idp, app.getIconCache()));
+ updatedItems.add(launcherWidgetInfo);
+ }
+
+ // Shortcuts
+ for (ShortcutConfigActivityInfo info :
+ queryList(context, packageUser)) {
+ widgetsAndShortcuts.add(new WidgetItem(info, app.getIconCache(), pm));
+ updatedItems.add(info);
+ }
+ setWidgetsAndShortcuts(widgetsAndShortcuts, app, packageUser);
+ } catch (Exception e) {
+ if (!FeatureFlags.IS_STUDIO_BUILD && Utilities.isBinderSizeError(e)) {
+ // the returned value may be incomplete and will not be refreshed until the next
+ // time Launcher starts.
+ // TODO: after figuring out a repro step, introduce a dirty bit to check when
+ // onResume is called to refresh the widget provider list.
+ } else {
+ throw e;
+ }
+ }
+
+ app.getWidgetCache().removeObsoletePreviews(widgetsAndShortcuts, packageUser);
+ return updatedItems;
}
+ private synchronized void setWidgetsAndShortcuts(ArrayList rawWidgetsShortcuts,
+ LauncherAppState app, @Nullable PackageUserKey packageUser) {
+ if (DEBUG) {
+ Log.d(TAG, "addWidgetsAndShortcuts, widgetsShortcuts#=" + rawWidgetsShortcuts.size());
+ }
+
+ // Temporary list for {@link PackageItemInfos} to avoid having to go through
+ // {@link mPackageItemInfos} to locate the key to be used for {@link #mWidgetsList}
+ HashMap tmpPackageItemInfos = new HashMap<>();
+
+ // clear the lists.
+ if (packageUser == null) {
+ mWidgetsList.clear();
+ } else {
+ // Only clear the widgets for the given package/user.
+ PackageItemInfo packageItem = null;
+ for (PackageItemInfo item : mWidgetsList.keySet()) {
+ if (item.packageName.equals(packageUser.mPackageName)) {
+ packageItem = item;
+ break;
+ }
+ }
+ if (packageItem != null) {
+ // We want to preserve the user that was on the packageItem previously,
+ // so add it to tmpPackageItemInfos here to avoid creating a new entry.
+ tmpPackageItemInfos.put(packageItem.packageName, packageItem);
+
+ Iterator widgetItemIterator = mWidgetsList.get(packageItem).iterator();
+ while (widgetItemIterator.hasNext()) {
+ WidgetItem nextWidget = widgetItemIterator.next();
+ if (nextWidget.componentName.getPackageName().equals(packageUser.mPackageName)
+ && nextWidget.user.equals(packageUser.mUser)) {
+ widgetItemIterator.remove();
+ }
+ }
+ }
+ }
+
+ InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
+ UserHandle myUser = Process.myUserHandle();
+
+ // add and update.
+ for (WidgetItem item : rawWidgetsShortcuts) {
+ if (item.widgetInfo != null) {
+ if ((item.widgetInfo.getWidgetFeatures() & WIDGET_FEATURE_HIDE_FROM_PICKER) != 0) {
+ // Widget is hidden from picker
+ continue;
+ }
+
+ // Ensure that all widgets we show can be added on a workspace of this size
+ int minSpanX = Math.min(item.widgetInfo.spanX, item.widgetInfo.minSpanX);
+ int minSpanY = Math.min(item.widgetInfo.spanY, item.widgetInfo.minSpanY);
+ if (minSpanX > idp.numColumns || minSpanY > idp.numRows) {
+ if (DEBUG) {
+ Log.d(TAG, String.format(
+ "Widget %s : (%d X %d) can't fit on this device",
+ item.componentName, minSpanX, minSpanY));
+ }
+ continue;
+ }
+ }
+
+ if (mAppFilter == null) {
+ mAppFilter = AppFilter.newInstance(app.getContext());
+ }
+ if (!mAppFilter.shouldShowApp(item.componentName)) {
+ if (DEBUG) {
+ Log.d(TAG, String.format("%s is filtered and not added to the widget tray.",
+ item.componentName));
+ }
+ continue;
+ }
+
+ String packageName = item.componentName.getPackageName();
+ PackageItemInfo pInfo = tmpPackageItemInfos.get(packageName);
+ if (pInfo == null) {
+ pInfo = new PackageItemInfo(packageName);
+ pInfo.user = item.user;
+ tmpPackageItemInfos.put(packageName, pInfo);
+ } else if (!myUser.equals(pInfo.user)) {
+ // Keep updating the user, until we get the primary user.
+ pInfo.user = item.user;
+ }
+ mWidgetsList.addToList(pInfo, item);
+ }
+
+ // Update each package entry
+ IconCache iconCache = app.getIconCache();
+ for (PackageItemInfo p : tmpPackageItemInfos.values()) {
+ iconCache.getTitleAndIconForApp(p, true /* userLowResIcon */);
+ }
+ }
public void onPackageIconsUpdated(Set packageNames, UserHandle user,
LauncherAppState app) {
+ for (Entry> entry : mWidgetsList.entrySet()) {
+ if (packageNames.contains(entry.getKey().packageName)) {
+ ArrayList items = entry.getValue();
+ int count = items.size();
+ for (int i = 0; i < count; i++) {
+ WidgetItem item = items.get(i);
+ if (item.user.equals(user)) {
+ if (item.activityInfo != null) {
+ items.set(i, new WidgetItem(item.activityInfo, app.getIconCache(),
+ app.getContext().getPackageManager()));
+ } else {
+ items.set(i, new WidgetItem(item.widgetInfo,
+ app.getInvariantDeviceProfile(), app.getIconCache()));
+ }
+ }
+ }
+ }
+ }
}
public WidgetItem getWidgetProviderInfoByProviderName(
ComponentName providerName) {
+ ArrayList widgetsList = mWidgetsList.get(
+ new PackageItemInfo(providerName.getPackageName()));
+ if (widgetsList == null) {
+ return null;
+ }
+
+ for (WidgetItem item : widgetsList) {
+ if (item.componentName.equals(providerName)) {
+ return item;
+ }
+ }
return null;
}
}
\ No newline at end of file
diff --git a/packages/apps/Launcher3/quickstep/AndroidManifest.xml b/packages/apps/Launcher3/quickstep/AndroidManifest.xml
old mode 100644
new mode 100755
index 0307146..c1ab2df
--- a/packages/apps/Launcher3/quickstep/AndroidManifest.xml
+++ b/packages/apps/Launcher3/quickstep/AndroidManifest.xml
@@ -32,6 +32,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
mShelfTopAtThreshold = mShiftRange * SCRIM_CATCHUP_THRESHOLD + mTopOffset;
}
updateColors();
- updateSysUiColors();
+ //updateSysUiColors(); //yim
updateDragHandleAlpha();
invalidate();
}
@@ -245,6 +247,7 @@ public class ShelfScrimView extends ScrimView
@Override
protected void updateSysUiColors() {
+ Log.d("yim hzx", "ShelfScrimView -- updateSysUiColors");
if (mDrawingFlatColor) {
super.updateSysUiColors();
} else {
diff --git a/packages/apps/Launcher3/res/drawable/bg_all_apps_searchbox.xml b/packages/apps/Launcher3/res/drawable/bg_all_apps_searchbox.xml
old mode 100644
new mode 100755
index c324927..3e878cc
--- a/packages/apps/Launcher3/res/drawable/bg_all_apps_searchbox.xml
+++ b/packages/apps/Launcher3/res/drawable/bg_all_apps_searchbox.xml
@@ -14,6 +14,6 @@
limitations under the License.
-->
-
-
+
+
\ No newline at end of file
diff --git a/packages/apps/Launcher3/res/values/config_ext.xml b/packages/apps/Launcher3/res/values/config_ext.xml
old mode 100644
new mode 100755
index ba662f0..be2d030
--- a/packages/apps/Launcher3/res/values/config_ext.xml
+++ b/packages/apps/Launcher3/res/values/config_ext.xml
@@ -42,7 +42,7 @@
-
+ 6_by_6
5
@@ -63,7 +63,7 @@
org.chromium.chrome/org.chromium.chrome.browser.searchwidget.SearchWidgetProvider
- 64
+ 46
false
diff --git a/packages/apps/Launcher3/res/xml/default_workspace_6x6.xml b/packages/apps/Launcher3/res/xml/default_workspace_6x6.xml
new file mode 100755
index 0000000..2f4958a
--- /dev/null
+++ b/packages/apps/Launcher3/res/xml/default_workspace_6x6.xml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/BubbleTextView.java b/packages/apps/Launcher3/src/com/android/launcher3/BubbleTextView.java
old mode 100644
new mode 100755
index 68a734b..00d15aba
--- a/packages/apps/Launcher3/src/com/android/launcher3/BubbleTextView.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/BubbleTextView.java
@@ -181,6 +181,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
defaultIconSize = grid.allAppsIconSizePx;
mIconTextSize = grid.allAppsIconTextSizePx;
+ setTextColor(Color.parseColor("#FFFFFF"));//yim add
} else if (mDisplay == DISPLAY_FOLDER) {
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.folderChildTextSizePx);
setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx);
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/views/BlurImageview.java b/packages/apps/Launcher3/src/com/android/launcher3/views/BlurImageview.java
new file mode 100755
index 0000000..2bc53b1
--- /dev/null
+++ b/packages/apps/Launcher3/src/com/android/launcher3/views/BlurImageview.java
@@ -0,0 +1,132 @@
+package com.android.launcher3.views;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Matrix;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.util.Log;
+import androidx.core.view.MotionEventCompat;
+
+public class BlurImageview {
+ private static float hRadius = 10.0f;
+ private static int iterations = 5;
+ private static float vRadius = 10.0f;
+
+ public static Drawable BlurImages(Bitmap bmp, Context context) {
+ Bitmap smallBmp = Bitmap.createScaledBitmap(bmp, bmp.getWidth() / 5, bmp.getHeight() / 5, true);
+ int width = smallBmp.getWidth();
+ int height = smallBmp.getHeight();
+ Log.d("yim hzx", "smallBmp width = " + width + ", height = " + height);
+ int[] inPixels = new int[(width * height)];
+ int[] outPixels = new int[(width * height)];
+ Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ smallBmp.getPixels(inPixels, 0, width, 0, 0, width, height);
+ for (int i = 0; i < iterations; i++) {
+ blur(inPixels, outPixels, width, height, hRadius);
+ blur(outPixels, inPixels, height, width, vRadius);
+ }
+ blurFractional(inPixels, outPixels, width, height, hRadius);
+ blurFractional(outPixels, inPixels, height, width, vRadius);
+ bitmap.setPixels(inPixels, 0, width, 0, 0, width, height);
+ return new BitmapDrawable(context.getResources(), cut(Bitmap.createScaledBitmap(bitmap, width * 5, height * 5, true)));
+ }
+
+ private static Bitmap cut(Bitmap bitmap) {
+ new Matrix();
+ return Bitmap.createBitmap(bitmap, 10, 10, bitmap.getWidth() - 20, bitmap.getHeight() - 20);
+ }
+
+ /* JADX INFO: Multiple debug info for r2v3 int: [D('rgb1' int), D('widthMinus1' int)] */
+ /* JADX INFO: Multiple debug info for r4v3 int: [D('rgb2' int), D('r' int)] */
+ public static void blur(int[] in, int[] out, int width, int height, float radius) {
+ int widthMinus1 = width - 1;
+ int r = (int) radius;
+ int tableSize = (r * 2) + 1;
+ int[] divide = new int[(tableSize * 256)];
+ for (int i = 0; i < tableSize * 256; i++) {
+ divide[i] = i / tableSize;
+ }
+ int inIndex = 0;
+ for (int y = 0; y < height; y++) {
+ int outIndex = y;
+ int ta = 0;
+ int tr = 0;
+ int tg = 0;
+ int tb = 0;
+ for (int i2 = -r; i2 <= r; i2++) {
+ int rgb = in[clamp(i2, 0, width - 1) + inIndex];
+ ta += (rgb >> 24) & 255;
+ tr += (rgb >> 16) & 255;
+ tg += (rgb >> 8) & 255;
+ tb += rgb & 255;
+ }
+ int x = 0;
+ while (x < width) {
+ out[outIndex] = (divide[ta] << 24) | (divide[tr] << 16) | (divide[tg] << 8) | divide[tb];
+ int i1 = x + r + 1;
+ if (i1 > widthMinus1) {
+ i1 = widthMinus1;
+ }
+ int i22 = x - r;
+ if (i22 < 0) {
+ i22 = 0;
+ }
+ int widthMinus12 = in[inIndex + i1];
+ int r2 = in[inIndex + i22];
+ ta += ((widthMinus12 >> 24) & 255) - ((r2 >> 24) & 255);
+ tr += ((widthMinus12 & 16711680) - (16711680 & r2)) >> 16;
+ tg += ((widthMinus12 & MotionEventCompat.ACTION_POINTER_INDEX_MASK) - (65280 & r2)) >> 8;
+ tb += (widthMinus12 & 255) - (r2 & 255);
+ outIndex += height;
+ x++;
+ tableSize = tableSize;
+ widthMinus1 = widthMinus1;
+ r = r;
+ divide = divide;
+ }
+ inIndex += width;
+ }
+ }
+
+ /* JADX INFO: Multiple debug info for r4v4 int: [D('y' int), D('b2' int)] */
+ public static void blurFractional(int[] in, int[] out, int width, int height, float radius) {
+ int i = height;
+ float radius2 = radius - ((float) ((int) radius));
+ float f = 1.0f / ((2.0f * radius2) + 1.0f);
+ int inIndex = 0;
+ int y = 0;
+ while (y < i) {
+ out[y] = in[0];
+ int outIndex = y + i;
+ int g3 = 1;
+ while (g3 < width - 1) {
+ int i2 = inIndex + g3;
+ int rgb1 = in[i2 - 1];
+ int rgb2 = in[i2];
+ int rgb3 = in[i2 + 1];
+ int b2 = rgb2 & 255;
+ int b3 = rgb3 & 255;
+ int i3 = (int) (((float) (((rgb1 >> 16) & 255) + ((rgb3 >> 16) & 255))) * radius2);
+ int i4 = (int) (((float) (((rgb1 >> 8) & 255) + ((rgb3 >> 8) & 255))) * radius2);
+ int b1 = (int) (((float) (((int) (((float) ((rgb1 & 255) + b3)) * radius2)) + b2)) * f);
+ out[outIndex] = (((int) (((float) (((int) (((float) (((rgb1 >> 24) & 255) + ((rgb3 >> 24) & 255))) * radius2)) + ((rgb2 >> 24) & 255))) * f)) << 24) | (((int) (((float) (i3 + ((rgb2 >> 16) & 255))) * f)) << 16) | (((int) (((float) (i4 + ((rgb2 >> 8) & 255))) * f)) << 8) | b1;
+ outIndex += height;
+ g3++;
+ y = y;
+ inIndex = inIndex;
+ }
+ out[outIndex] = in[width - 1];
+ inIndex += width;
+ y++;
+ i = height;
+ }
+ }
+
+ public static int clamp(int x, int a, int b) {
+ if (x < a) {
+ return a;
+ }
+ return x > b ? b : x;
+ }
+}
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/views/ScrimView.java b/packages/apps/Launcher3/src/com/android/launcher3/views/ScrimView.java
old mode 100644
new mode 100755
index 25f9e55..a7396c0
--- a/packages/apps/Launcher3/src/com/android/launcher3/views/ScrimView.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/views/ScrimView.java
@@ -35,18 +35,27 @@ import android.animation.Keyframe;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.RectEvaluator;
+import android.app.WallpaperManager; //yim
+import android.content.BroadcastReceiver; //yim
import android.content.Context;
+import android.content.Intent; //yim
+import android.content.IntentFilter; //yim
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.graphics.Bitmap; //yim
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.graphics.drawable.BitmapDrawable; //yim
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.os.Handler; //yim
+import android.os.Message; //yim
import android.util.AttributeSet;
import android.util.IntProperty;
+import android.util.Log; //yim
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -120,6 +129,28 @@ public class ScrimView extends View implements Insettable, O
private final AccessibilityManager mAM;
protected int mEndScrim;
protected final boolean mIsScrimDark;
+
+ private Handler backgroundHandle = new Handler() {
+
+ public void handleMessage(Message msg) {
+ if (msg.what == 1) {
+ Log.d("yim hzx", "setbackground -- " + ScrimView.this.mBackgroundDrawable);
+ if (ScrimView.this.mBackgroundDrawable != null) {
+ ScrimView scrimView = ScrimView.this;
+ scrimView.setBackgroundDrawable(scrimView.mBackgroundDrawable);
+ Log.d("yim hzx 1", "setbackground -- " + ScrimView.this.mBackgroundDrawable);
+ } else {
+ ScrimView scrimView = ScrimView.this;
+ scrimView.setBackgroundColor(scrimView.mWallpaperColorInfo.getMainColor());
+ Log.d("yim hzx 2", "setbackground -- " + ScrimView.this.mBackgroundDrawable);
+ }
+ ScrimView scrimView = ScrimView.this;
+ scrimView.setAlpha(1.0f - scrimView.mProgress);
+ // scrimView3.setAlpha(1.0f - 0.5f);
+ Log.d("yim hzx 3", "setbackground -- " + ScrimView.this.mBackgroundDrawable);
+ }
+ }
+ };
private final StateListener mAccessibilityLauncherStateListener =
new StateListener() {
@@ -155,13 +186,60 @@ public class ScrimView extends View implements Insettable, O
protected Drawable mDragHandle;
private int mDragHandleAlpha = 255;
+
+ private Drawable mBackgroundDrawable;
+
+
+ private WallpaperManager mWallpaperManager;
+ private BroadcastReceiver wallpaperReceiver = new BroadcastReceiver() {
+
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ Log.d("hzx", "action = " + action);
+ if ("android.intent.action.WALLPAPER_CHANGED".equals(action)) {
+ ScrimView.this.updateBackground();
+ Log.d("hzx", "ACTION_WALLPAPER_CHANGED = end");
+ }
+ }
+ };
+
+ private void updateBackground() {
+ new Thread(new Runnable() {
+
+ public void run() {
+ ScrimView.this.updateBackgroundSyn();
+ }
+ }).start();
+ }
+
+
+ private synchronized void updateBackgroundSyn() {
+ Log.d("hzx", "updateBackground start");
+ Log.d("hzx", "getBitmap start");
+ Bitmap wapaperBitmap = ((BitmapDrawable) this.mWallpaperManager.getDrawable()).getBitmap();
+ Log.d("hzx", "getBitmap end");
+ this.mBackgroundDrawable = BlurImageview.BlurImages(wapaperBitmap, this.mContext);
+ this.backgroundHandle.sendEmptyMessage(1);
+ // ScrimView scrimView = ScrimView.this;
+ // scrimView.setBackgroundDrawable(scrimView.mBackgroundDrawable);
+ Log.d("hzx", "updateBackground message");
+ }
+
public ScrimView(Context context, AttributeSet attrs) {
super(context, attrs);
+
+ this.mContext = context;
+ this.mWallpaperManager = (WallpaperManager) context.getSystemService("wallpaper");
+ Log.d("hzx", "ScrimView updateBackground");
+ updateBackground();
+ this.mContext.registerReceiver(this.wallpaperReceiver, new IntentFilter("android.intent.action.WALLPAPER_CHANGED"));
+
mLauncher = Launcher.cast(Launcher.getLauncher(context));
mWallpaperColorInfo = WallpaperColorInfo.INSTANCE.get(context);
mEndScrim = Themes.getAttrColor(context, R.attr.allAppsScrimColor);
- if (FeatureOption.SPRD_ALLAPP_BG_TRANSPARENT_SUPPORT.get()) {
+ // if (FeatureOption.SPRD_ALLAPP_BG_TRANSPARENT_SUPPORT.get()) {
+ if(true){
// Use dark Scrim color for a better experience
TypedArray array = mLauncher.getTheme().obtainStyledAttributes(
R.style.LauncherTheme_Dark, new int[]{R.attr.allAppsScrimColor});
@@ -171,7 +249,7 @@ public class ScrimView extends View implements Insettable, O
}
mIsScrimDark = ColorUtils.calculateLuminance(mEndScrim) < 0.5f;
- mMaxScrimAlpha = 0.7f;
+ mMaxScrimAlpha = 0.0f; //yim0.7f
Resources res = context.getResources();
mDragHandleSize = new Point(res.getDimensionPixelSize(R.dimen.vertical_drag_handle_width),
@@ -250,6 +328,7 @@ public class ScrimView extends View implements Insettable, O
updateSysUiColors();
updateDragHandleAlpha();
invalidate();
+ setAlpha(1.0f - progress); //yim
}
}
@@ -263,6 +342,7 @@ public class ScrimView extends View implements Insettable, O
protected void updateSysUiColors() {
// Use a light system UI (dark icons) if all apps is behind at least half of the
// status bar.
+ Log.d("yim hzx", "ScrimView -- updateSysUiColors");
boolean forceChange = mProgress <= 0.1f;
if (forceChange) {
mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !mIsScrimDark);
diff --git a/packages/apps/Launcher3/src/com/sprd/ext/FeatureOption.java b/packages/apps/Launcher3/src/com/sprd/ext/FeatureOption.java
old mode 100644
new mode 100755
index f7773fe..1b062e5
--- a/packages/apps/Launcher3/src/com/sprd/ext/FeatureOption.java
+++ b/packages/apps/Launcher3/src/com/sprd/ext/FeatureOption.java
@@ -49,7 +49,7 @@ public final class FeatureOption {
"enable folder icon support grid mode & aosp mode");
public static final BooleanFlag SPRD_ALLAPP_CUSTOMIZE_SUPPORT = new FeatureFlags.DebugFlag(
- "SPRD_ALLAPP_CUSTOMIZE_SUPPORT", getProp("ro.launcher.allapp.customize"),
+ "SPRD_ALLAPP_CUSTOMIZE_SUPPORT", true, //yim mod getProp("ro.launcher.allapp.customize" to true
"enable can customize the allapp views app position");
public static final BooleanFlag SPRD_TASK_LOCK_SUPPORT = new FeatureFlags.DebugFlag(
@@ -86,7 +86,7 @@ public final class FeatureOption {
public static final BooleanFlag SPRD_DESKTOP_GRID_SUPPORT = new FeatureFlags.DebugFlag(
"SPRD_DESKTOP_GRID_SUPPORT",
- getProp("ro.launcher.desktopgrid", !UtilitiesExt.IS_LOW_RAM),
+ getProp("ro.launcher.desktopgrid", true), //yim mod !UtilitiesExt.IS_LOW_RAM to true
"enable allows customization of the columns and rows on the desktop");
public static final BooleanFlag SPRD_DYNAMIC_ICON_SUPPORT = new FeatureFlags.DebugFlag(