Skip to content

Commit

Permalink
android: onSurfaceCleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Feb 18, 2025
1 parent 01c7456 commit d36a25d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
15 changes: 9 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:8.5.0' // for compileSdk 34. default ndk 26.1.10909125
classpath 'com.android.tools.build:gradle:8.7.0'
}
}

Expand All @@ -27,7 +27,7 @@ android {
}
// Bumping the plugin compileSdkVersion requires all clients of this plugin
// to bump the version in their app.
compileSdk 34
compileSdk 35

// Use the NDK version
// declared in /android/app/build.gradle file of the Flutter project.
Expand All @@ -50,8 +50,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

defaultConfig {
Expand Down Expand Up @@ -93,7 +93,7 @@ def flutterSdkVersion = {
def flutterSdkPath = properties.getProperty("flutter.sdk")
if (flutterSdkPath == null) {
flutterSdkPath = System.env.FLUTTER_ROOT // from flutter.groovy

if (flutterSdkPath == null) {
// add-to-app local.properties file located at <modulePath>/.android/local.properties
file(project(":flutter").getProjectDir().getParent() + "/local.properties").withInputStream { properties.load(it) }
Expand Down Expand Up @@ -133,5 +133,8 @@ if (flutterSdkVersionInt < 32400) {
println 'rename onSurfaceAvailable to onSurfaceCreated'
preprocessJava(['onSurfaceAvailable': 'onSurfaceCreated'])
}
if (flutterSdkVersionInt < 32800) {
println 'rename onSurfaceCleanup to onSurfaceDestroyed'
preprocessJava(['onSurfaceCleanup': 'onSurfaceDestroyed'])
}
}

6 changes: 3 additions & 3 deletions android/src/main/java/com/mediadevkit/fvp/FvpPlugin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024 WangBin <wbsecg1 at gmail.com>
* Copyright (c) 2023-2025 WangBin <wbsecg1 at gmail.com>
*/
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Expand Down Expand Up @@ -102,8 +102,8 @@ public void onSurfaceAvailable() {
}

@Override
public void onSurfaceDestroyed() {
Log.d("FvpPlugin", "SurfaceProducer.onSurfaceDestroyed for textureId " + texId);
public void onSurfaceCleanup() {
Log.d("FvpPlugin", "SurfaceProducer.onSurfaceCleanup for textureId " + texId);
textures.remove(texId);
nativeSetSurface(handle, texId, null, 0, 0, tunnel);
}
Expand Down
4 changes: 2 additions & 2 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.5.0' apply false // compileSdk 34
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.application" version '8.7.3' apply false // compileSdk 34
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}

include ":app"

0 comments on commit d36a25d

Please sign in to comment.