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

Unverified Commit 748964bf authored by DaVinci9196's avatar DaVinci9196 Committed by GitHub
Browse files

Vending: Added InAppReviewActivity (#3163)



Co-authored-by: default avatarMarvin W <git@larma.de>
parent bcd639d5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -299,6 +299,13 @@
            </intent-filter>
        </service>

        <activity
            android:name="com.google.android.finsky.inappreviewdialog.InAppReviewActivity"
            android:exported="false"
            android:excludeFromRecents="true"
            android:configChanges="orientation|keyboardHidden"
            android:windowSoftInputMode="stateHidden"/>

        <activity
            android:name="org.microg.vending.installer.AppInstallActivity"
            android:exported="true"
+1 −1
Original line number Diff line number Diff line
@@ -8,5 +8,5 @@ package com.google.android.play.core.inappreview.protocol;
import android.os.Bundle;

interface IInAppReviewServiceCallback {
    void onResult(in Bundle bundle);
    oneway void onResult(in Bundle bundle) = 1;
}
 No newline at end of file
+20 −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.inappreviewdialog

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class InAppReviewActivity: AppCompatActivity() {
    companion object {
        const val CALLING_PACKAGE = "calling_package"
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setResult(RESULT_OK)
        finish()
    }
}
 No newline at end of file
+18 −3
Original line number Diff line number Diff line
@@ -5,13 +5,16 @@

package com.google.android.finsky.inappreviewservice

import android.app.PendingIntent.FLAG_UPDATE_CURRENT
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.app.PendingIntentCompat
import androidx.lifecycle.LifecycleService
import com.google.android.finsky.inappreviewdialog.InAppReviewActivity
import com.google.android.play.core.inappreview.protocol.IInAppReviewService
import com.google.android.play.core.inappreview.protocol.IInAppReviewServiceCallback
import org.microg.gms.utils.warnOnTransactionIssues
@@ -35,9 +38,21 @@ class InAppReviewService : LifecycleService() {
class InAppReviewServiceImpl(val context: Context) : IInAppReviewService.Stub() {

    override fun requestInAppReview(packageName: String?, bundle: Bundle?, callback: IInAppReviewServiceCallback?) {
        bundle?.keySet()
        Log.d(TAG, "requestInAppReview: packageName: $packageName bundle:$bundle")
        callback?.onResult(Bundle.EMPTY)
        if (packageName == null) return
        val pendingIntent = Intent(context, InAppReviewActivity::class.java).apply {
            putExtra(InAppReviewActivity.CALLING_PACKAGE, packageName)
        }.let {
            PendingIntentCompat.getActivity(context, 0, it, FLAG_UPDATE_CURRENT, false)
        }
        val bundle = Bundle()
        bundle.putBoolean("is_review_no_op", false)
        bundle.putParcelable("confirmation_intent", pendingIntent)
        try {
            callback?.onResult(bundle)
        } catch (e: Exception) {
            Log.w(TAG, "Exception on in-app review service", e)
        }
    }

    override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int) = warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) }