app/build/intermediates/desugar_graph/debug/dexBuilderDebug/out/currentProject/dirs_bucket_9/graph.bin
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab
@@ -1,2 +1,2 @@
4
5
0
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at
Binary files differ
app/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i
Binary files differ
app/src/main/java/com/safeluck/floatwindow/MainActivity.kt
@@ -22,6 +22,9 @@
class MainActivity : ComponentActivity() {
    private var mediaAidlInterface: IMediaAidlInterface? = null
    private var serviceConnection: ServiceConnection? = null
    private var isServiceBound = false
    private val isServiceBoundState = mutableStateOf(false)
    
    private val callback = object : IMyCallback.Stub() {
        @Throws(RemoteException::class)
@@ -36,18 +39,18 @@
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        
        var isServiceBoundState by mutableStateOf(false)
        val serviceConnection = object : ServiceConnection {
        serviceConnection = object : ServiceConnection {
            override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
                mediaAidlInterface = IMediaAidlInterface.Stub.asInterface(service)
                isServiceBoundState = true
                isServiceBound = true
                isServiceBoundState.value = true
                Timber.d("FloatingService connected")
            }
            
            override fun onServiceDisconnected(name: ComponentName?) {
                mediaAidlInterface = null
                isServiceBoundState = false
                isServiceBound = false
                isServiceBoundState.value = false
                Timber.d("FloatingService disconnected")
            }
        }
@@ -59,26 +62,16 @@
                    color = MaterialTheme.colorScheme.background
                ) {
                    MainScreen(
                        isServiceBound = isServiceBoundState,
                        isServiceBound = isServiceBoundState.value,
                        onBindService = { 
                            if (!isServiceBoundState) {
                            if (!isServiceBoundState.value && serviceConnection != null) {
                                val intent = Intent(this@MainActivity, FloatingService::class.java)
                                bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE)
                                bindService(intent, serviceConnection!!, Context.BIND_AUTO_CREATE)
                                Timber.d("Binding FloatingService")
                            }
                        },
                        onUnbindService = { 
                            if (isServiceBoundState) {
                                try {
                                    mediaAidlInterface?.unregisterCallback(callback)
                                } catch (e: RemoteException) {
                                    Timber.e(e, "Error unregistering callback")
                                }
                                unbindService(serviceConnection)
                                isServiceBoundState = false
                                mediaAidlInterface = null
                                Timber.d("Unbinding FloatingService")
                            }
                            unbindServiceInternal()
                        },
                        onStartAndroidRecord = { startAndroidRecord() },
                        onStopAndroidRecord = { stopAndroidRecord() },
@@ -210,16 +203,29 @@
        }
    }
    
    override fun onDestroy() {
        super.onDestroy()
        if (mediaAidlInterface != null) {
    private fun unbindServiceInternal() {
        if (isServiceBound && serviceConnection != null) {
            try {
                mediaAidlInterface?.unregisterCallback(callback)
            } catch (e: RemoteException) {
                Timber.e(e, "Error unregistering callback")
            }
            try {
                unbindService(serviceConnection!!)
                Timber.d("Unbinding FloatingService")
            } catch (e: Exception) {
                Timber.e(e, "Error unbinding service")
            }
            isServiceBound = false
            isServiceBoundState.value = false
            mediaAidlInterface = null
        }
    }
    override fun onDestroy() {
        super.onDestroy()
        unbindServiceInternal()
    }
}
@Composable
app/src/main/java/com/safeluck/floatwindow/manager/AndroidCameraRecordManager.java
@@ -186,15 +186,31 @@
            }
            
            // 设置MediaRecorder
            // 注意:MediaRecorder的设置顺序非常重要,必须严格按照以下顺序:
            mediaRecorder = new MediaRecorder();
            // 1. 设置数据源(必须在setOutputFormat之前)
            mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
            mediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
            // 2. 设置输出格式(必须在setOutputFile和编码器之前)
            mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
            // 3. 设置输出文件(必须在编码器之前)
            mediaRecorder.setOutputFile(currentVideoFile.getAbsolutePath());
            // 4. 设置编码器(必须在setOutputFormat之后)
            mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
            mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
            // 5. 设置编码参数(必须在编码器之后)
            mediaRecorder.setAudioEncodingBitRate(64000); // 64kbps
            mediaRecorder.setAudioSamplingRate(44100); // 44.1kHz
            mediaRecorder.setVideoEncodingBitRate(width * height * 3);
            mediaRecorder.setVideoFrameRate(20);
            mediaRecorder.setVideoSize(width, height);
            mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
            
            // 6. 准备MediaRecorder
            mediaRecorder.prepare();
            
            // 创建Surface