Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Add fake licensing service
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed May 4, 2023
1 parent 7f529bf commit 464a546
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 39 deletions.
15 changes: 2 additions & 13 deletions fake-store/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
/*
* Copyright 2013-2015 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.
* SPDX-FileCopyrightText: 2015 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

apply plugin: 'com.android.application'
Expand Down
47 changes: 21 additions & 26 deletions fake-store/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2014 μg 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.
~ SPDX-FileCopyrightText: 2014 microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<permission android:name="com.android.vending.CHECK_LICENSE" android:protectionLevel="normal"/>
<uses-permission android:name="android.permission.FAKE_PACKAGE_SIGNATURE"/>
<application
android:forceQueryable="true"
android:icon="@drawable/icon"
android:label="@string/app_name">
<meta-data
android:name="fake-signature"
android:value="@string/fake_signature"/>
android:forceQueryable="true"
android:icon="@mipmap/ic_app"
android:label="@string/app_name">

<activity
android:name=".GrantFakeSignaturePermissionActivity"
android:exported="true"
android:theme="@style/Theme.Dialog.NoActionBar"/>
<meta-data android:name="fake-signature"
android:value="@string/fake_signature"/>

<service
android:name="com.android.vending.billing.InAppBillingService" >
<activity android:name=".GrantFakeSignaturePermissionActivity"
android:exported="true"
android:theme="@style/Theme.Dialog.NoActionBar"/>

<service android:name="com.android.vending.billing.InAppBillingService"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.billing.InAppBillingService.BIND"/>
</intent-filter>
</service>

<service android:name="com.android.vending.licensing.LicensingService"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.billing.InAppBillingService.BIND" />
<action android:name="com.android.vending.licensing.ILicensingService"/>
</intent-filter>
</service>
</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2010 The Android Open Source Project
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.android.vending.licensing;

interface ILicenseResultListener {
oneway void verifyLicense(int responseCode, String signedData, String signature);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2010 The Android Open Source Project
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.android.vending.licensing;

interface ILicenseV2ResultListener {
oneway void verifyLicense(int responseCode, in Bundle responsePayload);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2010 The Android Open Source Project
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.android.vending.licensing;

import com.android.vending.licensing.ILicenseResultListener;
import com.android.vending.licensing.ILicenseV2ResultListener;

interface ILicensingService {
oneway void checkLicense(long nonce, String packageName, ILicenseResultListener listener);
oneway void checkLicenseV2(String packageName, ILicenseV2ResultListener listener, in Bundle extraParams);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.android.vending.licensing;

import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

public class LicensingService extends Service {
private static final String TAG = "FakeLicenseService";

private final ILicensingService.Stub mLicenseService = new ILicensingService.Stub() {

@Override
public void checkLicense(long nonce, String packageName, ILicenseResultListener listener) throws RemoteException {
Log.d(TAG, "checkLicense(" + nonce + ", " + packageName + ")");
// We don't return anything yet. Seems to work good for some checkers.
}

@Override
public void checkLicenseV2(String packageName, ILicenseV2ResultListener listener, Bundle extraParams) throws RemoteException {
Log.d(TAG, "checkLicenseV2(" + packageName + ", " + extraParams + ")");
// We don't return anything yet. Seems to work good for some checkers.
}
};

public IBinder onBind(Intent intent) {
return mLicenseService;
}
}

0 comments on commit 464a546

Please sign in to comment.