Loading proguard.flags +5 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,11 @@ public <init>(...); } # InstantAppResolver -keep class com.android.quickstep.InstantAppResolverImpl { public <init>(...); } -keep interface com.android.launcher3.userevent.nano.LauncherLogProto.** { *; } Loading quickstep/res/values/override.xml +2 −0 Original line number Diff line number Diff line Loading @@ -16,5 +16,7 @@ <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_transition_manager_class" translatable="false">com.android.launcher3.LauncherAppTransitionManagerImpl</string> <string name="instant_app_resolver_class" translatable="false">com.android.quickstep.InstantAppResolverImpl</string> </resources> quickstep/src/com/android/quickstep/InstantAppResolverImpl.java 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * 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.quickstep; import android.content.ComponentName; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.InstantAppInfo; import android.content.pm.PackageManager; import android.util.Log; import com.android.launcher3.AppInfo; import com.android.launcher3.util.InstantAppResolver; import java.util.ArrayList; import java.util.List; /** * Implementation of InstantAppResolver using platform APIs */ @SuppressWarnings("unused") public class InstantAppResolverImpl extends InstantAppResolver { private static final String TAG = "InstantAppResolverImpl"; public static final String COMPONENT_CLASS_MARKER = "@instantapp"; private final PackageManager mPM; public InstantAppResolverImpl(Context context) throws NoSuchMethodException, ClassNotFoundException { mPM = context.getPackageManager(); } @Override public boolean isInstantApp(ApplicationInfo info) { return info.isInstantApp(); } @Override public boolean isInstantApp(AppInfo info) { ComponentName cn = info.getTargetComponent(); return cn != null && cn.getClassName().equals(COMPONENT_CLASS_MARKER); } @Override public List<ApplicationInfo> getInstantApps() { try { List<ApplicationInfo> result = new ArrayList<>(); for (InstantAppInfo iai : mPM.getInstantApps()) { ApplicationInfo info = iai.getApplicationInfo(); if (info != null) { result.add(info); } } return result; } catch (SecurityException se) { Log.w(TAG, "getInstantApps failed. Launcher may not be the default home app.", se); } catch (Exception e) { Log.e(TAG, "Error calling API: getInstantApps", e); } return super.getInstantApps(); } } quickstep/src/com/android/quickstep/NormalizedIconLoader.java +14 −7 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.util.SparseArray; import com.android.launcher3.FastBitmapDrawable; import com.android.launcher3.graphics.BitmapInfo; import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.LauncherIcons; import com.android.systemui.shared.recents.model.IconLoader; import com.android.systemui.shared.recents.model.TaskKeyLruCache; Loading @@ -40,11 +41,13 @@ import com.android.systemui.shared.recents.model.TaskKeyLruCache; public class NormalizedIconLoader extends IconLoader { private final SparseArray<BitmapInfo> mDefaultIcons = new SparseArray<>(); private final DrawableFactory mDrawableFactory; private LauncherIcons mLauncherIcons; public NormalizedIconLoader(Context context, TaskKeyLruCache<Drawable> iconCache, LruCache<ComponentName, ActivityInfo> activityInfoCache) { super(context, iconCache, activityInfoCache); mDrawableFactory = DrawableFactory.get(context); } @Override Loading @@ -53,7 +56,7 @@ public class NormalizedIconLoader extends IconLoader { BitmapInfo info = mDefaultIcons.get(userId); if (info == null) { info = getBitmapInfo(Resources.getSystem() .getDrawable(android.R.drawable.sym_def_app_icon), userId); .getDrawable(android.R.drawable.sym_def_app_icon), userId, false); mDefaultIcons.put(userId, info); } Loading @@ -63,22 +66,26 @@ public class NormalizedIconLoader extends IconLoader { @Override protected Drawable createBadgedDrawable(Drawable drawable, int userId) { return new FastBitmapDrawable(getBitmapInfo(drawable, userId)); return new FastBitmapDrawable(getBitmapInfo(drawable, userId, false)); } private synchronized BitmapInfo getBitmapInfo(Drawable drawable, int userId) { private synchronized BitmapInfo getBitmapInfo(Drawable drawable, int userId, boolean isInstantApp) { if (mLauncherIcons == null) { mLauncherIcons = LauncherIcons.obtain(mContext); } // User version code O, so that the icon is always wrapped in an adaptive icon container. return mLauncherIcons.createBadgedIconBitmap(drawable, UserHandle.of(userId), Build.VERSION_CODES.O); Build.VERSION_CODES.O, isInstantApp); } @Override protected Drawable getBadgedActivityIcon(ActivityInfo activityInfo, int userId) { return createBadgedDrawable( activityInfo.loadUnbadgedIcon(mContext.getPackageManager()), userId); protected synchronized Drawable getBadgedActivityIcon(ActivityInfo activityInfo, int userId) { BitmapInfo bitmapInfo = getBitmapInfo( activityInfo.loadUnbadgedIcon(mContext.getPackageManager()), userId, activityInfo.applicationInfo.isInstantApp()); return mDrawableFactory.newIcon(bitmapInfo, activityInfo); } } src/com/android/launcher3/FastBitmapDrawable.java +4 −5 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ public class FastBitmapDrawable extends Drawable { private static final ColorMatrix sTempFilterMatrix = new ColorMatrix(); protected final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG); private final Bitmap mBitmap; protected Bitmap mBitmap; protected final int mIconColor; private boolean mIsPressed; Loading Loading @@ -324,10 +324,9 @@ public class FastBitmapDrawable extends Drawable { return new MyConstantState(mBitmap, mIconColor); } private static class MyConstantState extends ConstantState { private final Bitmap mBitmap; private final int mIconColor; protected static class MyConstantState extends ConstantState { protected final Bitmap mBitmap; protected final int mIconColor; public MyConstantState(Bitmap bitmap, int color) { mBitmap = bitmap; Loading Loading
proguard.flags +5 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,11 @@ public <init>(...); } # InstantAppResolver -keep class com.android.quickstep.InstantAppResolverImpl { public <init>(...); } -keep interface com.android.launcher3.userevent.nano.LauncherLogProto.** { *; } Loading
quickstep/res/values/override.xml +2 −0 Original line number Diff line number Diff line Loading @@ -16,5 +16,7 @@ <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_transition_manager_class" translatable="false">com.android.launcher3.LauncherAppTransitionManagerImpl</string> <string name="instant_app_resolver_class" translatable="false">com.android.quickstep.InstantAppResolverImpl</string> </resources>
quickstep/src/com/android/quickstep/InstantAppResolverImpl.java 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * 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.quickstep; import android.content.ComponentName; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.InstantAppInfo; import android.content.pm.PackageManager; import android.util.Log; import com.android.launcher3.AppInfo; import com.android.launcher3.util.InstantAppResolver; import java.util.ArrayList; import java.util.List; /** * Implementation of InstantAppResolver using platform APIs */ @SuppressWarnings("unused") public class InstantAppResolverImpl extends InstantAppResolver { private static final String TAG = "InstantAppResolverImpl"; public static final String COMPONENT_CLASS_MARKER = "@instantapp"; private final PackageManager mPM; public InstantAppResolverImpl(Context context) throws NoSuchMethodException, ClassNotFoundException { mPM = context.getPackageManager(); } @Override public boolean isInstantApp(ApplicationInfo info) { return info.isInstantApp(); } @Override public boolean isInstantApp(AppInfo info) { ComponentName cn = info.getTargetComponent(); return cn != null && cn.getClassName().equals(COMPONENT_CLASS_MARKER); } @Override public List<ApplicationInfo> getInstantApps() { try { List<ApplicationInfo> result = new ArrayList<>(); for (InstantAppInfo iai : mPM.getInstantApps()) { ApplicationInfo info = iai.getApplicationInfo(); if (info != null) { result.add(info); } } return result; } catch (SecurityException se) { Log.w(TAG, "getInstantApps failed. Launcher may not be the default home app.", se); } catch (Exception e) { Log.e(TAG, "Error calling API: getInstantApps", e); } return super.getInstantApps(); } }
quickstep/src/com/android/quickstep/NormalizedIconLoader.java +14 −7 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.util.SparseArray; import com.android.launcher3.FastBitmapDrawable; import com.android.launcher3.graphics.BitmapInfo; import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.LauncherIcons; import com.android.systemui.shared.recents.model.IconLoader; import com.android.systemui.shared.recents.model.TaskKeyLruCache; Loading @@ -40,11 +41,13 @@ import com.android.systemui.shared.recents.model.TaskKeyLruCache; public class NormalizedIconLoader extends IconLoader { private final SparseArray<BitmapInfo> mDefaultIcons = new SparseArray<>(); private final DrawableFactory mDrawableFactory; private LauncherIcons mLauncherIcons; public NormalizedIconLoader(Context context, TaskKeyLruCache<Drawable> iconCache, LruCache<ComponentName, ActivityInfo> activityInfoCache) { super(context, iconCache, activityInfoCache); mDrawableFactory = DrawableFactory.get(context); } @Override Loading @@ -53,7 +56,7 @@ public class NormalizedIconLoader extends IconLoader { BitmapInfo info = mDefaultIcons.get(userId); if (info == null) { info = getBitmapInfo(Resources.getSystem() .getDrawable(android.R.drawable.sym_def_app_icon), userId); .getDrawable(android.R.drawable.sym_def_app_icon), userId, false); mDefaultIcons.put(userId, info); } Loading @@ -63,22 +66,26 @@ public class NormalizedIconLoader extends IconLoader { @Override protected Drawable createBadgedDrawable(Drawable drawable, int userId) { return new FastBitmapDrawable(getBitmapInfo(drawable, userId)); return new FastBitmapDrawable(getBitmapInfo(drawable, userId, false)); } private synchronized BitmapInfo getBitmapInfo(Drawable drawable, int userId) { private synchronized BitmapInfo getBitmapInfo(Drawable drawable, int userId, boolean isInstantApp) { if (mLauncherIcons == null) { mLauncherIcons = LauncherIcons.obtain(mContext); } // User version code O, so that the icon is always wrapped in an adaptive icon container. return mLauncherIcons.createBadgedIconBitmap(drawable, UserHandle.of(userId), Build.VERSION_CODES.O); Build.VERSION_CODES.O, isInstantApp); } @Override protected Drawable getBadgedActivityIcon(ActivityInfo activityInfo, int userId) { return createBadgedDrawable( activityInfo.loadUnbadgedIcon(mContext.getPackageManager()), userId); protected synchronized Drawable getBadgedActivityIcon(ActivityInfo activityInfo, int userId) { BitmapInfo bitmapInfo = getBitmapInfo( activityInfo.loadUnbadgedIcon(mContext.getPackageManager()), userId, activityInfo.applicationInfo.isInstantApp()); return mDrawableFactory.newIcon(bitmapInfo, activityInfo); } }
src/com/android/launcher3/FastBitmapDrawable.java +4 −5 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ public class FastBitmapDrawable extends Drawable { private static final ColorMatrix sTempFilterMatrix = new ColorMatrix(); protected final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG); private final Bitmap mBitmap; protected Bitmap mBitmap; protected final int mIconColor; private boolean mIsPressed; Loading Loading @@ -324,10 +324,9 @@ public class FastBitmapDrawable extends Drawable { return new MyConstantState(mBitmap, mIconColor); } private static class MyConstantState extends ConstantState { private final Bitmap mBitmap; private final int mIconColor; protected static class MyConstantState extends ConstantState { protected final Bitmap mBitmap; protected final int mIconColor; public MyConstantState(Bitmap bitmap, int color) { mBitmap = bitmap; Loading