博客專欄

        EEPW首頁 > 博客 > 方法|rk3568開發平臺如何去除android正在啟動彈窗

        方法|rk3568開發平臺如何去除android正在啟動彈窗

        發布人:TQwangbin 時間:2023-12-21 來源:工程師 發布文章
        去除android正在啟動彈窗  

        開機以后,設備會有一個android is starting的彈框,該界面就是FallbackHome。

        FallbackHome機制是為了在系統還沒有解鎖前先進入Setting中的android正在啟動彈窗 的頁面等系統完全解鎖后,然后進入默認Launcher但是彈窗也會影響產品效果,所以最后去掉這個彈窗不顯示在桌面壁紙,直接進入Launcher。

        1、延長開機動畫 在解鎖后直接進去Launcher  

        在WindowManagerService.java中,注釋掉退出開機動畫的邏輯,延時開機動畫            
        路徑:frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java            
                   
        private void performEnableScreen() {            
            synchronized (mGlobalLock) {            
                if (DEBUG_BOOT) Slog.i(TAG_WM, "performEnableScreen: mDisplayEnabled=" + mDisplayEnabled            
                        + " mForceDisplayEnabled=" + mForceDisplayEnabled            
                        + " mShowingBootMessages=" + mShowingBootMessages            
                        + " mSystemBooted=" + mSystemBooted            
                        + " mOnlyCore=" + mOnlyCore,            
                        new RuntimeException("here").fillInStackTrace());            
                if (mDisplayEnabled) {            
                    return;            
                }            
                if (!mSystemBooted && !mShowingBootMessages) {            
                    return;            
                }            
                   
                if (!mShowingBootMessages && !mPolicy.canDismissBootAnimation()) {            
                    return;            
                }            
                   
                // Don't enable the screen until all existing windows have been drawn.            
                if (!mForceDisplayEnabled            
                        // TODO(multidisplay): Expand to all displays?            
                        && getDefaultDisplayContentLocked().checkWaitingForWindows()) {            
                    return;            
                }            
                //在這里處理播放完開機動畫后是否退出開機動畫,所以注釋掉            
                //phoebe add for Extend Animation at ActivityRecord.java onWindowsDrawn start            
                /*if (!mBootAnimationStopped) {            
                    Trace.asyncTraceBegin(TRACE_TAG_WINDOW_MANAGER, "Stop bootanim", 0);            
                    // stop boot animation            
                    // formerly we would just kill the process, but we now ask it to exit so it            
                    // can choose where to stop the animation.            
                    SystemProperties.set("service.bootanim.exit", "1");            
                    mBootAnimationStopped = true;            
                }            
                if (!mForceDisplayEnabled && !checkBootAnimationCompleteLocked()) {            
                    if (DEBUG_BOOT) Slog.i(TAG_WM, "performEnableScreen: Waiting for anim complete");            
                    return;            
                }            
                try {            
                    IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlinger");            
                    if (surfaceFlinger != null) {            
                        Slog.i(TAG_WM, "******* TELLING SURFACE FLINGER WE ARE BOOTED!");            
                        Parcel data = Parcel.obtain();            
                        data.writeInterfaceToken("android.ui.ISurfaceComposer");            
                        surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION, // BOOT_FINISHED            
                                data, null, 0);            
                        data.recycle();            
                    }            
                } catch (RemoteException ex) {            
                    Slog.e(TAG_WM, "Boot completed: SurfaceFlinger is dead!");            
                }*/            
                //phoebe add for Extend Animation at ActivityRecord.java onWindowsDrawn end            
                            
                EventLog.writeEvent(EventLogTags.WM_BOOT_ANIMATION_DONE, SystemClock.uptimeMillis());            
                Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, "Stop bootanim", 0);            
                mDisplayEnabled = true;            
                if (DEBUG_SCREEN_ON || DEBUG_BOOT) Slog.i(TAG_WM, "******************** ENABLING SCREEN!");            
                   
                // Enable input dispatch.            
                mInputManagerCallback.setEventDispatchingLw(mEventDispatchingEnabled);            
            }            
                   
            try {            
                mActivityManager.bootAnimationComplete();            
            } catch (RemoteException e) {            
            }            
                   
            mPolicy.enableScreenAfterBoot();            
                   
            // Make sure the last requested orientation has been applied.            
            updateRotationUnchecked(false, false);            
        }            
           

        2、解鎖結束后退出開機動畫在ActivityRecord中onWindowsDrawn( 退出動畫 開啟系統手勢觸摸功能)  

        路徑:frameworks/base/services/core/java/com/android/server/wm/ActivityRecord.java            
        /** Called when the windows associated app window container are drawn. */            
        public void onWindowsDrawn(boolean drawn, long timestamp) {            
            synchronized (mAtmService.mGlobalLock) {            
                mDrawn = drawn;            
                if (!drawn) {            
                    return;            
                }            
                final WindowingModeTransitionInfoSnapshot info = mStackSupervisor            
                        .getActivityMetricsLogger().notifyWindowsDrawn(getWindowingMode(), timestamp);            
                final int windowsDrawnDelayMs = info != null ? info.windowsDrawnDelayMs : INVALID_DELAY;            
                final @LaunchState int launchState = info != null ? info.getLaunchState() : -1;            
                mStackSupervisor.reportActivityLaunchedLocked(false /* timeout */, this,            
                        windowsDrawnDelayMs, launchState);            
                mStackSupervisor.stopWaitingForActivityVisible(this);            
                finishLaunchTickingLocked();            
                if (task != null) {            
                    task.hasBeenVisible = true;            
                }            
                //解鎖后退出開機動畫            
                // phoebe add for exit bootanim start            
                if (isHomeIntent(intent) && shortComponentName != null && !shortComponentName.contains("FallbackHome")) {            
                    SystemProperties.set("service.bootanim.exit", "1");            
                    android.util.Log.e("ActivityRecord", "real home....." + shortComponentName);            
                   
                    try {            
                        IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlinger");            
                        if (surfaceFlinger != null) {            
                            Slog.i(TAG_WM, "******* TELLING SURFACE FLINGER WE ARE BOOTED!");            
                            Parcel data = Parcel.obtain();            
                            data.writeInterfaceToken("android.ui.ISurfaceComposer");            
                            surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION, // BOOT_FINISHED            
                                    data, null, 0);            
                            data.recycle();            
                        }            
                    } catch (RemoteException ex) {            
                        Slog.e(TAG, "Boot completed: SurfaceFlinger is dead!");            
                    }            
                }            
                // phoebe add for exit bootanim end            
                   
                //modify for performance begin            
                Bundle b = new Bundle();            
                b.putLong(ProcessInfo.KEY_LAUNCH_TIME, (long)windowsDrawnDelayMs);            
                b.putBoolean(ProcessInfo.KEY_FULLSCREEN, (task != null && task.mFullscreen));            
                mAtmService.notifyActivityStateChange(this.intent, ProcessInfo.ACTIVITY_STATE_LAUNCHDONE, b);            
                //modify for performance end            
            }            
        }            

        3、去掉Settings 的Android 正在啟動… 彈窗  

        //packages\apps\Settings\src\com\android\settings\FallbackHome.java            
            private final Runnable mProgressTimeoutRunnable = () -> {            
                //phoebe add for remove android is starting tips            
        //        View v = getLayoutInflater().inflate(            
        //                R.layout.fallback_home_finishing_boot, null /* root */);            
        //        setContentView(v);            
        //        v.setAlpha(0f);            
        //        v.animate()            
        //                .alpha(1f)            
        //                .setDuration(500)            
        //                .setInterpolator(AnimationUtils.loadInterpolator(            
        //                        this, android.R.interpolator.fast_out_slow_in))            
        //                .start();            
                getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);            
            };            

        重新編譯燒錄即可!



        -END-


        *博客內容為網友個人發布,僅代表博主個人觀點,如有侵權請聯系工作人員刪除。



        關鍵詞: 嵌入式 ARM開發

        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 登封市| 武山县| 桐城市| 平陆县| 积石山| 泸溪县| 彭州市| 桦甸市| 南木林县| 翁牛特旗| 万山特区| 彩票| 信丰县| 遂溪县| 师宗县| 文山县| 金塔县| 南平市| 左权县| 印江| 三穗县| 松溪县| 怀柔区| 洛川县| 巴塘县| 江北区| 嘉善县| 秀山| 南漳县| 张家川| 城口县| 宣化县| 凤山县| 阳泉市| 富源县| 河北区| 延寿县| 滁州市| 阳江市| 康定县| 岢岚县|