diff --git a/vending-app/src/main/AndroidManifest.xml b/vending-app/src/main/AndroidManifest.xml index 308f8bef45..6b0aeff6b6 100644 --- a/vending-app/src/main/AndroidManifest.xml +++ b/vending-app/src/main/AndroidManifest.xml @@ -206,5 +206,13 @@ android:name="com.google.android.finsky.services.PlayGearheadService" android:exported="true" /> + + + + + + diff --git a/vending-app/src/main/aidl/com/google/android/play/core/appupdate/protocol/IAppUpdateService.aidl b/vending-app/src/main/aidl/com/google/android/play/core/appupdate/protocol/IAppUpdateService.aidl new file mode 100644 index 0000000000..73cb613917 --- /dev/null +++ b/vending-app/src/main/aidl/com/google/android/play/core/appupdate/protocol/IAppUpdateService.aidl @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.play.core.appupdate.protocol; + +import com.google.android.play.core.appupdate.protocol.IAppUpdateServiceCallback; + +interface IAppUpdateService { + oneway void requestUpdateInfo(String packageName, in Bundle bundle, in IAppUpdateServiceCallback callback) = 1; + oneway void completeUpdate(String packageName, in Bundle bundle, in IAppUpdateServiceCallback callback) = 2; + oneway void updateProgress(in Bundle bundle) = 3; +} \ No newline at end of file diff --git a/vending-app/src/main/aidl/com/google/android/play/core/appupdate/protocol/IAppUpdateServiceCallback.aidl b/vending-app/src/main/aidl/com/google/android/play/core/appupdate/protocol/IAppUpdateServiceCallback.aidl new file mode 100644 index 0000000000..a9452c47fa --- /dev/null +++ b/vending-app/src/main/aidl/com/google/android/play/core/appupdate/protocol/IAppUpdateServiceCallback.aidl @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.play.core.appupdate.protocol; + +interface IAppUpdateServiceCallback { + oneway void onUpdateResult(in Bundle bundle) = 1; + oneway void onCompleteResult(in Bundle bundle) = 2; +} \ No newline at end of file diff --git a/vending-app/src/main/kotlin/com/google/android/finsky/installservice/DevTriggeredUpdateService.kt b/vending-app/src/main/kotlin/com/google/android/finsky/installservice/DevTriggeredUpdateService.kt new file mode 100644 index 0000000000..193ba46662 --- /dev/null +++ b/vending-app/src/main/kotlin/com/google/android/finsky/installservice/DevTriggeredUpdateService.kt @@ -0,0 +1,57 @@ +/** + * SPDX-FileCopyrightText: 2025 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.finsky.installservice + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import android.os.IBinder +import android.os.Parcel +import android.util.Log +import androidx.core.os.bundleOf +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.LifecycleService +import com.google.android.play.core.appupdate.protocol.IAppUpdateService +import com.google.android.play.core.appupdate.protocol.IAppUpdateServiceCallback +import org.microg.gms.utils.warnOnTransactionIssues + +private const val TAG = "TriggeredUpdateService" + +class DevTriggeredUpdateService : LifecycleService() { + + override fun onBind(intent: Intent): IBinder? { + super.onBind(intent) + Log.d(TAG, "onBind") + return DevTriggeredUpdateServiceImpl(this, lifecycle).asBinder() + } + + override fun onUnbind(intent: Intent?): Boolean { + Log.d(TAG, "onUnbind") + return super.onUnbind(intent) + } +} + +class DevTriggeredUpdateServiceImpl(private val context: Context, override val lifecycle: Lifecycle) : IAppUpdateService.Stub(), LifecycleOwner { + + override fun requestUpdateInfo(packageName: String?, bundle: Bundle?, callback: IAppUpdateServiceCallback?) { + bundle?.keySet() + Log.d(TAG, "requestUpdateInfo: packageName: $packageName bundle: $bundle") + callback?.onUpdateResult(bundleOf("error.code" to 0)) + } + + override fun completeUpdate(packageName: String?, bundle: Bundle?, callback: IAppUpdateServiceCallback?) { + bundle?.keySet() + Log.d(TAG, "completeUpdate: packageName: $packageName bundle: $bundle") + callback?.onCompleteResult(bundleOf("error.code" to 0)) + } + + override fun updateProgress(bundle: Bundle?) { + Log.d(TAG, "updateProgress: bundle: $bundle") + } + + override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) } +} \ No newline at end of file