Restricting the shared lib to java 7
Bug: 112849320
Test: Verified launcher works fine with the new jar
Change-Id: Ibfbc4e53f879894ada134c227e212e3e23c49ea6
diff --git a/packages/SystemUI/shared/Android.bp b/packages/SystemUI/shared/Android.bp
index 0fb1200..eb71698 100644
--- a/packages/SystemUI/shared/Android.bp
+++ b/packages/SystemUI/shared/Android.bp
@@ -20,6 +20,9 @@
"src/**/I*.aidl",
],
+ // Enforce that the library is build agains java 7 so that there are
+ // no compatibility issues with launcher
+ java_version: "1.7",
}
android_app {
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/BackgroundTaskLoader.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/BackgroundTaskLoader.java
index a0e7752..19e8673 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/BackgroundTaskLoader.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/BackgroundTaskLoader.java
@@ -110,11 +110,19 @@
synchronized(mLoadQueue) {
try {
mWaitingOnLoadQueue = true;
- mMainThreadHandler.post(
- () -> mOnIdleChangedListener.onIdleChanged(true));
+ mMainThreadHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mOnIdleChangedListener.onIdleChanged(true);
+ }
+ });
mLoadQueue.wait();
- mMainThreadHandler.post(
- () -> mOnIdleChangedListener.onIdleChanged(false));
+ mMainThreadHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mOnIdleChangedListener.onIdleChanged(false);
+ }
+ });
mWaitingOnLoadQueue = false;
} catch (InterruptedException ie) {
ie.printStackTrace();
@@ -142,8 +150,12 @@
if (!mCancelled) {
// Notify that the task data has changed
- mMainThreadHandler.post(
- () -> t.notifyTaskDataLoaded(thumbnailData, icon));
+ mMainThreadHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ t.notifyTaskDataLoaded(thumbnailData, icon);
+ }
+ });
}
}
}
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/HighResThumbnailLoader.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/HighResThumbnailLoader.java
index 24ba998..852463f 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/HighResThumbnailLoader.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/HighResThumbnailLoader.java
@@ -34,7 +34,8 @@
/**
* Loader class that loads full-resolution thumbnails when appropriate.
*/
-public class HighResThumbnailLoader implements TaskCallbacks {
+public class HighResThumbnailLoader implements
+ TaskCallbacks, BackgroundTaskLoader.OnIdleChangedListener {
private final ActivityManagerWrapper mActivityManager;
@@ -80,6 +81,11 @@
updateLoading();
}
+ @Override
+ public void onIdleChanged(boolean idle) {
+ setTaskLoadQueueIdle(idle);
+ }
+
/**
* Sets whether the other task load queue is idling. Avoid double-loading bitmaps by not
* starting this queue until the other queue is idling.
@@ -220,15 +226,18 @@
}
}
- private void loadTask(Task t) {
- ThumbnailData thumbnail = mActivityManager.getTaskThumbnail(t.key.id,
+ private void loadTask(final Task t) {
+ final ThumbnailData thumbnail = mActivityManager.getTaskThumbnail(t.key.id,
false /* reducedResolution */);
- mMainThreadHandler.post(() -> {
- synchronized (mLoadQueue) {
- mLoadingTasks.remove(t);
- }
- if (mVisibleTasks.contains(t)) {
- t.notifyTaskDataLoaded(thumbnail, t.icon);
+ mMainThreadHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ synchronized (mLoadQueue) {
+ mLoadingTasks.remove(t);
+ }
+ if (mVisibleTasks.contains(t)) {
+ t.notifyTaskDataLoaded(thumbnail, t.icon);
+ }
}
});
}
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/RecentsTaskLoader.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/RecentsTaskLoader.java
index ab2e277..996c837 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/RecentsTaskLoader.java
@@ -110,8 +110,7 @@
mActivityInfoCache = new LruCache<>(numRecentTasks);
mIconLoader = createNewIconLoader(context, mIconCache, mActivityInfoCache);
- mLoader = new BackgroundTaskLoader(mLoadQueue, mIconLoader,
- mHighResThumbnailLoader::setTaskLoadQueueIdle);
+ mLoader = new BackgroundTaskLoader(mLoadQueue, mIconLoader, mHighResThumbnailLoader);
}
protected IconLoader createNewIconLoader(Context context,TaskKeyLruCache<Drawable> iconCache,
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/TaskStack.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/TaskStack.java
index a369397..c731ac9 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/TaskStack.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/TaskStack.java
@@ -19,6 +19,7 @@
import android.content.ComponentName;
import android.util.ArrayMap;
import android.util.ArraySet;
+import android.util.SparseArray;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.utilities.AnimationProps;
@@ -67,7 +68,12 @@
public TaskStack() {
// Ensure that we only show stack tasks
- mStackTaskList.setFilter((taskIdMap, t, index) -> t.isStackTask);
+ mStackTaskList.setFilter(new TaskFilter() {
+ @Override
+ public boolean acceptTask(SparseArray<Task> taskIdMap, Task t, int index) {
+ return t.isStackTask;
+ }
+ });
}
/** Sets the callbacks for this task stack. */
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
index 0ded963..b04d047 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
@@ -201,8 +201,8 @@
/**
* Starts the recents activity. The caller should manage the thread on which this is called.
*/
- public void startRecentsActivity(Intent intent, AssistDataReceiver assistDataReceiver,
- RecentsAnimationListener animationHandler, Consumer<Boolean> resultCallback,
+ public void startRecentsActivity(Intent intent, final AssistDataReceiver assistDataReceiver,
+ final RecentsAnimationListener animationHandler, final Consumer<Boolean> resultCallback,
Handler resultCallbackHandler) {
try {
IAssistDataReceiver receiver = null;
@@ -284,9 +284,9 @@
* @param resultCallback The result success callback
* @param resultCallbackHandler The handler to receive the result callback
*/
- public void startActivityFromRecentsAsync(Task.TaskKey taskKey, ActivityOptions options,
- int windowingMode, int activityType, Consumer<Boolean> resultCallback,
- Handler resultCallbackHandler) {
+ public void startActivityFromRecentsAsync(final Task.TaskKey taskKey, ActivityOptions options,
+ int windowingMode, int activityType, final Consumer<Boolean> resultCallback,
+ final Handler resultCallbackHandler) {
if (taskKey.windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
// We show non-visible docked tasks in Recents, but we always want to launch
// them in the fullscreen stack.
@@ -364,7 +364,7 @@
/**
* Requests that the system close any open system windows (including other SystemUI).
*/
- public void closeSystemWindows(String reason) {
+ public void closeSystemWindows(final String reason) {
mBackgroundExecutor.submit(new Runnable() {
@Override
public void run() {
@@ -380,7 +380,7 @@
/**
* Removes a task by id.
*/
- public void removeTask(int taskId) {
+ public void removeTask(final int taskId) {
mBackgroundExecutor.submit(new Runnable() {
@Override
public void run() {
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationAdapterCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationAdapterCompat.java
index 625b1de..61be076 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationAdapterCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationAdapterCompat.java
@@ -41,11 +41,11 @@
}
private static IRemoteAnimationRunner.Stub wrapRemoteAnimationRunner(
- RemoteAnimationRunnerCompat remoteAnimationAdapter) {
+ final RemoteAnimationRunnerCompat remoteAnimationAdapter) {
return new IRemoteAnimationRunner.Stub() {
@Override
public void onAnimationStart(RemoteAnimationTarget[] apps,
- IRemoteAnimationFinishedCallback finishedCallback) throws RemoteException {
+ final IRemoteAnimationFinishedCallback finishedCallback) {
final RemoteAnimationTargetCompat[] appsCompat =
RemoteAnimationTargetCompat.wrap(apps);
final Runnable animationFinishedCallback = new Runnable() {
@@ -63,7 +63,7 @@
}
@Override
- public void onAnimationCancelled() throws RemoteException {
+ public void onAnimationCancelled() {
remoteAnimationAdapter.onAnimationCancelled();
}
};
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
index 217e0aa..dc4eb3b 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
@@ -21,6 +21,7 @@
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
+import android.view.ThreadedRenderer;
import android.view.View;
import android.view.ViewRootImpl;
@@ -47,11 +48,13 @@
* @param params The surface parameters to apply. DO NOT MODIFY the list after passing into
* this method to avoid synchronization issues.
*/
- public void scheduleApply(SurfaceParams... params) {
+ public void scheduleApply(final SurfaceParams... params) {
if (mTargetViewRootImpl == null) {
return;
}
- mTargetViewRootImpl.registerRtFrameCallback(frame -> {
+ mTargetViewRootImpl.registerRtFrameCallback(new ThreadedRenderer.FrameDrawingCallback() {
+ @Override
+ public void onFrameDraw(long frame) {
if (mTargetSurface == null || !mTargetSurface.isValid()) {
return;
}
@@ -64,6 +67,7 @@
}
t.setEarlyWakeup();
t.apply();
+ }
});
// Make sure a frame gets scheduled.