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

Commit 53810d70 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Fix for the race in Wallpaperservice" into gingerbread

parents d765ad15 a0c92d49
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -763,6 +763,7 @@ public abstract class WallpaperService extends Service {
        }
        
        void detach() {
           synchronized (mLock) {
            if (mDestroyed) {
                return;
            }
@@ -806,6 +807,7 @@ public abstract class WallpaperService extends Service {
            }
           }
        }
    }
    
    class IWallpaperEngineWrapper extends IWallpaperEngine.Stub
            implements HandlerCaller.Callback {
@@ -874,13 +876,17 @@ public abstract class WallpaperService extends Service {
                    }
                    Engine engine = onCreateEngine();
                    mEngine = engine;
                    synchronized (mActiveEngines) {
                        mActiveEngines.add(engine);
                    }
                    engine.attach(this);
                    return;
                }
                case DO_DETACH: {
                    mActiveEngines.remove(mEngine);
                    mEngine.detach();
                    synchronized (mActiveEngines) {
                        mActiveEngines.remove(mEngine);
                    }
                    return;
                }
                case DO_SET_DESIRED_SIZE: {
@@ -958,11 +964,13 @@ public abstract class WallpaperService extends Service {
    @Override
    public void onDestroy() {
        super.onDestroy();
        synchronized (mActiveEngines) {
           for (int i=0; i<mActiveEngines.size(); i++) {
               mActiveEngines.get(i).detach();
           }
           mActiveEngines.clear();
        }
    }

    /**
     * Implement to return the implementation of the internal accessibility