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

Commit 18baa8af authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Implement API_NOT_AVAILABLE answer

Answer that the SplitInstallService API is not available for now
to prevent PayPal app to display an endless Downloading activity.
parent 3af97783
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
/*
 * Copyright 2013-2022 microG Project Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.play.core.splitinstall.protocol;

import com.google.android.play.core.splitinstall.protocol.ISplitInstallServiceCallback;

interface ISplitInstallService {

    // Method not identified yet
    void a();

    void startInstall(String str, in List<Bundle> list, in Bundle bundle, in ISplitInstallServiceCallback callback);

    // Method not identified yet
    void c(String str);

    // Method not identified yet
    void d(String str);

    // Method not identified yet
    void e(String str);

    void getSessionStates(String str, in ISplitInstallServiceCallback callback);

    // Method not identified yet
    void g(String str);

    // Method not identified yet
    void h(String str, in ISplitInstallServiceCallback callback);

    // Method not identified yet
    void i(String str);

    // Method not identified yet
    void j(String str);

    // Method not identified yet
    void k(String str);

    // Method not identified yet
    void l(String str);

    // Method not identified yet
    void m(String str);
}
 No newline at end of file
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright 2013-2022 microG Project Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.play.core.splitinstall.protocol;

import android.os.Bundle;

interface ISplitInstallServiceCallback {

    void onStartInstall(int i, in Bundle bundle);

    // Method not identified yet
    void b();

    void onCompleteInstall(int i);

    void onCancelInstall(int i, in Bundle bundle);

    void onGetSession(int i, in Bundle bundle);

    void onError(in Bundle bundle);

    void onGetSessionStates(in List<Bundle> list);

    void onDeferredUninstall(in Bundle bundle);

    void onDeferredInstall(in Bundle bundle);

    void onGetSplitsForAppUpdate();

    void onCompleteInstallForAppUpdate();

    void onDeferredLanguageInstall();
}
 No newline at end of file
+96 −2
Original line number Diff line number Diff line
/*
 * Copyright 2013-2022 microG Project Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.vending

import android.app.Service
import android.content.Intent
import android.os.Bundle
import android.os.IBinder
import android.util.Log
import com.android.vending.splitinstall.SplitInstallErrorCode
import com.google.android.play.core.splitinstall.protocol.ISplitInstallService
import com.google.android.play.core.splitinstall.protocol.ISplitInstallServiceCallback

class SplitInstallService : Service() {

    companion object {
        const val TAG = "SplitInstallService"
        const val ERROR_CODE_KEY = "error_code"
    }

    override fun onBind(p0: Intent?): IBinder {
        Log.i(TAG, "onBind()")
        Log.i(TAG, "service bound")
        return mServiceInterface
    }

    private val mServiceInterface = object : ISplitInstallService.Stub() { }
    private val mServiceInterface = object : ISplitInstallService.Stub() {

        override fun a() {
            Log.d(TAG, "a")
        }

        private fun logBundle(bundle: Bundle) {
            for (key in bundle.keySet()) {
                Log.d(TAG, "$key : ${bundle.get(key)}")
            }
        }

        override fun startInstall(
            packageName: String,
            list: List<Bundle>,
            bundle: Bundle,
            callback: ISplitInstallServiceCallback
        ) {
            Log.i(TAG, "Start install request from $packageName")

            for (element in list) {
                logBundle(element)
            }

            logBundle(bundle)

            val errorBundle = Bundle()
            errorBundle.putInt(ERROR_CODE_KEY, SplitInstallErrorCode.API_NOT_AVAILABLE)
            callback.onError(errorBundle)
        }

        override fun c(str: String?) {
            Log.d(TAG, "c")
        }

        override fun d(str: String?) {
            Log.d(TAG, "d")
        }

        override fun e(str: String?) {
            Log.d(TAG, "e")
        }

        override fun getSessionStates(str: String, callback: ISplitInstallServiceCallback) {
            callback.onGetSessionStates(arrayListOf<Bundle>())
        }

        override fun g(str: String?) {
            Log.d(TAG, "g")
        }

        override fun h(str: String?, callback: ISplitInstallServiceCallback?) {
            Log.d(TAG, "h $str $callback")
        }

        override fun i(str: String?) {
            Log.d(TAG, "i")
        }

        override fun j(str: String?) {
            Log.d(TAG, "j")
        }

        override fun k(str: String?) {
            Log.d(TAG, "k")
        }

        override fun l(str: String?) {
            Log.d(TAG, "l")
        }

        override fun m(str: String?) {
            Log.d(TAG, "m")
        }
    }
}
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright 2013-2022 microG Project Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.vending.splitinstall

interface SplitInstallErrorCode {
    companion object {
        const val API_NOT_AVAILABLE = -5
    }
}