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

Commit 866133cc authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Implement minimal LicensingService

Implemented ILicensingService & ILicenseResultListener interfaces
with the minimal logic.

For now, we always answer the listener that the license result is
correct.
parent 62d981b3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -46,5 +46,13 @@
                <action android:name="com.google.android.play.core.splitinstall.BIND_SPLIT_INSTALL_SERVICE" />
            </intent-filter>
        </service>

        <service
            android:name="com.android.vending.licensing.LicensingService" >
            <intent-filter>
                <action android:name="com.android.vending.licensing.ILicensingService" />
            </intent-filter>
        </service>

    </application>
</manifest>
+6 −0
Original line number Diff line number Diff line
package com.android.vending.licensing;

interface ILicenseResultListener {

   void allow(int i);
}
+8 −0
Original line number Diff line number Diff line
package com.android.vending.licensing;

import com.android.vending.licensing.ILicenseResultListener;

interface ILicensingService {

    void checkLicense(long someLong, String someString, in ILicenseResultListener listener);
}
 No newline at end of file
+27 −0
Original line number Diff line number Diff line
package com.android.vending.licensing

import android.app.Service
import android.content.Intent
import android.os.IBinder

class LicensingService : Service() {

    companion object {
        const val LICENSED_OLD_KEY = 2
    }

    private val mServiceInterface = object : ILicensingService.Stub() {
        override fun checkLicense(
            someLong: Long,
            someString: String,
            listener: ILicenseResultListener
        ) {
            // Answer allow for each request
            listener.allow(LICENSED_OLD_KEY)
        }
    }

    override fun onBind(intent: Intent): IBinder {
        return mServiceInterface
    }
}
 No newline at end of file