[RK3288][Android5.1] 让开机动画(BootAnimation)提前一秒结束

动画在WindowManagerService停掉是最合适的,也就是说快要进入Android桌面前一秒让动画结束是允许被接受的。

vr_rk3288\frameworks\base\cmds\bootanimation\BootAnimation.cpp

vr_rk3288\frameworks\native\services\surfaceflinger\SurfaceFlinger.cpp

vr_rk3288\frameworks\base\services\core\java\com\android\server\wm\WindowManagerService.java


czz@xxx:~/vr_rk3288$ mmm frameworks/base/cmds/bootanimation/ -B -j24
czz@xxx:~/vr_rk3288$ mmm frameworks/native/services/surfaceflinger -B -j24
czz@xxx:~/vr_rk3288$ mmm frameworks/base/services/ -B -j24
czz@xxx:~/vr_rk3288$ ./mkimage.sh

C:\Users\Administrator>adb logcat -s -vtime BootAnimation
C:\Users\Administrator>adb logcat -s -vtime SurfaceFlinger
C:\Users\Administrator>adb logcat -s -vtime WindowManagerService

C:\Users\Administrator>adb root
C:\Users\Administrator>adb remount
C:\Users\Administrator>adb out\target\product\rk3288\system\framework\services.jar system/framework/
C:\Users\Administrator>adb reboot


////////////////////////////////////////  以上都是编译和调试的部分,属于题外话。本人调试/探索答案的过程中的摸索。

只要修改 WindowManagerService.java的部分就可以让动画提前一秒结束。

    public void enableScreenAfterBoot() {
     Slog.e(TAG, "ENABLESCREENAFTERBOOT");
try {                                                                           
    IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlinger");       
    if (surfaceFlinger != null) {                                               
        //Slog.i(TAG, "******* 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!");                     
}     
//...


当然了,这里面用到了 binder机制。从上层到下层。

这个try -catch 在 WindowManagerService.java 文件中其他的位置也有提到。

你可能感兴趣的:(Android,RockChip)