From c552aca5e28e5e64f42fd8f91ca63f2fa5b01836 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 11 Apr 2022 19:55:17 +0000 Subject: Remove unused support for "encrypted" boot animations Since support for Full Disk Encryption was removed in favor of File Based Encryption, "CryptKeeper mode" no longer exists and the "vold.decrypt" system property is never set. Therefore, remove the unused code that supported showing special boot animations in this mode. Bug: 208476087 Change-Id: I3fa2549338e1889dd9e9b381c60c264b95181b35 --- cmds/bootanimation/BootAnimation.cpp | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'cmds/bootanimation/BootAnimation.cpp') diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 968be3e20791..20311587f146 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -71,8 +71,6 @@ static const char PRODUCT_BOOTANIMATION_DARK_FILE[] = "/product/media/bootanimat static const char PRODUCT_BOOTANIMATION_FILE[] = "/product/media/bootanimation.zip"; static const char SYSTEM_BOOTANIMATION_FILE[] = "/system/media/bootanimation.zip"; static const char APEX_BOOTANIMATION_FILE[] = "/apex/com.android.bootanimation/etc/bootanimation.zip"; -static const char PRODUCT_ENCRYPTED_BOOTANIMATION_FILE[] = "/product/media/bootanimation-encrypted.zip"; -static const char SYSTEM_ENCRYPTED_BOOTANIMATION_FILE[] = "/system/media/bootanimation-encrypted.zip"; static const char OEM_SHUTDOWNANIMATION_FILE[] = "/oem/media/shutdownanimation.zip"; static const char PRODUCT_SHUTDOWNANIMATION_FILE[] = "/product/media/shutdownanimation.zip"; static const char SYSTEM_SHUTDOWNANIMATION_FILE[] = "/system/media/shutdownanimation.zip"; @@ -652,23 +650,6 @@ bool BootAnimation::findBootAnimationFileInternal(const std::vector } void BootAnimation::findBootAnimationFile() { - // If the device has encryption turned on or is in process - // of being encrypted we show the encrypted boot animation. - char decrypt[PROPERTY_VALUE_MAX]; - property_get("vold.decrypt", decrypt, ""); - - bool encryptedAnimation = atoi(decrypt) != 0 || - !strcmp("trigger_restart_min_framework", decrypt); - - if (!mShuttingDown && encryptedAnimation) { - static const std::vector encryptedBootFiles = { - PRODUCT_ENCRYPTED_BOOTANIMATION_FILE, SYSTEM_ENCRYPTED_BOOTANIMATION_FILE, - }; - if (findBootAnimationFileInternal(encryptedBootFiles)) { - return; - } - } - const bool playDarkAnim = android::base::GetIntProperty("ro.boot.theme", 0) == 1; static const std::vector bootFiles = { APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE, -- cgit v1.2.3-59-g8ed1b From 0c2269fa4bb1dff5324955faead0ad36cb15572f Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Wed, 17 Aug 2022 05:13:59 +0000 Subject: SurfaceComposerClient: Remove setSize This function is a noop with the introduction of BLAST. Bug: 238781169 Test: presubmit Change-Id: I84917bed157a93ec9bfd16d168312ce27ff1765e --- cmds/bootanimation/BootAnimation.cpp | 4 ---- core/java/android/view/SurfaceControl.java | 2 -- core/jni/android_view_SurfaceControl.cpp | 10 ---------- 3 files changed, 16 deletions(-) (limited to 'cmds/bootanimation/BootAnimation.cpp') diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index dae4570456cd..814800bcd9e5 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -615,10 +615,6 @@ void BootAnimation::resizeSurface(int newWidth, int newHeight) { mWidth = limitedSize.width; mHeight = limitedSize.height; - SurfaceComposerClient::Transaction t; - t.setSize(mFlingerSurfaceControl, mWidth, mHeight); - t.apply(); - EGLConfig config = getEglConfig(mDisplay); EGLSurface surface = eglCreateWindowSurface(mDisplay, config, mFlingerSurface.get(), nullptr); if (eglMakeCurrent(mDisplay, surface, surface, mContext) == EGL_FALSE) { diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 84f04c12cf51..c4532621ee07 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -130,7 +130,6 @@ public final class SurfaceControl implements Parcelable { float x, float y); private static native void nativeSetScale(long transactionObj, long nativeObject, float x, float y); - private static native void nativeSetSize(long transactionObj, long nativeObject, int w, int h); private static native void nativeSetTransparentRegionHint(long transactionObj, long nativeObject, Region region); private static native void nativeSetAlpha(long transactionObj, long nativeObject, float alpha); @@ -2954,7 +2953,6 @@ public final class SurfaceControl implements Parcelable { @IntRange(from = 0) int w, @IntRange(from = 0) int h) { checkPreconditions(sc); mResizedSurfaces.put(sc, new Point(w, h)); - nativeSetSize(mNativeObject, sc.mNativeObject, w, h); return this; } diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 9ae16304b6c8..ffd32d8f405a 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -820,14 +820,6 @@ static void nativeSetStretchEffect(JNIEnv* env, jclass clazz, jlong transactionO transaction->setStretchEffect(ctrl, stretch); } -static void nativeSetSize(JNIEnv* env, jclass clazz, jlong transactionObj, - jlong nativeObject, jint w, jint h) { - auto transaction = reinterpret_cast(transactionObj); - - SurfaceControl* const ctrl = reinterpret_cast(nativeObject); - transaction->setSize(ctrl, w, h); -} - static void nativeSetFlags(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint flags, jint mask) { auto transaction = reinterpret_cast(transactionObj); @@ -2163,8 +2155,6 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetPosition }, {"nativeSetScale", "(JJFF)V", (void*)nativeSetScale }, - {"nativeSetSize", "(JJII)V", - (void*)nativeSetSize }, {"nativeSetTransparentRegionHint", "(JJLandroid/graphics/Region;)V", (void*)nativeSetTransparentRegionHint }, {"nativeSetDamageRegion", "(JJLandroid/graphics/Region;)V", -- cgit v1.2.3-59-g8ed1b From 4430510577b3c158bf9da9ac20bf586e0309fbf1 Mon Sep 17 00:00:00 2001 From: Huihong Luo Date: Mon, 26 Sep 2022 11:16:20 -0700 Subject: Remove internal display related methods Sync with changes made in SurfaceFlinger and SurfaceComposerClient. Use the system property, persist.boot.animation.displays, to determine the displays to show the boot animation. If the system property is not present, the first display from the display list is used. Bug: 241285477 Test: manual, run bootanim command to verify Change-Id: If29ecb12a68fc075daef2b8f674995d0f11cbc09 --- cmds/bootanimation/BootAnimation.cpp | 67 +++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 23 deletions(-) (limited to 'cmds/bootanimation/BootAnimation.cpp') diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 814800bcd9e5..8be8cdacfc84 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -492,28 +492,13 @@ ui::Size BootAnimation::limitSurfaceSize(int width, int height) const { status_t BootAnimation::readyToRun() { mAssets.addDefaultAssets(); - mDisplayToken = SurfaceComposerClient::getInternalDisplayToken(); - if (mDisplayToken == nullptr) + const std::vector ids = SurfaceComposerClient::getPhysicalDisplayIds(); + if (ids.empty()) { + SLOGE("Failed to get ID for any displays\n"); return NAME_NOT_FOUND; + } - DisplayMode displayMode; - const status_t error = - SurfaceComposerClient::getActiveDisplayMode(mDisplayToken, &displayMode); - if (error != NO_ERROR) - return error; - - mMaxWidth = android::base::GetIntProperty("ro.surface_flinger.max_graphics_width", 0); - mMaxHeight = android::base::GetIntProperty("ro.surface_flinger.max_graphics_height", 0); - ui::Size resolution = displayMode.resolution; - resolution = limitSurfaceSize(resolution.width, resolution.height); - // create the native surface - sp control = session()->createSurface(String8("BootAnimation"), - resolution.getWidth(), resolution.getHeight(), PIXEL_FORMAT_RGB_565, - ISurfaceComposerClient::eOpaque); - - SurfaceComposerClient::Transaction t; - - // this guest property specifies multi-display IDs to show the boot animation + // this system property specifies multi-display IDs to show the boot animation // multiple ids can be set with comma (,) as separator, for example: // setprop persist.boot.animation.displays 19260422155234049,19261083906282754 Vector physicalDisplayIds; @@ -540,9 +525,44 @@ status_t BootAnimation::readyToRun() { stream.ignore(); } + // the first specified display id is used to retrieve mDisplayToken + for (const auto id : physicalDisplayIds) { + if (std::find(ids.begin(), ids.end(), id) != ids.end()) { + if (const auto token = SurfaceComposerClient::getPhysicalDisplayToken(id)) { + mDisplayToken = token; + break; + } + } + } + } + + // If the system property is not present or invalid, display 0 is used + if (mDisplayToken == nullptr) { + mDisplayToken = SurfaceComposerClient::getPhysicalDisplayToken(ids.front()); + if (mDisplayToken == nullptr) { + return NAME_NOT_FOUND; + } + } + + DisplayMode displayMode; + const status_t error = + SurfaceComposerClient::getActiveDisplayMode(mDisplayToken, &displayMode); + if (error != NO_ERROR) { + return error; + } + + mMaxWidth = android::base::GetIntProperty("ro.surface_flinger.max_graphics_width", 0); + mMaxHeight = android::base::GetIntProperty("ro.surface_flinger.max_graphics_height", 0); + ui::Size resolution = displayMode.resolution; + resolution = limitSurfaceSize(resolution.width, resolution.height); + // create the native surface + sp control = session()->createSurface(String8("BootAnimation"), + resolution.getWidth(), resolution.getHeight(), PIXEL_FORMAT_RGB_565, + ISurfaceComposerClient::eOpaque); + + SurfaceComposerClient::Transaction t; + if (isValid) { // In the case of multi-display, boot animation shows on the specified displays - // in addition to the primary display - const auto ids = SurfaceComposerClient::getPhysicalDisplayIds(); for (const auto id : physicalDisplayIds) { if (std::find(ids.begin(), ids.end(), id) != ids.end()) { if (const auto token = SurfaceComposerClient::getPhysicalDisplayToken(id)) { @@ -570,8 +590,9 @@ status_t BootAnimation::readyToRun() { eglQuerySurface(display, surface, EGL_WIDTH, &w); eglQuerySurface(display, surface, EGL_HEIGHT, &h); - if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) + if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) { return NO_INIT; + } mDisplay = display; mContext = context; -- cgit v1.2.3-59-g8ed1b