Skip to content

Commit 1bdc9a9

Browse files
committed
Vending: Add AppUpdateService dummy
1 parent 27bacdd commit 1bdc9a9

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

vending-app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,13 @@
201201
</intent-filter>
202202
</receiver>
203203

204+
<service android:name="com.google.android.finsky.installservice.DevTriggeredUpdateService"
205+
android:enabled="true"
206+
android:exported="true">
207+
<intent-filter>
208+
<action android:name="com.google.android.play.core.install.BIND_UPDATE_SERVICE"/>
209+
</intent-filter>
210+
</service>
211+
204212
</application>
205213
</manifest>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2023 microG Project Team
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package com.google.android.play.core.appupdate.protocol;
7+
8+
import com.google.android.play.core.appupdate.protocol.IAppUpdateServiceCallback;
9+
10+
interface IAppUpdateService {
11+
oneway void requestUpdateInfo(String packageName, in Bundle bundle, in IAppUpdateServiceCallback callback) = 1;
12+
oneway void completeUpdate(String packageName, in Bundle bundle, in IAppUpdateServiceCallback callback) = 2;
13+
oneway void updateProgress(in Bundle bundle) = 3;
14+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2023 microG Project Team
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package com.google.android.play.core.appupdate.protocol;
7+
8+
interface IAppUpdateServiceCallback {
9+
oneway void onUpdateResult(in Bundle bundle) = 1;
10+
oneway void onCompleteResult(in Bundle bundle) = 2;
11+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2025 microG Project Team
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package com.google.android.finsky.installservice
7+
8+
import android.content.Context
9+
import android.content.Intent
10+
import android.os.Bundle
11+
import android.os.IBinder
12+
import android.os.Parcel
13+
import android.util.Log
14+
import androidx.core.os.bundleOf
15+
import androidx.lifecycle.Lifecycle
16+
import androidx.lifecycle.LifecycleOwner
17+
import androidx.lifecycle.LifecycleService
18+
import com.google.android.play.core.appupdate.protocol.IAppUpdateService
19+
import com.google.android.play.core.appupdate.protocol.IAppUpdateServiceCallback
20+
import org.microg.gms.utils.warnOnTransactionIssues
21+
22+
private const val TAG = "TriggeredUpdateService"
23+
24+
class DevTriggeredUpdateService : LifecycleService() {
25+
26+
override fun onBind(intent: Intent): IBinder? {
27+
super.onBind(intent)
28+
Log.d(TAG, "onBind")
29+
return DevTriggeredUpdateServiceImpl(this, lifecycle).asBinder()
30+
}
31+
32+
override fun onUnbind(intent: Intent?): Boolean {
33+
Log.d(TAG, "onUnbind")
34+
return super.onUnbind(intent)
35+
}
36+
}
37+
38+
class DevTriggeredUpdateServiceImpl(private val context: Context, override val lifecycle: Lifecycle) : IAppUpdateService.Stub(), LifecycleOwner {
39+
40+
override fun requestUpdateInfo(packageName: String?, bundle: Bundle?, callback: IAppUpdateServiceCallback?) {
41+
bundle?.keySet()
42+
Log.d(TAG, "requestUpdateInfo: packageName: $packageName bundle: $bundle")
43+
callback?.onUpdateResult(bundleOf("error.code" to 0))
44+
}
45+
46+
override fun completeUpdate(packageName: String?, bundle: Bundle?, callback: IAppUpdateServiceCallback?) {
47+
bundle?.keySet()
48+
Log.d(TAG, "completeUpdate: packageName: $packageName bundle: $bundle")
49+
callback?.onCompleteResult(bundleOf("error.code" to 0))
50+
}
51+
52+
override fun updateProgress(bundle: Bundle?) {
53+
Log.d(TAG, "updateProgress: bundle: $bundle")
54+
}
55+
56+
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) }
57+
}

0 commit comments

Comments
 (0)