diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java index 09f513dc15790..18dcf4c55d21e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java @@ -120,8 +120,6 @@ public class NotificationContentInflater { @InflationFlag private int mInflationFlags = REQUIRED_INFLATION_FLAGS; - static final InflationExecutor EXECUTOR = new InflationExecutor(); - private final ExpandableNotificationRow mRow; private boolean mIsLowPriority; private boolean mUsesIncreasedHeight; @@ -638,14 +636,14 @@ public class NotificationContentInflater { cancellationSignal = newContentView.applyAsync( result.packageContext, parentLayout, - EXECUTOR, + null, listener, remoteViewClickHandler); } else { cancellationSignal = newContentView.reapplyAsync( result.packageContext, existingView, - EXECUTOR, + null, listener, remoteViewClickHandler); } @@ -996,40 +994,4 @@ public class NotificationContentInflater { public abstract void setResultView(View v); public abstract RemoteViews getRemoteView(); } - - /** - * A custom executor that allows more tasks to be queued. Default values are copied from - * AsyncTask - */ - private static class InflationExecutor implements Executor { - private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors(); - // We want at least 2 threads and at most 4 threads in the core pool, - // preferring to have 1 less than the CPU count to avoid saturating - // the CPU with background work - private static final int CORE_POOL_SIZE = Math.max(2, Math.min(CPU_COUNT - 1, 4)); - private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1; - private static final int KEEP_ALIVE_SECONDS = 30; - - private static final ThreadFactory sThreadFactory = new ThreadFactory() { - private final AtomicInteger mCount = new AtomicInteger(1); - - public Thread newThread(Runnable r) { - return new Thread(r, "InflaterThread #" + mCount.getAndIncrement()); - } - }; - - private final ThreadPoolExecutor mExecutor; - - private InflationExecutor() { - mExecutor = new ThreadPoolExecutor( - CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE_SECONDS, TimeUnit.SECONDS, - new LinkedBlockingQueue<>(), sThreadFactory); - mExecutor.allowCoreThreadTimeOut(true); - } - - @Override - public void execute(Runnable runnable) { - mExecutor.execute(runnable); - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageCache.java index 6eb376b585867..4b0e2ffd5d7f7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageCache.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageCache.java @@ -52,7 +52,7 @@ public class NotificationInlineImageCache implements NotificationInlineImageReso @Override public void preload(Uri uri) { PreloadImageTask newTask = new PreloadImageTask(mResolver); - newTask.executeOnExecutor(NotificationContentInflater.EXECUTOR, uri); + newTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, uri); mCache.put(uri, newTask); }