Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38acfe29 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Refactor unused methods and unnecessary members."

parents c0a9edb6 b1ef3696
Loading
Loading
Loading
Loading
+5 −24
Original line number Diff line number Diff line
@@ -100,7 +100,6 @@ public abstract class WallpaperService extends Service {
    private static final int MSG_WINDOW_MOVED = 10035;
    private static final int MSG_TOUCH_EVENT = 10040;
    
    private Looper mCallbackLooper;
    private final ArrayList<Engine> mActiveEngines
            = new ArrayList<Engine>();
    
@@ -961,13 +960,7 @@ public abstract class WallpaperService extends Service {
        IWallpaperEngineWrapper(WallpaperService context,
                IWallpaperConnection conn, IBinder windowToken,
                int windowType, boolean isPreview, int reqWidth, int reqHeight) {
            if (DEBUG && mCallbackLooper != null) {
                mCallbackLooper.setMessageLogging(new LogPrinter(Log.VERBOSE, TAG));
            }
            mCaller = new HandlerCaller(context,
                    mCallbackLooper != null
                            ? mCallbackLooper : context.getMainLooper(),
                    this);
            mCaller = new HandlerCaller(context, context.getMainLooper(), this);
            mConnection = conn;
            mWindowToken = windowToken;
            mWindowType = windowType;
@@ -1105,6 +1098,7 @@ public abstract class WallpaperService extends Service {
            mTarget = context;
        }

        @Override
        public void attach(IWallpaperConnection conn, IBinder windowToken,
                int windowType, boolean isPreview, int reqWidth, int reqHeight) {
            new IWallpaperEngineWrapper(mTarget, conn, windowToken,
@@ -1135,19 +1129,6 @@ public abstract class WallpaperService extends Service {
        return new IWallpaperServiceWrapper(this);
    }

    /**
     * This allows subclasses to change the thread that most callbacks
     * occur on.  Currently hidden because it is mostly needed for the
     * image wallpaper (which runs in the system process and doesn't want
     * to get stuck running on that seriously in use main thread).  Not
     * exposed right now because the semantics of this are not totally
     * well defined and some callbacks can still happen on the main thread).
     * @hide
     */
    public void setCallbackLooper(Looper looper) {
        mCallbackLooper = looper;
    }
    
    /**
     * Must be implemented to return a new instance of the wallpaper's engine.
     * Note that multiple instances may be active at the same time, such as
+21 −36
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.os.SystemProperties;
import android.renderscript.Matrix4f;
import android.service.wallpaper.WallpaperService;
import android.util.Log;
import android.view.Display;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.WindowManager;
@@ -41,7 +40,6 @@ import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -93,6 +91,7 @@ public class ImageWallpaper extends WallpaperService {
        return "1".equals(SystemProperties.get(PROPERTY_KERNEL_QEMU, "0"));
    }

    @Override
    public Engine onCreateEngine() {
        mEngine = new DrawableEngine();
        return mEngine;
@@ -102,8 +101,6 @@ public class ImageWallpaper extends WallpaperService {
        static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
        static final int EGL_OPENGL_ES2_BIT = 4;

        private final Object mLock = new Object[0];

        // TODO: Not currently used, keeping around until we know we don't need it
        @SuppressWarnings({"UnusedDeclaration"})
        private WallpaperObserver mReceiver;
@@ -125,7 +122,6 @@ public class ImageWallpaper extends WallpaperService {
        private EGLConfig mEglConfig;
        private EGLContext mEglContext;
        private EGLSurface mEglSurface;
        private GL mGL;

        private static final String sSimpleVS =
                "attribute vec4 position;\n" +
@@ -150,17 +146,16 @@ public class ImageWallpaper extends WallpaperService {
        private static final int TRIANGLE_VERTICES_DATA_UV_OFFSET = 3;

        class WallpaperObserver extends BroadcastReceiver {
            @Override
            public void onReceive(Context context, Intent intent) {
                if (DEBUG) {
                    Log.d(TAG, "onReceive");
                }

                synchronized (mLock) {
                mLastSurfaceWidth = mLastSurfaceHeight = -1;
                mBackground = null;
                mRedrawNeeded = true;
                    drawFrameLocked();
                }
                drawFrame();
            }
        }

@@ -234,14 +229,12 @@ public class ImageWallpaper extends WallpaperService {
                Log.d(TAG, "onVisibilityChanged: mVisible, visible=" + mVisible + ", " + visible);
            }

            synchronized (mLock) {
            if (mVisible != visible) {
                if (DEBUG) {
                    Log.d(TAG, "Visibility changed to visible=" + visible);
                }
                mVisible = visible;
                    drawFrameLocked();
                }
                drawFrame();
            }
        }

@@ -260,7 +253,6 @@ public class ImageWallpaper extends WallpaperService {
                        + ", xPixels=" + xPixels + ", yPixels=" + yPixels);
            }

            synchronized (mLock) {
            if (mXOffset != xOffset || mYOffset != yOffset) {
                if (DEBUG) {
                    Log.d(TAG, "Offsets changed to (" + xOffset + "," + yOffset + ").");
@@ -269,8 +261,7 @@ public class ImageWallpaper extends WallpaperService {
                mYOffset = yOffset;
                mOffsetsChanged = true;
            }
                drawFrameLocked();
            }
            drawFrame();
        }

        @Override
@@ -281,9 +272,7 @@ public class ImageWallpaper extends WallpaperService {

            super.onSurfaceChanged(holder, format, width, height);

            synchronized (mLock) {
                drawFrameLocked();
            }
            drawFrame();
        }

        @Override
@@ -305,12 +294,10 @@ public class ImageWallpaper extends WallpaperService {
            }
            super.onSurfaceRedrawNeeded(holder);

            synchronized (mLock) {
                drawFrameLocked();
            }
            drawFrame();
        }

        void drawFrameLocked() {
        void drawFrame() {
            SurfaceHolder sh = getSurfaceHolder();
            final Rect frame = sh.getSurfaceFrame();
            final int dw = frame.width();
@@ -658,8 +645,6 @@ public class ImageWallpaper extends WallpaperService {
                        GLUtils.getEGLErrorString(mEgl.eglGetError()));
            }

            mGL = mEglContext.getGL();

            return true;
        }