方法|rk3568開發(fā)平臺如何去除android正在啟動彈窗
開機以后,設備會有一個android is starting的彈框,該界面就是FallbackHome。
FallbackHome機制是為了在系統(tǒng)還沒有解鎖前先進入Setting中的android正在啟動彈窗 的頁面等系統(tǒng)完全解鎖后,然后進入默認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);
}
路徑: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
}
}
//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-
*博客內容為網友個人發(fā)布,僅代表博主個人觀點,如有侵權請聯(lián)系工作人員刪除。