新闻  |   论坛  |   博客  |   在线研讨会
方法|rk3568开发平台如何去除android正在启动弹窗
TQwangbin | 2023-12-21 15:47:48    阅读:189   发布文章

去除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-


*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
推荐文章
最近访客