Merge "Fixing potential ANR when fetching for wallpaper info" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2b80d6f813
@@ -14,6 +14,8 @@ import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.annotation.AnyThread;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
@@ -182,6 +184,7 @@ public class WallpaperOffsetInterpolator extends BroadcastReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
private void updateOffset() {
|
||||
Message.obtain(mHandler, MSG_SET_NUM_PARALLAX, getNumPagesForWallpaperParallax(), 0,
|
||||
mWindowToken).sendToTarget();
|
||||
@@ -206,9 +209,12 @@ public class WallpaperOffsetInterpolator extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
mWallpaperIsLiveWallpaper =
|
||||
WallpaperManager.getInstance(mWorkspace.getContext()).getWallpaperInfo() != null;
|
||||
updateOffset();
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
// Updating the boolean on a background thread is fine as the assignments are atomic
|
||||
mWallpaperIsLiveWallpaper =
|
||||
WallpaperManager.getInstance(context).getWallpaperInfo() != null;
|
||||
updateOffset();
|
||||
});
|
||||
}
|
||||
|
||||
private static final int MSG_START_ANIMATION = 1;
|
||||
|
||||
Reference in New Issue
Block a user