美文网首页
开机壁纸下半部分黑屏2-3秒

开机壁纸下半部分黑屏2-3秒

作者: 梧叶已秋声 | 来源:发表于2021-01-12 11:08 被阅读0次

屏蔽掉AsyncTask,将异步改为同步,可能由于机器性能原因导致下半部分黑屏(加载太慢了)。

//vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/ImageWallpaper.java
        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;
                }
            }
         /*   mLoader = new AsyncTask<Void, Void, Bitmap>() {
                @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 *//* forDraw *//*);
                    if (mNeedsDrawAfterLoadingWallpaper) {
                        drawFrame();
                    }

                    mLoader = null;
                    mNeedsDrawAfterLoadingWallpaper = false;
                }
            }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);*/
            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;
        }

参考链接:
android 8.1 开机壁纸下半部分黑屏2-3秒的问题解决

相关文章

  • 开机壁纸下半部分黑屏2-3秒

    屏蔽掉AsyncTask,将异步改为同步,可能由于机器性能原因导致下半部分黑屏(加载太慢了)。 参考链接:andr...

  • 2018-12-10

    开机后黑屏只有鼠标怎么回事,开机后黑屏故障排除教程 电脑开机黑屏,只有一个光标在不停地闪,不管你等多少个时...

  • 问题二:Android系统第一次开机启动Launcher黑屏问题

    现象: 系统第一次开机启动,进入桌面前黑屏10秒.log信息: 启动超时:ActivityManager: Lau...

  • 电脑黑屏怎么办

    1,黑屏是啥?先看看黑屏的样子吧。 2,为啥黑屏?想想黑屏常常发生在啥时候?场景1:开机360提醒你软件更新,漏洞...

  • 笔记本电脑突然黑屏,手足无措?

    人们对笔记本电脑的使用已经是非常普遍的现象了,电脑开机黑屏怎么办,相信大部分人当看到自己的电脑出现黑屏现象时,都是...

  • kernel logo到开机动画之间闪现黑屏

    [DESCRIPTION] 现象:L版本开机时,kernel logo与开机动画之间闪一帧黑屏。 [SOLUTIO...

  • LCD液晶显示器开机黑屏无暗像是怎么回事

    LCD液晶显示器开机黑屏无暗像是怎么回事? 分析检修:这种现象比较特殊,刚开机时有图像显示但使用一段时间后黑屏,或...

  • 求助大佬

    华硕笔记本电脑K55ZE 重装系统后安装驱动就黑屏,然后试着恢复出厂设置,然后现在开机黑屏,硬盘指示灯开机前几秒会...

  • 被大数据鄙视了

    上个周儿子说他的电脑出问题了,关机后重启无法开机,开机后时不时就黑屏了。还说一旦黑屏了,自己正在做的简历就无法保存...

  • ubuntu 开机黑屏处理

    1 桌面坏了 开机,黑屏,按ctrl+alt+f1 进入命令行模式,根据自己的桌面模式选择重新安装桌面 1 Uni...

网友评论

      本文标题:开机壁纸下半部分黑屏2-3秒

      本文链接:https://www.haomeiwen.com/subject/xgssaktx.html