vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/ImageWallpaper.java
private void loadWallpaper(boolean needsDraw, boolean needsReset)
上方法的异步改为同步进行测试(目的是将异步改为同步

            private void loadWallpaper(boolean needsDraw, boolean needsReset) {        mNeedsDrawAfterLoadingWallpaper |= needsDraw;        if (mLoader != null) {            if (needsReset) {                mLoader.cancel(false /* interrupt */);                mLoader = null;            } else {                if (DEBUG) {                    Log.d(TAG, "Skipping loadWallpaper, already in flight ");                }                return;            }        }        /* SUN:jicong.wang remove for ALPS03943376        mLoader = new AsyncTask() {            @Override            protected Bitmap doInBackground(Void... params) {                Throwable exception;                try {                    if (needsReset) {                        mWallpaperManager.forgetLoadedWallpaper();                    }                    return mWallpaperManager.getBitmap();                } catch (RuntimeException | OutOfMemoryError e) {                    exception = e;                }                if (isCancelled()) {                    return null;                }                if (exception != null) {                    // Note that if we do fail at this, and the default wallpaper can't                    // be loaded, we will go into a cycle.  Don't do a build where the                    // default wallpaper can't be loaded.                    Log.w(TAG, "Unable to load wallpaper!", exception);                    try {                        mWallpaperManager.clear();                    } catch (IOException ex) {                        // now we're really screwed.                        Log.w(TAG, "Unable reset to default wallpaper!", ex);                    }                    if (isCancelled()) {                        return null;                    }                    try {                        return mWallpaperManager.getBitmap();                    } catch (RuntimeException | OutOfMemoryError e) {                        Log.w(TAG, "Unable to load default wallpaper!", e);                    }                }                return null;            }            @Override            protected void onPostExecute(Bitmap b) {                mBackground = null;                mBackgroundWidth = -1;                mBackgroundHeight = -1;                if (b != null) {                    mBackground = b;                    mBackgroundWidth = mBackground.getWidth();                    mBackgroundHeight = mBackground.getHeight();                }                if (DEBUG) {                    Log.d(TAG, "Wallpaper loaded: " + mBackground);                }                updateSurfaceSize(getSurfaceHolder(), getDefaultDisplayInfo(),                        false );                if (mNeedsDrawAfterLoadingWallpaper) {                    drawFrame();                }                mLoader = null;                mNeedsDrawAfterLoadingWallpaper = false;            }        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);        */        /*SUN:jicong.wang add start ALPS03943376 {@*/        Bitmap  b = null;        Throwable exception = null;        try {            if (needsReset) {                mWallpaperManager.forgetLoadedWallpaper();            }            b =  mWallpaperManager.getBitmap();        } catch (RuntimeException | OutOfMemoryError e) {            exception = e;        }        if (exception != null) {            // Note that if we do fail at this, and the default wallpaper can't            // be loaded, we will go into a cycle.  Don't do a build where the            // default wallpaper can't be loaded.            Log.w(TAG, "Unable to load wallpaper!", exception);            try {                mWallpaperManager.clear();            } catch (IOException ex) {                // now we're really screwed.                Log.w(TAG, "Unable reset to default wallpaper!", ex);            }            try {                b =  mWallpaperManager.getBitmap();            } catch (RuntimeException | OutOfMemoryError e) {                Log.w(TAG, "Unable to load default wallpaper!", e);            }        }        mBackground = null;        mBackgroundWidth = -1;        mBackgroundHeight = -1;        if (b != null) {            mBackground = b;            mBackgroundWidth = mBackground.getWidth();            mBackgroundHeight = mBackground.getHeight();        }        if (DEBUG) {            Log.d(TAG, "Wallpaper loaded: " + mBackground);        }        updateSurfaceSize(getSurfaceHolder(), getDefaultDisplayInfo(),                false );        if (mNeedsDrawAfterLoadingWallpaper) {            drawFrame();        }        mLoader = null;        mNeedsDrawAfterLoadingWallpaper = false;            /*SUN:jicong.wang add end ALPS03943376 @}*/               }

更多相关文章

  1. 浅谈Java中Collections.sort对List排序的两种方法
  2. Python list sort方法的具体使用
  3. python list.sort()根据多个关键字排序的方法实现
  4. Android(安卓)Bitmap Drawable byte[] InputStream 相互转换方法
  5. 解析底层原理!月薪20k+的Android面试都问些什么?深夜思考
  6. Android中的消息机制
  7. Android第一行代码——14章继续进阶-你还应该掌握的高级技巧
  8. android auto 能微信_5分钟搞定Flutter与Android(安卓)的交互(内
  9. 三. Android安全测试:为挂钩而战-Xposed模块编写

随机推荐

  1. android 7.1 默认壁纸拉伸问题
  2. android TextUtils的使用
  3. Android点击左右按钮实现左右滑动页面切
  4. Android(安卓)开 发 资 源 分 享
  5. Android(安卓)Camera调用过程分析
  6. android Menu相关
  7. Android(安卓)5.0 如何正确启用isLoggabl
  8. Android:注册登录
  9. android 视频播放器的INTENT-FILTER属性
  10. android的文件操作