Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SplitInstallService #2500

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ buildscript {

ext.slf4jVersion = '1.7.36'
ext.volleyVersion = '1.2.1'
ext.wireVersion = '4.8.0'
ext.wireVersion = '4.9.9'

ext.androidBuildGradleVersion = '8.2.2'

Expand Down
mar-v-in marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.google.android.finsky.splitinstallservice;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
17 changes: 17 additions & 0 deletions vending-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.google.android.gms.permission.READ_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>

<uses-permission
android:name="android.permission.USE_CREDENTIALS"
Expand Down Expand Up @@ -56,6 +57,10 @@
android:roundIcon="@mipmap/ic_app"
android:label="@string/app_name">

<meta-data
android:name="GpVersion"
android:value="41.2.21-31 [0] [PR] 636997666"/>

mar-v-in marked this conversation as resolved.
Show resolved Hide resolved
<meta-data
android:name="org.microg.gms.settings:source-package"
android:value="com.google.android.gms" />
Expand Down Expand Up @@ -93,6 +98,7 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"/>
mar-v-in marked this conversation as resolved.
Show resolved Hide resolved
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.INFO" />
</intent-filter>
Expand Down Expand Up @@ -148,6 +154,13 @@
</intent-filter>
</activity>

<service android:name="com.google.android.finsky.splitinstallservice.SplitInstallService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.play.core.splitinstall.BIND_SPLIT_INSTALL_SERVICE"/>
</intent-filter>
</service>

<service
android:name="com.android.vending.billing.InAppBillingService"
android:exported="true">
Expand Down Expand Up @@ -175,5 +188,9 @@
</intent-filter>
</service>

<receiver android:name="com.google.android.finsky.splitinstallservice.SplitInstallServiceImpl$InstallResultReceiver"
android:exported="true">
</receiver>

</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.play.core.splitinstall.protocol;
import com.google.android.play.core.splitinstall.protocol.ISplitInstallServiceCallback;

interface ISplitInstallService {
void startInstall(String pkg,in List<Bundle> splits,in Bundle bundle, ISplitInstallServiceCallback callback) = 1;
void completeInstalls(String pkg, int sessionId,in Bundle bundle, ISplitInstallServiceCallback callback) = 2;
void cancelInstall(String pkg, int sessionId, ISplitInstallServiceCallback callback) = 3;
void getSessionState(String pkg, int sessionId, ISplitInstallServiceCallback callback) = 4;
void getSessionStates(String pkg, ISplitInstallServiceCallback callback) = 5;
void splitRemoval(String pkg,in List<Bundle> splits, ISplitInstallServiceCallback callback) = 6;
void splitDeferred(String pkg,in List<Bundle> splits,in Bundle bundle, ISplitInstallServiceCallback callback) = 7;
void getSessionState2(String pkg, int sessionId, ISplitInstallServiceCallback callback) = 8;
void getSessionStates2(String pkg, ISplitInstallServiceCallback callback) = 9;
void getSplitsAppUpdate(String pkg, ISplitInstallServiceCallback callback) = 10;
void completeInstallAppUpdate(String pkg, ISplitInstallServiceCallback callback) = 11;
void languageSplitInstall(String pkg,in List<Bundle> splits,in Bundle bundle, ISplitInstallServiceCallback callback) = 12;
void languageSplitUninstall(String pkg,in List<Bundle> splits, ISplitInstallServiceCallback callback) =13;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.play.core.splitinstall.protocol;


interface ISplitInstallServiceCallback {
oneway void onStartInstall(int status, in Bundle bundle) = 1;
oneway void onInstallCompleted(int status, in Bundle bundle) = 2;
oneway void onCancelInstall(int status, in Bundle bundle) = 3;
oneway void onGetSessionState(int status, in Bundle bundle) = 4;
oneway void onError(in Bundle bundle) = 5;
oneway void onGetSessionStates(in List<Bundle> list) = 6;
oneway void onDeferredUninstall(in Bundle bundle) = 7;
oneway void onDeferredInstall(in Bundle bundle) = 8;
oneway void onDeferredLanguageInstall(in Bundle bundle) = 11;
oneway void onDeferredLanguageUninstall(in Bundle bundle) = 12;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ const val VENDING_PACKAGE_NAME = "com.android.vending"
// TODO: Replace key name
const val KEY_IAP_SHEET_UI_PARAM = "key_iap_sheet_ui_param"
const val DEFAULT_ACCOUNT_TYPE = "com.google"
const val ADD_PAYMENT_METHOD_URL = "https://play.google.com/store/paymentmethods"
const val ADD_PAYMENT_METHOD_URL = "https://play.google.com/store/paymentmethods"
const val FINSKY_REGULAR = "com.google.android.finsky.regular"
mar-v-in marked this conversation as resolved.
Show resolved Hide resolved
const val FINSKY_STABLE = "com.google.android.finsky.stable"
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.net.Uri
object GServices {
private val CONTENT_URI: Uri = Uri.parse("content://com.google.android.gsf.gservices")


fun getString(resolver: ContentResolver, key: String, defaultValue: String?): String? {
var result = defaultValue
val cursor = resolver.query(CONTENT_URI, null, null, arrayOf(key), null)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.finsky.splitinstallservice

import android.content.Intent
import android.os.IBinder
import androidx.lifecycle.LifecycleService
import com.google.android.play.core.splitinstall.protocol.ISplitInstallService
import org.microg.gms.profile.ProfileManager

class SplitInstallService : LifecycleService() {
private var mService: ISplitInstallService? = null

override fun onCreate() {
super.onCreate()
ProfileManager.ensureInitialized(this)
}

override fun onBind(intent: Intent): IBinder? {
if (mService == null) {
mService = SplitInstallServiceImpl(this.applicationContext)
}
return mService as IBinder?
}
}
Loading