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

Port to Android 12 #4

Merged
merged 7 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 3 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,5 @@
# FakeGApps by thermatk

Xposed Repo: http://repo.xposed.info/module/com.thermatk.android.xf.fakegapps

F-Droid Repo: https://f-droid.org/packages/com.thermatk.android.xf.fakegapps/
# FakeGApps

Used in combinaton with [µg GmsCore](https://github.com/microg/android_packages_apps_GmsCore) to enable Google Cloud Messaging (GCM) and much more.

This tutorial describes only the installation process to get GCM working. The also available Google Play Store replacement Blankstore is not discussed here.

## Installation for Android with root access and without Gapps

* Install Xposed
* For Lollipop and Marshmallow from http://forum.xda-developers.com/showthread.php?t=3034811

* For version below Lollipop using Xposed installer from http://repo.xposed.info/module/de.robv.android.xposed.installer

* Install this FakeGApps module from Xposed Repo(or releases) and enable it in Xposed Installer under 'Modules'
* Install FakeStore from http://own.darkcloud.ca:90/Android-Builds/ instead you can use Blankstore (see below)
* Install latest GmsCore build 'play-services-core-debug.apk' from http://files.brnmod.rocks/apps/GmsCore/Latest/
* Reboot and dial in your phone app \*#\*#CHECKIN#\*#\* to register GCM

Note: to enable GCM e.g for messaging apps like Threema or Textsecure, you have to update / install the same apk once again to allow them to obtain the GCM related permissions.

GCM can be tested using e.g. [Google Play Store](https://play.google.com/store/apps/details?id=com.firstrowria.pushnotificationtester&hl=en) which is also downloadble from [evozi](http://apps.evozi.com/apk-downloader/?id=com.firstrowria.pushnotificationtester).


## Untested ways to remove Gapps

The procedure described [here](http://hex.ro/wp/blog/removing-gapps-from-cyanogenmod-11/) for removing Gapps from CM11 should also work for other ROMs where Gapps has been installed using a flashable zip.

## How To Install Blankstore
Its assumed that Gapps has already been removed completely including previous folders such as ```/data/app/com.android.vending/```.

### For Android 5.0+
* create the folder ```/system/priv-app/Phonesky``` and change permissions to 755
* Download latest ```Blankstore.apk``` from [BlankStore Repo](https://github.com/mar-v-in/BlankStore/releases/), copy it to folder ```/system/priv-app/Phonesky``` and change the APK's permissions to 644
* Reboot
* Download [this JAR file](http://forum.xda-developers.com/attachment.php?attachmentid=3392935&d=1436186022) and run ```java -jar android-checkin-1.0.jar <email> <password>``` from the <b>console/terminal of your PC running Linux/OSX</b>
* Start the new Market app and login using your credentials and the Android ID from output of previous command

### Untested ways for Android 4.0+ - 4.3.x
* Instead of the first two steps for Android 5.0, download the Blankstore.apk, rename it to ```com.android.vending.apk``` and copy it to ```/system/app```, apply same permissions as above and proceed the same way as for Android 5.0

### Untested ways for Android 4.4.x
* Instead of the first two steps for Android 5.0, download the Blankstore.apk, rename it to ```com.android.vending.apk``` and copy it to ```/system/priv-app```, apply same permissions as above and proceed the same way as for Android 5.0
This is an Xposed module and such needs LSPosed or compatible installed.
To install, install the APK from the releases section and enable it in LSPosed Manager. You don't need to tick any checkboxes except the already enabled "system frameworks".
25 changes: 21 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
compileSdkVersion 32

defaultConfig {
applicationId "com.thermatk.android.xf.fakegapps"
minSdkVersion 15
targetSdkVersion 30
versionCode 4
versionName "3.0"
targetSdkVersion 32
versionCode 7
versionName "3.3"
}
signingConfigs {
release {
if (project.hasProperty('RELEASE_KEY_ALIAS')) {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
v1SigningEnabled true
v2SigningEnabled true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (project.hasProperty('RELEASE_KEY_ALIAS')) {
signingConfig signingConfigs.release
}
}
}

namespace 'com.thermatk.android.xf.fakegapps'
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thermatk.android.xf.fakegapps">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:allowBackup="true" android:label="FakeGapps"
android:icon="@mipmap/ic_launcher" android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.thermatk.android.xf.fakegapps;

import android.app.AndroidAppHelper;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Binder;
import android.util.Log;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
Expand All @@ -19,32 +15,30 @@ public void handleLoadPackage(LoadPackageParam loadedPackage) {
if (!loadedPackage.packageName.equals("android"))
return;

final Class<?> PackageManagerService = XposedHelpers.findClass("com.android.server.pm.PackageManagerService", loadedPackage.classLoader);
XposedBridge.hookAllMethods(PackageManagerService, "generatePackageInfo", new XC_MethodHook() {
XC_MethodHook hook = new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) {
PackageInfo pi = (PackageInfo) param.getResult();
if (pi != null) {
String packageName = pi.packageName;
if (packageName.equals("com.google.android.gms") || packageName.equals("com.android.vending")) {
String callerPackageName = "unknown package name";

PackageManager pm;
try {
pm = AndroidAppHelper.currentApplication().getApplicationContext().getPackageManager();
callerPackageName = pm.getNameForUid(Binder.getCallingUid());
} catch (Exception ignored) {
}

Log.i("FakeGApps", "Returning fake signature to \"" + callerPackageName + "\"");

String sig = "308204433082032ba003020102020900c2e08746644a308d300d06092a864886f70d01010405003074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964301e170d3038303832313233313333345a170d3336303130373233313333345a3074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f696430820120300d06092a864886f70d01010105000382010d00308201080282010100ab562e00d83ba208ae0a966f124e29da11f2ab56d08f58e2cca91303e9b754d372f640a71b1dcb130967624e4656a7776a92193db2e5bfb724a91e77188b0e6a47a43b33d9609b77183145ccdf7b2e586674c9e1565b1f4c6a5955bff251a63dabf9c55c27222252e875e4f8154a645f897168c0b1bfc612eabf785769bb34aa7984dc7e2ea2764cae8307d8c17154d7ee5f64a51a44a602c249054157dc02cd5f5c0e55fbef8519fbe327f0b1511692c5a06f19d18385f5c4dbc2d6b93f68cc2979c70e18ab93866b3bd5db8999552a0e3b4c99df58fb918bedc182ba35e003c1b4b10dd244a8ee24fffd333872ab5221985edab0fc0d0b145b6aa192858e79020103a381d93081d6301d0603551d0e04160414c77d8cc2211756259a7fd382df6be398e4d786a53081a60603551d2304819e30819b8014c77d8cc2211756259a7fd382df6be398e4d786a5a178a4763074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964820900c2e08746644a308d300c0603551d13040530030101ff300d06092a864886f70d010104050003820101006dd252ceef85302c360aaace939bcff2cca904bb5d7a1661f8ae46b2994204d0ff4a68c7ed1a531ec4595a623ce60763b167297a7ae35712c407f208f0cb109429124d7b106219c084ca3eb3f9ad5fb871ef92269a8be28bf16d44c8d9a08e6cb2f005bb3fe2cb96447e868e731076ad45b33f6009ea19c161e62641aa99271dfd5228c5c587875ddb7f452758d661f6cc0cccb7352e424cc4365c523532f7325137593c4ae341f4db41edda0d0b1071a7c440f0fe9ea01cb627ca674369d084bd2fd911ff06cdbf2cfa10dc0f893ae35762919048c7efc64c7144178342f70581c9de573af55b390dd7fdb9418631895d5f759f30112687ff621410c069308a";

pi.signatures = new Signature[]{new Signature(sig)};
param.setResult(pi);
}
}
}
});
};

Class<?> PackageManagerServiceComputer = null;
try {
PackageManagerServiceComputer = XposedHelpers.findClass("com.android.server.pm.PackageManagerService.ComputerEngine", loadedPackage.classLoader);
} catch (Exception ignored) {}
if (PackageManagerServiceComputer != null) {
XposedBridge.hookAllMethods(PackageManagerServiceComputer, "generatePackageInfo", hook);
}
final Class<?> PackageManagerService = XposedHelpers.findClass("com.android.server.pm.PackageManagerService", loadedPackage.classLoader);
XposedBridge.hookAllMethods(PackageManagerService, "generatePackageInfo", hook);
}
}
15 changes: 12 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:7.1.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,7 +15,16 @@ buildscript {

allprojects {
repositories {
jcenter()
mavenCentral()
google()

// Needed for Xposed API
//noinspection JcenterRepositoryObsolete
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
}
}
}
19 changes: 8 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
#Fri Apr 15 14:24:54 CEST 2022
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M -XX:+UseParallelGC" -XX:+UseParallelGC
org.gradle.unsafe.configuration-cache=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip