Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Remove hooking, we can do it without.
Browse files Browse the repository at this point in the history
This also adds compat with Android < 5.0
  • Loading branch information
mar-v-in committed Nov 6, 2016
1 parent bb232f2 commit 0ca6fb2
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 449 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.2.2'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

public class Constants {
public static final String GMS_PACKAGE_NAME = "com.google.android.gms";
public static final int GMS_VERSION_CODE = 9683430;
public static final String GMS_VERSION_NAME_PREFIX = "9.6.83 (430-";
public static final int GMS_VERSION_CODE = 10084430;
public static final String GMS_VERSION_NAME_PREFIX = "10.0.84 (430-";
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

package org.microg.gms.droidguard;

import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.telephony.TelephonyManager;
import android.util.Log;

import java.util.concurrent.CountDownLatch;
Expand All @@ -43,13 +41,7 @@ public Result guard(final String type, final String androidIdLong) {
return guard(type, androidIdLong, new Bundle());
}

@SuppressLint("HardwareIds")
public Result guard(final String type, final String androidIdLong, final Bundle extras) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return guard(type, androidIdLong, extras, tm.getDeviceId(), tm.getSubscriberId());
}

public synchronized Result guard(final String type, final String androidIdLong, final Bundle extras, final String deviceId, final String subscriberId) {
public synchronized Result guard(final String type, final String androidIdLong, final Bundle extras) {
final Result res = new Result();
res.statusCode = 14;
connectForTask(new Task() {
Expand All @@ -61,8 +53,6 @@ public void run(IRemoteDroidGuard remote, final CountDownLatch countDownLatch) {
request.reason = type;
request.androidIdLong = androidIdLong;
request.extras = extras;
request.deviceId = deviceId;
request.subscriberId = subscriberId;
remote.guard(new IRemoteDroidGuardCallback.Stub() {
@Override
public void onResult(byte[] result) throws RemoteException {
Expand All @@ -88,6 +78,11 @@ public void onError(String err) throws RemoteException {
return res;
}

@Deprecated
public Result guard(String type, String androidIdLong, Bundle extras, String id1, String id2) {
return guard(type, androidIdLong, extras);
}

private boolean connectForTask(Task todo) {
CountDownLatch countDownLatch = new CountDownLatch(1);
Intent intent = new Intent("org.microg.gms.droidguard.REMOTE");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ public class RemoteDroidGuardRequest extends AutoSafeParcelable {
@SafeParceled(3)
public String androidIdLong;

// From TelephonyManager
@SafeParceled(10)
public String deviceId;
@SafeParceled(11)
public String subscriberId;

// additional fields, known key: "contentBinding"
@SafeParceled(100)
public Bundle extras;
Expand Down
5 changes: 4 additions & 1 deletion remote-droid-guard/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ repositories {
dependencies {
compile 'com.squareup.wire:wire-runtime:1.6.1'
compile ':droidguasso:@jar'
compile ':arthook:@aar'
compile project(':remote-droid-guard-lib')
}

Expand Down Expand Up @@ -47,6 +46,10 @@ android {
java.srcDirs += 'src/main/protos-java'
}
}

dexOptions {
additionalParameters "--core-library"
}
}

if (file('user.gradle').exists()) {
Expand Down
Binary file removed remote-droid-guard/libs/arthook.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion remote-droid-guard/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-sdk
android:minSdkVersion="19"
android:minSdkVersion="9"
android:targetSdkVersion="24"
tools:overrideLibrary="de.larma.arthook"/>

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import android.util.Base64;
import android.util.Log;

import com.google.android.gms.droidguard.DroidGuardChimeraService;
import com.squareup.wire.Wire;

import java.io.ByteArrayInputStream;
Expand Down Expand Up @@ -87,20 +86,13 @@ public static byte[] guard(Context context, RemoteDroidGuardRequest request) thr
clazz = loadedClass.get(checksum);
}

String odexArch = context.getClassLoader().toString().contains("arm64") ? "arm64" : "arm";
SysHook.activate(odexArch, checksum, request.deviceId, request.subscriberId);
return invoke(context, clazz, request.packageName, request.reason, response.byteCode.toByteArray(), request.androidIdLong, request.extras);
}

private static Context getSpecialContext(Context context) {
if (context.getApplicationContext() != null) context = context.getApplicationContext();
return new DroidGuardChimeraService(context);
}

public static byte[] invoke(Context context, Class<?> clazz, String packageName, String type, byte[] byteCode, String androidIdLong, Bundle extras) throws InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException, NoSuchMethodException {
Object instance = clazz
.getDeclaredConstructor(Context.class, String.class, byte[].class, Object.class)
.newInstance(getSpecialContext(context), type, byteCode, new Callback(packageName, androidIdLong));
.newInstance(context, type, byteCode, new Callback(packageName, androidIdLong));
final Map<String, String> map = new HashMap<>();
if (extras != null) {
for (String key : extras.keySet()) {
Expand Down
Loading

0 comments on commit 0ca6fb2

Please sign in to comment.