Merge "Call bootFinished using JNI."

This commit is contained in:
Carlos Martinez Romero
2022-12-12 17:00:51 +00:00
committed by Android (Google) Code Review
4 changed files with 32 additions and 27 deletions

View File

@@ -275,6 +275,7 @@ public final class SurfaceControl implements Parcelable {
int l, int t, int r, int b);
private static native void nativeSetDefaultApplyToken(IBinder token);
private static native IBinder nativeGetDefaultApplyToken();
private static native boolean nativeBootFinished();
/**
@@ -2375,6 +2376,14 @@ public final class SurfaceControl implements Parcelable {
return nativeGetGPUContextPriority();
}
/**
* Lets surfaceFlinger know the boot procedure is completed.
* @hide
*/
public static boolean bootFinished() {
return nativeBootFinished();
}
/**
* Interface to handle request to
* {@link SurfaceControl.Transaction#addTransactionCommittedListener(Executor, TransactionCommittedListener)}
@@ -3870,4 +3879,5 @@ public final class SurfaceControl implements Parcelable {
SyncFence fence = new SyncFence(nativeFencePtr);
callback.accept(fence);
}
}

View File

@@ -1906,6 +1906,11 @@ static jobject nativeGetDefaultApplyToken(JNIEnv* env, jclass clazz) {
return javaObjectForIBinder(env, token);
}
static jboolean nativeBootFinished(JNIEnv* env, jclass clazz) {
status_t error = SurfaceComposerClient::bootFinished();
return error == OK ? JNI_TRUE : JNI_FALSE;
}
// ----------------------------------------------------------------------------
SurfaceControl* android_view_SurfaceControl_getNativeSurfaceControl(JNIEnv* env,
@@ -2138,6 +2143,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeSetDefaultApplyToken },
{"nativeGetDefaultApplyToken", "()Landroid/os/IBinder;",
(void*)nativeGetDefaultApplyToken },
{"nativeBootFinished", "()Z",
(void*)nativeBootFinished },
// clang-format on
};

View File

@@ -805,6 +805,12 @@
"group": "WM_DEBUG_CONTENT_RECORDING",
"at": "com\/android\/server\/wm\/ContentRecorder.java"
},
"-1323783276": {
"message": "performEnableScreen: bootFinished() failed.",
"level": "WARN",
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"-1318478129": {
"message": "applyAnimation: win=%s anim=%d attr=0x%x a=%s transit=%d type=%d isEntrance=%b Callers %s",
"level": "VERBOSE",
@@ -1603,6 +1609,12 @@
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"-576580969": {
"message": "viewServerWindowCommand: bootFinished() failed.",
"level": "WARN",
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"-576070986": {
"message": "Performing post-rotate rotation after seamless rotation",
"level": "INFO",
@@ -2113,12 +2125,6 @@
"group": "WM_DEBUG_FOCUS_LIGHT",
"at": "com\/android\/server\/wm\/DisplayContent.java"
},
"-87703044": {
"message": "Boot completed: SurfaceFlinger is dead!",
"level": "ERROR",
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"-86763148": {
"message": " KILL SURFACE SESSION %s",
"level": "INFO",
@@ -2911,12 +2917,6 @@
"group": "WM_DEBUG_CONTENT_RECORDING",
"at": "com\/android\/server\/wm\/ContentRecorder.java"
},
"620368427": {
"message": "******* TELLING SURFACE FLINGER WE ARE BOOTED!",
"level": "INFO",
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"620519522": {
"message": "findFocusedWindow: No focusable windows, display=%d",
"level": "VERBOSE",

View File

@@ -168,7 +168,6 @@ import android.app.IActivityManager;
import android.app.IAssistDataReceiver;
import android.app.WindowConfiguration;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -178,7 +177,6 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManagerInternal;
import android.content.pm.TestUtilityService;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.graphics.Bitmap;
@@ -3718,19 +3716,9 @@ public class WindowManagerService extends IWindowManager.Stub
return;
}
try {
// TODO(b/221898546): remove the following and convert to jni
IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlingerAIDL");
if (surfaceFlinger != null) {
ProtoLog.i(WM_ERROR, "******* TELLING SURFACE FLINGER WE ARE BOOTED!");
Parcel data = Parcel.obtain();
data.writeInterfaceToken("android.gui.ISurfaceComposer");
surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION, // BOOT_FINISHED
data, null, 0);
data.recycle();
}
} catch (RemoteException ex) {
ProtoLog.e(WM_ERROR, "Boot completed: SurfaceFlinger is dead!");
if (!SurfaceControl.bootFinished()) {
ProtoLog.w(WM_ERROR, "performEnableScreen: bootFinished() failed.");
return;
}
EventLogTags.writeWmBootAnimationDone(SystemClock.uptimeMillis());