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

Commit 67b1ac74 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Various small fixes

- Add two Google signatures to acceptable apps. Likely to increae this further
- Fix small change in GCM unregistering
- Modify intent delivery for GCM, related to #75 and #84
- Lint fixes
- Update Travis CI config
parent 97e5cc40
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -4,16 +4,22 @@ git:
  submodules: false
before_install:
  - git submodule update --init --recursive
before_script:
  - echo sdk.dir $ANDROID_HOME > local.properties
script:
  - export JAVA_OPTS="-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m"
  - export TERM=dumb
  - echo sdk.dir $ANDROID_HOME > local.properties
  - ./gradlew assembleDebug -x lint
  - export JAVA_OPTS="-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m"
  - ./gradlew build
android:
  components:
  - platform-tools
  - tools
  - build-tools-23.0.2
  - android-23
  - extra-android-m2repository

before_cache:
  - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
  directories:
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
Compare 3b5727c7 to eea7ff3c
Original line number Diff line number Diff line
Subproject commit 3b5727c78ab7a997226f2b030d4b168d0b3346a4
Subproject commit eea7ff3c927234e6d958fc8bff92938bcdef1010
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import static org.microg.gms.common.Constants.GMS_PACKAGE_SIGNATURE_SHA1;

public class PackageUtils {

    private static final String[] KNOWN_GOOGLE_SIGNATURES = {GMS_PACKAGE_SIGNATURE_SHA1};
    private static final String[] KNOWN_GOOGLE_SIGNATURES = {GMS_PACKAGE_SIGNATURE_SHA1, "58e1c4133f7441ec3d2c270270a14802da47ba0e", "24bb24c05e47e0aefa68a58a766179d9b613a600"};

    public static boolean isGoogleSignedPackages(Context context, String packageName) {
        return Arrays.asList(KNOWN_GOOGLE_SIGNATURES).contains(firstSignatureDigest(context, packageName));
+7 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package org.microg.gms.gcm;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -303,7 +304,7 @@ public class McsService extends Service implements Handler.Callback {
    private void handleAppMessage(DataMessageStanza msg) {
        Intent intent = new Intent();
        intent.setAction(ACTION_C2DM_RECEIVE);
        intent.addCategory(msg.category);
        intent.setPackage(msg.category);
        intent.putExtra(EXTRA_MESSAGE_TYPE, MESSAGE_TYPE_GCM);
        intent.putExtra(EXTRA_FROM, msg.from);
        for (AppData appData : msg.app_data) {
@@ -312,11 +313,14 @@ public class McsService extends Service implements Handler.Callback {
        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
        // FIXME: #75
        List<ResolveInfo> infos = getPackageManager().queryBroadcastReceivers(intent, PackageManager.GET_RESOLVED_FILTER);
        for (ResolveInfo resolveInfo : infos)
        for (ResolveInfo resolveInfo : infos) {
            Log.d(TAG, "Target: " + resolveInfo);
            Intent targetIntent = new Intent(intent);
            targetIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name));
            sendOrderedBroadcast(targetIntent, msg.category + ".permission.C2D_MESSAGE");
        }
        if (infos.isEmpty())
            Log.d(TAG, "No target for message, wut?");
        sendOrderedBroadcast(intent, msg.category + ".permission.C2D_MESSAGE");
    }

    private void handleSelfMessage(DataMessageStanza msg) {
+4 −3
Original line number Diff line number Diff line
@@ -64,10 +64,11 @@ public class PushRegisterService extends IntentService {
    protected void onHandleIntent(Intent intent) {
        Log.d(TAG, "onHandleIntent: " + intent);
        try {
            if (ACTION_C2DM_REGISTER.equals(intent.getAction())) {
                register(intent);
            } else if (ACTION_C2DM_UNREGISTER.equals(intent.getAction())) {
            if (ACTION_C2DM_UNREGISTER.equals(intent.getAction()) ||
                    (ACTION_C2DM_REGISTER.equals(intent.getAction()) && "1".equals(intent.getStringExtra("delete")))) {
                unregister(intent);
            } else if (ACTION_C2DM_REGISTER.equals(intent.getAction())) {
                register(intent);
            }
        } catch (Exception e) {
            Log.w(TAG, e);
Loading