Remove Google Play Services dependency

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

Change-Id: I1eb1fb76e4b80e26992599e3511d265abbfa1cd7
This commit is contained in:
Marvin W 2017-01-23 23:50:47 +01:00 committed by Zhao Wei Liew
parent 10f91eefaa
commit 4ab4cb96b7
5 changed files with 8 additions and 32 deletions

View File

@ -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

View File

@ -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"

View File

@ -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.**

View File

@ -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));
}

View File

@ -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 UserHandle.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;
}