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

Commit 4e218b65 authored by Marvin W.'s avatar Marvin W. 🐿️ Committed by Zhao Wei Liew
Browse files

Remove Google Play Services dependency

PS2: inline hasGms usage, don't use addprefix for a single entry,
     remove unused imports

Change-Id: I1eb1fb76e4b80e26992599e3511d265abbfa1cd7
parent a0cd2472
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -14,19 +14,15 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-v4 \
    android-support-v13 \
    play \
    libphonenumber \
    org.cyanogenmod.platform.sdk

LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_JAVA_LIBRARIES := \
    org.cyanogenmod.platform.internal \
    telephony-common

# Include res dir from chips
google_play_dir := ../../../external/google/google_play_services/libproject/google-play-services_lib/res
res_dir := $(google_play_dir) res

LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dir))
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_AAPT_FLAGS += --extra-packages com.google.android.gms

include frameworks/opt/setupwizard/library/common.mk

+0 −3
Original line number Diff line number Diff line
@@ -69,9 +69,6 @@
                 android:taskAffinity="com.android.wizard"
                 android:name=".SetupWizardApp">

        <meta-data android:name="com.google.android.gms.version"
                   android:value="@integer/google_play_services_version" />

        <activity android:name=".ui.SetupWizardActivity"
                  android:label="@string/product_name"
                  android:launchMode="singleInstance"
+0 −13
Original line number Diff line number Diff line
@@ -2,18 +2,6 @@
    protected Object[][] getContents();
}

# Keep SafeParcelable value, needed for reflection. This is required to support backwards
# compatibility of some classes.
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

# Keep the names of classes/members we need for client functionality.
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

# Needed for Parcelable/SafeParcelable Creators to not get stripped
-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
@@ -22,4 +10,3 @@
# Needed when building against the Marshmallow SDK
-dontwarn org.apache.http.**
-dontwarn android.support.**
-dontwarn com.google.android.gms.**
 No newline at end of file
+4 −1
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import com.android.internal.telephony.TelephonyIntents;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;

import org.cyanogenmod.internal.util.PackageManagerUtils;

import java.util.ArrayList;

public class CMSetupWizardData extends AbstractSetupData {
@@ -68,7 +70,8 @@ public class CMSetupWizardData extends AbstractSetupData {
            pages.add(new MobileDataPage(mContext, this)
                    .setHidden(!isSimInserted() || mMobileDataEnabled));
        }
        final boolean hasGMS = SetupWizardUtils.hasGMS(mContext);
        final boolean hasGMS = PackageManagerUtils
                .isAppInstalled(mContext, "com.google.android.gms");
        if (hasGMS) {
            pages.add(new GmsAccountPage(mContext, this));
        }
+0 −7
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ import android.util.Log;
/*import com.android.internal.os.IKillSwitchService;*/
import com.cyanogenmod.setupwizard.SetupWizardApp;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import cyanogenmod.providers.CMSettings;

import static android.content.res.ThemeConfig.SYSTEM_DEFAULT;
@@ -197,11 +195,6 @@ public class SetupWizardUtils {
        return Binder.getCallingUserHandle().isOwner();
    }

    public static boolean hasGMS(Context context) {
        return GooglePlayServicesUtil.isGooglePlayServicesAvailable(context) !=
                ConnectionResult.SERVICE_MISSING;
    }

    public static boolean accountExists(Context context, String accountType) {
        return AccountManager.get(context).getAccountsByType(accountType).length > 0;
    }