Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 358bd531 authored by davinci9196's avatar davinci9196 Committed by Jonathan Klee
Browse files

Vending: Add AppUpdateService dummy

parent 0d5da0a3
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -213,5 +213,13 @@
            </intent-filter>
        </receiver>

        <service android:name="com.google.android.finsky.installservice.DevTriggeredUpdateService"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.google.android.play.core.install.BIND_UPDATE_SERVICE"/>
            </intent-filter>
        </service>

    </application>
</manifest>
+14 −0
Original line number Diff line number Diff line
/*
 * 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
+11 −0
Original line number Diff line number Diff line
/*
 * 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
+57 −0
Original line number Diff line number Diff line
/**
 * 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